Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
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:
MetaCell
Compiler Version
v0.8.3+commit.8d00100c
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.3; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/common/ERC2981Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "../erc721-tradable-upgradeable/ERC721TradableUpgradeable.sol"; import "./abstracts/ACellRepository.sol"; import "./interfaces/IMetaCellCreator.sol"; contract MetaCell is IMetaCellCreator, ERC721TradableUpgradeable, ERC2981Upgradeable, PausableUpgradeable, ACellRepository, ReentrancyGuardUpgradeable, OwnableUpgradeable { using Counters for Counters.Counter; using ECDSA for bytes32; Counters.Counter private tokenIdCount; string public baseTokenURI; string public contractURI; bytes32 public stagesID; uint256 public price; uint256 public maxClaimed; uint256 public mintableAmount; uint256 public remainingAmount; uint96 public feeNumerator; address private proxyRegistryAddress; mapping(bytes32 => uint256) private claimedTimes; bool public isCanTransfer; address public signer; mapping(bytes => uint256) public claimedTime; event SetNewTranche( address newSigner, bytes32 stageID, uint256 newPrice, uint256 newAmount, uint256 newMaxClaimed, uint256 timestamp ); event MintForGift( address caller, address to, uint256 tokenId, uint256 timestamp ); event SetBaseTokenURI(string uri, uint256 timestamp); event SetContractURI(string uri, uint256 timestamp); event SetProxyRegistry(address proxy, uint256 timestamp); /** * @dev validates signature */ modifier isValidSign(bytes calldata sig, uint256 index) { bytes32 dataHash = keccak256( abi.encodePacked(msg.sender, stagesID, index) ); bytes32 ethSigHash = dataHash.toEthSignedMessageHash(); require(_verifySig(ethSigHash, sig), "This wallet is not in whitelist"); require( claimedTime[sig] < maxClaimed, "This wallet reached claimed times to mint MetaCell" ); claimedTime[sig]++; _; } function _verifySig(bytes32 ethSigHash, bytes calldata sig) internal view returns (bool) { address _signer = ethSigHash.recover(sig); require(_signer != address(0), "ECDSA: invalid signature"); return _signer == signer; } function claimable( address account, bytes calldata sig, uint256 index ) external view returns (bool) { bytes32 dataHash = keccak256( abi.encodePacked(account, stagesID, index) ); bytes32 ethSigHash = dataHash.toEthSignedMessageHash(); return _verifySig(ethSigHash, sig) && claimedTime[sig] < maxClaimed; } function initialize( string memory _name, string memory _symbol, address _proxyRegistryAddress, address _timelock ) external initializer { require(_proxyRegistryAddress != address(0), "Empty address"); proxyRegistryAddress = _proxyRegistryAddress; timelock = _timelock; __ERC721_init(_name, _symbol); _initializeEIP712(_name); __ReentrancyGuard_init(); __Ownable_init(); __Pausable_init(); baseTokenURI = ""; contractURI = ""; maxClaimed = 1; } function getProxyRegistryAddress() public view virtual override returns (address) { return proxyRegistryAddress; } function setProxyRegistryAddress(address newProxyRegistryAddress) external onlyTimelock { require(newProxyRegistryAddress != address(0), "Empty address"); proxyRegistryAddress = newProxyRegistryAddress; emit SetProxyRegistry(newProxyRegistryAddress, block.timestamp); } function setNewTranche( address newSigner, bytes32 stageID, uint256 newPrice, uint256 newAmount, uint256 newMaxClaimed ) external onlyTimelock { require(newSigner != address(0), "Empty address"); require(newMaxClaimed > 0, "Invalid value"); signer = newSigner; stagesID = stageID; maxClaimed = newMaxClaimed; price = newPrice; remainingAmount = mintableAmount = newAmount; emit SetNewTranche( newSigner, stagesID, newPrice, newAmount, newMaxClaimed, block.timestamp ); } function _create(address _to) internal returns (uint256 _tokenId) { tokenIdCount.increment(); _tokenId = tokenIdCount.current(); _mint(_to, _tokenId); CellData.Cell memory _newCell = CellData.Cell( _tokenId, _to, CellData.Class.INIT, 0, 0, 0, false, 0 ); _addMetaCell(_newCell); _setTokenRoyalty(_tokenId, msg.sender, feeNumerator); } function create(address to) external override isOperator returns (uint256 tokenId) { return _create(to); } function createMultiple(address to, uint256 amount) external isOperator { for (uint256 i = 0; i < amount; i++) { _create(to); } } function mint(address to) external payable isOperator returns (uint256 tokenId) { require(msg.value == price, "Invalid price"); return _create(to); } function mintForGift( address to, bytes calldata sig, uint256 index ) external payable isValidSign(sig, index) nonReentrant whenNotPaused { require(msg.value == price, "Invalid price"); require(remainingAmount >= 1, "Sold out"); remainingAmount--; _create(to); uint256 tokenId = tokenIdCount.current(); emit MintForGift(msg.sender, to, tokenId, block.timestamp); } function _transfer( address from, address to, uint256 tokenId ) internal override { require(isCanTransfer == true, "Can not transfer at this time"); CellData.Cell memory cell = _getMetaCell(tokenId); _removeMetaCell(from, tokenId); super._transfer(from, to, tokenId); cell.user = to; _addMetaCell(cell); } function _customBurn(uint256 tokenId) internal { CellData.Cell memory cell = _getMetaCell(tokenId); require(cell.onSale == false, "MetaCell is on sale"); _removeMetaCell(msg.sender, tokenId); super._burn(tokenId); } function burn(uint256 tokenId) external override { require( msg.sender == ownerOf(tokenId), "Caller is not owner of token id" ); _customBurn(tokenId); } function ownerOf(uint256 tokenId) public view virtual override(ERC721Upgradeable, ACellRepository) returns (address) { return ERC721Upgradeable.ownerOf(tokenId); } function addMetaCell(CellData.Cell memory _cell) external override isOperator { _addMetaCell(_cell); } function removeMetaCell(uint256 _tokenId, address _owner) external override isOperator { _removeMetaCell(_owner, _tokenId); } function updateMetaCell(CellData.Cell memory _cell, address _owner) external override isOperator { _updateMetaCell(_cell, _owner); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721EnumerableUpgradeable, ERC2981Upgradeable) returns (bool) { return ERC721Upgradeable.supportsInterface(interfaceId) || ERC2981Upgradeable.supportsInterface(interfaceId); } function setBaseTokenURI(string memory uri) external onlyTimelock { baseTokenURI = uri; emit SetBaseTokenURI(uri, block.timestamp); } function setContractURI(string memory uri) external onlyTimelock { contractURI = uri; emit SetContractURI(uri, block.timestamp); } function tokenURI(uint256 _tokenId) public view override returns (string memory) { return string( abi.encodePacked( baseTokenURI, Strings.toString(_tokenId), ".json" ) ); } function withdrawETH(address payable to) external onlyTimelock { uint256 balance = address(this).balance; to.transfer(balance); } function setFeeNumerator(uint96 value) external onlyTimelock { feeNumerator = value; } function setIsCanTransfer(bool value) external onlyTimelock { isCanTransfer = value; } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.3; interface IMetaCellCreator { function create(address to) external returns (uint256 tokenId); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.3; import "../../libs/CellData.sol"; /** * @title Interface for interaction with particular cell */ interface ICellRepository { event AddMetaCell(CellData.Cell metaCell, uint256 timestamp); event UpdateMetaCell( CellData.Cell currentMetaCell, CellData.Cell newMetaCell, uint256 timestamp ); event RemoveMetaCell(CellData.Cell metaCell, uint256 timestamp); function addMetaCell(CellData.Cell memory _cell) external; function removeMetaCell(uint256 _tokenId, address _owner) external; /** * @dev Returns meta cell id's for particular user */ function getUserMetaCellsIndexes(address _user) external view returns (uint256[] memory); function updateMetaCell(CellData.Cell memory _cell, address _owner) external; function getMetaCell(uint256 _tokenId) external view returns (CellData.Cell memory); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.3; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Multicall.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "../interfaces/ICellRepository.sol"; import "../../libs/CellData.sol"; /** * @title Interface for interaction with particular cell */ abstract contract ACellRepository is ICellRepository, Multicall { using SafeMath for uint256; using Counters for Counters.Counter; // are meta cells EnumerableSet.UintSet private idSet; mapping(address => uint256[]) private userIndexesArray; mapping(address => mapping(uint256 => CellData.Cell)) public addressToMap; function _addMetaCell(CellData.Cell memory _cell) internal { require( _getMetaCell(_cell.tokenId).user == address(0), "Token already exists" ); EnumerableSet.add(idSet, _cell.tokenId); addressToMap[_cell.user][_cell.tokenId] = _cell; userIndexesArray[_cell.user].push(_cell.tokenId); emit AddMetaCell(_cell, block.timestamp); } function _removeMetaCell(address _user, uint256 _tokenId) internal { CellData.Cell memory _cell = _getMetaCell(_tokenId); require( _cell.user != address(0), "Token not exists" ); require( addressToMap[_user][_tokenId].user == _user, "User is no the owner" ); EnumerableSet.remove(idSet, _tokenId); emit RemoveMetaCell(_cell, block.timestamp); uint256 indexInArray = _getIndexInCellsArray(_user, _tokenId); require(indexInArray != type(uint256).max, "No such index"); userIndexesArray[_user][indexInArray] = userIndexesArray[_user][ userIndexesArray[_user].length - 1 ]; userIndexesArray[_user].pop(); delete addressToMap[_user][_tokenId]; } function _getIndexInCellsArray(address _user, uint256 _value) internal view returns (uint256) { for (uint256 i = 0; i < userIndexesArray[_user].length; i++) { if (userIndexesArray[_user][i] == _value) { return i; } } return type(uint256).max; } /** * @dev Returns meta cell id's for particular user */ function getUserMetaCellsIndexes(address _user) external view override returns (uint256[] memory) { return userIndexesArray[_user]; } function _updateMetaCell(CellData.Cell memory _cell, address _owner) internal { CellData.Cell memory cell = _getMetaCell(_cell.tokenId); require(cell.user != address(0), "Token not exists"); emit UpdateMetaCell(cell, _cell, block.timestamp); cell = _cell; //uint256 index = idToIndex[cell.tokenId]; addressToMap[_owner][_cell.tokenId] = cell; } function getMetaCell(uint256 _tokenId) external view override returns (CellData.Cell memory) { return _getMetaCell( _tokenId); } function _getMetaCell(uint256 _tokenId) internal view returns (CellData.Cell memory _metaCell) { if (!EnumerableSet.contains(idSet, _tokenId)) { return _metaCell; } address _ownerOf = ownerOf(_tokenId); require( addressToMap[_ownerOf][_tokenId].user == _ownerOf, "User is not the owner" ); _metaCell = addressToMap[_ownerOf][_tokenId]; return _metaCell; } function ownerOf(uint256 tokenId) public view virtual returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; /** * @title Representation of cell with it fields */ library CellData { /** * Represents the standart roles * on which cell can be divided */ enum Class { INIT, COMMON, SPLITTABLE_NANO, SPLITTABLE_BIOMETA, SPLITTABLE_ENHANCER, FINISHED } function isSplittable(Class _class) internal pure returns (bool) { return _class == Class.SPLITTABLE_NANO || _class == Class.SPLITTABLE_BIOMETA || _class == Class.SPLITTABLE_ENHANCER; } /** * Represents the basic parameters that describes cell */ struct Cell { uint256 tokenId; address user; Class class; uint256 stage; uint256 nextEvolutionBlock; uint256 variant; bool onSale; uint256 price; } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.3; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; /** * @title Interface to add alowed operator in additiona to owner */ abstract contract IOperator { using EnumerableSet for EnumerableSet.AddressSet; EnumerableSet.AddressSet private operators; modifier isOperator() { require(operators.contains(msg.sender), "You do not have rights"); _; } event OperatorAdded(address); event OperatorRemoved(address); function addOperator(address _operator) external virtual; function removeOperator(address _operator) external virtual; function _addOperator(address _operator) internal { require(_operator != address(0), "Address should not be empty"); require(!operators.contains(_operator), "Already added"); if (!operators.contains(_operator)) { operators.add(_operator); emit OperatorAdded(_operator); } } function _removeOperator(address _operator) internal { require(operators.contains(_operator), "Not exist"); if (operators.contains(_operator)) { operators.remove(_operator); emit OperatorRemoved(_operator); } } function getOperators() external view returns (address[] memory) { return operators.values(); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.3; abstract contract TimelockAccess { address public timelock; modifier onlyTimelock() { require(msg.sender == timelock, "Must call from Timelock"); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import {EIP712Base} from "./EIP712Base.sol"; contract NativeMetaTransaction is EIP712Base { using SafeMath for uint256; bytes32 private constant META_TRANSACTION_TYPEHASH = keccak256( bytes( "MetaTransaction(uint256 nonce,address from,bytes functionSignature)" ) ); event MetaTransactionExecuted( address userAddress, address payable relayerAddress, bytes functionSignature ); mapping(address => uint256) private nonces; /* * Meta transaction structure. * No point of including value field here as if user is doing value transfer then he has the funds to pay for gas * He should call the desired function directly in that case. */ struct MetaTransaction { uint256 nonce; address from; bytes functionSignature; } function executeMetaTransaction( address userAddress, bytes memory functionSignature, bytes32 sigR, bytes32 sigS, uint8 sigV ) public payable returns (bytes memory) { MetaTransaction memory metaTx = MetaTransaction({ nonce: nonces[userAddress], from: userAddress, functionSignature: functionSignature }); require( verify(userAddress, metaTx, sigR, sigS, sigV), "Signer and signature do not match" ); // increase nonce for user (to avoid re-use) nonces[userAddress] = nonces[userAddress].add(1); emit MetaTransactionExecuted( userAddress, payable(msg.sender), functionSignature ); // Append userAddress and relayer address at the end to extract it from calling context (bool success, bytes memory returnData) = address(this).call( abi.encodePacked(functionSignature, userAddress) ); require(success, "Function call not successful"); return returnData; } function hashMetaTransaction(MetaTransaction memory metaTx) internal pure returns (bytes32) { return keccak256( abi.encode( META_TRANSACTION_TYPEHASH, metaTx.nonce, metaTx.from, keccak256(metaTx.functionSignature) ) ); } function getNonce(address user) public view returns (uint256 nonce) { nonce = nonces[user]; } function verify( address signer, MetaTransaction memory metaTx, bytes32 sigR, bytes32 sigS, uint8 sigV ) internal view returns (bool) { require(signer != address(0), "NativeMetaTransaction: INVALID_SIGNER"); return signer == ecrecover( toTypedMessageHash(hashMetaTransaction(metaTx)), sigV, sigR, sigS ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; contract EIP712Base { struct EIP712Domain { string name; string version; address verifyingContract; bytes32 salt; } string public constant ERC712_VERSION = "1"; bytes32 internal constant EIP712_DOMAIN_TYPEHASH = keccak256( bytes( "EIP712Domain(string name,string version,address verifyingContract,bytes32 salt)" ) ); bytes32 internal domainSeparator; // supposed to be called once while initializing. // one of the contracts that inherits this contract follows proxy pattern // so it is not possible to do this in a constructor function _initializeEIP712(string memory name) internal { _setDomainSeparator(name); } function _setDomainSeparator(string memory name) internal { domainSeparator = keccak256( abi.encode( EIP712_DOMAIN_TYPEHASH, keccak256(bytes(name)), keccak256(bytes(ERC712_VERSION)), address(this), bytes32(block.chainid) ) ); } function getdomainSeparator() public view returns (bytes32) { return domainSeparator; } /** * Accept message hash and returns hash message in EIP712 compatible form * So that it can be used to recover signer from signature signed using EIP712 formatted data * https://eips.ethereum.org/EIPS/eip-712 * "\\x19" makes the encoding deterministic * "\\x01" is the version byte to make it compatible to EIP-191 */ function toTypedMessageHash(bytes32 messageHash) internal view returns (bytes32) { return keccak256( abi.encodePacked("\x19\x01", getdomainSeparator(), messageHash) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; abstract contract ContextMixin { function msgSender() internal view returns (address payable sender) { if (msg.sender == address(this)) { bytes memory array = msg.data; uint256 index = msg.data.length; assembly { // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. sender := and( mload(add(array, index)), 0xffffffffffffffffffffffffffffffffffffffff ) } } else { sender = payable(msg.sender); } return sender; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.3; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./meta-transactions/ContentMixin.sol"; import "./meta-transactions/NativeMetaTransaction.sol"; import "../interfaces/IOperator.sol"; import "../helpers/timelock-access/TimelockAccess.sol"; contract OwnableDelegateProxy {} contract ProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies; } /** * @title ERC721Tradable * ERC721Tradable - ERC721 contract that whitelists a trading address, and has minting functionality. */ abstract contract ERC721TradableUpgradeable is ContextMixin, ERC721EnumerableUpgradeable, NativeMetaTransaction, TimelockAccess, IOperator { using SafeMath for uint256; function getProxyRegistryAddress() public virtual view returns (address); function burn(uint256 tokenId) external virtual { require( msg.sender == ownerOf(tokenId), "Caller is not owner of token id" ); super._burn(tokenId); } /** * Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings. */ function isApprovedForAll(address owner, address operator) public view override returns (bool) { // Whitelist OpenSea proxy contract for easy trading. ProxyRegistry proxyRegistry = ProxyRegistry(getProxyRegistryAddress()); if (address(proxyRegistry.proxies(owner)) == operator) { return true; } return super.isApprovedForAll(owner, operator); } function addOperator(address _operator) external override onlyTimelock { _addOperator(_operator); } function removeOperator(address _operator) external override onlyTimelock { _removeOperator(_operator); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @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); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (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 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (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 /// @solidity memory-safe-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 (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 IERC165Upgradeable { /** * @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 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @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); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @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 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981Upgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable { function __ERC2981_init() internal onlyInitializing { } function __ERC2981_init_unchained() internal onlyInitializing { } struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) { return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981Upgradeable */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[48] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721EnumerableUpgradeable is IERC721Upgradeable { /** * @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/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "./IERC721EnumerableUpgradeable.sol"; import "../../../proxy/utils/Initializable.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 ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable { function __ERC721Enumerable_init() internal onlyInitializing { } function __ERC721Enumerable_init_unchained() internal onlyInitializing { } // 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(IERC165Upgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721Upgradeable.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 < ERC721EnumerableUpgradeable.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 = ERC721Upgradeable.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 = ERC721Upgradeable.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(); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[46] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @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`. * * 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; /** * @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 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 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 the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (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 IERC721ReceiverUpgradeable { /** * @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 `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable 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. */ function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); 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: invalid token ID"); 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) { _requireMinted(tokenId); 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 overridden 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 = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); 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: caller is not token 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: caller is not token 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) { address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == 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 = ERC721Upgradeable.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(ERC721Upgradeable.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 an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {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 Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly 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 {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[44] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ReentrancyGuardUpgradeable is Initializable { // 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; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _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; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981Upgradeable is IERC165Upgradeable { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { 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); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "istanbul", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"enum CellData.Class","name":"class","type":"uint8"},{"internalType":"uint256","name":"stage","type":"uint256"},{"internalType":"uint256","name":"nextEvolutionBlock","type":"uint256"},{"internalType":"uint256","name":"variant","type":"uint256"},{"internalType":"bool","name":"onSale","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"}],"indexed":false,"internalType":"struct CellData.Cell","name":"metaCell","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"AddMetaCell","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"address payable","name":"relayerAddress","type":"address"},{"indexed":false,"internalType":"bytes","name":"functionSignature","type":"bytes"}],"name":"MetaTransactionExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"MintForGift","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"}],"name":"OperatorAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"}],"name":"OperatorRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"enum CellData.Class","name":"class","type":"uint8"},{"internalType":"uint256","name":"stage","type":"uint256"},{"internalType":"uint256","name":"nextEvolutionBlock","type":"uint256"},{"internalType":"uint256","name":"variant","type":"uint256"},{"internalType":"bool","name":"onSale","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"}],"indexed":false,"internalType":"struct CellData.Cell","name":"metaCell","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"RemoveMetaCell","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"uri","type":"string"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"SetBaseTokenURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"uri","type":"string"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"SetContractURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newSigner","type":"address"},{"indexed":false,"internalType":"bytes32","name":"stageID","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxClaimed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"SetNewTranche","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"proxy","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"SetProxyRegistry","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"enum CellData.Class","name":"class","type":"uint8"},{"internalType":"uint256","name":"stage","type":"uint256"},{"internalType":"uint256","name":"nextEvolutionBlock","type":"uint256"},{"internalType":"uint256","name":"variant","type":"uint256"},{"internalType":"bool","name":"onSale","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"}],"indexed":false,"internalType":"struct CellData.Cell","name":"currentMetaCell","type":"tuple"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"enum CellData.Class","name":"class","type":"uint8"},{"internalType":"uint256","name":"stage","type":"uint256"},{"internalType":"uint256","name":"nextEvolutionBlock","type":"uint256"},{"internalType":"uint256","name":"variant","type":"uint256"},{"internalType":"bool","name":"onSale","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"}],"indexed":false,"internalType":"struct CellData.Cell","name":"newMetaCell","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"UpdateMetaCell","type":"event"},{"inputs":[],"name":"ERC712_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"enum CellData.Class","name":"class","type":"uint8"},{"internalType":"uint256","name":"stage","type":"uint256"},{"internalType":"uint256","name":"nextEvolutionBlock","type":"uint256"},{"internalType":"uint256","name":"variant","type":"uint256"},{"internalType":"bool","name":"onSale","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct CellData.Cell","name":"_cell","type":"tuple"}],"name":"addMetaCell","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"addOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"addressToMap","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"enum CellData.Class","name":"class","type":"uint8"},{"internalType":"uint256","name":"stage","type":"uint256"},{"internalType":"uint256","name":"nextEvolutionBlock","type":"uint256"},{"internalType":"uint256","name":"variant","type":"uint256"},{"internalType":"bool","name":"onSale","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes","name":"sig","type":"bytes"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"claimable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"claimedTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"create","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"createMultiple","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"bytes","name":"functionSignature","type":"bytes"},{"internalType":"bytes32","name":"sigR","type":"bytes32"},{"internalType":"bytes32","name":"sigS","type":"bytes32"},{"internalType":"uint8","name":"sigV","type":"uint8"}],"name":"executeMetaTransaction","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"feeNumerator","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getMetaCell","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"enum CellData.Class","name":"class","type":"uint8"},{"internalType":"uint256","name":"stage","type":"uint256"},{"internalType":"uint256","name":"nextEvolutionBlock","type":"uint256"},{"internalType":"uint256","name":"variant","type":"uint256"},{"internalType":"bool","name":"onSale","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct CellData.Cell","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getNonce","outputs":[{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOperators","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getProxyRegistryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserMetaCellsIndexes","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getdomainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_proxyRegistryAddress","type":"address"},{"internalType":"address","name":"_timelock","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isCanTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"sig","type":"bytes"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"mintForGift","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"remainingAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"}],"name":"removeMetaCell","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"removeOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setBaseTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint96","name":"value","type":"uint96"}],"name":"setFeeNumerator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"value","type":"bool"}],"name":"setIsCanTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSigner","type":"address"},{"internalType":"bytes32","name":"stageID","type":"bytes32"},{"internalType":"uint256","name":"newPrice","type":"uint256"},{"internalType":"uint256","name":"newAmount","type":"uint256"},{"internalType":"uint256","name":"newMaxClaimed","type":"uint256"}],"name":"setNewTranche","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newProxyRegistryAddress","type":"address"}],"name":"setProxyRegistryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stagesID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timelock","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"enum CellData.Class","name":"class","type":"uint8"},{"internalType":"uint256","name":"stage","type":"uint256"},{"internalType":"uint256","name":"nextEvolutionBlock","type":"uint256"},{"internalType":"uint256","name":"variant","type":"uint256"},{"internalType":"bool","name":"onSale","type":"bool"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct CellData.Cell","name":"_cell","type":"tuple"},{"internalType":"address","name":"_owner","type":"address"}],"name":"updateMetaCell","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"to","type":"address"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b506155ca806100206000396000f3fe6080604052600436106103ad5760003560e01c80636a627842116101e7578063a50a1fe61161010d578063d26ea6c0116100a0578063e8a3d4851161006f578063e8a3d48514610bb3578063e985e9c514610bc8578063f2fde38b14610be8578063fd76e13514610c08576103ad565b8063d26ea6c014610b25578063d33219b414610b45578063d547cfb714610b65578063e86dea4a14610b7a576103ad565b8063b846c76a116100dc578063b846c76a14610a3a578063b88d4fde14610ac5578063c6a1292814610ae5578063c87b56dd14610b05576103ad565b8063a50a1fe6146109bf578063ac8a584a146109d6578063ac9650d8146109f6578063ae3baf4d14610a23576103ad565b80638f15b414116101855780639ed93318116101545780639ed9331814610948578063a035b1fe14610968578063a18083c31461097f578063a22cb4651461099f576103ad565b80638f15b414146108d3578063938e3d7b146108f357806395d89b41146109135780639870d7fe14610928576103ad565b806371d68601116101c157806371d68601146108615780637302e6211461088157806388397249146108945780638da5cb5b146108b4576103ad565b80636a6278421461081957806370a082311461082c578063715018a61461084c576103ad565b806327a099d8116102d757806342842e0e1161026a5780635c975abb116102395780635c975abb146107a05780636352211e146107b9578063653a819e146107d9578063690d8320146107f9576103ad565b806342842e0e1461072057806342966c68146107405780634825195a146107605780634f6ccce714610780576103ad565b80632f745c59116102a65780632f745c59146106ab57806330176e13146106cb5780633b913697146106eb5780633bc5b6e414610700576103ad565b806327a099d8146105fd5780632a55205a1461061f5780632d0335ab1461065e5780632e3cc59c14610694576103ad565b80630c53c51c1161034f5780631fe5b4571161031e5780631fe5b45714610557578063238ac9331461057e57806323b872dd146105a4578063264c0b61146105c4576103ad565b80630c53c51c146104e25780630f7e5970146104f55780631382649b1461052257806318160ddd14610542576103ad565b8063064713a81161038b578063064713a81461043957806306fdde0314610466578063081812fc14610488578063095ea7b3146104c0576103ad565b806301ffc9a7146103b257806302470e10146103e75780630367f62c14610414575b600080fd5b3480156103be57600080fd5b506103d26103cd366004614b94565b610c23565b60405190151581526020015b60405180910390f35b3480156103f357600080fd5b50610407610402366004614869565b610c45565b6040516103de9190615061565b34801561042057600080fd5b5061042b61019f5481565b6040519081526020016103de565b34801561044557600080fd5b50610459610454366004614ceb565b610cb2565b6040516103de9190615247565b34801561047257600080fd5b5061047b610cc3565b6040516103de9190615099565b34801561049457600080fd5b506104a86104a3366004614ceb565b610d55565b6040516001600160a01b0390911681526020016103de565b3480156104cc57600080fd5b506104e06104db366004614adf565b610d7c565b005b61047b6104f0366004614a64565b610e97565b34801561050157600080fd5b5061047b604051806040016040528060018152602001603160f81b81525081565b34801561052e57600080fd5b506104e061053d366004614d03565b611081565b34801561054e57600080fd5b5060995461042b565b34801561056357600080fd5b506104a86101a254600160601b90046001600160a01b031690565b34801561058a57600080fd5b506101a4546104a89061010090046001600160a01b031681565b3480156105b057600080fd5b506104e06105bf3660046148bd565b6110b6565b3480156105d057600080fd5b5061042b6105df366004614bcc565b80516020818301810180516101a58252928201919093012091525481565b34801561060957600080fd5b506106126110e7565b6040516103de9190614fb3565b34801561062b57600080fd5b5061063f61063a366004614d27565b6110f8565b604080516001600160a01b0390931683526020830191909152016103de565b34801561066a57600080fd5b5061042b610679366004614869565b6001600160a01b0316600090815260ca602052604090205490565b3480156106a057600080fd5b5061042b61019d5481565b3480156106b757600080fd5b5061042b6106c6366004614adf565b6111a6565b3480156106d757600080fd5b506104e06106e6366004614bcc565b61123f565b3480156106f757600080fd5b5060c95461042b565b34801561070c57600080fd5b506103d261071b3660046149de565b6112ba565b34801561072c57600080fd5b506104e061073b3660046148bd565b611358565b34801561074c57600080fd5b506104e061075b366004614ceb565b611373565b34801561076c57600080fd5b506104e061077b36600461499b565b6113e8565b34801561078c57600080fd5b5061042b61079b366004614ceb565b611519565b3480156107ac57600080fd5b506101005460ff166103d2565b3480156107c557600080fd5b506104a86107d4366004614ceb565b6115ba565b3480156107e557600080fd5b506104e06107f4366004614d48565b6115c5565b34801561080557600080fd5b506104e0610814366004614869565b611612565b61042b610827366004614869565b611674565b34801561083857600080fd5b5061042b610847366004614869565b6116e8565b34801561085857600080fd5b506104e061176e565b34801561086d57600080fd5b506104e061087c366004614cbd565b611782565b6104e061088f3660046149de565b6117b3565b3480156108a057600080fd5b506104e06108af366004614ca1565b611a9a565b3480156108c057600080fd5b50610168546001600160a01b03166104a8565b3480156108df57600080fd5b506104e06108ee366004614c1b565b611aca565b3480156108ff57600080fd5b506104e061090e366004614bcc565b611caa565b34801561091f57600080fd5b5061047b611d1a565b34801561093457600080fd5b506104e0610943366004614869565b611d29565b34801561095457600080fd5b5061042b610963366004614869565b611d5c565b34801561097457600080fd5b5061042b61019e5481565b34801561098b57600080fd5b506104e061099a366004614b7a565b611d85565b3480156109ab57600080fd5b506104e06109ba366004614967565b611dc3565b3480156109cb57600080fd5b5061042b6101a15481565b3480156109e257600080fd5b506104e06109f1366004614869565b611dce565b348015610a0257600080fd5b50610a16610a11366004614b0a565b611e01565b6040516103de9190615000565b348015610a2f57600080fd5b5061042b6101a05481565b348015610a4657600080fd5b50610ab1610a55366004614adf565b610135602090815260009283526040808420909152908252902080546001820154600283015460038401546004850154600586015460069096015494956001600160a01b03851695600160a01b90950460ff9081169591169088565b6040516103de98979695949392919061529f565b348015610ad157600080fd5b506104e0610ae03660046148fd565b611f20565b348015610af157600080fd5b506104e0610b00366004614adf565b611f58565b348015610b1157600080fd5b5061047b610b20366004614ceb565b611fa6565b348015610b3157600080fd5b506104e0610b40366004614869565b611fdb565b348015610b5157600080fd5b5060cb546104a8906001600160a01b031681565b348015610b7157600080fd5b5061047b612087565b348015610b8657600080fd5b506101a254610b9b906001600160601b031681565b6040516001600160601b0390911681526020016103de565b348015610bbf57600080fd5b5061047b612116565b348015610bd457600080fd5b506103d2610be3366004614885565b612124565b348015610bf457600080fd5b506104e0610c03366004614869565b612208565b348015610c1457600080fd5b506101a4546103d29060ff1681565b6000610c2e8261227e565b80610c3d5750610c3d826122ce565b90505b919050565b6001600160a01b03811660009081526101346020908152604091829020805483518184028101840190945280845260609392830182828015610ca657602002820191906000526020600020905b815481526020019060010190808311610c92575b50505050509050919050565b610cba614680565b610c3d826122f3565b606060658054610cd29061540a565b80601f0160208091040260200160405190810160405280929190818152602001828054610cfe9061540a565b8015610d4b5780601f10610d2057610100808354040283529160200191610d4b565b820191906000526020600020905b815481529060010190602001808311610d2e57829003601f168201915b5050505050905090565b6000610d6082612461565b506000908152606960205260409020546001600160a01b031690565b6000610d87826124c0565b9050806001600160a01b0316836001600160a01b03161415610dfa5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b0382161480610e165750610e168133610be3565b610e885760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610df1565b610e928383612520565b505050565b60408051606081810183526001600160a01b038816600081815260ca602090815290859020548452830152918101869052610ed5878287878761258e565b610f2b5760405162461bcd60e51b815260206004820152602160248201527f5369676e657220616e64207369676e617475726520646f206e6f74206d6174636044820152600d60fb1b6064820152608401610df1565b6001600160a01b038716600090815260ca6020526040902054610f4f90600161267e565b6001600160a01b038816600090815260ca60205260409081902091909155517f5845892132946850460bff5a0083f71031bc5bf9aadcd40f1de79423eac9b10b90610f9f90899033908a90614f54565b60405180910390a1600080306001600160a01b0316888a604051602001610fc7929190614e68565b60408051601f1981840301815290829052610fe191614e4c565b6000604051808303816000865af19150503d806000811461101e576040519150601f19603f3d011682016040523d82523d6000602084013e611023565b606091505b5091509150816110755760405162461bcd60e51b815260206004820152601c60248201527f46756e6374696f6e2063616c6c206e6f74207375636365737366756c000000006044820152606401610df1565b98975050505050505050565b61108c60cc33612691565b6110a85760405162461bcd60e51b8152600401610df19061517e565b6110b281836126b3565b5050565b6110c03382612966565b6110dc5760405162461bcd60e51b8152600401610df1906151f9565b610e928383836129c4565b60606110f360cc612a56565b905090565b600082815260cf602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b031692820192909252829161116d57506040805180820190915260ce546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101516000906127109061118c906001600160601b031687615391565b611196919061537d565b91519350909150505b9250929050565b60006111b1836116e8565b82106112135760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610df1565b506001600160a01b03821660009081526097602090815260408083208484529091529020545b92915050565b60cb546001600160a01b031633146112695760405162461bcd60e51b8152600401610df190615120565b805161127d9061019b9060208401906146c7565b507f32a5f562ebdb778da7cea304f2a834f431b09b992451c09c4e3a1b191f75154981426040516112af9291906150ac565b60405180910390a150565b61019d546040516001600160601b0319606087901b1660208201526034810191909152605481018290526000908190607401604051602081830303815290604052805190602001209050600061130f82612a63565b905061131c818787612ab7565b801561134b575061019f546101a5878760405161133a929190614e3c565b908152602001604051809103902054105b925050505b949350505050565b610e9283838360405180602001604052806000815250611f20565b61137c816115ba565b6001600160a01b0316336001600160a01b0316146113dc5760405162461bcd60e51b815260206004820152601f60248201527f43616c6c6572206973206e6f74206f776e6572206f6620746f6b656e206964006044820152606401610df1565b6113e581612b6f565b50565b60cb546001600160a01b031633146114125760405162461bcd60e51b8152600401610df190615120565b6001600160a01b0385166114385760405162461bcd60e51b8152600401610df190615157565b600081116114785760405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606401610df1565b6101a48054610100600160a81b0319166101006001600160a01b0388169081029190911790915561019d85905561019f82905561019e8490556101a08390556101a18390556040805191825260208201869052810184905260608101839052608081018290524260a08201527f5132c8a91f18038ad801cbf666d4b5001078b0aecb2218d31b1817fb2f419a719060c0015b60405180910390a15050505050565b600061152460995490565b82106115875760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610df1565b609982815481106115a857634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000610c3d826124c0565b60cb546001600160a01b031633146115ef5760405162461bcd60e51b8152600401610df190615120565b6101a280546001600160601b0319166001600160601b0392909216919091179055565b60cb546001600160a01b0316331461163c5760405162461bcd60e51b8152600401610df190615120565b60405147906001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610e92573d6000803e3d6000fd5b600061168160cc33612691565b61169d5760405162461bcd60e51b8152600401610df19061517e565b61019e5434146116df5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420707269636560981b6044820152606401610df1565b610c3d82612bd8565b60006001600160a01b0382166117525760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610df1565b506001600160a01b031660009081526068602052604090205490565b611776612c6e565b6117806000612cc9565b565b61178d60cc33612691565b6117a95760405162461bcd60e51b8152600401610df19061517e565b6110b28282612d1c565b61019d546040516001600160601b03193360601b166020820152603481019190915260548101829052839083908390600090607401604051602081830303815290604052805190602001209050600061180b82612a63565b9050611818818686612ab7565b6118645760405162461bcd60e51b815260206004820152601f60248201527f546869732077616c6c6574206973206e6f7420696e2077686974656c697374006044820152606401610df1565b61019f546101a5868660405161187b929190614e3c565b908152602001604051809103902054106118f25760405162461bcd60e51b815260206004820152603260248201527f546869732077616c6c6574207265616368656420636c61696d65642074696d656044820152711cc81d1bc81b5a5b9d0813595d1850d95b1b60721b6064820152608401610df1565b6101a58585604051611905929190614e3c565b90815260405190819003602001902080549060006119228361543f565b9190505550600261013654141561197b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610df1565b600261013655611989612e88565b61019e5434146119cb5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420707269636560981b6044820152606401610df1565b60016101a1541015611a0a5760405162461bcd60e51b815260206004820152600860248201526714dbdb19081bdd5d60c21b6044820152606401610df1565b6101a18054906000611a1b836153f3565b9190505550611a2989612bd8565b506000611a3661019a5490565b604080513381526001600160a01b038d1660208201529081018290524260608201529091507fd5b1ebf448a550f0ea9dd2a6731a3b499f6a22e15af12907a7f53f2ea175bb7f9060800160405180910390a150506001610136555050505050505050565b611aa560cc33612691565b611ac15760405162461bcd60e51b8152600401610df19061517e565b6113e581612ecf565b600054610100900460ff1615808015611aea5750600054600160ff909116105b80611b045750303b158015611b04575060005460ff166001145b611b675760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610df1565b6000805460ff191660011790558015611b8a576000805461ff0019166101001790555b6001600160a01b038316611bb05760405162461bcd60e51b8152600401610df190615157565b6101a280546001600160601b0316600160601b6001600160a01b03868116919091029190911790915560cb80546001600160a01b031916918416919091179055611bfa858561306f565b611c03856130a0565b611c0b6130a9565b611c136130d8565b611c1b613107565b604080516020810191829052600090819052611c3a9161019b916146c7565b50604080516020810191829052600090819052611c5a9161019c916146c7565b50600161019f558015611ca3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200161150a565b5050505050565b60cb546001600160a01b03163314611cd45760405162461bcd60e51b8152600401610df190615120565b8051611ce89061019c9060208401906146c7565b507ff75313b02871303b6d21a557a111f9bcba1641fd4cd380d86d7ff747ee4410da81426040516112af9291906150ac565b606060668054610cd29061540a565b60cb546001600160a01b03163314611d535760405162461bcd60e51b8152600401610df190615120565b6113e581613136565b6000611d6960cc33612691565b6116df5760405162461bcd60e51b8152600401610df19061517e565b60cb546001600160a01b03163314611daf5760405162461bcd60e51b8152600401610df190615120565b6101a4805460ff1916911515919091179055565b6110b2338383613228565b60cb546001600160a01b03163314611df85760405162461bcd60e51b8152600401610df190615120565b6113e5816132f7565b60608167ffffffffffffffff811115611e2a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611e5d57816020015b6060815260200190600190039081611e485790505b50905060005b82811015611f1957611edb30858584818110611e8f57634e487b7160e01b600052603260045260246000fd5b9050602002810190611ea191906152ef565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061338f92505050565b828281518110611efb57634e487b7160e01b600052603260045260246000fd5b60200260200101819052508080611f119061543f565b915050611e63565b5092915050565b611f2a3383612966565b611f465760405162461bcd60e51b8152600401610df1906151f9565b611f52848484846133b4565b50505050565b611f6360cc33612691565b611f7f5760405162461bcd60e51b8152600401610df19061517e565b60005b81811015610e9257611f9383612bd8565b5080611f9e8161543f565b915050611f82565b606061019b611fb4836133e7565b604051602001611fc5929190614e9a565b6040516020818303038152906040529050919050565b60cb546001600160a01b031633146120055760405162461bcd60e51b8152600401610df190615120565b6001600160a01b03811661202b5760405162461bcd60e51b8152600401610df190615157565b6101a280546001600160601b0316600160601b6001600160a01b03841690810291909117909155604080519182524260208301527f7f1924a40a7994f6ac7d7a1b2969a344e6adecc6433ea81be31a1eb2471d818c91016112af565b61019b80546120959061540a565b80601f01602080910402602001604051908101604052809291908181526020018280546120c19061540a565b801561210e5780601f106120e35761010080835404028352916020019161210e565b820191906000526020600020905b8154815290600101906020018083116120f157829003601f168201915b505050505081565b61019c80546120959061540a565b6000806121416101a254600160601b90046001600160a01b031690565b60405163c455279160e01b81526001600160a01b0386811660048301529192508185169183169063c45527919060240160206040518083038186803b15801561218957600080fd5b505afa15801561219d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121c19190614bff565b6001600160a01b031614156121da576001915050611239565b6001600160a01b038085166000908152606a602090815260408083209387168352929052205460ff16611350565b612210612c6e565b6001600160a01b0381166122755760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610df1565b6113e581612cc9565b60006001600160e01b031982166380ac58cd60e01b14806122af57506001600160e01b03198216635b5e139f60e01b145b80610c3d57506301ffc9a760e01b6001600160e01b0319831614610c3d565b60006001600160e01b0319821663152a902d60e11b1480610c3d5750610c3d82613502565b6122fb614680565b61230761013283613527565b61231057610c40565b600061231b836115ba565b6001600160a01b0380821660008181526101356020908152604080832089845290915290206001015492935091161461238e5760405162461bcd60e51b81526020600482015260156024820152742ab9b2b91034b9903737ba103a34329037bbb732b960591b6044820152606401610df1565b6001600160a01b038181166000908152610135602090815260408083208784528252918290208251610100810184528154815260018201549485169281019290925290929091830190600160a01b900460ff16600581111561240057634e487b7160e01b600052602160045260246000fd5b600581111561241f57634e487b7160e01b600052602160045260246000fd5b8152600282015460208201526003820154604082015260048201546060820152600582015460ff161515608082015260069091015460a0909101529392505050565b6000818152606760205260409020546001600160a01b03166113e55760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610df1565b6000818152606760205260408120546001600160a01b031680610c3d5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610df1565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612555826124c0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006001600160a01b0386166125f45760405162461bcd60e51b815260206004820152602560248201527f4e61746976654d6574615472616e73616374696f6e3a20494e56414c49445f5360448201526424a3a722a960d91b6064820152608401610df1565b60016126076126028761353f565b61359f565b6040805160008152602081018083529290925260ff851690820152606081018690526080810185905260a0016020604051602081039080840390855afa158015612655573d6000803e3d6000fd5b505050602060405103516001600160a01b0316866001600160a01b031614905095945050505050565b600061268a8284615365565b9392505050565b6001600160a01b0381166000908152600183016020526040812054151561268a565b60006126be826122f3565b60208101519091506001600160a01b031661270e5760405162461bcd60e51b815260206004820152601060248201526f546f6b656e206e6f742065786973747360801b6044820152606401610df1565b6001600160a01b038084166000818152610135602090815260408083208784529091529020600101549091161461277e5760405162461bcd60e51b81526020600482015260146024820152732ab9b2b91034b9903737903a34329037bbb732b960611b6044820152606401610df1565b61278a610132836135cf565b507fbcdbcc9e9af0823eefdc689e14cb0ba1dfdd1bbe3ece3f7736cdfaef81af007881426040516127bc929190615282565b60405180910390a160006127d084846135db565b90506000198114156128145760405162461bcd60e51b815260206004820152600d60248201526c09cde40e6eac6d040d2dcc8caf609b1b6044820152606401610df1565b6001600160a01b038416600090815261013460205260409020805461283b906001906153b0565b8154811061285957634e487b7160e01b600052603260045260246000fd5b90600052602060002001546101346000866001600160a01b03166001600160a01b0316815260200190815260200160002082815481106128a957634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101929092556001600160a01b0386168152610134909152604090208054806128ed57634e487b7160e01b600052603160045260246000fd5b6000828152602080822083016000199081018390559092019092556001600160a01b0390951681526101358552604080822094825293909452505081208181556001810180546001600160a81b031916905560028101829055600381018290556004810182905560058101805460ff1916905560060155565b600080612972836124c0565b9050806001600160a01b0316846001600160a01b0316148061299957506129998185612124565b806113505750836001600160a01b03166129b284610d55565b6001600160a01b031614949350505050565b6101a45460ff161515600114612a1c5760405162461bcd60e51b815260206004820152601d60248201527f43616e206e6f74207472616e7366657220617420746869732074696d650000006044820152606401610df1565b6000612a27826122f3565b9050612a3384836126b3565b612a3e848484613671565b6001600160a01b0383166020820152611f5281612ecf565b6060600061268a83613818565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c015b604051602081830303815290604052805190602001209050919050565b600080612afc84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525089939250506138729050565b90506001600160a01b038116612b4f5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610df1565b6101a45461010090046001600160a01b0390811691161490509392505050565b6000612b7a826122f3565b60c081015190915015612bc55760405162461bcd60e51b81526020600482015260136024820152724d65746143656c6c206973206f6e2073616c6560681b6044820152606401610df1565b612bcf33836126b3565b6110b282613896565b6000612be961019a80546001019055565b5061019a54612bf8828261393e565b60408051610100810182528281526001600160a01b0384166020820152600091810182815260200160008152602001600081526020016000815260200160001515815260200160008152509050612c4e81612ecf565b6101a254612c6890839033906001600160601b0316613a8d565b50919050565b610168546001600160a01b031633146117805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610df1565b61016880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000612d2b83600001516122f3565b60208101519091506001600160a01b0316612d7b5760405162461bcd60e51b815260206004820152601060248201526f546f6b656e206e6f742065786973747360801b6044820152606401610df1565b7fa1894e8b9943c13ae3a44b3b6790518ca2b411cd94ba6017bb5e59d7cf61159b818442604051612dae93929190615256565b60405180910390a1506001600160a01b038181166000908152610135602090815260408083208651845282529182902085518155908501516001820180546001600160a01b03198116929095169182178155928601518694859491926001600160a81b031990911617600160a01b836005811115612e3c57634e487b7160e01b600052602160045260246000fd5b0217905550606082015160028201556080820151600382015560a0820151600482015560c082015160058201805460ff191691151591909117905560e090910151600690910155505050565b6101005460ff16156117805760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610df1565b8051600090612edd906122f3565b602001516001600160a01b031614612f2e5760405162461bcd60e51b8152602060048201526014602482015273546f6b656e20616c72656164792065786973747360601b6044820152606401610df1565b612f3e6101328260000151613b9b565b50602080820180516001600160a01b0390811660009081526101358452604080822086518352909452839020845181559151600183018054919092166001600160a01b03198216811783559385015185949092916001600160a81b03191617600160a01b836005811115612fc257634e487b7160e01b600052602160045260246000fd5b0217905550606082015160028201556080820151600382015560a0820151600482015560c082015160058201805460ff191691151591909117905560e0909101516006909101556020818101516001600160a01b0316600090815261013482526040808220845181546001810183559184529390922090910191909155517f53fb2fc76bb695860d4fc492a77118789d840cd5a06d4e513603dd0a3a9c0d4c906112af9083904290615282565b600054610100900460ff166130965760405162461bcd60e51b8152600401610df1906151ae565b6110b28282613ba7565b6113e581613bf5565b600054610100900460ff166130d05760405162461bcd60e51b8152600401610df1906151ae565b611780613c92565b600054610100900460ff166130ff5760405162461bcd60e51b8152600401610df1906151ae565b611780613cc1565b600054610100900460ff1661312e5760405162461bcd60e51b8152600401610df1906151ae565b611780613cf1565b6001600160a01b03811661318c5760405162461bcd60e51b815260206004820152601b60248201527f416464726573732073686f756c64206e6f7420626520656d70747900000000006044820152606401610df1565b61319760cc82612691565b156131d45760405162461bcd60e51b815260206004820152600d60248201526c105b1c9958591e481859191959609a1b6044820152606401610df1565b6131df60cc82612691565b6113e5576131ee60cc82613d25565b506040516001600160a01b03821681527fac6fa858e9350a46cec16539926e0fde25b7629f84b5a72bffaae4df888ae86d906020016112af565b816001600160a01b0316836001600160a01b0316141561328a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610df1565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61330260cc82612691565b61333a5760405162461bcd60e51b8152602060048201526009602482015268139bdd08195e1a5cdd60ba1b6044820152606401610df1565b61334560cc82612691565b156113e55761335560cc82613d3a565b506040516001600160a01b03821681527f80c0b871b97b595b16a7741c1b06fed0c6f6f558639f18ccbce50724325dc40d906020016112af565b606061268a838360405180606001604052806027815260200161556e60279139613d4f565b6133bf8484846129c4565b6133cb84848484613e2c565b611f525760405162461bcd60e51b8152600401610df1906150ce565b60608161340c57506040805180820190915260018152600360fc1b6020820152610c40565b8160005b811561343657806134208161543f565b915061342f9050600a8361537d565b9150613410565b60008167ffffffffffffffff81111561345f57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613489576020820181803683370190505b5090505b84156113505761349e6001836153b0565b91506134ab600a8661545a565b6134b6906030615365565b60f81b8183815181106134d957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506134fb600a8661537d565b945061348d565b60006001600160e01b0319821663780e9d6360e01b1480610c3d5750610c3d8261227e565b6000818152600183016020526040812054151561268a565b60006040518060800160405280604381526020016154dc6043913980516020918201208351848301516040808701518051908601209051612a9a950193845260208401929092526001600160a01b03166040830152606082015260800190565b60006135aa60c95490565b60405161190160f01b6020820152602281019190915260428101839052606201612a9a565b600061268a8383613f36565b6000805b6001600160a01b03841660009081526101346020526040902054811015613666576001600160a01b03841660009081526101346020526040902080548491908390811061363c57634e487b7160e01b600052603260045260246000fd5b90600052602060002001541415613654579050611239565b8061365e8161543f565b9150506135df565b506000199392505050565b826001600160a01b0316613684826124c0565b6001600160a01b0316146136e85760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610df1565b6001600160a01b03821661374a5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610df1565b613755838383614053565b613760600082612520565b6001600160a01b03831660009081526068602052604081208054600192906137899084906153b0565b90915550506001600160a01b03821660009081526068602052604081208054600192906137b7908490615365565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610e92565b606081600001805480602002602001604051908101604052809291908181526020018280548015610ca65760200282019190600052602060002090815481526020019060010190808311610c925750505050509050919050565b60008060006138818585614110565b9150915061388e81614153565b509392505050565b60006138a1826124c0565b90506138af81600084614053565b6138ba600083612520565b6001600160a01b03811660009081526068602052604081208054600192906138e39084906153b0565b909155505060008281526067602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a46110b2565b6001600160a01b0382166139945760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610df1565b6000818152606760205260409020546001600160a01b0316156139f95760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610df1565b613a0560008383614053565b6001600160a01b0382166000908152606860205260408120805460019290613a2e908490615365565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46110b2565b6127106001600160601b0382161115613afb5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610df1565b6001600160a01b038216613b515760405162461bcd60e51b815260206004820152601b60248201527f455243323938313a20496e76616c696420706172616d657465727300000000006044820152606401610df1565b6040805180820182526001600160a01b0393841681526001600160601b039283166020808301918252600096875260cf90529190942093519051909116600160a01b029116179055565b600061268a8383614351565b600054610100900460ff16613bce5760405162461bcd60e51b8152600401610df1906151ae565b8151613be19060659060208501906146c7565b508051610e929060669060208401906146c7565b6040518060800160405280604f815260200161551f604f9139805160209182012082518383012060408051808201825260018152603160f81b90850152805193840192909252908201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201523060808201524660a082015260c00160408051601f19818403018152919052805160209091012060c95550565b600054610100900460ff16613cb95760405162461bcd60e51b8152600401610df1906151ae565b600161013655565b600054610100900460ff16613ce85760405162461bcd60e51b8152600401610df1906151ae565b61178033612cc9565b600054610100900460ff16613d185760405162461bcd60e51b8152600401610df1906151ae565b610100805460ff19169055565b600061268a836001600160a01b038416614351565b600061268a836001600160a01b038416613f36565b60606001600160a01b0384163b613db75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610df1565b600080856001600160a01b031685604051613dd29190614e4c565b600060405180830381855af49150503d8060008114613e0d576040519150601f19603f3d011682016040523d82523d6000602084013e613e12565b606091505b5091509150613e228282866143a0565b9695505050505050565b60006001600160a01b0384163b15613f2e57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613e70903390899088908890600401614f80565b602060405180830381600087803b158015613e8a57600080fd5b505af1925050508015613eba575060408051601f3d908101601f19168201909252613eb791810190614bb0565b60015b613f14573d808015613ee8576040519150601f19603f3d011682016040523d82523d6000602084013e613eed565b606091505b508051613f0c5760405162461bcd60e51b8152600401610df1906150ce565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611350565b506001611350565b60008181526001830160205260408120548015614049576000613f5a6001836153b0565b8554909150600090613f6e906001906153b0565b9050818114613fef576000866000018281548110613f9c57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080876000018481548110613fcd57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061400e57634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611239565b6000915050611239565b6001600160a01b0383166140ae576140a981609980546000838152609a60205260408120829055600182018355919091527f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d000155565b6140d1565b816001600160a01b0316836001600160a01b0316146140d1576140d183826143d9565b6001600160a01b0382166140ed576140e881614476565b610e92565b826001600160a01b0316826001600160a01b031614610e9257610e92828261454f565b6000808251604114156141475760208301516040840151606085015160001a61413b87828585614593565b9450945050505061119f565b5060009050600261119f565b600081600481111561417557634e487b7160e01b600052602160045260246000fd5b1415614180576113e5565b60018160048111156141a257634e487b7160e01b600052602160045260246000fd5b14156141eb5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610df1565b600281600481111561420d57634e487b7160e01b600052602160045260246000fd5b141561425b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610df1565b600381600481111561427d57634e487b7160e01b600052602160045260246000fd5b14156142d65760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610df1565b60048160048111156142f857634e487b7160e01b600052602160045260246000fd5b14156113e55760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610df1565b600081815260018301602052604081205461439857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611239565b506000611239565b606083156143af57508161268a565b8251156143bf5782518084602001fd5b8160405162461bcd60e51b8152600401610df19190615099565b600060016143e6846116e8565b6143f091906153b0565b600083815260986020526040902054909150808214614443576001600160a01b03841660009081526097602090815260408083208584528252808320548484528184208190558352609890915290208190555b5060009182526098602090815260408084208490556001600160a01b039094168352609781528383209183525290812055565b609954600090614488906001906153b0565b6000838152609a6020526040812054609980549394509092849081106144be57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080609983815481106144ed57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152609a9091526040808220849055858252812055609980548061453357634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b600061455a836116e8565b6001600160a01b039093166000908152609760209081526040808320868452825280832085905593825260989052919091209190915550565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156145ca5750600090506003614677565b8460ff16601b141580156145e257508460ff16601c14155b156145f35750600090506004614677565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614647573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661467057600060019250925050614677565b9150600090505b94509492505050565b604080516101008101825260008082526020820181905290918201908152602001600081526020016000815260200160008152602001600015158152602001600081525090565b8280546146d39061540a565b90600052602060002090601f0160209004810192826146f5576000855561473b565b82601f1061470e57805160ff191683800117855561473b565b8280016001018555821561473b579182015b8281111561473b578251825591602001919060010190614720565b5061474792915061474b565b5090565b5b80821115614747576000815560010161474c565b80358015158114610c4057600080fd5b600082601f830112614780578081fd5b813567ffffffffffffffff81111561479a5761479a61549a565b6147ad601f8201601f1916602001615334565b8181528460208386010111156147c1578283fd5b816020850160208301379081016020019190915292915050565b60006101008083850312156147ee578182fd5b6147f781615334565b91505081358152602082013561480c816154b0565b602082015260408201356006811061482357600080fd5b80604083015250606082013560608201526080820135608082015260a082013560a082015261485460c08301614760565b60c082015260e082013560e082015292915050565b60006020828403121561487a578081fd5b813561268a816154b0565b60008060408385031215614897578081fd5b82356148a2816154b0565b915060208301356148b2816154b0565b809150509250929050565b6000806000606084860312156148d1578081fd5b83356148dc816154b0565b925060208401356148ec816154b0565b929592945050506040919091013590565b60008060008060808587031215614912578081fd5b843561491d816154b0565b9350602085013561492d816154b0565b925060408501359150606085013567ffffffffffffffff81111561494f578182fd5b61495b87828801614770565b91505092959194509250565b60008060408385031215614979578182fd5b8235614984816154b0565b915061499260208401614760565b90509250929050565b600080600080600060a086880312156149b2578081fd5b85356149bd816154b0565b97602087013597506040870135966060810135965060800135945092505050565b600080600080606085870312156149f3578182fd5b84356149fe816154b0565b9350602085013567ffffffffffffffff80821115614a1a578384fd5b818701915087601f830112614a2d578384fd5b813581811115614a3b578485fd5b886020828501011115614a4c578485fd5b95986020929092019750949560400135945092505050565b600080600080600060a08688031215614a7b578283fd5b8535614a86816154b0565b9450602086013567ffffffffffffffff811115614aa1578384fd5b614aad88828901614770565b9450506040860135925060608601359150608086013560ff81168114614ad1578182fd5b809150509295509295909350565b60008060408385031215614af1578182fd5b8235614afc816154b0565b946020939093013593505050565b60008060208385031215614b1c578182fd5b823567ffffffffffffffff80821115614b33578384fd5b818501915085601f830112614b46578384fd5b813581811115614b54578485fd5b8660208260051b8501011115614b68578485fd5b60209290920196919550909350505050565b600060208284031215614b8b578081fd5b61268a82614760565b600060208284031215614ba5578081fd5b813561268a816154c5565b600060208284031215614bc1578081fd5b815161268a816154c5565b600060208284031215614bdd578081fd5b813567ffffffffffffffff811115614bf3578182fd5b61135084828501614770565b600060208284031215614c10578081fd5b815161268a816154b0565b60008060008060808587031215614c30578182fd5b843567ffffffffffffffff80821115614c47578384fd5b614c5388838901614770565b95506020870135915080821115614c68578384fd5b50614c7587828801614770565b9350506040850135614c86816154b0565b91506060850135614c96816154b0565b939692955090935050565b60006101008284031215614cb3578081fd5b61268a83836147db565b6000806101208385031215614cd0578182fd5b614cda84846147db565b91506101008301356148b2816154b0565b600060208284031215614cfc578081fd5b5035919050565b60008060408385031215614d15578182fd5b8235915060208301356148b2816154b0565b60008060408385031215614d39578182fd5b50508035926020909101359150565b600060208284031215614d59578081fd5b81356001600160601b038116811461268a578182fd5b60008151808452614d878160208601602086016153c7565b601f01601f19169290920160200192915050565b60008151614dad8185602086016153c7565b9290920192915050565b60068110614dd557634e487b7160e01b600052602160045260246000fd5b9052565b805182526020808201516001600160a01b03169083015260408082015190614e0390840182614db7565b50606081015160608301526080810151608083015260a081015160a083015260c0810151151560c083015260e081015160e08301525050565b6000828483379101908152919050565b60008251614e5e8184602087016153c7565b9190910192915050565b60008351614e7a8184602088016153c7565b60609390931b6001600160601b0319169190920190815260140192915050565b600080845482600182811c915080831680614eb657607f831692505b6020808410821415614ed657634e487b7160e01b87526022600452602487fd5b818015614eea5760018114614efb57614f27565b60ff19861689528489019650614f27565b60008b815260209020885b86811015614f1f5781548b820152908501908301614f06565b505084890196505b505050505050614f4b614f3a8286614d9b565b64173539b7b760d91b815260050190565b95945050505050565b6001600160a01b03848116825283166020820152606060408201819052600090614f4b90830184614d6f565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613e2290830184614d6f565b6020808252825182820181905260009190848201906040850190845b81811015614ff45783516001600160a01b031683529284019291840191600101614fcf565b50909695505050505050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b8281101561505457603f19888603018452615042858351614d6f565b94509285019290850190600101615026565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015614ff45783518352928401929184019160010161507d565b60006020825261268a6020830184614d6f565b6000604082526150bf6040830185614d6f565b90508260208301529392505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526017908201527f4d7573742063616c6c2066726f6d2054696d656c6f636b000000000000000000604082015260600190565b6020808252600d908201526c456d707479206164647265737360981b604082015260600190565b602080825260169082015275596f7520646f206e6f7420686176652072696768747360501b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b61010081016112398284614dd9565b61022081016152658286614dd9565b615273610100830185614dd9565b82610200830152949350505050565b61012081016152918285614dd9565b826101008301529392505050565b8881526001600160a01b038816602082015261010081016152c36040830189614db7565b6060820196909652608081019490945260a0840192909252151560c083015260e0909101529392505050565b6000808335601e19843603018112615305578283fd5b83018035915067ffffffffffffffff82111561531f578283fd5b60200191503681900382131561119f57600080fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561535d5761535d61549a565b604052919050565b600082198211156153785761537861546e565b500190565b60008261538c5761538c615484565b500490565b60008160001904831182151516156153ab576153ab61546e565b500290565b6000828210156153c2576153c261546e565b500390565b60005b838110156153e25781810151838201526020016153ca565b83811115611f525750506000910152565b6000816154025761540261546e565b506000190190565b600181811c9082168061541e57607f821691505b60208210811415612c6857634e487b7160e01b600052602260045260246000fd5b60006000198214156154535761545361546e565b5060010190565b60008261546957615469615484565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146113e557600080fd5b6001600160e01b0319811681146113e557600080fdfe4d6574615472616e73616374696f6e2875696e74323536206e6f6e63652c616464726573732066726f6d2c62797465732066756e6374696f6e5369676e617475726529454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c6164647265737320766572696679696e67436f6e74726163742c627974657333322073616c7429416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012f38ecbb0a9db0b70f74aeaba300131f849d1e9b4f2b669331281d5f70ec2a464736f6c63430008030033
Deployed Bytecode
0x6080604052600436106103ad5760003560e01c80636a627842116101e7578063a50a1fe61161010d578063d26ea6c0116100a0578063e8a3d4851161006f578063e8a3d48514610bb3578063e985e9c514610bc8578063f2fde38b14610be8578063fd76e13514610c08576103ad565b8063d26ea6c014610b25578063d33219b414610b45578063d547cfb714610b65578063e86dea4a14610b7a576103ad565b8063b846c76a116100dc578063b846c76a14610a3a578063b88d4fde14610ac5578063c6a1292814610ae5578063c87b56dd14610b05576103ad565b8063a50a1fe6146109bf578063ac8a584a146109d6578063ac9650d8146109f6578063ae3baf4d14610a23576103ad565b80638f15b414116101855780639ed93318116101545780639ed9331814610948578063a035b1fe14610968578063a18083c31461097f578063a22cb4651461099f576103ad565b80638f15b414146108d3578063938e3d7b146108f357806395d89b41146109135780639870d7fe14610928576103ad565b806371d68601116101c157806371d68601146108615780637302e6211461088157806388397249146108945780638da5cb5b146108b4576103ad565b80636a6278421461081957806370a082311461082c578063715018a61461084c576103ad565b806327a099d8116102d757806342842e0e1161026a5780635c975abb116102395780635c975abb146107a05780636352211e146107b9578063653a819e146107d9578063690d8320146107f9576103ad565b806342842e0e1461072057806342966c68146107405780634825195a146107605780634f6ccce714610780576103ad565b80632f745c59116102a65780632f745c59146106ab57806330176e13146106cb5780633b913697146106eb5780633bc5b6e414610700576103ad565b806327a099d8146105fd5780632a55205a1461061f5780632d0335ab1461065e5780632e3cc59c14610694576103ad565b80630c53c51c1161034f5780631fe5b4571161031e5780631fe5b45714610557578063238ac9331461057e57806323b872dd146105a4578063264c0b61146105c4576103ad565b80630c53c51c146104e25780630f7e5970146104f55780631382649b1461052257806318160ddd14610542576103ad565b8063064713a81161038b578063064713a81461043957806306fdde0314610466578063081812fc14610488578063095ea7b3146104c0576103ad565b806301ffc9a7146103b257806302470e10146103e75780630367f62c14610414575b600080fd5b3480156103be57600080fd5b506103d26103cd366004614b94565b610c23565b60405190151581526020015b60405180910390f35b3480156103f357600080fd5b50610407610402366004614869565b610c45565b6040516103de9190615061565b34801561042057600080fd5b5061042b61019f5481565b6040519081526020016103de565b34801561044557600080fd5b50610459610454366004614ceb565b610cb2565b6040516103de9190615247565b34801561047257600080fd5b5061047b610cc3565b6040516103de9190615099565b34801561049457600080fd5b506104a86104a3366004614ceb565b610d55565b6040516001600160a01b0390911681526020016103de565b3480156104cc57600080fd5b506104e06104db366004614adf565b610d7c565b005b61047b6104f0366004614a64565b610e97565b34801561050157600080fd5b5061047b604051806040016040528060018152602001603160f81b81525081565b34801561052e57600080fd5b506104e061053d366004614d03565b611081565b34801561054e57600080fd5b5060995461042b565b34801561056357600080fd5b506104a86101a254600160601b90046001600160a01b031690565b34801561058a57600080fd5b506101a4546104a89061010090046001600160a01b031681565b3480156105b057600080fd5b506104e06105bf3660046148bd565b6110b6565b3480156105d057600080fd5b5061042b6105df366004614bcc565b80516020818301810180516101a58252928201919093012091525481565b34801561060957600080fd5b506106126110e7565b6040516103de9190614fb3565b34801561062b57600080fd5b5061063f61063a366004614d27565b6110f8565b604080516001600160a01b0390931683526020830191909152016103de565b34801561066a57600080fd5b5061042b610679366004614869565b6001600160a01b0316600090815260ca602052604090205490565b3480156106a057600080fd5b5061042b61019d5481565b3480156106b757600080fd5b5061042b6106c6366004614adf565b6111a6565b3480156106d757600080fd5b506104e06106e6366004614bcc565b61123f565b3480156106f757600080fd5b5060c95461042b565b34801561070c57600080fd5b506103d261071b3660046149de565b6112ba565b34801561072c57600080fd5b506104e061073b3660046148bd565b611358565b34801561074c57600080fd5b506104e061075b366004614ceb565b611373565b34801561076c57600080fd5b506104e061077b36600461499b565b6113e8565b34801561078c57600080fd5b5061042b61079b366004614ceb565b611519565b3480156107ac57600080fd5b506101005460ff166103d2565b3480156107c557600080fd5b506104a86107d4366004614ceb565b6115ba565b3480156107e557600080fd5b506104e06107f4366004614d48565b6115c5565b34801561080557600080fd5b506104e0610814366004614869565b611612565b61042b610827366004614869565b611674565b34801561083857600080fd5b5061042b610847366004614869565b6116e8565b34801561085857600080fd5b506104e061176e565b34801561086d57600080fd5b506104e061087c366004614cbd565b611782565b6104e061088f3660046149de565b6117b3565b3480156108a057600080fd5b506104e06108af366004614ca1565b611a9a565b3480156108c057600080fd5b50610168546001600160a01b03166104a8565b3480156108df57600080fd5b506104e06108ee366004614c1b565b611aca565b3480156108ff57600080fd5b506104e061090e366004614bcc565b611caa565b34801561091f57600080fd5b5061047b611d1a565b34801561093457600080fd5b506104e0610943366004614869565b611d29565b34801561095457600080fd5b5061042b610963366004614869565b611d5c565b34801561097457600080fd5b5061042b61019e5481565b34801561098b57600080fd5b506104e061099a366004614b7a565b611d85565b3480156109ab57600080fd5b506104e06109ba366004614967565b611dc3565b3480156109cb57600080fd5b5061042b6101a15481565b3480156109e257600080fd5b506104e06109f1366004614869565b611dce565b348015610a0257600080fd5b50610a16610a11366004614b0a565b611e01565b6040516103de9190615000565b348015610a2f57600080fd5b5061042b6101a05481565b348015610a4657600080fd5b50610ab1610a55366004614adf565b610135602090815260009283526040808420909152908252902080546001820154600283015460038401546004850154600586015460069096015494956001600160a01b03851695600160a01b90950460ff9081169591169088565b6040516103de98979695949392919061529f565b348015610ad157600080fd5b506104e0610ae03660046148fd565b611f20565b348015610af157600080fd5b506104e0610b00366004614adf565b611f58565b348015610b1157600080fd5b5061047b610b20366004614ceb565b611fa6565b348015610b3157600080fd5b506104e0610b40366004614869565b611fdb565b348015610b5157600080fd5b5060cb546104a8906001600160a01b031681565b348015610b7157600080fd5b5061047b612087565b348015610b8657600080fd5b506101a254610b9b906001600160601b031681565b6040516001600160601b0390911681526020016103de565b348015610bbf57600080fd5b5061047b612116565b348015610bd457600080fd5b506103d2610be3366004614885565b612124565b348015610bf457600080fd5b506104e0610c03366004614869565b612208565b348015610c1457600080fd5b506101a4546103d29060ff1681565b6000610c2e8261227e565b80610c3d5750610c3d826122ce565b90505b919050565b6001600160a01b03811660009081526101346020908152604091829020805483518184028101840190945280845260609392830182828015610ca657602002820191906000526020600020905b815481526020019060010190808311610c92575b50505050509050919050565b610cba614680565b610c3d826122f3565b606060658054610cd29061540a565b80601f0160208091040260200160405190810160405280929190818152602001828054610cfe9061540a565b8015610d4b5780601f10610d2057610100808354040283529160200191610d4b565b820191906000526020600020905b815481529060010190602001808311610d2e57829003601f168201915b5050505050905090565b6000610d6082612461565b506000908152606960205260409020546001600160a01b031690565b6000610d87826124c0565b9050806001600160a01b0316836001600160a01b03161415610dfa5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b0382161480610e165750610e168133610be3565b610e885760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c00006064820152608401610df1565b610e928383612520565b505050565b60408051606081810183526001600160a01b038816600081815260ca602090815290859020548452830152918101869052610ed5878287878761258e565b610f2b5760405162461bcd60e51b815260206004820152602160248201527f5369676e657220616e64207369676e617475726520646f206e6f74206d6174636044820152600d60fb1b6064820152608401610df1565b6001600160a01b038716600090815260ca6020526040902054610f4f90600161267e565b6001600160a01b038816600090815260ca60205260409081902091909155517f5845892132946850460bff5a0083f71031bc5bf9aadcd40f1de79423eac9b10b90610f9f90899033908a90614f54565b60405180910390a1600080306001600160a01b0316888a604051602001610fc7929190614e68565b60408051601f1981840301815290829052610fe191614e4c565b6000604051808303816000865af19150503d806000811461101e576040519150601f19603f3d011682016040523d82523d6000602084013e611023565b606091505b5091509150816110755760405162461bcd60e51b815260206004820152601c60248201527f46756e6374696f6e2063616c6c206e6f74207375636365737366756c000000006044820152606401610df1565b98975050505050505050565b61108c60cc33612691565b6110a85760405162461bcd60e51b8152600401610df19061517e565b6110b281836126b3565b5050565b6110c03382612966565b6110dc5760405162461bcd60e51b8152600401610df1906151f9565b610e928383836129c4565b60606110f360cc612a56565b905090565b600082815260cf602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b031692820192909252829161116d57506040805180820190915260ce546001600160a01b0381168252600160a01b90046001600160601b031660208201525b60208101516000906127109061118c906001600160601b031687615391565b611196919061537d565b91519350909150505b9250929050565b60006111b1836116e8565b82106112135760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610df1565b506001600160a01b03821660009081526097602090815260408083208484529091529020545b92915050565b60cb546001600160a01b031633146112695760405162461bcd60e51b8152600401610df190615120565b805161127d9061019b9060208401906146c7565b507f32a5f562ebdb778da7cea304f2a834f431b09b992451c09c4e3a1b191f75154981426040516112af9291906150ac565b60405180910390a150565b61019d546040516001600160601b0319606087901b1660208201526034810191909152605481018290526000908190607401604051602081830303815290604052805190602001209050600061130f82612a63565b905061131c818787612ab7565b801561134b575061019f546101a5878760405161133a929190614e3c565b908152602001604051809103902054105b925050505b949350505050565b610e9283838360405180602001604052806000815250611f20565b61137c816115ba565b6001600160a01b0316336001600160a01b0316146113dc5760405162461bcd60e51b815260206004820152601f60248201527f43616c6c6572206973206e6f74206f776e6572206f6620746f6b656e206964006044820152606401610df1565b6113e581612b6f565b50565b60cb546001600160a01b031633146114125760405162461bcd60e51b8152600401610df190615120565b6001600160a01b0385166114385760405162461bcd60e51b8152600401610df190615157565b600081116114785760405162461bcd60e51b815260206004820152600d60248201526c496e76616c69642076616c756560981b6044820152606401610df1565b6101a48054610100600160a81b0319166101006001600160a01b0388169081029190911790915561019d85905561019f82905561019e8490556101a08390556101a18390556040805191825260208201869052810184905260608101839052608081018290524260a08201527f5132c8a91f18038ad801cbf666d4b5001078b0aecb2218d31b1817fb2f419a719060c0015b60405180910390a15050505050565b600061152460995490565b82106115875760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610df1565b609982815481106115a857634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050919050565b6000610c3d826124c0565b60cb546001600160a01b031633146115ef5760405162461bcd60e51b8152600401610df190615120565b6101a280546001600160601b0319166001600160601b0392909216919091179055565b60cb546001600160a01b0316331461163c5760405162461bcd60e51b8152600401610df190615120565b60405147906001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610e92573d6000803e3d6000fd5b600061168160cc33612691565b61169d5760405162461bcd60e51b8152600401610df19061517e565b61019e5434146116df5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420707269636560981b6044820152606401610df1565b610c3d82612bd8565b60006001600160a01b0382166117525760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610df1565b506001600160a01b031660009081526068602052604090205490565b611776612c6e565b6117806000612cc9565b565b61178d60cc33612691565b6117a95760405162461bcd60e51b8152600401610df19061517e565b6110b28282612d1c565b61019d546040516001600160601b03193360601b166020820152603481019190915260548101829052839083908390600090607401604051602081830303815290604052805190602001209050600061180b82612a63565b9050611818818686612ab7565b6118645760405162461bcd60e51b815260206004820152601f60248201527f546869732077616c6c6574206973206e6f7420696e2077686974656c697374006044820152606401610df1565b61019f546101a5868660405161187b929190614e3c565b908152602001604051809103902054106118f25760405162461bcd60e51b815260206004820152603260248201527f546869732077616c6c6574207265616368656420636c61696d65642074696d656044820152711cc81d1bc81b5a5b9d0813595d1850d95b1b60721b6064820152608401610df1565b6101a58585604051611905929190614e3c565b90815260405190819003602001902080549060006119228361543f565b9190505550600261013654141561197b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610df1565b600261013655611989612e88565b61019e5434146119cb5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420707269636560981b6044820152606401610df1565b60016101a1541015611a0a5760405162461bcd60e51b815260206004820152600860248201526714dbdb19081bdd5d60c21b6044820152606401610df1565b6101a18054906000611a1b836153f3565b9190505550611a2989612bd8565b506000611a3661019a5490565b604080513381526001600160a01b038d1660208201529081018290524260608201529091507fd5b1ebf448a550f0ea9dd2a6731a3b499f6a22e15af12907a7f53f2ea175bb7f9060800160405180910390a150506001610136555050505050505050565b611aa560cc33612691565b611ac15760405162461bcd60e51b8152600401610df19061517e565b6113e581612ecf565b600054610100900460ff1615808015611aea5750600054600160ff909116105b80611b045750303b158015611b04575060005460ff166001145b611b675760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610df1565b6000805460ff191660011790558015611b8a576000805461ff0019166101001790555b6001600160a01b038316611bb05760405162461bcd60e51b8152600401610df190615157565b6101a280546001600160601b0316600160601b6001600160a01b03868116919091029190911790915560cb80546001600160a01b031916918416919091179055611bfa858561306f565b611c03856130a0565b611c0b6130a9565b611c136130d8565b611c1b613107565b604080516020810191829052600090819052611c3a9161019b916146c7565b50604080516020810191829052600090819052611c5a9161019c916146c7565b50600161019f558015611ca3576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200161150a565b5050505050565b60cb546001600160a01b03163314611cd45760405162461bcd60e51b8152600401610df190615120565b8051611ce89061019c9060208401906146c7565b507ff75313b02871303b6d21a557a111f9bcba1641fd4cd380d86d7ff747ee4410da81426040516112af9291906150ac565b606060668054610cd29061540a565b60cb546001600160a01b03163314611d535760405162461bcd60e51b8152600401610df190615120565b6113e581613136565b6000611d6960cc33612691565b6116df5760405162461bcd60e51b8152600401610df19061517e565b60cb546001600160a01b03163314611daf5760405162461bcd60e51b8152600401610df190615120565b6101a4805460ff1916911515919091179055565b6110b2338383613228565b60cb546001600160a01b03163314611df85760405162461bcd60e51b8152600401610df190615120565b6113e5816132f7565b60608167ffffffffffffffff811115611e2a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611e5d57816020015b6060815260200190600190039081611e485790505b50905060005b82811015611f1957611edb30858584818110611e8f57634e487b7160e01b600052603260045260246000fd5b9050602002810190611ea191906152ef565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061338f92505050565b828281518110611efb57634e487b7160e01b600052603260045260246000fd5b60200260200101819052508080611f119061543f565b915050611e63565b5092915050565b611f2a3383612966565b611f465760405162461bcd60e51b8152600401610df1906151f9565b611f52848484846133b4565b50505050565b611f6360cc33612691565b611f7f5760405162461bcd60e51b8152600401610df19061517e565b60005b81811015610e9257611f9383612bd8565b5080611f9e8161543f565b915050611f82565b606061019b611fb4836133e7565b604051602001611fc5929190614e9a565b6040516020818303038152906040529050919050565b60cb546001600160a01b031633146120055760405162461bcd60e51b8152600401610df190615120565b6001600160a01b03811661202b5760405162461bcd60e51b8152600401610df190615157565b6101a280546001600160601b0316600160601b6001600160a01b03841690810291909117909155604080519182524260208301527f7f1924a40a7994f6ac7d7a1b2969a344e6adecc6433ea81be31a1eb2471d818c91016112af565b61019b80546120959061540a565b80601f01602080910402602001604051908101604052809291908181526020018280546120c19061540a565b801561210e5780601f106120e35761010080835404028352916020019161210e565b820191906000526020600020905b8154815290600101906020018083116120f157829003601f168201915b505050505081565b61019c80546120959061540a565b6000806121416101a254600160601b90046001600160a01b031690565b60405163c455279160e01b81526001600160a01b0386811660048301529192508185169183169063c45527919060240160206040518083038186803b15801561218957600080fd5b505afa15801561219d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121c19190614bff565b6001600160a01b031614156121da576001915050611239565b6001600160a01b038085166000908152606a602090815260408083209387168352929052205460ff16611350565b612210612c6e565b6001600160a01b0381166122755760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610df1565b6113e581612cc9565b60006001600160e01b031982166380ac58cd60e01b14806122af57506001600160e01b03198216635b5e139f60e01b145b80610c3d57506301ffc9a760e01b6001600160e01b0319831614610c3d565b60006001600160e01b0319821663152a902d60e11b1480610c3d5750610c3d82613502565b6122fb614680565b61230761013283613527565b61231057610c40565b600061231b836115ba565b6001600160a01b0380821660008181526101356020908152604080832089845290915290206001015492935091161461238e5760405162461bcd60e51b81526020600482015260156024820152742ab9b2b91034b9903737ba103a34329037bbb732b960591b6044820152606401610df1565b6001600160a01b038181166000908152610135602090815260408083208784528252918290208251610100810184528154815260018201549485169281019290925290929091830190600160a01b900460ff16600581111561240057634e487b7160e01b600052602160045260246000fd5b600581111561241f57634e487b7160e01b600052602160045260246000fd5b8152600282015460208201526003820154604082015260048201546060820152600582015460ff161515608082015260069091015460a0909101529392505050565b6000818152606760205260409020546001600160a01b03166113e55760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610df1565b6000818152606760205260408120546001600160a01b031680610c3d5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610df1565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612555826124c0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006001600160a01b0386166125f45760405162461bcd60e51b815260206004820152602560248201527f4e61746976654d6574615472616e73616374696f6e3a20494e56414c49445f5360448201526424a3a722a960d91b6064820152608401610df1565b60016126076126028761353f565b61359f565b6040805160008152602081018083529290925260ff851690820152606081018690526080810185905260a0016020604051602081039080840390855afa158015612655573d6000803e3d6000fd5b505050602060405103516001600160a01b0316866001600160a01b031614905095945050505050565b600061268a8284615365565b9392505050565b6001600160a01b0381166000908152600183016020526040812054151561268a565b60006126be826122f3565b60208101519091506001600160a01b031661270e5760405162461bcd60e51b815260206004820152601060248201526f546f6b656e206e6f742065786973747360801b6044820152606401610df1565b6001600160a01b038084166000818152610135602090815260408083208784529091529020600101549091161461277e5760405162461bcd60e51b81526020600482015260146024820152732ab9b2b91034b9903737903a34329037bbb732b960611b6044820152606401610df1565b61278a610132836135cf565b507fbcdbcc9e9af0823eefdc689e14cb0ba1dfdd1bbe3ece3f7736cdfaef81af007881426040516127bc929190615282565b60405180910390a160006127d084846135db565b90506000198114156128145760405162461bcd60e51b815260206004820152600d60248201526c09cde40e6eac6d040d2dcc8caf609b1b6044820152606401610df1565b6001600160a01b038416600090815261013460205260409020805461283b906001906153b0565b8154811061285957634e487b7160e01b600052603260045260246000fd5b90600052602060002001546101346000866001600160a01b03166001600160a01b0316815260200190815260200160002082815481106128a957634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101929092556001600160a01b0386168152610134909152604090208054806128ed57634e487b7160e01b600052603160045260246000fd5b6000828152602080822083016000199081018390559092019092556001600160a01b0390951681526101358552604080822094825293909452505081208181556001810180546001600160a81b031916905560028101829055600381018290556004810182905560058101805460ff1916905560060155565b600080612972836124c0565b9050806001600160a01b0316846001600160a01b0316148061299957506129998185612124565b806113505750836001600160a01b03166129b284610d55565b6001600160a01b031614949350505050565b6101a45460ff161515600114612a1c5760405162461bcd60e51b815260206004820152601d60248201527f43616e206e6f74207472616e7366657220617420746869732074696d650000006044820152606401610df1565b6000612a27826122f3565b9050612a3384836126b3565b612a3e848484613671565b6001600160a01b0383166020820152611f5281612ecf565b6060600061268a83613818565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c015b604051602081830303815290604052805190602001209050919050565b600080612afc84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525089939250506138729050565b90506001600160a01b038116612b4f5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610df1565b6101a45461010090046001600160a01b0390811691161490509392505050565b6000612b7a826122f3565b60c081015190915015612bc55760405162461bcd60e51b81526020600482015260136024820152724d65746143656c6c206973206f6e2073616c6560681b6044820152606401610df1565b612bcf33836126b3565b6110b282613896565b6000612be961019a80546001019055565b5061019a54612bf8828261393e565b60408051610100810182528281526001600160a01b0384166020820152600091810182815260200160008152602001600081526020016000815260200160001515815260200160008152509050612c4e81612ecf565b6101a254612c6890839033906001600160601b0316613a8d565b50919050565b610168546001600160a01b031633146117805760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610df1565b61016880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000612d2b83600001516122f3565b60208101519091506001600160a01b0316612d7b5760405162461bcd60e51b815260206004820152601060248201526f546f6b656e206e6f742065786973747360801b6044820152606401610df1565b7fa1894e8b9943c13ae3a44b3b6790518ca2b411cd94ba6017bb5e59d7cf61159b818442604051612dae93929190615256565b60405180910390a1506001600160a01b038181166000908152610135602090815260408083208651845282529182902085518155908501516001820180546001600160a01b03198116929095169182178155928601518694859491926001600160a81b031990911617600160a01b836005811115612e3c57634e487b7160e01b600052602160045260246000fd5b0217905550606082015160028201556080820151600382015560a0820151600482015560c082015160058201805460ff191691151591909117905560e090910151600690910155505050565b6101005460ff16156117805760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610df1565b8051600090612edd906122f3565b602001516001600160a01b031614612f2e5760405162461bcd60e51b8152602060048201526014602482015273546f6b656e20616c72656164792065786973747360601b6044820152606401610df1565b612f3e6101328260000151613b9b565b50602080820180516001600160a01b0390811660009081526101358452604080822086518352909452839020845181559151600183018054919092166001600160a01b03198216811783559385015185949092916001600160a81b03191617600160a01b836005811115612fc257634e487b7160e01b600052602160045260246000fd5b0217905550606082015160028201556080820151600382015560a0820151600482015560c082015160058201805460ff191691151591909117905560e0909101516006909101556020818101516001600160a01b0316600090815261013482526040808220845181546001810183559184529390922090910191909155517f53fb2fc76bb695860d4fc492a77118789d840cd5a06d4e513603dd0a3a9c0d4c906112af9083904290615282565b600054610100900460ff166130965760405162461bcd60e51b8152600401610df1906151ae565b6110b28282613ba7565b6113e581613bf5565b600054610100900460ff166130d05760405162461bcd60e51b8152600401610df1906151ae565b611780613c92565b600054610100900460ff166130ff5760405162461bcd60e51b8152600401610df1906151ae565b611780613cc1565b600054610100900460ff1661312e5760405162461bcd60e51b8152600401610df1906151ae565b611780613cf1565b6001600160a01b03811661318c5760405162461bcd60e51b815260206004820152601b60248201527f416464726573732073686f756c64206e6f7420626520656d70747900000000006044820152606401610df1565b61319760cc82612691565b156131d45760405162461bcd60e51b815260206004820152600d60248201526c105b1c9958591e481859191959609a1b6044820152606401610df1565b6131df60cc82612691565b6113e5576131ee60cc82613d25565b506040516001600160a01b03821681527fac6fa858e9350a46cec16539926e0fde25b7629f84b5a72bffaae4df888ae86d906020016112af565b816001600160a01b0316836001600160a01b0316141561328a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610df1565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61330260cc82612691565b61333a5760405162461bcd60e51b8152602060048201526009602482015268139bdd08195e1a5cdd60ba1b6044820152606401610df1565b61334560cc82612691565b156113e55761335560cc82613d3a565b506040516001600160a01b03821681527f80c0b871b97b595b16a7741c1b06fed0c6f6f558639f18ccbce50724325dc40d906020016112af565b606061268a838360405180606001604052806027815260200161556e60279139613d4f565b6133bf8484846129c4565b6133cb84848484613e2c565b611f525760405162461bcd60e51b8152600401610df1906150ce565b60608161340c57506040805180820190915260018152600360fc1b6020820152610c40565b8160005b811561343657806134208161543f565b915061342f9050600a8361537d565b9150613410565b60008167ffffffffffffffff81111561345f57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613489576020820181803683370190505b5090505b84156113505761349e6001836153b0565b91506134ab600a8661545a565b6134b6906030615365565b60f81b8183815181106134d957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506134fb600a8661537d565b945061348d565b60006001600160e01b0319821663780e9d6360e01b1480610c3d5750610c3d8261227e565b6000818152600183016020526040812054151561268a565b60006040518060800160405280604381526020016154dc6043913980516020918201208351848301516040808701518051908601209051612a9a950193845260208401929092526001600160a01b03166040830152606082015260800190565b60006135aa60c95490565b60405161190160f01b6020820152602281019190915260428101839052606201612a9a565b600061268a8383613f36565b6000805b6001600160a01b03841660009081526101346020526040902054811015613666576001600160a01b03841660009081526101346020526040902080548491908390811061363c57634e487b7160e01b600052603260045260246000fd5b90600052602060002001541415613654579050611239565b8061365e8161543f565b9150506135df565b506000199392505050565b826001600160a01b0316613684826124c0565b6001600160a01b0316146136e85760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610df1565b6001600160a01b03821661374a5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610df1565b613755838383614053565b613760600082612520565b6001600160a01b03831660009081526068602052604081208054600192906137899084906153b0565b90915550506001600160a01b03821660009081526068602052604081208054600192906137b7908490615365565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610e92565b606081600001805480602002602001604051908101604052809291908181526020018280548015610ca65760200282019190600052602060002090815481526020019060010190808311610c925750505050509050919050565b60008060006138818585614110565b9150915061388e81614153565b509392505050565b60006138a1826124c0565b90506138af81600084614053565b6138ba600083612520565b6001600160a01b03811660009081526068602052604081208054600192906138e39084906153b0565b909155505060008281526067602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a46110b2565b6001600160a01b0382166139945760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610df1565b6000818152606760205260409020546001600160a01b0316156139f95760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610df1565b613a0560008383614053565b6001600160a01b0382166000908152606860205260408120805460019290613a2e908490615365565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46110b2565b6127106001600160601b0382161115613afb5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610df1565b6001600160a01b038216613b515760405162461bcd60e51b815260206004820152601b60248201527f455243323938313a20496e76616c696420706172616d657465727300000000006044820152606401610df1565b6040805180820182526001600160a01b0393841681526001600160601b039283166020808301918252600096875260cf90529190942093519051909116600160a01b029116179055565b600061268a8383614351565b600054610100900460ff16613bce5760405162461bcd60e51b8152600401610df1906151ae565b8151613be19060659060208501906146c7565b508051610e929060669060208401906146c7565b6040518060800160405280604f815260200161551f604f9139805160209182012082518383012060408051808201825260018152603160f81b90850152805193840192909252908201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201523060808201524660a082015260c00160408051601f19818403018152919052805160209091012060c95550565b600054610100900460ff16613cb95760405162461bcd60e51b8152600401610df1906151ae565b600161013655565b600054610100900460ff16613ce85760405162461bcd60e51b8152600401610df1906151ae565b61178033612cc9565b600054610100900460ff16613d185760405162461bcd60e51b8152600401610df1906151ae565b610100805460ff19169055565b600061268a836001600160a01b038416614351565b600061268a836001600160a01b038416613f36565b60606001600160a01b0384163b613db75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610df1565b600080856001600160a01b031685604051613dd29190614e4c565b600060405180830381855af49150503d8060008114613e0d576040519150601f19603f3d011682016040523d82523d6000602084013e613e12565b606091505b5091509150613e228282866143a0565b9695505050505050565b60006001600160a01b0384163b15613f2e57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290613e70903390899088908890600401614f80565b602060405180830381600087803b158015613e8a57600080fd5b505af1925050508015613eba575060408051601f3d908101601f19168201909252613eb791810190614bb0565b60015b613f14573d808015613ee8576040519150601f19603f3d011682016040523d82523d6000602084013e613eed565b606091505b508051613f0c5760405162461bcd60e51b8152600401610df1906150ce565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611350565b506001611350565b60008181526001830160205260408120548015614049576000613f5a6001836153b0565b8554909150600090613f6e906001906153b0565b9050818114613fef576000866000018281548110613f9c57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080876000018481548110613fcd57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061400e57634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611239565b6000915050611239565b6001600160a01b0383166140ae576140a981609980546000838152609a60205260408120829055600182018355919091527f72a152ddfb8e864297c917af52ea6c1c68aead0fee1a62673fcc7e0c94979d000155565b6140d1565b816001600160a01b0316836001600160a01b0316146140d1576140d183826143d9565b6001600160a01b0382166140ed576140e881614476565b610e92565b826001600160a01b0316826001600160a01b031614610e9257610e92828261454f565b6000808251604114156141475760208301516040840151606085015160001a61413b87828585614593565b9450945050505061119f565b5060009050600261119f565b600081600481111561417557634e487b7160e01b600052602160045260246000fd5b1415614180576113e5565b60018160048111156141a257634e487b7160e01b600052602160045260246000fd5b14156141eb5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610df1565b600281600481111561420d57634e487b7160e01b600052602160045260246000fd5b141561425b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610df1565b600381600481111561427d57634e487b7160e01b600052602160045260246000fd5b14156142d65760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610df1565b60048160048111156142f857634e487b7160e01b600052602160045260246000fd5b14156113e55760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610df1565b600081815260018301602052604081205461439857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611239565b506000611239565b606083156143af57508161268a565b8251156143bf5782518084602001fd5b8160405162461bcd60e51b8152600401610df19190615099565b600060016143e6846116e8565b6143f091906153b0565b600083815260986020526040902054909150808214614443576001600160a01b03841660009081526097602090815260408083208584528252808320548484528184208190558352609890915290208190555b5060009182526098602090815260408084208490556001600160a01b039094168352609781528383209183525290812055565b609954600090614488906001906153b0565b6000838152609a6020526040812054609980549394509092849081106144be57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905080609983815481106144ed57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255828152609a9091526040808220849055858252812055609980548061453357634e487b7160e01b600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b600061455a836116e8565b6001600160a01b039093166000908152609760209081526040808320868452825280832085905593825260989052919091209190915550565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156145ca5750600090506003614677565b8460ff16601b141580156145e257508460ff16601c14155b156145f35750600090506004614677565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614647573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661467057600060019250925050614677565b9150600090505b94509492505050565b604080516101008101825260008082526020820181905290918201908152602001600081526020016000815260200160008152602001600015158152602001600081525090565b8280546146d39061540a565b90600052602060002090601f0160209004810192826146f5576000855561473b565b82601f1061470e57805160ff191683800117855561473b565b8280016001018555821561473b579182015b8281111561473b578251825591602001919060010190614720565b5061474792915061474b565b5090565b5b80821115614747576000815560010161474c565b80358015158114610c4057600080fd5b600082601f830112614780578081fd5b813567ffffffffffffffff81111561479a5761479a61549a565b6147ad601f8201601f1916602001615334565b8181528460208386010111156147c1578283fd5b816020850160208301379081016020019190915292915050565b60006101008083850312156147ee578182fd5b6147f781615334565b91505081358152602082013561480c816154b0565b602082015260408201356006811061482357600080fd5b80604083015250606082013560608201526080820135608082015260a082013560a082015261485460c08301614760565b60c082015260e082013560e082015292915050565b60006020828403121561487a578081fd5b813561268a816154b0565b60008060408385031215614897578081fd5b82356148a2816154b0565b915060208301356148b2816154b0565b809150509250929050565b6000806000606084860312156148d1578081fd5b83356148dc816154b0565b925060208401356148ec816154b0565b929592945050506040919091013590565b60008060008060808587031215614912578081fd5b843561491d816154b0565b9350602085013561492d816154b0565b925060408501359150606085013567ffffffffffffffff81111561494f578182fd5b61495b87828801614770565b91505092959194509250565b60008060408385031215614979578182fd5b8235614984816154b0565b915061499260208401614760565b90509250929050565b600080600080600060a086880312156149b2578081fd5b85356149bd816154b0565b97602087013597506040870135966060810135965060800135945092505050565b600080600080606085870312156149f3578182fd5b84356149fe816154b0565b9350602085013567ffffffffffffffff80821115614a1a578384fd5b818701915087601f830112614a2d578384fd5b813581811115614a3b578485fd5b886020828501011115614a4c578485fd5b95986020929092019750949560400135945092505050565b600080600080600060a08688031215614a7b578283fd5b8535614a86816154b0565b9450602086013567ffffffffffffffff811115614aa1578384fd5b614aad88828901614770565b9450506040860135925060608601359150608086013560ff81168114614ad1578182fd5b809150509295509295909350565b60008060408385031215614af1578182fd5b8235614afc816154b0565b946020939093013593505050565b60008060208385031215614b1c578182fd5b823567ffffffffffffffff80821115614b33578384fd5b818501915085601f830112614b46578384fd5b813581811115614b54578485fd5b8660208260051b8501011115614b68578485fd5b60209290920196919550909350505050565b600060208284031215614b8b578081fd5b61268a82614760565b600060208284031215614ba5578081fd5b813561268a816154c5565b600060208284031215614bc1578081fd5b815161268a816154c5565b600060208284031215614bdd578081fd5b813567ffffffffffffffff811115614bf3578182fd5b61135084828501614770565b600060208284031215614c10578081fd5b815161268a816154b0565b60008060008060808587031215614c30578182fd5b843567ffffffffffffffff80821115614c47578384fd5b614c5388838901614770565b95506020870135915080821115614c68578384fd5b50614c7587828801614770565b9350506040850135614c86816154b0565b91506060850135614c96816154b0565b939692955090935050565b60006101008284031215614cb3578081fd5b61268a83836147db565b6000806101208385031215614cd0578182fd5b614cda84846147db565b91506101008301356148b2816154b0565b600060208284031215614cfc578081fd5b5035919050565b60008060408385031215614d15578182fd5b8235915060208301356148b2816154b0565b60008060408385031215614d39578182fd5b50508035926020909101359150565b600060208284031215614d59578081fd5b81356001600160601b038116811461268a578182fd5b60008151808452614d878160208601602086016153c7565b601f01601f19169290920160200192915050565b60008151614dad8185602086016153c7565b9290920192915050565b60068110614dd557634e487b7160e01b600052602160045260246000fd5b9052565b805182526020808201516001600160a01b03169083015260408082015190614e0390840182614db7565b50606081015160608301526080810151608083015260a081015160a083015260c0810151151560c083015260e081015160e08301525050565b6000828483379101908152919050565b60008251614e5e8184602087016153c7565b9190910192915050565b60008351614e7a8184602088016153c7565b60609390931b6001600160601b0319169190920190815260140192915050565b600080845482600182811c915080831680614eb657607f831692505b6020808410821415614ed657634e487b7160e01b87526022600452602487fd5b818015614eea5760018114614efb57614f27565b60ff19861689528489019650614f27565b60008b815260209020885b86811015614f1f5781548b820152908501908301614f06565b505084890196505b505050505050614f4b614f3a8286614d9b565b64173539b7b760d91b815260050190565b95945050505050565b6001600160a01b03848116825283166020820152606060408201819052600090614f4b90830184614d6f565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613e2290830184614d6f565b6020808252825182820181905260009190848201906040850190845b81811015614ff45783516001600160a01b031683529284019291840191600101614fcf565b50909695505050505050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b8281101561505457603f19888603018452615042858351614d6f565b94509285019290850190600101615026565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015614ff45783518352928401929184019160010161507d565b60006020825261268a6020830184614d6f565b6000604082526150bf6040830185614d6f565b90508260208301529392505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526017908201527f4d7573742063616c6c2066726f6d2054696d656c6f636b000000000000000000604082015260600190565b6020808252600d908201526c456d707479206164647265737360981b604082015260600190565b602080825260169082015275596f7520646f206e6f7420686176652072696768747360501b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b61010081016112398284614dd9565b61022081016152658286614dd9565b615273610100830185614dd9565b82610200830152949350505050565b61012081016152918285614dd9565b826101008301529392505050565b8881526001600160a01b038816602082015261010081016152c36040830189614db7565b6060820196909652608081019490945260a0840192909252151560c083015260e0909101529392505050565b6000808335601e19843603018112615305578283fd5b83018035915067ffffffffffffffff82111561531f578283fd5b60200191503681900382131561119f57600080fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561535d5761535d61549a565b604052919050565b600082198211156153785761537861546e565b500190565b60008261538c5761538c615484565b500490565b60008160001904831182151516156153ab576153ab61546e565b500290565b6000828210156153c2576153c261546e565b500390565b60005b838110156153e25781810151838201526020016153ca565b83811115611f525750506000910152565b6000816154025761540261546e565b506000190190565b600181811c9082168061541e57607f821691505b60208210811415612c6857634e487b7160e01b600052602260045260246000fd5b60006000198214156154535761545361546e565b5060010190565b60008261546957615469615484565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146113e557600080fd5b6001600160e01b0319811681146113e557600080fdfe4d6574615472616e73616374696f6e2875696e74323536206e6f6e63652c616464726573732066726f6d2c62797465732066756e6374696f6e5369676e617475726529454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c6164647265737320766572696679696e67436f6e74726163742c627974657333322073616c7429416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012f38ecbb0a9db0b70f74aeaba300131f849d1e9b4f2b669331281d5f70ec2a464736f6c63430008030033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.