Contract Overview
Balance:
0 MATIC
My Name Tag:
Not Available
[ Download CSV Export ]
Latest 1 internal transaction
Parent Txn Hash | Block | From | To | Value | |||
---|---|---|---|---|---|---|---|
0x523dfcb93f65cf2b56ebfee3a113050168128bb4797d10b4acc1b5d1f04fc435 | 26293607 | 320 days 10 hrs ago | 0xcd3f834dbfac270ead97d7bbb91e2d8012774c18 | Contract Creation | 0 MATIC |
[ Download CSV Export ]
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
TheSpace
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; import "@openzeppelin/contracts/utils/Multicall.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./ACLManager.sol"; import "./TheSpaceRegistry.sol"; import "./ITheSpaceRegistry.sol"; import "./ITheSpace.sol"; contract TheSpace is ITheSpace, Multicall, ReentrancyGuard, ACLManager { TheSpaceRegistry public registry; constructor( address currencyAddress_, address aclManager_, address marketAdmin_, address treasuryAdmin_ ) ACLManager(aclManager_, marketAdmin_, treasuryAdmin_) { registry = new TheSpaceRegistry( "Planck", // property name "PLK", // property symbol 1000000, // total supply 75, // taxRate 500, // treasuryShare 1 * (10**uint256(ERC20(currencyAddress_).decimals())), // mintTax, 1 $SPACE currencyAddress_ ); } /** * @notice See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId_) external view virtual returns (bool) { return interfaceId_ == type(ITheSpace).interfaceId; } ////////////////////////////// /// Upgradability ////////////////////////////// /// @inheritdoc ITheSpace function upgradeTo(address newImplementation) external onlyRole(Role.aclManager) { registry.transferOwnership(newImplementation); } ////////////////////////////// /// Configuration / Admin ////////////////////////////// function setTotalSupply(uint256 totalSupply_) external onlyRole(Role.marketAdmin) { registry.setTotalSupply(totalSupply_); } /// @inheritdoc ITheSpace function setTaxConfig(ITheSpaceRegistry.ConfigOptions option_, uint256 value_) external onlyRole(Role.marketAdmin) { registry.setTaxConfig(option_, value_); } /// @inheritdoc ITheSpace function withdrawTreasury(address to_) external onlyRole(Role.treasuryAdmin) { (uint256 accumulatedUBI, uint256 accumulatedTreasury, uint256 treasuryWithdrawn) = registry.treasuryRecord(); // calculate available amount and transfer uint256 amount = accumulatedTreasury - treasuryWithdrawn; registry.transferCurrency(to_, amount); registry.emitTreasury(to_, amount); // set `treasuryWithdrawn` to `accumulatedTreasury` registry.setTreasuryRecord(accumulatedUBI, accumulatedTreasury, accumulatedTreasury); } ////////////////////////////// /// Pixel ////////////////////////////// /// @inheritdoc ITheSpace function getPixel(uint256 tokenId_) external view returns (ITheSpaceRegistry.Pixel memory pixel) { return _getPixel(tokenId_); } function _getPixel(uint256 tokenId_) internal view returns (ITheSpaceRegistry.Pixel memory pixel) { (, uint256 lastTaxCollection, ) = registry.tokenRecord(tokenId_); pixel = ITheSpaceRegistry.Pixel( tokenId_, getPrice(tokenId_), lastTaxCollection, ubiAvailable(tokenId_), getOwner(tokenId_), registry.pixelColor(tokenId_) ); } /// @inheritdoc ITheSpace function setPixel( uint256 tokenId_, uint256 bidPrice_, uint256 newPrice_, uint256 color_ ) external { bid(tokenId_, bidPrice_); setPrice(tokenId_, newPrice_); _setColor(tokenId_, color_, msg.sender); } /// @inheritdoc ITheSpace function setColor(uint256 tokenId_, uint256 color_) public { if (!registry.isApprovedOrOwner(msg.sender, tokenId_)) revert Unauthorized(); _setColor(tokenId_, color_, registry.ownerOf(tokenId_)); } function _setColor( uint256 tokenId_, uint256 color_, address owner_ ) internal { registry.setColor(tokenId_, color_, owner_); } /// @inheritdoc ITheSpace function getColor(uint256 tokenId) public view returns (uint256 color) { color = registry.pixelColor(tokenId); } /// @inheritdoc ITheSpace function getPixelsByOwner( address owner_, uint256 limit_, uint256 offset_ ) external view returns ( uint256 total, uint256 limit, uint256 offset, ITheSpaceRegistry.Pixel[] memory pixels ) { uint256 _total = registry.balanceOf(owner_); if (limit_ == 0) { return (_total, limit_, offset_, new ITheSpaceRegistry.Pixel[](0)); } if (offset_ >= _total) { return (_total, limit_, offset_, new ITheSpaceRegistry.Pixel[](0)); } uint256 left = _total - offset_; uint256 size = left > limit_ ? limit_ : left; ITheSpaceRegistry.Pixel[] memory _pixels = new ITheSpaceRegistry.Pixel[](size); for (uint256 i = 0; i < size; i++) { uint256 tokenId = registry.tokenOfOwnerByIndex(owner_, i + offset_); _pixels[i] = _getPixel(tokenId); } return (_total, limit_, offset_, _pixels); } ////////////////////////////// /// Trading ////////////////////////////// /// @inheritdoc ITheSpace function getPrice(uint256 tokenId_) public view returns (uint256 price) { return registry.exists(tokenId_) ? _getPrice(tokenId_) : registry.taxConfig(ITheSpaceRegistry.ConfigOptions.mintTax); } function _getPrice(uint256 tokenId_) internal view returns (uint256) { (uint256 price, , ) = registry.tokenRecord(tokenId_); return price; } /// @inheritdoc ITheSpace function setPrice(uint256 tokenId_, uint256 price_) public { if (!(registry.isApprovedOrOwner(msg.sender, tokenId_))) revert Unauthorized(); if (price_ == _getPrice(tokenId_)) return; bool success = settleTax(tokenId_); if (success) _setPrice(tokenId_, price_); } /** * @dev Internal function to set price without checking */ function _setPrice(uint256 tokenId_, uint256 price_) private { _setPrice(tokenId_, price_, registry.ownerOf(tokenId_)); } function _setPrice( uint256 tokenId_, uint256 price_, address operator_ ) private { // max price to prevent overflow of `_getTax` uint256 maxPrice = registry.currency().totalSupply(); if (price_ > maxPrice) revert PriceTooHigh(maxPrice); (, uint256 lastTaxCollection, uint256 ubiWithdrawn) = registry.tokenRecord(tokenId_); registry.setTokenRecord(tokenId_, price_, lastTaxCollection, ubiWithdrawn); registry.emitPrice(tokenId_, price_, operator_); } /// @inheritdoc ITheSpace function getOwner(uint256 tokenId_) public view returns (address owner) { return registry.exists(tokenId_) ? registry.ownerOf(tokenId_) : address(0); } /// @inheritdoc ITheSpace function bid(uint256 tokenId_, uint256 price_) public nonReentrant { address owner = getOwner(tokenId_); uint256 askPrice = _getPrice(tokenId_); uint256 mintTax = registry.taxConfig(ITheSpaceRegistry.ConfigOptions.mintTax); // bid price and payee is calculated based on tax and token status uint256 bidPrice; if (registry.exists(tokenId_)) { // skip if already own if (owner == msg.sender) return; // clear tax bool success = _collectTax(tokenId_); // proceed with transfer if (success) { // if tax fully paid, owner get paid normally bidPrice = askPrice; // revert if price too low if (price_ < bidPrice) revert PriceTooLow(); // settle ERC20 token registry.transferCurrencyFrom(msg.sender, owner, bidPrice); // settle ERC721 token registry.safeTransferByMarket(owner, msg.sender, tokenId_); // emit bid event registry.emitBid(tokenId_, owner, msg.sender, bidPrice); // update price to ask price if difference if (price_ > askPrice) _setPrice(tokenId_, price_, msg.sender); return; } else { // if tax not fully paid, token is treated as defaulted and mint tax is collected and recorded registry.burn(tokenId_); } } // mint tax is collected and recorded bidPrice = mintTax; // revert if price too low if (price_ < bidPrice) revert PriceTooLow(); // settle ERC20 token registry.transferCurrencyFrom(msg.sender, address(registry), bidPrice); // record as tax income _recordTax(tokenId_, msg.sender, mintTax); // settle ERC721 token registry.mint(msg.sender, tokenId_); // emit bid event registry.emitBid(tokenId_, owner, msg.sender, bidPrice); // update price to ask price if difference if (price_ > askPrice) _setPrice(tokenId_, price_, msg.sender); } ////////////////////////////// /// Tax & UBI ////////////////////////////// /// @inheritdoc ITheSpace function getTax(uint256 tokenId_) public view returns (uint256) { if (!registry.exists(tokenId_)) revert TokenNotExists(); return _getTax(tokenId_); } function _getTax(uint256 tokenId_) internal view returns (uint256) { (uint256 price, uint256 lastTaxCollection, ) = registry.tokenRecord(tokenId_); if (price == 0) return 0; uint256 taxRate = registry.taxConfig(ITheSpaceRegistry.ConfigOptions.taxRate); // `1000` for every `1000` blocks, `10000` for conversion from bps return ((price * taxRate * (block.number - lastTaxCollection)) / (1000 * 10000)); } /// @inheritdoc ITheSpace function evaluateOwnership(uint256 tokenId_) public view returns (uint256 collectable, bool shouldDefault) { uint256 tax = getTax(tokenId_); if (tax > 0) { // calculate collectable amount address taxpayer = registry.ownerOf(tokenId_); uint256 allowance = registry.currency().allowance(taxpayer, address(registry)); uint256 balance = registry.currency().balanceOf(taxpayer); uint256 available = allowance < balance ? allowance : balance; if (available >= tax) { // can pay tax fully and do not need to be defaulted return (tax, false); } else { // cannot pay tax fully and need to be defaulted return (available, true); } } else { // not tax needed return (0, false); } } /** * @notice Collect outstanding tax for a given token, put token on tax sale if obligation not met. * @dev Emits a {Tax} event * @dev Emits a {Price} event (when properties are put on tax sale). */ function _collectTax(uint256 tokenId_) private returns (bool success) { (uint256 collectable, bool shouldDefault) = evaluateOwnership(tokenId_); if (collectable > 0) { // collect and record tax address owner = registry.ownerOf(tokenId_); registry.transferCurrencyFrom(owner, address(registry), collectable); _recordTax(tokenId_, owner, collectable); } return !shouldDefault; } /** * @notice Update tax record and emit Tax event. */ function _recordTax( uint256 tokenId_, address taxpayer_, uint256 amount_ ) private { // calculate treasury change uint256 treasuryShare = registry.taxConfig(ITheSpaceRegistry.ConfigOptions.treasuryShare); uint256 treasuryAdded = (amount_ * treasuryShare) / 10000; // set treasury record (uint256 accumulatedUBI, uint256 accumulatedTreasury, uint256 treasuryWithdrawn) = registry.treasuryRecord(); registry.setTreasuryRecord( accumulatedUBI + (amount_ - treasuryAdded), accumulatedTreasury + treasuryAdded, treasuryWithdrawn ); // update lastTaxCollection and emit tax event (uint256 price, , uint256 ubiWithdrawn) = registry.tokenRecord(tokenId_); registry.setTokenRecord(tokenId_, price, block.number, ubiWithdrawn); registry.emitTax(tokenId_, taxpayer_, amount_); } /// @inheritdoc ITheSpace function settleTax(uint256 tokenId_) public returns (bool success) { success = _collectTax(tokenId_); if (!success) registry.burn(tokenId_); } /// @inheritdoc ITheSpace function ubiAvailable(uint256 tokenId_) public view returns (uint256) { (uint256 accumulatedUBI, , ) = registry.treasuryRecord(); (, , uint256 ubiWithdrawn) = registry.tokenRecord(tokenId_); return accumulatedUBI / registry.totalSupply() - ubiWithdrawn; } /// @inheritdoc ITheSpace function withdrawUbi(uint256 tokenId_) external { uint256 amount = ubiAvailable(tokenId_); if (amount > 0) { // transfer address recipient = registry.ownerOf(tokenId_); registry.transferCurrency(recipient, amount); // record (uint256 price, uint256 lastTaxCollection, uint256 ubiWithdrawn) = registry.tokenRecord(tokenId_); registry.setTokenRecord(tokenId_, price, lastTaxCollection, ubiWithdrawn + amount); // emit event registry.emitUBI(tokenId_, recipient, amount); } } ////////////////////////////// /// Registry backcall ////////////////////////////// /// @inheritdoc ITheSpace function beforeTransferByRegistry(uint256 tokenId_) external returns (bool success) { if (msg.sender != address(registry)) revert Unauthorized(); // clear tax or default settleTax(tokenId_); // proceed with transfer if tax settled if (registry.exists(tokenId_)) { // transfer is regarded as setting price to 0, then bid for free // this is to prevent transferring huge tax obligation as a form of attack _setPrice(tokenId_, 0); success = true; } else { success = false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Multicall.sol) pragma solidity ^0.8.0; import "./Address.sol"; /** * @dev Provides a function to batch together multiple calls in a single external call. * * _Available since v4.1._ */ abstract contract Multicall { /** * @dev Receives and executes a batch of function calls on this contract. */ function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { results[i] = Address.functionDelegateCall(address(this), data[i]); } return results; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { uint256 currentAllowance = _allowances[sender][_msgSender()]; if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } } _transfer(sender, recipient, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
//SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "./IACLManager.sol"; contract ACLManager is IACLManager, Context { mapping(Role => address) private _roles; constructor( address aclManager_, address marketAdmin_, address treasuryAdmin_ ) { if (aclManager_ == address(0)) revert ZeroAddress(); _transferRole(Role.aclManager, aclManager_); _transferRole(Role.marketAdmin, marketAdmin_); _transferRole(Role.treasuryAdmin, treasuryAdmin_); } /** * @dev Throws if called by any address other than the role address. */ modifier onlyRole(Role role) { if (!_hasRole(role, _msgSender())) revert RoleRequired(role); _; } /// @inheritdoc IACLManager function hasRole(Role role, address account) public view returns (bool) { return _hasRole(role, account); } function _hasRole(Role role, address account) internal view returns (bool) { return _roles[role] == account; } /// @inheritdoc IACLManager function grantRole(Role role, address newAccount) public virtual onlyRole(Role.aclManager) { if (role == Role.aclManager) revert Forbidden(); if (newAccount == address(0)) revert ZeroAddress(); _transferRole(role, newAccount); } /// @inheritdoc IACLManager function transferRole(Role role, address newAccount) public virtual onlyRole(role) { if (newAccount == address(0)) revert ZeroAddress(); _transferRole(role, newAccount); } /// @inheritdoc IACLManager function renounceRole(Role role) public virtual onlyRole(role) { if (role == Role.aclManager) revert Forbidden(); _transferRole(role, address(0)); } /** * @dev Transfers role to a new account (`newAccount`). * Internal function without access restriction. */ function _transferRole(Role role, address newAccount) internal virtual { address oldAccount = _roles[role]; _roles[role] = newAccount; emit RoleTransferred(role, oldAccount, newAccount); } }
//SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ITheSpace.sol"; import "./ITheSpaceRegistry.sol"; contract TheSpaceRegistry is ITheSpaceRegistry, ERC721Enumerable, Ownable { /** * @dev Total possible number of ERC721 token */ uint256 private _totalSupply; /** * @dev ERC20 token used as currency */ ERC20 public immutable currency; /** * @dev Record for all tokens (tokenId => TokenRecord). */ mapping(uint256 => TokenRecord) public tokenRecord; /** * @dev Color of each token. */ mapping(uint256 => uint256) public pixelColor; /** * @dev Tax configuration of market. */ mapping(ConfigOptions => uint256) public taxConfig; /** * @dev Global state of tax and treasury. */ TreasuryRecord public treasuryRecord; /** * @dev Create Property contract, setup attached currency contract, setup tax rate. */ constructor( string memory propertyName_, string memory propertySymbol_, uint256 totalSupply_, uint256 taxRate_, uint256 treasuryShare_, uint256 mintTax_, address currencyAddress_ ) ERC721(propertyName_, propertySymbol_) { // initialize total supply _totalSupply = totalSupply_; // initialize currency contract currency = ERC20(currencyAddress_); // initialize tax config taxConfig[ConfigOptions.taxRate] = taxRate_; emit Config(ConfigOptions.taxRate, taxRate_); taxConfig[ConfigOptions.treasuryShare] = treasuryShare_; emit Config(ConfigOptions.treasuryShare, treasuryShare_); taxConfig[ConfigOptions.mintTax] = mintTax_; emit Config(ConfigOptions.mintTax, mintTax_); } ////////////////////////////// /// Getters & Setters ////////////////////////////// /** * @notice See {IERC20-totalSupply}. * @dev Always return total possible amount of supply, instead of current token in circulation. */ function totalSupply() public view override(ERC721Enumerable, IERC721Enumerable) returns (uint256) { return _totalSupply; } ////////////////////////////// /// Setters for global variables ////////////////////////////// /// @inheritdoc ITheSpaceRegistry function setTotalSupply(uint256 totalSupply_) external onlyOwner { emit TotalSupply(_totalSupply, totalSupply_); _totalSupply = totalSupply_; } /// @inheritdoc ITheSpaceRegistry function setTaxConfig(ConfigOptions option_, uint256 value_) external onlyOwner { taxConfig[option_] = value_; emit Config(option_, value_); } /// @inheritdoc ITheSpaceRegistry function setTreasuryRecord( uint256 accumulatedUBI_, uint256 accumulatedTreasury_, uint256 treasuryWithdrawn_ ) external onlyOwner { treasuryRecord = TreasuryRecord(accumulatedUBI_, accumulatedTreasury_, treasuryWithdrawn_); } /// @inheritdoc ITheSpaceRegistry function setTokenRecord( uint256 tokenId_, uint256 price_, uint256 lastTaxCollection_, uint256 ubiWithdrawn_ ) external onlyOwner { tokenRecord[tokenId_] = TokenRecord(price_, lastTaxCollection_, ubiWithdrawn_); } /// @inheritdoc ITheSpaceRegistry function setColor( uint256 tokenId_, uint256 color_, address owner_ ) external onlyOwner { pixelColor[tokenId_] = color_; emit Color(tokenId_, color_, owner_); } ////////////////////////////// /// Event emission ////////////////////////////// /// @inheritdoc ITheSpaceRegistry function emitTax( uint256 tokenId_, address taxpayer_, uint256 amount_ ) external onlyOwner { emit Tax(tokenId_, taxpayer_, amount_); } /// @inheritdoc ITheSpaceRegistry function emitPrice( uint256 tokenId_, uint256 price_, address operator_ ) external onlyOwner { emit Price(tokenId_, price_, operator_); } /// @inheritdoc ITheSpaceRegistry function emitUBI( uint256 tokenId_, address recipient_, uint256 amount_ ) external onlyOwner { emit UBI(tokenId_, recipient_, amount_); } /// @inheritdoc ITheSpaceRegistry function emitTreasury(address recipient_, uint256 amount_) external onlyOwner { emit Treasury(recipient_, amount_); } /// @inheritdoc ITheSpaceRegistry function emitBid( uint256 tokenId_, address from_, address to_, uint256 amount_ ) external onlyOwner { emit Bid(tokenId_, from_, to_, amount_); } ////////////////////////////// /// ERC721 property related ////////////////////////////// /// @inheritdoc ITheSpaceRegistry function mint(address to_, uint256 tokenId_) external onlyOwner { if (tokenId_ > _totalSupply || tokenId_ < 1) revert InvalidTokenId(1, _totalSupply); _safeMint(to_, tokenId_); } /// @inheritdoc ITheSpaceRegistry function burn(uint256 tokenId_) external onlyOwner { _burn(tokenId_); } /// @inheritdoc ITheSpaceRegistry function safeTransferByMarket( address from_, address to_, uint256 tokenId_ ) external onlyOwner { _safeTransfer(from_, to_, tokenId_, ""); } /// @inheritdoc ITheSpaceRegistry function exists(uint256 tokenId_) external view returns (bool) { return _exists(tokenId_); } /// @inheritdoc ITheSpaceRegistry function isApprovedOrOwner(address spender_, uint256 tokenId_) external view returns (bool) { return _isApprovedOrOwner(spender_, tokenId_); } /** * @notice See {IERC721-transferFrom}. * @dev Override to collect tax and set price before transfer. */ function transferFrom( address from_, address to_, uint256 tokenId_ ) public override(ERC721, IERC721) { safeTransferFrom(from_, to_, tokenId_, ""); } /** * @notice See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from_, address to_, uint256 tokenId_, bytes memory data_ ) public override(ERC721, IERC721) { // solhint-disable-next-line max-line-length require(_isApprovedOrOwner(msg.sender, tokenId_), "ERC721: transfer caller is not owner nor approved"); ITheSpace market = ITheSpace(owner()); bool success = market.beforeTransferByRegistry(tokenId_); if (success) { _safeTransfer(from_, to_, tokenId_, data_); } } ////////////////////////////// /// ERC20 currency related ////////////////////////////// /// @inheritdoc ITheSpaceRegistry function transferCurrency(address to_, uint256 amount_) external onlyOwner { currency.transfer(to_, amount_); } /// @inheritdoc ITheSpaceRegistry function transferCurrencyFrom( address from_, address to_, uint256 amount_ ) external onlyOwner { currency.transferFrom(from_, to_, amount_); } }
//SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; /** * @title The interface for `TheSpaceRegistry` contract. * @notice Storage contract for `TheSpace` contract. * @dev It stores all states related to the market, and is owned by the TheSpace contract. * @dev The market contract can be upgraded by changing the owner of this contract to the new implementation contract. */ interface ITheSpaceRegistry is IERC721Enumerable { ////////////////////////////// /// Error types ////////////////////////////// /** * @notice Token id is out of range. * @param min Lower range of possible token id. * @param max Higher range of possible token id. */ error InvalidTokenId(uint256 min, uint256 max); ////////////////////////////// /// Event types ////////////////////////////// /** * @notice A token updated price. * @param tokenId Id of token that updated price. * @param price New price after update. * @param owner Token owner during price update. */ event Price(uint256 indexed tokenId, uint256 price, address indexed owner); /** * @notice Global configuration is updated. * @param option Field of config been updated. * @param value New value after update. */ event Config(ConfigOptions indexed option, uint256 value); /** * @notice Total is updated. * @param previousSupply Total supply amount before update. * @param newSupply New supply amount after update. */ event TotalSupply(uint256 previousSupply, uint256 newSupply); /** * @notice Tax is collected for a token. * @param tokenId Id of token that has been taxed. * @param taxpayer user address who has paid the tax. * @param amount Amount of tax been collected. */ event Tax(uint256 indexed tokenId, address indexed taxpayer, uint256 amount); /** * @notice UBI (universal basic income) is withdrawn for a token. * @param tokenId Id of token that UBI has been withdrawn for. * @param recipient user address who got this withdrawn UBI. * @param amount Amount of UBI withdrawn. */ event UBI(uint256 indexed tokenId, address indexed recipient, uint256 amount); /** * @notice Treasury is withdrawn. * @param recipient address who got this withdrawn treasury. * @param amount Amount of withdrawn. */ event Treasury(address indexed recipient, uint256 amount); /** * @notice A token has been succefully bid. * @param tokenId Id of token that has been bid. * @param from Original owner before bid. * @param to New owner after bid. * @param amount Amount of currency used for bidding. */ event Bid(uint256 indexed tokenId, address indexed from, address indexed to, uint256 amount); /** * @notice Emitted when the color of a pixel is updated. * @param tokenId Id of token that has been bid. * @param color Color index defined by client. * @param owner Token owner. */ event Color(uint256 indexed tokenId, uint256 indexed color, address indexed owner); ////////////////////////////// /// Data structure ////////////////////////////// /** * @notice Options for global tax configuration. * @param taxRate: Tax rate in bps every 1000 blocks * @param treasuryShare: Share to treasury in bps. * @param mintTax: Tax to mint a token. It should be non-zero to prevent attacker constantly mint, default and mint token again. */ enum ConfigOptions { taxRate, treasuryShare, mintTax } /** * @notice Record of each token. * @param price Current price. * @param lastTaxCollection Block number of last tax collection. * @param ubiWithdrawn Amount of UBI been withdrawn. */ struct TokenRecord { uint256 price; uint256 lastTaxCollection; uint256 ubiWithdrawn; } /** * @notice Global state of tax and treasury. * @param accumulatedUBI Total amount of currency allocated for UBI. * @param accumulatedTreasury Total amount of currency allocated for treasury. * @param treasuryWithdrawn Total amount of treasury been withdrawn. */ struct TreasuryRecord { uint256 accumulatedUBI; uint256 accumulatedTreasury; uint256 treasuryWithdrawn; } /** * @dev Packed pixel info. */ struct Pixel { uint256 tokenId; uint256 price; uint256 lastTaxCollection; uint256 ubi; address owner; uint256 color; } ////////////////////////////// /// Getters & Setters ////////////////////////////// /** * @notice Update total supply of ERC721 token. * @param totalSupply_ New amount of total supply. */ function setTotalSupply(uint256 totalSupply_) external; /** * @notice Update global tax settings. * @param option_ Tax config options, see {ConfigOptions} for detail. * @param value_ New value for tax setting. */ function setTaxConfig(ConfigOptions option_, uint256 value_) external; /** * @notice Update UBI and treasury. * @param accumulatedUBI_ Total amount of currency allocated for UBI. * @param accumulatedTreasury_ Total amount of currency allocated for treasury. * @param treasuryWithdrawn_ Total amount of treasury been withdrawn. */ function setTreasuryRecord( uint256 accumulatedUBI_, uint256 accumulatedTreasury_, uint256 treasuryWithdrawn_ ) external; /** * @notice Set record for a given token. * @param tokenId_ Id of token to be set. * @param price_ Current price. * @param lastTaxCollection_ Block number of last tax collection. * @param ubiWithdrawn_ Amount of UBI been withdrawn. */ function setTokenRecord( uint256 tokenId_, uint256 price_, uint256 lastTaxCollection_, uint256 ubiWithdrawn_ ) external; /** * @notice Set color for a given token. * @param tokenId_ Token id to be set. * @param color_ Color Id. * @param owner_ Token owner. */ function setColor( uint256 tokenId_, uint256 color_, address owner_ ) external; ////////////////////////////// /// Event emission ////////////////////////////// /** * @dev Emit {Tax} event */ function emitTax( uint256 tokenId_, address taxpayer_, uint256 amount_ ) external; /** * @dev Emit {Price} event */ function emitPrice( uint256 tokenId_, uint256 price_, address operator_ ) external; /** * @dev Emit {UBI} event */ function emitUBI( uint256 tokenId_, address recipient_, uint256 amount_ ) external; /** * @dev Emit {Treasury} event */ function emitTreasury(address recipient_, uint256 amount_) external; /** * @dev Emit {Bid} event */ function emitBid( uint256 tokenId_, address from_, address to_, uint256 amount_ ) external; ////////////////////////////// /// ERC721 property related ////////////////////////////// /** * @dev Mint an ERC721 token. */ function mint(address to_, uint256 tokenId_) external; /** * @dev Burn an ERC721 token. */ function burn(uint256 tokenId_) external; /** * @dev Perform ERC721 token transfer by market contract. */ function safeTransferByMarket( address from_, address to_, uint256 tokenId_ ) external; /** * @dev If an ERC721 token has been minted. */ function exists(uint256 tokenId_) external view returns (bool); /** * @dev If an address is allowed to transfer an ERC721 token. */ function isApprovedOrOwner(address spender_, uint256 tokenId_) external view returns (bool); ////////////////////////////// /// ERC20 currency related ////////////////////////////// /** * @dev Perform ERC20 token transfer by market contract. */ function transferCurrency(address to_, uint256 amount_) external; /** * @dev Perform ERC20 token transferFrom by market contract. */ function transferCurrencyFrom( address from_, address to_, uint256 amount_ ) external; }
//SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "./ITheSpaceRegistry.sol"; /** * @title The interface for `TheSpace` contract * @notice _The Space_ is a pixel space owned by a decentralized autonomous organization (DAO), where members can tokenize, own, trade and color pixels. * * Pixels are tokenized as ERC721 tokens and traded under Harberger tax, while members receive dividend based on the share of pixels they own. * * #### Trading * - User needs to call `approve` on currency contract before starting. If there is not sufficient allowance for taxing, the corresponding assets are defaulted. * - User buy pixel: call [`bid` function](./ITheSpace.md). * - User set pixel price: call [`setPrice` function](./ITheSpace.md). * * @dev This contract holds the logic of market place, while read from and write into {TheSpaceRegistry}, which is the storage contact. * @dev This contract owns a {TheSpaceRegistry} contract for storage, and can be updated by transfering ownership to a new implementation contract. */ interface ITheSpace { ////////////////////////////// /// Error types ////////////////////////////// /** * @dev Price too low to bid the given token. */ error PriceTooLow(); /** * @dev Price too high to set. */ error PriceTooHigh(uint256 maxPrice); /** * @dev Sender is not authorized for given operation. */ error Unauthorized(); /** * @dev The give token does not exist and needs to be minted first via bidding. */ error TokenNotExists(); ////////////////////////////// /// Upgradability ////////////////////////////// /** * @notice Switch logic contract to another one. * * @dev Access: only `Role.aclManager`. * @dev Throws: `RoleRequired` error. * * @param newImplementation address of new logic contract. */ function upgradeTo(address newImplementation) external; ////////////////////////////// /// Configuration / Admin ////////////////////////////// /** * @notice Update total supply of ERC721 token. * * @dev Access: only `Role.marketAdmin`. * @dev Throws: `RoleRequired` error. * * @param totalSupply_ New amount of total supply. */ function setTotalSupply(uint256 totalSupply_) external; /** * @notice Update current tax configuration. * * @dev Access: only `Role.marketAdmin`. * @dev Emits: `Config` event. * @dev Throws: `RoleRequired` error. * * @param option_ Field of config been updated. * @param value_ New value after update. */ function setTaxConfig(ITheSpaceRegistry.ConfigOptions option_, uint256 value_) external; /** * @notice Withdraw all available treasury. * * @dev Access: only `Role.treasuryAdmin`. * @dev Throws: `RoleRequired` error. * * @param to address of DAO treasury. */ function withdrawTreasury(address to) external; ////////////////////////////// /// Pixel ////////////////////////////// /** * @notice Get pixel info. * @param tokenId_ Token id to be queried. * @return pixel Packed pixel info. */ function getPixel(uint256 tokenId_) external view returns (ITheSpaceRegistry.Pixel memory pixel); /** * @notice Bid pixel, then set price and color. * * @dev Throws: inherits from `bid` and `setPrice`. * * @param tokenId_ Token id to be bid and set. * @param bidPrice_ Bid price. * @param newPrice_ New price to be set. * @param color_ Color to be set. */ function setPixel( uint256 tokenId_, uint256 bidPrice_, uint256 newPrice_, uint256 color_ ) external; /** * @notice Set color for a pixel. * * @dev Access: only token owner or approved operator. * @dev Throws: `Unauthorized` or `ERC721: operator query for nonexistent token` error. * @dev Emits: `Color` event. * * @param tokenId_ Token id to be set. * @param color_ Color to be set. */ function setColor(uint256 tokenId_, uint256 color_) external; /** * @notice Get color for a pixel. * @param tokenId_ Token id to be queried. * @return color Color. */ function getColor(uint256 tokenId_) external view returns (uint256 color); /** * @notice Get pixels owned by a given address. * @param owner_ Owner address. * @param limit_ Limit of returned pixels. * @param offset_ Offset of returned pixels. * @return total Total number of pixels. * @return limit Limit of returned pixels. * @return offset Offset of returned pixels. * @return pixels Packed pixels. * @dev offset-based pagination */ function getPixelsByOwner( address owner_, uint256 limit_, uint256 offset_ ) external view returns ( uint256 total, uint256 limit, uint256 offset, ITheSpaceRegistry.Pixel[] memory pixels ); ////////////////////////////// /// Trading ////////////////////////////// /** * @notice Returns the current price of a token by id. * @param tokenId_ Token id to be queried. * @return price Current price. */ function getPrice(uint256 tokenId_) external view returns (uint256 price); /** * @notice Set the current price of a token with id. Triggers tax settle first, price is succefully updated after tax is successfully collected. * * @dev Access: only token owner or approved operator. * @dev Throws: `Unauthorized` or `ERC721: operator query for nonexistent token` error. * @dev Emits: `Price` event. * * @param tokenId_ Id of token been updated. * @param price_ New price to be updated. */ function setPrice(uint256 tokenId_, uint256 price_) external; /** * @notice Returns the current owner of an Harberger property with token id. * @dev If token does not exisit, return zero address and user can bid the token as usual. * @param tokenId_ Token id to be queried. * @return owner Current owner address. */ function getOwner(uint256 tokenId_) external view returns (address owner); /** * @notice Purchase property with bid higher than current price. * If bid price is higher than ask price, only ask price will be deducted. * @dev Clear tax for owner before transfer. * * @dev Throws: `PriceTooLow` or `InvalidTokenId` error. * @dev Emits: `Bid`, `Tax` events. * * @param tokenId_ Id of token been bid. * @param price_ Bid price. */ function bid(uint256 tokenId_, uint256 price_) external; ////////////////////////////// /// Tax & UBI ////////////////////////////// /** * @notice Calculate outstanding tax for a token. * @param tokenId_ Token id to be queried. * @return amount Current amount of tax that needs to be paid. */ function getTax(uint256 tokenId_) external view returns (uint256 amount); /** * @notice Calculate amount of tax that can be collected, and determine if token should be defaulted. * @param tokenId_ Token id to be queried. * @return collectable Amount of currency that can be collected, considering balance and allowance. * @return shouldDefault Whether current token should be defaulted. */ function evaluateOwnership(uint256 tokenId_) external view returns (uint256 collectable, bool shouldDefault); /** * @notice Collect outstanding tax of a token and default it if needed. * @dev Anyone can trigger this function. It could be desirable for the developer team to trigger it once a while to make sure all tokens meet their tax obligation. * * @dev Throws: `PriceTooLow` or `InvalidTokenId` error. * @dev Emits: `Bid`, `Tax` events. * * @param tokenId_ Id of token been settled. * @return success Whether tax is fully collected without token been defaulted. */ function settleTax(uint256 tokenId_) external returns (bool success); /** * @notice Amount of UBI available for withdraw on given token. * @param tokenId_ Token id to be queried. * @param amount Amount of UBI available to be collected */ function ubiAvailable(uint256 tokenId_) external view returns (uint256 amount); /** * @notice Withdraw all UBI on given token. * * @dev Emits: `UBI` event. * * @param tokenId_ Id of token been withdrawn. */ function withdrawUbi(uint256 tokenId_) external; ////////////////////////////// /// Registry backcall ////////////////////////////// /** * @notice Perform before `safeTransfer` and `safeTransferFrom` by registry contract. * @dev Collect tax and set price. * * @dev Access: only registry. * @dev Throws: `Unauthorized` error. * * @param tokenId_ Token id to be transferred. * @return success Whether tax is fully collected without token been defaulted. */ function beforeTransferByRegistry(uint256 tokenId_) external returns (bool success); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
//SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; /** * @title The interface for `ACLManager` contract to manage _The Space_ market. * @notice Access Control List Manager is a role-based access control mechanism. * @dev Each role can be granted to an address. * @dev All available roles are defined in `Role` enum. */ interface IACLManager { ////////////////////////////// /// Error types ////////////////////////////// /** * @dev Given operation is requires a given role. */ error RoleRequired(Role role); /** * @dev Given operation is forbidden. */ error Forbidden(); /** * @dev Given a zero address. */ error ZeroAddress(); ////////////////////////////// /// Eevent types ////////////////////////////// /** * @notice Role is transferred to a new address. * @param role Role transferred. * @param prevAccount Old address. * @param newAccount New address. */ event RoleTransferred(Role indexed role, address indexed prevAccount, address indexed newAccount); /** * @notice Available roles. * @param aclManager: responsible for assigning and revoking roles of other addresses * @param marketAdmin: responsible for updating configuration, e.g. tax rate or treasury rate. * @param treasuryAdmin: responsible for withdrawing treasury from contract. */ enum Role { aclManager, marketAdmin, treasuryAdmin } /** * @notice Returns `true` if `account` has been granted `role`. */ function hasRole(Role role, address account) external returns (bool); /** * @notice Grant role to a account (`newAccount`). * @dev Cannot grant `Role.aclManager`. * * @dev Access: only `Role.aclManager`. * @dev Throws: `RoleRequired`, `Forbidden` or `ZeroAddress` error. */ function grantRole(Role role, address newAccount) external; /** * @notice Transfers role to a new account (`newAccount`). * @dev Acces: only current role address. * @dev Throws: `RoleRequired`, or `ZeroAddress` error. */ function transferRole(Role role, address newAccount) external; /** * @notice Revokes role from the role address. * @dev `Role.aclManager` can not be revoked. * * @dev Access: only current role address. * @dev Throws: `RoleRequired` or `Forbidden` error. */ function renounceRole(Role role) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
{ "remappings": [ "@openzeppelin/=lib/openzeppelin-contracts/", "ds-test/=lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "src/=src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london" }
[{"inputs":[{"internalType":"address","name":"currencyAddress_","type":"address"},{"internalType":"address","name":"aclManager_","type":"address"},{"internalType":"address","name":"marketAdmin_","type":"address"},{"internalType":"address","name":"treasuryAdmin_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Forbidden","type":"error"},{"inputs":[{"internalType":"uint256","name":"maxPrice","type":"uint256"}],"name":"PriceTooHigh","type":"error"},{"inputs":[],"name":"PriceTooLow","type":"error"},{"inputs":[{"internalType":"enum IACLManager.Role","name":"role","type":"uint8"}],"name":"RoleRequired","type":"error"},{"inputs":[],"name":"TokenNotExists","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"enum IACLManager.Role","name":"role","type":"uint8"},{"indexed":true,"internalType":"address","name":"prevAccount","type":"address"},{"indexed":true,"internalType":"address","name":"newAccount","type":"address"}],"name":"RoleTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"beforeTransferByRegistry","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"uint256","name":"price_","type":"uint256"}],"name":"bid","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"evaluateOwnership","outputs":[{"internalType":"uint256","name":"collectable","type":"uint256"},{"internalType":"bool","name":"shouldDefault","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getColor","outputs":[{"internalType":"uint256","name":"color","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"getOwner","outputs":[{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"getPixel","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"lastTaxCollection","type":"uint256"},{"internalType":"uint256","name":"ubi","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"color","type":"uint256"}],"internalType":"struct ITheSpaceRegistry.Pixel","name":"pixel","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"uint256","name":"limit_","type":"uint256"},{"internalType":"uint256","name":"offset_","type":"uint256"}],"name":"getPixelsByOwner","outputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"},{"internalType":"uint256","name":"offset","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"lastTaxCollection","type":"uint256"},{"internalType":"uint256","name":"ubi","type":"uint256"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"color","type":"uint256"}],"internalType":"struct ITheSpaceRegistry.Pixel[]","name":"pixels","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"getTax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum IACLManager.Role","name":"role","type":"uint8"},{"internalType":"address","name":"newAccount","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum IACLManager.Role","name":"role","type":"uint8"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"contract TheSpaceRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum IACLManager.Role","name":"role","type":"uint8"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"uint256","name":"color_","type":"uint256"}],"name":"setColor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"uint256","name":"bidPrice_","type":"uint256"},{"internalType":"uint256","name":"newPrice_","type":"uint256"},{"internalType":"uint256","name":"color_","type":"uint256"}],"name":"setPixel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"uint256","name":"price_","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum ITheSpaceRegistry.ConfigOptions","name":"option_","type":"uint8"},{"internalType":"uint256","name":"value_","type":"uint256"}],"name":"setTaxConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"totalSupply_","type":"uint256"}],"name":"setTotalSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"settleTax","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId_","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum IACLManager.Role","name":"role","type":"uint8"},{"internalType":"address","name":"newAccount","type":"address"}],"name":"transferRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"ubiAvailable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to_","type":"address"}],"name":"withdrawTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"withdrawUbi","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162005fde38038062005fde8339810160408190526200003491620002f1565b60016000558282826001600160a01b038316620000645760405163d92e233d60e01b815260040160405180910390fd5b62000071600084620001d8565b6200007e600183620001d8565b6200008b600282620001d8565b505050620f4240604b6101f4866001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000fc91906200034e565b6200010c9060ff16600a6200048f565b620001199060016200049d565b876040516200012890620002c6565b60e080825260069082015265506c616e636b60d01b6101008201526101206020820181905260039082015262504c4b60e81b61014082015260408101959095526060850193909352608084019190915260a08301526001600160a01b031660c082015261016001604051809103906000f080158015620001ac573d6000803e3d6000fd5b50600280546001600160a01b0319166001600160a01b039290921691909117905550620004d592505050565b600060016000846002811115620001f357620001f3620004bf565b6002811115620002075762000207620004bf565b815260208101919091526040016000908120546001600160a01b0316915082906001908560028111156200023f576200023f620004bf565b6002811115620002535762000253620004bf565b8152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055828116908216846002811115620002985762000298620004bf565b6040517f796d9fd27d307e851f66684ea6fe5e98600f0d922d136a5717ae5949892cfcf790600090a4505050565b612ae080620034fe83390190565b80516001600160a01b0381168114620002ec57600080fd5b919050565b600080600080608085870312156200030857600080fd5b6200031385620002d4565b93506200032360208601620002d4565b92506200033360408601620002d4565b91506200034360608601620002d4565b905092959194509250565b6000602082840312156200036157600080fd5b815160ff811681146200037357600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115620003d1578160001904821115620003b557620003b56200037a565b80851615620003c357918102915b93841c939080029062000395565b509250929050565b600082620003ea5750600162000489565b81620003f95750600062000489565b81600181146200041257600281146200041d576200043d565b600191505062000489565b60ff8411156200043157620004316200037a565b50506001821b62000489565b5060208310610133831016604e8410600b841016171562000462575081810a62000489565b6200046e838362000390565b80600019048211156200048557620004856200037a565b0290505b92915050565b6000620003738383620003d9565b6000816000190483118215151615620004ba57620004ba6200037a565b500290565b634e487b7160e01b600052602160045260246000fd5b61301980620004e56000396000f3fe608060405234801561001057600080fd5b506004361061018e5760003560e01c8063ac9650d8116100de578063e757223011610097578063f7d9757711610071578063f7d97577146103c2578063f7ea7a3d146103d5578063f86c9e9a146103e8578063ff1644d8146103fb57600080fd5b8063e757223014610389578063ecaf822a1461039c578063ee1ef07e146103af57600080fd5b8063ac9650d8146102d8578063b4f80eb9146102f8578063c0aed4a714610318578063c41a360a1461033b578063cf3a421f1461034e578063e017dc861461037657600080fd5b80633659cfe61161014b5780637b103999116101255780637b1039991461027457806380057b9a1461029f5780638ec8c504146102b25780639e97b8f6146102c557600080fd5b80633659cfe61461023b578063598647f81461024e5780635d5664e11461026157600080fd5b806301ffc9a714610193578063057c9cb8146101cc578063099da37f146101e157806310718d3b1461020257806310ac4e7414610215578063242d81cd14610228575b600080fd5b6101b76101a13660046129f9565b6001600160e01b0319166321c0ada760e01b1490565b60405190151581526020015b60405180910390f35b6101df6101da366004612a33565b61040e565b005b6101f46101ef366004612a50565b610482565b6040519081526020016101c3565b6101df610210366004612a7e565b61051b565b6101f4610223366004612a50565b61057b565b6101df610236366004612ab7565b610702565b6101df610249366004612ad9565b610809565b6101df61025c366004612ab7565b610898565b6101df61026f366004612a7e565b610d8a565b600254610287906001600160a01b031681565b6040516001600160a01b0390911681526020016101c3565b6101f46102ad366004612a50565b610de7565b6101b76102c0366004612a50565b610e55565b6101b76102d3366004612a7e565b610ecb565b6102eb6102e6366004612af6565b610ede565b6040516101c39190612bc3565b61030b610306366004612a50565b610fd3565b6040516101c39190612c65565b61032b610326366004612c73565b610fe4565b6040516101c39493929190612ca8565b610287610349366004612a50565b61125b565b61036161035c366004612a50565b611341565b604080519283529015156020830152016101c3565b6101b7610384366004612a50565b6115e1565b6101f4610397366004612a50565b6116a5565b6101df6103aa366004612d0e565b611796565b6101df6103bd366004612a50565b61182a565b6101df6103d0366004612ab7565b611a84565b6101df6103e3366004612a50565b611b43565b6101df6103f6366004612ad9565b611b9f565b6101df610409366004612d3a565b611d66565b806104198133611d8b565b6104415780604051631e6fd6c360e21b81526004016104389190612da0565b60405180910390fd5b600082600281111561045557610455612d6c565b0361047357604051631dd2188d60e31b815260040160405180910390fd5b61047e826000611de0565b5050565b600254604051634f558e7960e01b8152600481018390526000916001600160a01b031690634f558e7990602401602060405180830381865afa1580156104cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f09190612db3565b61050c57604051626f708760e21b815260040160405180910390fd5b61051582611ebf565b92915050565b816105268133611d8b565b6105455780604051631e6fd6c360e21b81526004016104389190612da0565b6001600160a01b03821661056c5760405163d92e233d60e01b815260040160405180910390fd5b6105768383611de0565b505050565b600080600260009054906101000a90046001600160a01b03166001600160a01b0316634d7c7dc76040518163ffffffff1660e01b8152600401606060405180830381865afa1580156105d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f59190612dd5565b5050600254604051631751d10160e21b8152600481018690529192506000916001600160a01b0390911690635d47440490602401606060405180830381865afa158015610646573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066a9190612dd5565b9250505080600260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e69190612e03565b6106f09084612e32565b6106fa9190612e54565b949350505050565b60025460405163430c208160e01b8152336004820152602481018490526001600160a01b039091169063430c208190604401602060405180830381865afa158015610751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107759190612db3565b610791576040516282b42960e81b815260040160405180910390fd5b6002546040516331a9108f60e11b81526004810184905261047e91849184916001600160a01b031690636352211e90602401602060405180830381865afa1580156107e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108049190612e6b565b611ff1565b60006108158133611d8b565b6108345780604051631e6fd6c360e21b81526004016104389190612da0565b60025460405163f2fde38b60e01b81526001600160a01b0384811660048301529091169063f2fde38b906024015b600060405180830381600087803b15801561087c57600080fd5b505af1158015610890573d6000803e3d6000fd5b505050505050565b6002600054036108ea5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610438565b600260009081556108fa8361125b565b9050600061090784612031565b6002805460405163e7d6fbbf60e01b81529293506000926001600160a01b039091169163e7d6fbbf9161093d9190600401612da0565b602060405180830381865afa15801561095a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097e9190612e03565b600254604051634f558e7960e01b8152600481018890529192506000916001600160a01b0390911690634f558e7990602401602060405180830381865afa1580156109cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f19190612db3565b15610c0057336001600160a01b03851603610a0f5750505050610d81565b6000610a1a876120ad565b90508015610ba05783915081861015610a4657604051636dddf41160e11b815260040160405180910390fd5b600254604051631daa479b60e21b81526001600160a01b03909116906376a91e6c90610a7a90339089908790600401612e88565b600060405180830381600087803b158015610a9457600080fd5b505af1158015610aa8573d6000803e3d6000fd5b5050600254604051631614022160e21b81526001600160a01b03909116925063585008849150610ae090889033908c90600401612e88565b600060405180830381600087803b158015610afa57600080fd5b505af1158015610b0e573d6000803e3d6000fd5b50506002546040516207f57560e41b8152600481018b90526001600160a01b038981166024830152336044830152606482018790529091169250627f57509150608401600060405180830381600087803b158015610b6b57600080fd5b505af1158015610b7f573d6000803e3d6000fd5b5050505083861115610b9657610b968787336121b0565b5050505050610d81565b600254604051630852cd8d60e31b8152600481018990526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015610be657600080fd5b505af1158015610bfa573d6000803e3d6000fd5b50505050505b508080851015610c2357604051636dddf41160e11b815260040160405180910390fd5b600254604051631daa479b60e21b81526001600160a01b03909116906376a91e6c90610c5790339084908690600401612e88565b600060405180830381600087803b158015610c7157600080fd5b505af1158015610c85573d6000803e3d6000fd5b50505050610c948633846123cf565b6002546040516340c10f1960e01b8152336004820152602481018890526001600160a01b03909116906340c10f1990604401600060405180830381600087803b158015610ce057600080fd5b505af1158015610cf4573d6000803e3d6000fd5b50506002546040516207f57560e41b8152600481018a90526001600160a01b038881166024830152336044830152606482018690529091169250627f57509150608401600060405180830381600087803b158015610d5157600080fd5b505af1158015610d65573d6000803e3d6000fd5b5050505082851115610d7c57610d7c8686336121b0565b505050505b50506001600055565b6000610d968133611d8b565b610db55780604051631e6fd6c360e21b81526004016104389190612da0565b6000836002811115610dc957610dc9612d6c565b0361054557604051631dd2188d60e31b815260040160405180910390fd5b6002546040516303b1a1e960e31b8152600481018390526000916001600160a01b031690631d8d0f4890602401602060405180830381865afa158015610e31573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105159190612e03565b6000610e60826120ad565b905080610ec657600254604051630852cd8d60e31b8152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b158015610ead57600080fd5b505af1158015610ec1573d6000803e3d6000fd5b505050505b919050565b6000610ed78383611d8b565b9392505050565b60608167ffffffffffffffff811115610ef957610ef9612eac565b604051908082528060200260200182016040528015610f2c57816020015b6060815260200190600190039081610f175790505b50905060005b82811015610fcc57610f9c30858584818110610f5057610f50612ec2565b9050602002810190610f629190612ed8565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506126d192505050565b828281518110610fae57610fae612ec2565b60200260200101819052508080610fc490612f26565b915050610f32565b5092915050565b610fdb6129ba565b610515826126f6565b6002546040516370a0823160e01b81526001600160a01b0385811660048301526000928392839260609284929116906370a0823190602401602060405180830381865afa158015611039573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105d9190612e03565b9050866000036110ac576040805160008082526020820190925282918991899161109d565b61108a6129ba565b8152602001906001900390816110825790505b50945094509450945050611252565b8086106110f7576040805160008082526020820190925282918991899161109d565b6110d66129ba565b8152602001906001900390816110ce57905050945094509450945050611252565b60006111038783612e54565b905060008882116111145781611116565b885b905060008167ffffffffffffffff81111561113357611133612eac565b60405190808252806020026020018201604052801561116c57816020015b6111596129ba565b8152602001906001900390816111515790505b50905060005b82811015611242576002546000906001600160a01b0316632f745c598e6111998e86612f3f565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381865afa1580156111e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112069190612e03565b9050611211816126f6565b83838151811061122357611223612ec2565b602002602001018190525050808061123a90612f26565b915050611172565b5092965088955087945091925050505b93509350935093565b600254604051634f558e7960e01b8152600481018390526000916001600160a01b031690634f558e7990602401602060405180830381865afa1580156112a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c99190612db3565b6112d4576000610515565b6002546040516331a9108f60e11b8152600481018490526001600160a01b0390911690636352211e90602401602060405180830381865afa15801561131d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105159190612e6b565b600080600061134f84610482565b905080156115d5576002546040516331a9108f60e11b8152600481018690526000916001600160a01b031690636352211e90602401602060405180830381865afa1580156113a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c59190612e6b565b90506000600260009054906101000a90046001600160a01b03166001600160a01b031663e5a6b10f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561141c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114409190612e6b565b600254604051636eb1769f60e11b81526001600160a01b038581166004830152918216602482015291169063dd62ed3e90604401602060405180830381865afa158015611491573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b59190612e03565b90506000600260009054906101000a90046001600160a01b03166001600160a01b031663e5a6b10f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561150c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115309190612e6b565b6040516370a0823160e01b81526001600160a01b03858116600483015291909116906370a0823190602401602060405180830381865afa158015611578573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159c9190612e03565b905060008183106115ad57816115af565b825b90508481106115c75750929660009650945050505050565b976001975095505050505050565b50600093849350915050565b6002546000906001600160a01b0316331461160e576040516282b42960e81b815260040160405180910390fd5b61161782610e55565b50600254604051634f558e7960e01b8152600481018490526001600160a01b0390911690634f558e7990602401602060405180830381865afa158015611661573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116859190612db3565b1561169d5761169582600061282c565b506001919050565b506000919050565b600254604051634f558e7960e01b8152600481018390526000916001600160a01b031690634f558e7990602401602060405180830381865afa1580156116ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117139190612db3565b61178d576002805460405163e7d6fbbf60e01b81526001600160a01b039091169163e7d6fbbf916117479190600401612da0565b602060405180830381865afa158015611764573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117889190612e03565b610515565b61051582612031565b60016117a28133611d8b565b6117c15780604051631e6fd6c360e21b81526004016104389190612da0565b600254604051637657c11560e11b81526001600160a01b039091169063ecaf822a906117f39086908690600401612f57565b600060405180830381600087803b15801561180d57600080fd5b505af1158015611821573d6000803e3d6000fd5b50505050505050565b60006118358261057b565b9050801561047e576002546040516331a9108f60e11b8152600481018490526000916001600160a01b031690636352211e90602401602060405180830381865afa158015611887573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ab9190612e6b565b60025460405163e3759abd60e01b81526001600160a01b0380841660048301526024820186905292935091169063e3759abd90604401600060405180830381600087803b1580156118fb57600080fd5b505af115801561190f573d6000803e3d6000fd5b5050600254604051631751d10160e21b8152600481018790526000935083925082916001600160a01b031690635d47440490602401606060405180830381865afa158015611961573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119859190612dd5565b60025492955090935091506001600160a01b031663b3e4ee228785856119ab8a87612f3f565b6040516001600160e01b031960e087901b1681526004810194909452602484019290925260448301526064820152608401600060405180830381600087803b1580156119f657600080fd5b505af1158015611a0a573d6000803e3d6000fd5b50506002546040516308b26d3b60e11b8152600481018a90526001600160a01b038881166024830152604482018a90529091169250631164da7691506064015b600060405180830381600087803b158015611a6457600080fd5b505af1158015611a78573d6000803e3d6000fd5b50505050505050505050565b60025460405163430c208160e01b8152336004820152602481018490526001600160a01b039091169063430c208190604401602060405180830381865afa158015611ad3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af79190612db3565b611b13576040516282b42960e81b815260040160405180910390fd5b611b1c82612031565b8103611b26575050565b6000611b3183610e55565b9050801561057657610576838361282c565b6001611b4f8133611d8b565b611b6e5780604051631e6fd6c360e21b81526004016104389190612da0565b60025460405163f7ea7a3d60e01b8152600481018490526001600160a01b039091169063f7ea7a3d90602401610862565b6002611bab8133611d8b565b611bca5780604051631e6fd6c360e21b81526004016104389190612da0565b6000806000600260009054906101000a90046001600160a01b03166001600160a01b0316634d7c7dc76040518163ffffffff1660e01b8152600401606060405180830381865afa158015611c22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c469190612dd5565b919450925090506000611c598284612e54565b60025460405163e3759abd60e01b81526001600160a01b0389811660048301526024820184905292935091169063e3759abd90604401600060405180830381600087803b158015611ca957600080fd5b505af1158015611cbd573d6000803e3d6000fd5b5050600254604051635701e25d60e01b81526001600160a01b038a81166004830152602482018690529091169250635701e25d9150604401600060405180830381600087803b158015611d0f57600080fd5b505af1158015611d23573d6000803e3d6000fd5b5050600254604051630b07a84960e31b81526004810188905260248101879052604481018790526001600160a01b03909116925063583d42489150606401611a4a565b611d708484610898565b611d7a8483611a84565b611d85848233611ff1565b50505050565b6000816001600160a01b031660016000856002811115611dad57611dad612d6c565b6002811115611dbe57611dbe612d6c565b81526020810191909152604001600020546001600160a01b0316149392505050565b600060016000846002811115611df857611df8612d6c565b6002811115611e0957611e09612d6c565b815260208101919091526040016000908120546001600160a01b031691508290600190856002811115611e3e57611e3e612d6c565b6002811115611e4f57611e4f612d6c565b8152602081019190915260400160002080546001600160a01b0319166001600160a01b03928316179055828116908216846002811115611e9157611e91612d6c565b6040517f796d9fd27d307e851f66684ea6fe5e98600f0d922d136a5717ae5949892cfcf790600090a4505050565b600254604051631751d10160e21b815260048101839052600091829182916001600160a01b031690635d47440490602401606060405180830381865afa158015611f0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f319190612dd5565b509150915081600003611f48575060009392505050565b60025460405163e7d6fbbf60e01b81526000916001600160a01b03169063e7d6fbbf90611f79908490600401612da0565b602060405180830381865afa158015611f96573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fba9190612e03565b905062989680611fca8343612e54565b611fd48386612f6e565b611fde9190612f6e565b611fe89190612e32565b95945050505050565b6002546040516352f2cfd960e11b815260048101859052602481018490526001600160a01b0383811660448301529091169063a5e59fb2906064016117f3565b600254604051631751d10160e21b81526004810183905260009182916001600160a01b0390911690635d47440490602401606060405180830381865afa15801561207f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a39190612dd5565b5090949350505050565b60008060006120bb84611341565b909250905081156121a8576002546040516331a9108f60e11b8152600481018690526000916001600160a01b031690636352211e90602401602060405180830381865afa158015612110573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121349190612e6b565b600254604051631daa479b60e21b81529192506001600160a01b0316906376a91e6c9061216990849084908890600401612e88565b600060405180830381600087803b15801561218357600080fd5b505af1158015612197573d6000803e3d6000fd5b505050506121a68582856123cf565b505b159392505050565b6002546040805163e5a6b10f60e01b815290516000926001600160a01b03169163e5a6b10f9160048083019260209291908290030181865afa1580156121fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061221e9190612e6b565b6001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561225b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061227f9190612e03565b9050808311156122a557604051630c3db3e760e01b815260048101829052602401610438565b600254604051631751d10160e21b81526004810186905260009182916001600160a01b0390911690635d47440490602401606060405180830381865afa1580156122f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123179190612dd5565b6002546040516359f2771160e11b8152600481018b9052602481018a905260448101849052606481018390529295509093506001600160a01b0316915063b3e4ee2290608401600060405180830381600087803b15801561237757600080fd5b505af115801561238b573d6000803e3d6000fd5b505060025460405163d17d14c560e01b8152600481018a9052602481018990526001600160a01b038881166044830152909116925063d17d14c59150606401611a4a565b60025460405163e7d6fbbf60e01b81526000916001600160a01b03169063e7d6fbbf9061240190600190600401612da0565b602060405180830381865afa15801561241e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124429190612e03565b905060006127106124538385612f6e565b61245d9190612e32565b90506000806000600260009054906101000a90046001600160a01b03166001600160a01b0316634d7c7dc76040518163ffffffff1660e01b8152600401606060405180830381865afa1580156124b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124db9190612dd5565b60025492955090935091506001600160a01b031663583d42486124fe8689612e54565b6125089086612f3f565b6125128786612f3f565b6040516001600160e01b031960e085901b1681526004810192909252602482015260448101849052606401600060405180830381600087803b15801561255757600080fd5b505af115801561256b573d6000803e3d6000fd5b5050600254604051631751d10160e21b8152600481018c9052600093508392506001600160a01b0390911690635d47440490602401606060405180830381865afa1580156125bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125e19190612dd5565b6002546040516359f2771160e11b8152600481018f905260248101859052436044820152606481018390529395509093506001600160a01b03169163b3e4ee229150608401600060405180830381600087803b15801561264057600080fd5b505af1158015612654573d6000803e3d6000fd5b5050600254604051632b2163b360e01b8152600481018e90526001600160a01b038d81166024830152604482018d90529091169250632b2163b39150606401600060405180830381600087803b1580156126ad57600080fd5b505af11580156126c1573d6000803e3d6000fd5b5050505050505050505050505050565b6060610ed78383604051806060016040528060278152602001612fbd602791396128a4565b6126fe6129ba565b600254604051631751d10160e21b8152600481018490526000916001600160a01b031690635d47440490602401606060405180830381865afa158015612748573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061276c9190612dd5565b509150506040518060c0016040528084815260200161278a856116a5565b815260200182815260200161279e8561057b565b81526020016127ac8561125b565b6001600160a01b0390811682526002546040516303b1a1e960e31b815260048101889052602090930192911690631d8d0f4890602401602060405180830381865afa1580156127ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128239190612e03565b90529392505050565b6002546040516331a9108f60e11b81526004810184905261047e91849184916001600160a01b031690636352211e90602401602060405180830381865afa15801561287b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289f9190612e6b565b6121b0565b60606001600160a01b0384163b61290c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610438565b600080856001600160a01b0316856040516129279190612f8d565b600060405180830381855af49150503d8060008114612962576040519150601f19603f3d011682016040523d82523d6000602084013e612967565b606091505b5091509150612977828286612981565b9695505050505050565b60608315612990575081610ed7565b8251156129a05782518084602001fd5b8160405162461bcd60e51b81526004016104389190612fa9565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160006001600160a01b03168152602001600081525090565b600060208284031215612a0b57600080fd5b81356001600160e01b031981168114610ed757600080fd5b60038110612a3057600080fd5b50565b600060208284031215612a4557600080fd5b8135610ed781612a23565b600060208284031215612a6257600080fd5b5035919050565b6001600160a01b0381168114612a3057600080fd5b60008060408385031215612a9157600080fd5b8235612a9c81612a23565b91506020830135612aac81612a69565b809150509250929050565b60008060408385031215612aca57600080fd5b50508035926020909101359150565b600060208284031215612aeb57600080fd5b8135610ed781612a69565b60008060208385031215612b0957600080fd5b823567ffffffffffffffff80821115612b2157600080fd5b818501915085601f830112612b3557600080fd5b813581811115612b4457600080fd5b8660208260051b8501011115612b5957600080fd5b60209290920196919550909350505050565b60005b83811015612b86578181015183820152602001612b6e565b83811115611d855750506000910152565b60008151808452612baf816020860160208601612b6b565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015612c1857603f19888603018452612c06858351612b97565b94509285019290850190600101612bea565b5092979650505050505050565b805182526020808201519083015260408082015190830152606080820151908301526080808201516001600160a01b03169083015260a090810151910152565b60c081016105158284612c25565b600080600060608486031215612c8857600080fd5b8335612c9381612a69565b95602085013595506040909401359392505050565b600060808201868352602086818501528560408501526080606085015281855180845260a086019150828701935060005b81811015612cff57612cec838651612c25565b9383019360c09290920191600101612cd9565b50909998505050505050505050565b60008060408385031215612d2157600080fd5b8235612d2c81612a23565b946020939093013593505050565b60008060008060808587031215612d5057600080fd5b5050823594602084013594506040840135936060013592509050565b634e487b7160e01b600052602160045260246000fd5b60038110612a3057634e487b7160e01b600052602160045260246000fd5b60208101612dad83612d82565b91905290565b600060208284031215612dc557600080fd5b81518015158114610ed757600080fd5b600080600060608486031215612dea57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215612e1557600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600082612e4f57634e487b7160e01b600052601260045260246000fd5b500490565b600082821015612e6657612e66612e1c565b500390565b600060208284031215612e7d57600080fd5b8151610ed781612a69565b6001600160a01b039384168152919092166020820152604081019190915260600190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112612eef57600080fd5b83018035915067ffffffffffffffff821115612f0a57600080fd5b602001915036819003821315612f1f57600080fd5b9250929050565b600060018201612f3857612f38612e1c565b5060010190565b60008219821115612f5257612f52612e1c565b500190565b60408101612f6484612d82565b9281526020015290565b6000816000190483118215151615612f8857612f88612e1c565b500290565b60008251612f9f818460208701612b6b565b9190910192915050565b602081526000610ed76020830184612b9756fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220ba54362a00915456e710932d528b2cf29f692a70d90f7ac9f9d238d49aca941364736f6c634300080d003360a06040523480156200001157600080fd5b5060405162002ae038038062002ae0833981016040819052620000349162000365565b8651879087906200004d906000906020850190620001f2565b50805162000063906001906020840190620001f2565b505050620000806200007a6200019c60201b60201c565b620001a0565b600b8590556001600160a01b0381166080526000808052600e60209081527fe710864318d4a32f37d6ce54cb3fadbef648dd12d8dbdf53973564d56b7f881c86905560408051878152905160008051602062002ac0833981519152929181900390910190a260016000819052600e60209081527fa7c5ba7114a813b50159add3a36832908dc83db71d0b9a24c2ad0f83be95820785905560408051868152905160008051602062002ac0833981519152929181900390910190a260026000819052600e60209081527f9adb202b1492743bc00c81d33cdc6423fa8c79109027eb6a845391e8fc1f048184905560408051858152905160008051602062002ac0833981519152929181900390910190a25050505050505062000452565b3390565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620002009062000416565b90600052602060002090601f0160209004810192826200022457600085556200026f565b82601f106200023f57805160ff19168380011785556200026f565b828001600101855582156200026f579182015b828111156200026f57825182559160200191906001019062000252565b506200027d92915062000281565b5090565b5b808211156200027d576000815560010162000282565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620002c057600080fd5b81516001600160401b0380821115620002dd57620002dd62000298565b604051601f8301601f19908116603f0116810190828211818310171562000308576200030862000298565b816040528381526020925086838588010111156200032557600080fd5b600091505b838210156200034957858201830151818301840152908201906200032a565b838211156200035b5760008385830101525b9695505050505050565b600080600080600080600060e0888a0312156200038157600080fd5b87516001600160401b03808211156200039957600080fd5b620003a78b838c01620002ae565b985060208a0151915080821115620003be57600080fd5b50620003cd8a828b01620002ae565b96505060408801519450606088015193506080880151925060a0880151915060c088015160018060a01b03811681146200040657600080fd5b8091505092959891949750929550565b600181811c908216806200042b57607f821691505b6020821081036200044c57634e487b7160e01b600052602260045260246000fd5b50919050565b6080516126446200047c6000396000818161053d01528181610e6d015261128101526126446000f3fe608060405234801561001057600080fd5b50600436106102525760003560e01c80635850088411610146578063b3e4ee22116100c3578063e5a6b10f11610087578063e5a6b10f14610538578063e7d6fbbf1461055f578063e985e9c51461057f578063ecaf822a146105bb578063f2fde38b146105ce578063f7ea7a3d146105e157600080fd5b8063b3e4ee22146104d9578063b88d4fde146104ec578063c87b56dd146104ff578063d17d14c514610512578063e3759abd1461052557600080fd5b806376a91e6c1161010a57806376a91e6c146104875780638da5cb5b1461049a57806395d89b41146104ab578063a22cb465146104b3578063a5e59fb2146104c657600080fd5b806358500884146104175780635d4744041461042a5780636352211e1461045957806370a082311461046c578063715018a61461047f57600080fd5b80632f745c59116101d45780634d7c7dc7116101985780634d7c7dc71461039e5780634f558e79146103cb5780634f6ccce7146103de5780635701e25d146103f1578063583d42481461040457600080fd5b80632f745c591461035257806340c10f191461036557806342842e0e1461032c57806342966c6814610378578063430c20811461038b57600080fd5b80631164da761161021b5780631164da76146102e757806318160ddd146102fa5780631d8d0f481461030c57806323b872dd1461032c5780632b2163b31461033f57600080fd5b80627f57501461025757806301ffc9a71461026c57806306fdde0314610294578063081812fc146102a9578063095ea7b3146102d4575b600080fd5b61026a610265366004611fe5565b6105f4565b005b61027f61027a36600461203f565b61067b565b60405190151581526020015b60405180910390f35b61029c6106a6565b60405161028b91906120b4565b6102bc6102b73660046120c7565b610738565b6040516001600160a01b03909116815260200161028b565b61026a6102e23660046120e0565b6107cd565b61026a6102f536600461210a565b6108e2565b600b545b60405190815260200161028b565b6102fe61031a3660046120c7565b600d6020526000908152604090205481565b61026a61033a36600461213f565b610955565b61026a61034d36600461210a565b610970565b6102fe6103603660046120e0565b6109d6565b61026a6103733660046120e0565b610a6c565b61026a6103863660046120c7565b610ae0565b61027f6103993660046120e0565b610b16565b600f546010546011546103b092919083565b6040805193845260208401929092529082015260600161028b565b61027f6103d93660046120c7565b610b29565b6102fe6103ec3660046120c7565b610b48565b61026a6103ff3660046120e0565b610bdb565b61026a61041236600461216b565b610c4c565b61026a61042536600461213f565b610c9c565b6103b06104383660046120c7565b600c6020526000908152604090208054600182015460029092015490919083565b6102bc6104673660046120c7565b610ce1565b6102fe61047a366004612197565b610d58565b61026a610ddf565b61026a61049536600461213f565b610e15565b600a546001600160a01b03166102bc565b61029c610ee0565b61026a6104c13660046121c0565b610eef565b61026a6104d43660046121f7565b610efa565b61026a6104e736600461222c565b610f6e565b61026a6104fa366004612274565b610fd3565b61029c61050d3660046120c7565b6110e4565b61026a6105203660046121f7565b6111cb565b61026a6105333660046120e0565b611231565b6102bc7f000000000000000000000000000000000000000000000000000000000000000081565b6102fe61056d36600461235f565b600e6020526000908152604090205481565b61027f61058d36600461237a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61026a6105c93660046123ad565b6112ee565b61026a6105dc366004612197565b611393565b61026a6105ef3660046120c7565b61142b565b600a546001600160a01b031633146106275760405162461bcd60e51b815260040161061e906123c9565b60405180910390fd5b816001600160a01b0316836001600160a01b0316857ff828f9266a867e728bd505090b4db2d33e1935c90d43a9fe0a6906eaf30bc48b8460405161066d91815260200190565b60405180910390a450505050565b60006001600160e01b0319821663780e9d6360e01b14806106a057506106a082611496565b92915050565b6060600080546106b5906123fe565b80601f01602080910402602001604051908101604052809291908181526020018280546106e1906123fe565b801561072e5780601f106107035761010080835404028352916020019161072e565b820191906000526020600020905b81548152906001019060200180831161071157829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166107b15760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161061e565b506000908152600460205260409020546001600160a01b031690565b60006107d882610ce1565b9050806001600160a01b0316836001600160a01b0316036108455760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161061e565b336001600160a01b03821614806108615750610861813361058d565b6108d35760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161061e565b6108dd83836114e6565b505050565b600a546001600160a01b0316331461090c5760405162461bcd60e51b815260040161061e906123c9565b816001600160a01b0316837fa760fe80056c46d089c37a35d9dbe762141a463ae0eb8235522d27ab9595286d8360405161094891815260200190565b60405180910390a3505050565b6108dd83838360405180602001604052806000815250610fd3565b600a546001600160a01b0316331461099a5760405162461bcd60e51b815260040161061e906123c9565b816001600160a01b0316837fc5790222911f43ca7d78c4f5ef5cb5a21d7fda4d923d433b80e7db9c295de88a8360405161094891815260200190565b60006109e183610d58565b8210610a435760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161061e565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b03163314610a965760405162461bcd60e51b815260040161061e906123c9565b600b54811180610aa65750600181105b15610ad257600b5460405163168a450960e21b815260016004820152602481019190915260440161061e565b610adc8282611554565b5050565b600a546001600160a01b03163314610b0a5760405162461bcd60e51b815260040161061e906123c9565b610b138161156e565b50565b6000610b228383611615565b9392505050565b6000818152600260205260408120546001600160a01b031615156106a0565b6000610b5360085490565b8210610bb65760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161061e565b60088281548110610bc957610bc9612438565b90600052602060002001549050919050565b600a546001600160a01b03163314610c055760405162461bcd60e51b815260040161061e906123c9565b816001600160a01b03167f782743bed566521eb169ba5186430a0e29079bfd1bdf4fc061bd63b48729846682604051610c4091815260200190565b60405180910390a25050565b600a546001600160a01b03163314610c765760405162461bcd60e51b815260040161061e906123c9565b604080516060810182528481526020810184905201819052600f92909255601055601155565b600a546001600160a01b03163314610cc65760405162461bcd60e51b815260040161061e906123c9565b6108dd8383836040518060200160405280600081525061170c565b6000818152600260205260408120546001600160a01b0316806106a05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161061e565b60006001600160a01b038216610dc35760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161061e565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b03163314610e095760405162461bcd60e51b815260040161061e906123c9565b610e13600061173f565b565b600a546001600160a01b03163314610e3f5760405162461bcd60e51b815260040161061e906123c9565b6040516323b872dd60e01b81526001600160a01b0384811660048301528381166024830152604482018390527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064016020604051808303816000875af1158015610eb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eda919061244e565b50505050565b6060600180546106b5906123fe565b610adc338383611791565b600a546001600160a01b03163314610f245760405162461bcd60e51b815260040161061e906123c9565b6000838152600d6020526040808220849055516001600160a01b03831691849186917f8da7074ffa2c919782faaf9705c7edfe7f814551a91b91aed83ee2ef5ac6af2791a4505050565b600a546001600160a01b03163314610f985760405162461bcd60e51b815260040161061e906123c9565b6040805160608101825293845260208085019384528482019283526000958652600c9052909320915182555160018201559051600290910155565b610fdd3383611615565b6110435760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6044820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606482015260840161061e565b6000611057600a546001600160a01b031690565b60405163700bee4360e11b8152600481018590529091506000906001600160a01b0383169063e017dc86906024016020604051808303816000875af11580156110a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c8919061244e565b905080156110dc576110dc8686868661170c565b505050505050565b6000818152600260205260409020546060906001600160a01b03166111635760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161061e565b600061117a60408051602081019091526000815290565b9050600081511161119a5760405180602001604052806000815250610b22565b806111a484611857565b6040516020016111b592919061246b565b6040516020818303038152906040529392505050565b600a546001600160a01b031633146111f55760405162461bcd60e51b815260040161061e906123c9565b806001600160a01b0316837f75a0543aefc16d03b25751bdf0b5a2fbbec05c6436fd60b038d40f5b7d1def838460405161094891815260200190565b600a546001600160a01b0316331461125b5760405162461bcd60e51b815260040161061e906123c9565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af11580156112ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108dd919061244e565b600a546001600160a01b031633146113185760405162461bcd60e51b815260040161061e906123c9565b80600e600084600281111561132f5761132f61249a565b60028111156113405761134061249a565b81526020810191909152604001600020558160028111156113635761136361249a565b6040518281527f90e64b63a2c952a97e60fcb9bdb464e5e76d2920683504331028687f0cd6643b90602001610c40565b600a546001600160a01b031633146113bd5760405162461bcd60e51b815260040161061e906123c9565b6001600160a01b0381166114225760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161061e565b610b138161173f565b600a546001600160a01b031633146114555760405162461bcd60e51b815260040161061e906123c9565b600b5460408051918252602082018390527fce065be89501ad8aef77e0eb0160264c2d1eb1732a004bcb98735bb0b8102205910160405180910390a1600b55565b60006001600160e01b031982166380ac58cd60e01b14806114c757506001600160e01b03198216635b5e139f60e01b145b806106a057506301ffc9a760e01b6001600160e01b03198316146106a0565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061151b82610ce1565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b610adc828260405180602001604052806000815250611958565b600061157982610ce1565b90506115878160008461198b565b6115926000836114e6565b6001600160a01b03811660009081526003602052604081208054600192906115bb9084906124c6565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000818152600260205260408120546001600160a01b031661168e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161061e565b600061169983610ce1565b9050806001600160a01b0316846001600160a01b031614806116d45750836001600160a01b03166116c984610738565b6001600160a01b0316145b8061170457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b611717848484611a43565b61172384848484611bea565b610eda5760405162461bcd60e51b815260040161061e906124dd565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036117f25760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161061e565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101610948565b60608160000361187e5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156118a857806118928161252f565b91506118a19050600a8361255e565b9150611882565b60008167ffffffffffffffff8111156118c3576118c361225e565b6040519080825280601f01601f1916602001820160405280156118ed576020820181803683370190505b5090505b8415611704576119026001836124c6565b915061190f600a86612572565b61191a906030612586565b60f81b81838151811061192f5761192f612438565b60200101906001600160f81b031916908160001a905350611951600a8661255e565b94506118f1565b6119628383611ceb565b61196f6000848484611bea565b6108dd5760405162461bcd60e51b815260040161061e906124dd565b6001600160a01b0383166119e6576119e181600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611a09565b816001600160a01b0316836001600160a01b031614611a0957611a098382611e39565b6001600160a01b038216611a20576108dd81611ed6565b826001600160a01b0316826001600160a01b0316146108dd576108dd8282611f85565b826001600160a01b0316611a5682610ce1565b6001600160a01b031614611aba5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161061e565b6001600160a01b038216611b1c5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161061e565b611b2783838361198b565b611b326000826114e6565b6001600160a01b0383166000908152600360205260408120805460019290611b5b9084906124c6565b90915550506001600160a01b0382166000908152600360205260408120805460019290611b89908490612586565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006001600160a01b0384163b15611ce057604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611c2e90339089908890889060040161259e565b6020604051808303816000875af1925050508015611c69575060408051601f3d908101601f19168201909252611c66918101906125db565b60015b611cc6573d808015611c97576040519150601f19603f3d011682016040523d82523d6000602084013e611c9c565b606091505b508051600003611cbe5760405162461bcd60e51b815260040161061e906124dd565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611704565b506001949350505050565b6001600160a01b038216611d415760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161061e565b6000818152600260205260409020546001600160a01b031615611da65760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161061e565b611db26000838361198b565b6001600160a01b0382166000908152600360205260408120805460019290611ddb908490612586565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006001611e4684610d58565b611e5091906124c6565b600083815260076020526040902054909150808214611ea3576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090611ee8906001906124c6565b60008381526009602052604081205460088054939450909284908110611f1057611f10612438565b906000526020600020015490508060088381548110611f3157611f31612438565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480611f6957611f696125f8565b6001900381819060005260206000200160009055905550505050565b6000611f9083610d58565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b80356001600160a01b0381168114611fe057600080fd5b919050565b60008060008060808587031215611ffb57600080fd5b8435935061200b60208601611fc9565b925061201960408601611fc9565b9396929550929360600135925050565b6001600160e01b031981168114610b1357600080fd5b60006020828403121561205157600080fd5b8135610b2281612029565b60005b8381101561207757818101518382015260200161205f565b83811115610eda5750506000910152565b600081518084526120a081602086016020860161205c565b601f01601f19169290920160200192915050565b602081526000610b226020830184612088565b6000602082840312156120d957600080fd5b5035919050565b600080604083850312156120f357600080fd5b6120fc83611fc9565b946020939093013593505050565b60008060006060848603121561211f57600080fd5b8335925061212f60208501611fc9565b9150604084013590509250925092565b60008060006060848603121561215457600080fd5b61215d84611fc9565b925061212f60208501611fc9565b60008060006060848603121561218057600080fd5b505081359360208301359350604090920135919050565b6000602082840312156121a957600080fd5b610b2282611fc9565b8015158114610b1357600080fd5b600080604083850312156121d357600080fd5b6121dc83611fc9565b915060208301356121ec816121b2565b809150509250929050565b60008060006060848603121561220c57600080fd5b833592506020840135915061222360408501611fc9565b90509250925092565b6000806000806080858703121561224257600080fd5b5050823594602084013594506040840135936060013592509050565b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561228a57600080fd5b61229385611fc9565b93506122a160208601611fc9565b925060408501359150606085013567ffffffffffffffff808211156122c557600080fd5b818701915087601f8301126122d957600080fd5b8135818111156122eb576122eb61225e565b604051601f8201601f19908116603f011681019083821181831017156123135761231361225e565b816040528281528a602084870101111561232c57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b803560038110611fe057600080fd5b60006020828403121561237157600080fd5b610b2282612350565b6000806040838503121561238d57600080fd5b61239683611fc9565b91506123a460208401611fc9565b90509250929050565b600080604083850312156123c057600080fd5b6120fc83612350565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c9082168061241257607f821691505b60208210810361243257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561246057600080fd5b8151610b22816121b2565b6000835161247d81846020880161205c565b83519083019061249181836020880161205c565b01949350505050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000828210156124d8576124d86124b0565b500390565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060018201612541576125416124b0565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261256d5761256d612548565b500490565b60008261258157612581612548565b500690565b60008219821115612599576125996124b0565b500190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906125d190830184612088565b9695505050505050565b6000602082840312156125ed57600080fd5b8151610b2281612029565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220e3cc4adf28603d304dd258ff9cb919e7f7ee0564a5ffd84872be969455e9a15864736f6c634300080d003390e64b63a2c952a97e60fcb9bdb464e5e76d2920683504331028687f0cd6643b000000000000000000000000eb6814043dc2184b0b321f6de995bf11bdbcc5b800000000000000000000000031e0afda9e1ece2468bbcb2fb24b24ef1cb9cdc300000000000000000000000031e0afda9e1ece2468bbcb2fb24b24ef1cb9cdc300000000000000000000000031e0afda9e1ece2468bbcb2fb24b24ef1cb9cdc3
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000eb6814043dc2184b0b321f6de995bf11bdbcc5b800000000000000000000000031e0afda9e1ece2468bbcb2fb24b24ef1cb9cdc300000000000000000000000031e0afda9e1ece2468bbcb2fb24b24ef1cb9cdc300000000000000000000000031e0afda9e1ece2468bbcb2fb24b24ef1cb9cdc3
-----Decoded View---------------
Arg [0] : currencyAddress_ (address): 0xeb6814043dc2184b0b321f6de995bf11bdbcc5b8
Arg [1] : aclManager_ (address): 0x31e0afda9e1ece2468bbcb2fb24b24ef1cb9cdc3
Arg [2] : marketAdmin_ (address): 0x31e0afda9e1ece2468bbcb2fb24b24ef1cb9cdc3
Arg [3] : treasuryAdmin_ (address): 0x31e0afda9e1ece2468bbcb2fb24b24ef1cb9cdc3
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000eb6814043dc2184b0b321f6de995bf11bdbcc5b8
Arg [1] : 00000000000000000000000031e0afda9e1ece2468bbcb2fb24b24ef1cb9cdc3
Arg [2] : 00000000000000000000000031e0afda9e1ece2468bbcb2fb24b24ef1cb9cdc3
Arg [3] : 00000000000000000000000031e0afda9e1ece2468bbcb2fb24b24ef1cb9cdc3
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|