Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 1,192 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Set Approval For... | 21250574 | 9 days ago | IN | 0 ETH | 0.00071734 | ||||
Safe Transfer Fr... | 20873289 | 62 days ago | IN | 0 ETH | 0.00087902 | ||||
Safe Transfer Fr... | 20858234 | 64 days ago | IN | 0 ETH | 0.00082462 | ||||
Set Approval For... | 20846589 | 65 days ago | IN | 0 ETH | 0.00034815 | ||||
Set Approval For... | 20829990 | 68 days ago | IN | 0 ETH | 0.00136447 | ||||
Set Approval For... | 20729606 | 82 days ago | IN | 0 ETH | 0.000681 | ||||
Set Approval For... | 20399502 | 128 days ago | IN | 0 ETH | 0.00009713 | ||||
Set Approval For... | 20262291 | 147 days ago | IN | 0 ETH | 0.00028289 | ||||
Safe Transfer Fr... | 19992174 | 185 days ago | IN | 0 ETH | 0.00062997 | ||||
Set Approval For... | 19927113 | 194 days ago | IN | 0 ETH | 0.00118973 | ||||
Set Approval For... | 19820490 | 209 days ago | IN | 0 ETH | 0.00024759 | ||||
Set Approval For... | 19777886 | 215 days ago | IN | 0 ETH | 0.00031521 | ||||
Set Approval For... | 19742862 | 219 days ago | IN | 0 ETH | 0.00026063 | ||||
Set Approval For... | 19395678 | 268 days ago | IN | 0 ETH | 0.002148 | ||||
Set Approval For... | 19366014 | 272 days ago | IN | 0 ETH | 0.00367877 | ||||
Set Approval For... | 19340330 | 276 days ago | IN | 0 ETH | 0.0022682 | ||||
Set Approval For... | 19229324 | 291 days ago | IN | 0 ETH | 0.00048004 | ||||
Set Approval For... | 18989416 | 325 days ago | IN | 0 ETH | 0.00097652 | ||||
Safe Transfer Fr... | 18930160 | 333 days ago | IN | 0 ETH | 0.00329701 | ||||
Set Approval For... | 18920539 | 335 days ago | IN | 0 ETH | 0.00128319 | ||||
Safe Transfer Fr... | 18919130 | 335 days ago | IN | 0 ETH | 0.00078134 | ||||
Safe Transfer Fr... | 18904250 | 337 days ago | IN | 0 ETH | 0.00084924 | ||||
Safe Transfer Fr... | 18903467 | 337 days ago | IN | 0 ETH | 0.00054294 | ||||
Set Approval For... | 18895821 | 338 days ago | IN | 0 ETH | 0.00078338 | ||||
Safe Transfer Fr... | 18895732 | 338 days ago | IN | 0 ETH | 0.0009277 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
TerrapinGenesis
Compiler Version
v0.8.9+commit.e5eed63a
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT /* ************************************************************************************************************************ * * * ___________ .__ ________ .__ * * \__ ___/____ _______ _______ _____ ______ |__| ____ / _____/ ____ ____ ____ ______|__| ______ * * | | _/ __ \\_ __ \\_ __ \\__ \ \____ \ | | / \ / \ ___ _/ __ \ / \ _/ __ \ / ___/| | / ___/ * * | | \ ___/ | | \/ | | \/ / __ \_| |_> >| || | \ \ \_\ \\ ___/ | | \\ ___/ \___ \ | | \___ \ * * |____| \___ >|__| |__| (____ /| __/ |__||___| / \______ / \___ >|___| / \___ >/____ >|__|/____ > * * \/ \/ |__| \/ \/ \/ \/ \/ \/ \/ * * * ************************************************************************************************************************ */ pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "erc721a/contracts/extensions/ERC721AQueryable.sol"; error MintNotActive(); error MaxSupplyExceeded(); error InvalidSignature(); error AccountPreviouslyMinted(); error InvalidValue(); error ValueUnchanged(); contract OSOwnableDelegateProxy {} contract OSProxyRegistry { mapping(address => OSOwnableDelegateProxy) public proxies; } /** * @title Terrapin Genesis * * @notice ERC-721 NFT Token Contract. * * @author 0x1687572416fdd591bcc710fa07cee94a76eea201681884b1d5cc528cba584815 */ contract TerrapinGenesis is Ownable, AccessControl, EIP712, ERC721AQueryable { using Address for address payable; using ECDSA for bytes32; bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE"); bytes32 public constant MINT_SIGNER_ROLE = keccak256("MINT_SIGNER_ROLE"); bytes32 public constant WHITELIST_TYPEHASH = keccak256("Whitelist(address account)"); uint256 public constant maxSupply = 333; bool public mintActive; string public baseURI; OSProxyRegistry internal _osProxyRegistry; event MintActiveUpdated(bool mintActive); event BaseURIUpdated(string oldBaseURI, string baseURI); constructor( string memory baseURI_, address osProxyRegistryAddress, address[] memory operators, address[] memory mintSigners ) EIP712("TerrapinGenesis", "1") ERC721A("TerrapinGenesis", "TG") { baseURI = baseURI_; _osProxyRegistry = OSProxyRegistry(osProxyRegistryAddress); _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); for (uint256 index = 0; index < operators.length; ++index) { _grantRole(OPERATOR_ROLE, operators[index]); } for (uint256 index = 0; index < mintSigners.length; ++index) { _grantRole(MINT_SIGNER_ROLE, mintSigners[index]); } } /** * @dev Mint function, only whitelisted accounts allowed. With a valid * signature from an account with a MINT_SIGNER_ROLE role, accounts may mint * up to 1 token. */ function mint(bytes calldata sig) external { if (mintActive != true) revert MintNotActive(); if (numberMinted(_msgSender()) > 0) revert AccountPreviouslyMinted(); if ((_totalMinted() + 1) > maxSupply) revert MaxSupplyExceeded(); bytes32 digest = _hashTypedDataV4( keccak256(abi.encode(WHITELIST_TYPEHASH, _msgSender())) ); address signer = ECDSA.recover(digest, sig); if (hasRole(MINT_SIGNER_ROLE, signer) != true) revert InvalidSignature(); _safeMint(_msgSender(), 1); } /** * @dev Special Mint function. For miscellaneous purposes, e.g. raffles. */ function mintSpecial(address[] calldata addresses) external onlyRole(OPERATOR_ROLE) { if (_totalMinted() + addresses.length > maxSupply) revert MaxSupplyExceeded(); for (uint256 index = 0; index < addresses.length; ++index) { _safeMint(addresses[index], 1); } } /** * @dev Reserve Mint function. */ function mintReserve(address to, uint256 quantity) external onlyRole(OPERATOR_ROLE) { if (_totalMinted() + quantity > maxSupply) revert MaxSupplyExceeded(); _safeMint(to, quantity); } function setMintActive(bool mintActive_) external onlyRole(OPERATOR_ROLE) { if (mintActive == mintActive_) revert ValueUnchanged(); mintActive = mintActive_; emit MintActiveUpdated(mintActive); } function setBaseURI(string memory baseURI_) external onlyRole(OPERATOR_ROLE) { if ( keccak256(abi.encodePacked(baseURI_)) == keccak256(abi.encodePacked(_baseURI())) ) revert ValueUnchanged(); string memory oldBaseURI = _baseURI(); baseURI = baseURI_; emit BaseURIUpdated(oldBaseURI, baseURI_); } function withdraw() external onlyRole(DEFAULT_ADMIN_ROLE) { payable(_msgSender()).sendValue(address(this).balance); } /** * @dev Number of tokens minted. */ function totalMinted() external view returns (uint256) { return _totalMinted(); } /** * @dev Returns number of tokens `account` has minted. */ function numberMinted(address account) public view returns (uint256) { return _numberMinted(account); } function isApprovedForAll(address owner_, address operator) public view override returns (bool) { if (super.isApprovedForAll(owner_, operator)) { return true; } if ( address(_osProxyRegistry) != address(0) && address(_osProxyRegistry.proxies(owner_)) == operator ) { return true; } return false; } function supportsInterface(bytes4 interfaceId) public view override(AccessControl, ERC721A) returns (bool) { return ERC721A.supportsInterface(interfaceId) || AccessControl.supportsInterface(interfaceId); } function _baseURI() internal view override returns (string memory) { return baseURI; } function _startTokenId() internal pure override returns (uint256) { return 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/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) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ 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. 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 if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } 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; uint8 v; assembly { s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 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 v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.0.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev ERC721 token receiver interface. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Mask of an entry in packed address data. uint256 private constant BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant BITMASK_NEXT_INITIALIZED = 1 << 225; // The tokenId of the next token to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See `_packedOwnershipOf` implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // 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; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see `_totalMinted`. */ function totalSupply() public view override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { // Counter underflow is impossible as _currentIndex does not decrement, // and it is initialized to `_startTokenId()` unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view returns (uint256) { return _burnCounter; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes of the XOR of // all function selectors in the interface. See: https://eips.ethereum.org/EIPS/eip-165 // e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)` return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> BITPOS_NUMBER_MINTED) & BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> BITPOS_NUMBER_BURNED) & BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> BITPOS_AUX); } /** * Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; assembly { // Cast aux without masking. auxCasted := aux } packed = (packed & BITMASK_AUX_COMPLEMENT) | (auxCasted << BITPOS_AUX); _packedAddressData[owner] = packed; } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & BITMASK_BURNED == 0) { // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. // // We can directly compare the packed value. // If the address is zero, packed is zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> BITPOS_START_TIMESTAMP); ownership.burned = packed & BITMASK_BURNED != 0; } /** * Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @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) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } /** * @dev Casts the address to uint256 without masking. */ function _addressToUint256(address value) private pure returns (uint256 result) { assembly { result := value } } /** * @dev Casts the boolean to uint256 without branching. */ function _boolToUint256(bool value) private pure returns (uint256 result) { assembly { result := value } } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public override { address owner = address(uint160(_packedOwnershipOf(tokenId))); if (to == owner) revert ApprovalToCurrentOwner(); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { if (operator == _msgSenderERC721A()) revert ApproveToCaller(); _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), 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 { _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 { _transfer(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @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`), */ function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & BITMASK_BURNED == 0; // and not burned. } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ''); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the balance and number minted. _packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _addressToUint256(to) | (block.timestamp << BITPOS_START_TIMESTAMP) | (_boolToUint256(quantity == 1) << BITPOS_NEXT_INITIALIZED); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; if (to.code.length != 0) { do { emit Transfer(address(0), to, updatedIndex); if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (updatedIndex < end); // Reentrancy protection if (_currentIndex != startTokenId) revert(); } else { do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex < end); } _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _mint(address to, uint256 quantity) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the balance and number minted. _packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _addressToUint256(to) | (block.timestamp << BITPOS_START_TIMESTAMP) | (_boolToUint256(quantity == 1) << BITPOS_NEXT_INITIALIZED); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex < end); _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * 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 ) private { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); bool isApprovedOrOwner = (_msgSenderERC721A() == from || isApprovedForAll(from, _msgSenderERC721A()) || getApproved(tokenId) == _msgSenderERC721A()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. delete _tokenApprovals[tokenId]; // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _addressToUint256(to) | (block.timestamp << BITPOS_START_TIMESTAMP) | BITMASK_NEXT_INITIALIZED; // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); if (approvalCheck) { bool isApprovedOrOwner = (_msgSenderERC721A() == from || isApprovedForAll(from, _msgSenderERC721A()) || getApproved(tokenId) == _msgSenderERC721A()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. delete _tokenApprovals[tokenId]; // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _addressToUint256(from) | (block.timestamp << BITPOS_START_TIMESTAMP) | BITMASK_BURNED | BITMASK_NEXT_INITIALIZED; // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target 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 _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * And also called before burning one token. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * 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, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * And also called after one token has been burned. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function _toString(uint256 value) internal pure returns (string memory ptr) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), // but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged. // We will need 1 32-byte word to store the length, // and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 3 * 32 = 128. ptr := add(mload(0x40), 128) // Update the free memory pointer to allocate. mstore(0x40, ptr) // Cache the end of the memory to calculate the length later. let end := ptr // We write the string from the rightmost digit to the leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // Costs a bit more than early returning for the zero case, // but cheaper in terms of deployment and overall runtime costs. for { // Initialize and perform the first pass without check. let temp := value // Move the pointer 1 byte leftwards to point to an empty character slot. ptr := sub(ptr, 1) // Write the character to the pointer. 48 is the ASCII index of '0'. mstore8(ptr, add(48, mod(temp, 10))) temp := div(temp, 10) } temp { // Keep dividing `temp` until zero. temp := div(temp, 10) } { // Body of the for loop. ptr := sub(ptr, 1) mstore8(ptr, add(48, mod(temp, 10))) } let length := sub(end, ptr) // Move the pointer 32 bytes leftwards to make room for the length. ptr := sub(ptr, 32) // Store the length. mstore(ptr, length) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.0.0 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of an ERC721A compliant contract. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * The caller cannot approve to their own address. */ error ApproveToCaller(); /** * The caller cannot approve to the current owner. */ error ApprovalToCurrentOwner(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; } /** * @dev Returns the total amount of tokens stored by the contract. * * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens. */ function totalSupply() external view returns (uint256); // ============================== // IERC165 // ============================== /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================== // IERC721 // ============================== /** * @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 be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev 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); // ============================== // IERC721Metadata // ============================== /** * @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 // ERC721A Contracts v4.0.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AQueryable.sol'; import '../ERC721A.sol'; /** * @title ERC721A Queryable * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable { /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * - `addr` = `address(0)` * - `startTimestamp` = `0` * - `burned` = `false` * * If the `tokenId` is burned: * - `addr` = `<Address of owner before token was burned>` * - `startTimestamp` = `<Timestamp when token was burned>` * - `burned = `true` * * Otherwise: * - `addr` = `<Address of owner>` * - `startTimestamp` = `<Timestamp of start of ownership>` * - `burned = `false` */ function explicitOwnershipOf(uint256 tokenId) public view override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; } ownership = _ownershipAt(tokenId); if (ownership.burned) { return ownership; } return _ownershipOf(tokenId); } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view override returns (TokenOwnership[] memory) { unchecked { uint256 tokenIdsLength = tokenIds.length; TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength); for (uint256 i; i != tokenIdsLength; ++i) { ownerships[i] = explicitOwnershipOf(tokenIds[i]); } return ownerships; } } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start` < `stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view override returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); uint256 tokenIdsIdx; uint256 stopLimit = _nextTokenId(); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, stopLimit)`. if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`, // to cater for cases where `balanceOf(owner)` is too big. if (start < stop) { uint256 rangeLength = stop - start; if (rangeLength < tokenIdsMaxLength) { tokenIdsMaxLength = rangeLength; } } else { tokenIdsMaxLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength); if (tokenIdsMaxLength == 0) { return tokenIds; } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`. // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range. if (!ownership.burned) { currOwnershipAddr = ownership.addr; } for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } // Downsize the array to fit. assembly { mstore(tokenIds, tokenIdsIdx) } return tokenIds; } } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(totalSupply) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K pfp collections should be fine). */ function tokensOfOwner(address owner) external view override returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; address currOwnershipAddr; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); TokenOwnership memory ownership; for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } return tokenIds; } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.0.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of an ERC721AQueryable compliant contract. */ interface IERC721AQueryable is IERC721A { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * - `addr` = `address(0)` * - `startTimestamp` = `0` * - `burned` = `false` * * If the `tokenId` is burned: * - `addr` = `<Address of owner before token was burned>` * - `startTimestamp` = `<Timestamp when token was burned>` * - `burned = `true` * * Otherwise: * - `addr` = `<Address of owner>` * - `startTimestamp` = `<Timestamp of start of ownership>` * - `burned = `false` */ function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory); /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory); /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start` < `stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view returns (uint256[] memory); /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(totalSupply) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K pfp collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"},{"internalType":"address","name":"osProxyRegistryAddress","type":"address"},{"internalType":"address[]","name":"operators","type":"address[]"},{"internalType":"address[]","name":"mintSigners","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccountPreviouslyMinted","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MintNotActive","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ValueUnchanged","type":"error"},{"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":"string","name":"oldBaseURI","type":"string"},{"indexed":false,"internalType":"string","name":"baseURI","type":"string"}],"name":"BaseURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"mintActive","type":"bool"}],"name":"MintActiveUpdated","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":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","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"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_SIGNER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WHITELIST_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"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":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"sig","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mintReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"name":"mintSpecial","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"numberMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","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":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"mintActive_","type":"bool"}],"name":"setMintActive","outputs":[],"stateMutability":"nonpayable","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":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101406040523480156200001257600080fd5b50604051620034cf380380620034cf83398101604081905262000035916200052b565b6040518060400160405280600f81526020016e546572726170696e47656e6573697360881b81525060405180604001604052806002815260200161544760f01b8152506040518060400160405280600f81526020016e546572726170696e47656e6573697360881b815250604051806040016040528060018152602001603160f81b815250620000d4620000ce620002b160201b60201c565b620002b5565b815160208084019190912082518383012060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81880181905281830187905260608201869052608082019490945230818401528151808203909301835260c00190528051940193909320919290916080523060c05261012052505083516200017a92506004915060208501906200038e565b508051620001909060059060208401906200038e565b50600160025550508351620001ad90600b9060208701906200038e565b50600c80546001600160a01b0319166001600160a01b038516179055620001dd6000620001d73390565b62000305565b60005b82518110156200024b57620002387f97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b9298483815181106200022457620002246200064a565b60200260200101516200030560201b60201c565b620002438162000660565b9050620001e0565b5060005b8151811015620002a657620002937fa935ad49455f7e8f11eb0a0d7865a0ce5ae2dcc1e65d3e41227a702e4e398a0c8383815181106200022457620002246200064a565b6200029e8162000660565b90506200024f565b5050505050620006c7565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff166200038a5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45b5050565b8280546200039c906200068a565b90600052602060002090601f016020900481019282620003c057600085556200040b565b82601f10620003db57805160ff19168380011785556200040b565b828001600101855582156200040b579182015b828111156200040b578251825591602001919060010190620003ee565b50620004199291506200041d565b5090565b5b808211156200041957600081556001016200041e565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171562000475576200047562000434565b604052919050565b80516001600160a01b03811681146200049557600080fd5b919050565b600082601f830112620004ac57600080fd5b815160206001600160401b03821115620004ca57620004ca62000434565b8160051b620004db8282016200044a565b9283528481018201928281019087851115620004f657600080fd5b83870192505b84831015620005205762000510836200047d565b82529183019190830190620004fc565b979650505050505050565b600080600080608085870312156200054257600080fd5b84516001600160401b03808211156200055a57600080fd5b818701915087601f8301126200056f57600080fd5b81518181111562000584576200058462000434565b60206200059a601f8301601f191682016200044a565b8281528a82848701011115620005af57600080fd5b60005b83811015620005cf578581018301518282018401528201620005b2565b83811115620005e15760008385840101525b509750620005f18982016200047d565b9650505060408701519150808211156200060a57600080fd5b62000618888389016200049a565b935060608701519150808211156200062f57600080fd5b506200063e878288016200049a565b91505092959194509250565b634e487b7160e01b600052603260045260246000fd5b60006000198214156200068357634e487b7160e01b600052601160045260246000fd5b5060010190565b600181811c908216806200069f57607f821691505b60208210811415620006c157634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e0516101005161012051612db862000717600039600061205f015260006120ae0152600061208901526000611fe20152600061200c015260006120360152612db86000f3fe608060405234801561001057600080fd5b50600436106102535760003560e01c8063715018a611610146578063a2309ff8116100c3578063d5abeb0111610087578063d5abeb011461053f578063dc33e68114610548578063e985e9c51461055b578063ee1cc9441461056e578063f2fde38b14610581578063f5b541a61461059457600080fd5b8063a2309ff8146104de578063b88d4fde146104e6578063c23dc68f146104f9578063c87b56dd14610519578063d547741f1461052c57600080fd5b806391d148541161010a57806391d148541461049557806395d89b41146104a857806399a2557a146104b0578063a217fddf146104c3578063a22cb465146104cb57600080fd5b8063715018a6146104365780637ba0e2e71461043e5780638462151c146104515780638da5cb5b146104715780638e825be01461048257600080fd5b806336568abe116101d45780635bbb2177116101985780635bbb2177146103c15780636301dccf146103e15780636352211e146104085780636c0360eb1461041b57806370a082311461042357600080fd5b806336568abe14610359578063390dad5f1461036c5780633ccfd60b1461039357806342842e0e1461039b57806355f804b3146103ae57600080fd5b806318160ddd1161021b57806318160ddd146102e857806323b872dd14610302578063248a9ca31461031557806325fd90f3146103395780632f2ff15d1461034657600080fd5b8063014b0c8a1461025857806301ffc9a71461026d57806306fdde0314610295578063081812fc146102aa578063095ea7b3146102d5575b600080fd5b61026b610266366004612516565b6105a9565b005b61028061027b3660046125a0565b61064e565b60405190151581526020015b60405180910390f35b61029d61066e565b60405161028c9190612615565b6102bd6102b8366004612628565b610700565b6040516001600160a01b03909116815260200161028c565b61026b6102e3366004612656565b610744565b60035460025403600019015b60405190815260200161028c565b61026b610310366004612682565b610817565b6102f4610323366004612628565b6000908152600160208190526040909120015490565b600a546102809060ff1681565b61026b6103543660046126c3565b610827565b61026b6103673660046126c3565b61084e565b6102f47fa935ad49455f7e8f11eb0a0d7865a0ce5ae2dcc1e65d3e41227a702e4e398a0c81565b61026b6108d1565b61026b6103a9366004612682565b6108ea565b61026b6103bc366004612790565b610905565b6103d46103cf3660046127d8565b6109f1565b60405161028c919061287d565b6102f47fe74c04bdb85741f90efadc0228949f2b97fc0c6a16334216c9bd13273891142b81565b6102bd610416366004612628565b610ab7565b61029d610ac2565b6102f46104313660046128e7565b610b50565b61026b610b9e565b61026b61044c366004612904565b610c04565b61046461045f3660046128e7565b610d82565b60405161028c9190612963565b6000546001600160a01b03166102bd565b61026b610490366004612656565b610e8a565b6102806104a33660046126c3565b610ee7565b61029d610f12565b6104646104be36600461299b565b610f21565b6102f4600081565b61026b6104d93660046129e5565b6110ac565b6102f4611142565b61026b6104f4366004612a1a565b611156565b61050c610507366004612628565b61119a565b60405161028c9190612a99565b61029d610527366004612628565b61120f565b61026b61053a3660046126c3565b611293565b6102f461014d81565b6102f46105563660046128e7565b6112ba565b610280610569366004612ace565b6112e4565b61026b61057c366004612afc565b6113d1565b61026b61058f3660046128e7565b611462565b6102f4600080516020612d6383398151915281565b600080516020612d638339815191526105c2813361152a565b61014d826105d36002546000190190565b6105dd9190612b2d565b11156105fc57604051638a164f6360e01b815260040160405180910390fd5b60005b828110156106485761063884848381811061061c5761061c612b45565b905060200201602081019061063191906128e7565b600161158e565b61064181612b5b565b90506105ff565b50505050565b6000610659826115a8565b806106685750610668826115f6565b92915050565b60606004805461067d90612b76565b80601f01602080910402602001604051908101604052809291908181526020018280546106a990612b76565b80156106f65780601f106106cb576101008083540402835291602001916106f6565b820191906000526020600020905b8154815290600101906020018083116106d957829003601f168201915b5050505050905090565b600061070b8261162b565b610728576040516333d1c03960e21b815260040160405180910390fd5b506000908152600860205260409020546001600160a01b031690565b600061074f82611660565b9050806001600160a01b0316836001600160a01b031614156107845760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b038216146107bb5761079e81336112e4565b6107bb576040516367d9dca160e11b815260040160405180910390fd5b60008281526008602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6108228383836116c9565b505050565b60008281526001602081905260409091200154610844813361152a565b610822838361186c565b6001600160a01b03811633146108c35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108cd82826118d7565b5050565b60006108dd813361152a565b6108e7334761193e565b50565b61082283838360405180602001604052806000815250611156565b600080516020612d6383398151915261091e813361152a565b610926611a57565b6040516020016109369190612bb1565b604051602081830303815290604052805190602001208260405160200161095d9190612bb1565b6040516020818303038152906040528051906020012014156109925760405163df82d43b60e01b815260040160405180910390fd5b600061099c611a57565b83519091506109b290600b90602086019061247d565b507f309b29ded109b9e28fb9885757b3e0096eb75c51d23aa4635d68bcd569f6adc181846040516109e4929190612bcd565b60405180910390a1505050565b80516060906000816001600160401b03811115610a1057610a106126f3565b604051908082528060200260200182016040528015610a5b57816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181610a2e5790505b50905060005b828114610aaf57610a8a858281518110610a7d57610a7d612b45565b602002602001015161119a565b828281518110610a9c57610a9c612b45565b6020908102919091010152600101610a61565b509392505050565b600061066882611660565b600b8054610acf90612b76565b80601f0160208091040260200160405190810160405280929190818152602001828054610afb90612b76565b8015610b485780601f10610b1d57610100808354040283529160200191610b48565b820191906000526020600020905b815481529060010190602001808311610b2b57829003601f168201915b505050505081565b60006001600160a01b038216610b79576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600760205260409020546001600160401b031690565b6000546001600160a01b03163314610bf85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108ba565b610c026000611a66565b565b600a5460ff161515600114610c2c5760405163914edb0f60e01b815260040160405180910390fd5b6000610c37336112ba565b1115610c5657604051630de2dc9360e41b815260040160405180910390fd5b61014d610c666002546000190190565b610c71906001612b2d565b1115610c9057604051638a164f6360e01b815260040160405180910390fd5b604080517fe74c04bdb85741f90efadc0228949f2b97fc0c6a16334216c9bd13273891142b60208201523391810191909152600090610ce79060600160405160208183030381529060405280519060200120611ab6565b90506000610d2b8285858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611b0492505050565b9050610d577fa935ad49455f7e8f11eb0a0d7865a0ce5ae2dcc1e65d3e41227a702e4e398a0c82610ee7565b1515600114610d7957604051638baa579f60e01b815260040160405180910390fd5b61064833610631565b60606000806000610d9285610b50565b90506000816001600160401b03811115610dae57610dae6126f3565b604051908082528060200260200182016040528015610dd7578160200160208202803683370190505b509050610dfd604080516060810182526000808252602082018190529181019190915290565b60015b838614610e7e57610e1081611b20565b9150816040015115610e2157610e76565b81516001600160a01b031615610e3657815194505b876001600160a01b0316856001600160a01b03161415610e765780838780600101985081518110610e6957610e69612b45565b6020026020010181815250505b600101610e00565b50909695505050505050565b600080516020612d63833981519152610ea3813361152a565b61014d82610eb46002546000190190565b610ebe9190612b2d565b1115610edd57604051638a164f6360e01b815260040160405180910390fd5b610822838361158e565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606005805461067d90612b76565b6060818310610f4357604051631960ccad60e11b815260040160405180910390fd5b600080610f4f60025490565b90506001851015610f5f57600194505b80841115610f6b578093505b6000610f7687610b50565b905084861015610f955785850381811015610f8f578091505b50610f99565b5060005b6000816001600160401b03811115610fb357610fb36126f3565b604051908082528060200260200182016040528015610fdc578160200160208202803683370190505b50905081610fef5793506110a592505050565b6000610ffa8861119a565b90506000816040015161100b575080515b885b88811415801561101d5750848714155b156110995761102b81611b20565b925082604001511561103c57611091565b82516001600160a01b03161561105157825191505b8a6001600160a01b0316826001600160a01b03161415611091578084888060010199508151811061108457611084612b45565b6020026020010181815250505b60010161100d565b50505092835250909150505b9392505050565b6001600160a01b0382163314156110d65760405163b06307db60e01b815260040160405180910390fd5b3360008181526009602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60006111516002546000190190565b905090565b6111618484846116c9565b6001600160a01b0383163b156106485761117d84848484611b55565b610648576040516368d2bf6b60e11b815260040160405180910390fd5b604080516060808201835260008083526020808401829052838501829052845192830185528183528201819052928101929092529060018310806111e057506002548310155b156111eb5792915050565b6111f483611b20565b90508060400151156112065792915050565b6110a583611c4d565b606061121a8261162b565b61123757604051630a14c4b560e41b815260040160405180910390fd5b6000611241611a57565b905080516000141561126257604051806020016040528060008152506110a5565b8061126c84611c7b565b60405160200161127d929190612bfb565b6040516020818303038152906040529392505050565b600082815260016020819052604090912001546112b0813361152a565b61082283836118d7565b6001600160a01b038116600090815260076020526040808220546001600160401b03911c16610668565b6001600160a01b03808316600090815260096020908152604080832093851683529290529081205460ff161561131c57506001610668565b600c546001600160a01b0316158015906113bb5750600c5460405163c455279160e01b81526001600160a01b03858116600483015284811692169063c45527919060240160206040518083038186803b15801561137857600080fd5b505afa15801561138c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b09190612c2a565b6001600160a01b0316145b156113c857506001610668565b50600092915050565b600080516020612d638339815191526113ea813361152a565b600a5460ff16151582151514156114145760405163df82d43b60e01b815260040160405180910390fd5b600a805460ff191683151590811790915560405160ff909116151581527f4f6846e1a6a026ffba330735c9ca2845cfe23bccb44541d241c637b8542fa7a09060200160405180910390a15050565b6000546001600160a01b031633146114bc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108ba565b6001600160a01b0381166115215760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108ba565b6108e781611a66565b6115348282610ee7565b6108cd5761154c816001600160a01b03166014611cca565b611557836020611cca565b604051602001611568929190612c47565b60408051601f198184030181529082905262461bcd60e51b82526108ba91600401612615565b6108cd828260405180602001604052806000815250611e65565b60006301ffc9a760e01b6001600160e01b0319831614806115d957506380ac58cd60e01b6001600160e01b03198316145b806106685750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b03198216637965db0b60e01b148061066857506301ffc9a760e01b6001600160e01b0319831614610668565b60008160011115801561163f575060025482105b8015610668575050600090815260066020526040902054600160e01b161590565b600081806001116116b0576002548110156116b057600081815260066020526040902054600160e01b81166116ae575b806110a5575060001901600081815260066020526040902054611690565b505b604051636f96cda160e11b815260040160405180910390fd5b60006116d482611660565b9050836001600160a01b0316816001600160a01b0316146117075760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b0386161480611725575061172585336112e4565b8061174057503361173584610700565b6001600160a01b0316145b90508061176057604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03841661178757604051633a954ecd60e21b815260040160405180910390fd5b600083815260086020908152604080832080546001600160a01b03191690556001600160a01b038881168452600783528184208054600019019055871683528083208054600101905585835260069091529020600160e11b4260a01b86178117909155821661182457600183016000818152600660205260409020546118225760025481146118225760008181526006602052604090208390555b505b82846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050505050565b6118768282610ee7565b6108cd5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6118e18282610ee7565b156108cd5760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b8047101561198e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108ba565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119db576040519150601f19603f3d011682016040523d82523d6000602084013e6119e0565b606091505b50509050806108225760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108ba565b6060600b805461067d90612b76565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610668611ac3611fd5565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000611b1385856120fc565b91509150610aaf8161216c565b604080516060810182526000808252602082018190529181019190915260008281526006602052604090205461066890612327565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611b8a903390899088908890600401612cbc565b602060405180830381600087803b158015611ba457600080fd5b505af1925050508015611bd4575060408051601f3d908101601f19168201909252611bd191810190612cf9565b60015b611c2f573d808015611c02576040519150601f19603f3d011682016040523d82523d6000602084013e611c07565b606091505b508051611c27576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6040805160608101825260008082526020820181905291810191909152610668611c7683611660565b612327565b604080516080810191829052607f0190826030600a8206018353600a90045b8015611cb857600183039250600a81066030018353600a9004611c9a565b50819003601f19909101908152919050565b60606000611cd9836002612d16565b611ce4906002612b2d565b6001600160401b03811115611cfb57611cfb6126f3565b6040519080825280601f01601f191660200182016040528015611d25576020820181803683370190505b509050600360fc1b81600081518110611d4057611d40612b45565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611d6f57611d6f612b45565b60200101906001600160f81b031916908160001a9053506000611d93846002612d16565b611d9e906001612b2d565b90505b6001811115611e16576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611dd257611dd2612b45565b1a60f81b828281518110611de857611de8612b45565b60200101906001600160f81b031916908160001a90535060049490941c93611e0f81612d35565b9050611da1565b5083156110a55760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108ba565b6002546001600160a01b038416611e8e57604051622e076360e81b815260040160405180910390fd5b82611eac5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03841660008181526007602090815260408083208054680100000000000000018902019055848352600690915290204260a01b86176001861460e11b1790558190818501903b15611f81575b60405182906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4611f4a6000878480600101955087611b55565b611f67576040516368d2bf6b60e11b815260040160405180910390fd5b808210611eff578260025414611f7c57600080fd5b611fc6565b5b6040516001830192906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4808210611f82575b50600255610648600085838684565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561202e57507f000000000000000000000000000000000000000000000000000000000000000046145b1561205857507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000808251604114156121335760208301516040840151606085015160001a61212787828585612361565b94509450505050612165565b82516040141561215d576020830151604084015161215286838361244e565b935093505050612165565b506000905060025b9250929050565b600081600481111561218057612180612d4c565b14156121895750565b600181600481111561219d5761219d612d4c565b14156121eb5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016108ba565b60028160048111156121ff576121ff612d4c565b141561224d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016108ba565b600381600481111561226157612261612d4c565b14156122ba5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016108ba565b60048160048111156122ce576122ce612d4c565b14156108e75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016108ba565b604080516060810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b90921615159082015290565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156123985750600090506003612445565b8460ff16601b141580156123b057508460ff16601c14155b156123c15750600090506004612445565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612415573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661243e57600060019250925050612445565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b0161246f87828885612361565b935093505050935093915050565b82805461248990612b76565b90600052602060002090601f0160209004810192826124ab57600085556124f1565b82601f106124c457805160ff19168380011785556124f1565b828001600101855582156124f1579182015b828111156124f15782518255916020019190600101906124d6565b506124fd929150612501565b5090565b5b808211156124fd5760008155600101612502565b6000806020838503121561252957600080fd5b82356001600160401b038082111561254057600080fd5b818501915085601f83011261255457600080fd5b81358181111561256357600080fd5b8660208260051b850101111561257857600080fd5b60209290920196919550909350505050565b6001600160e01b0319811681146108e757600080fd5b6000602082840312156125b257600080fd5b81356110a58161258a565b60005b838110156125d85781810151838201526020016125c0565b838111156106485750506000910152565b600081518084526126018160208601602086016125bd565b601f01601f19169290920160200192915050565b6020815260006110a560208301846125e9565b60006020828403121561263a57600080fd5b5035919050565b6001600160a01b03811681146108e757600080fd5b6000806040838503121561266957600080fd5b823561267481612641565b946020939093013593505050565b60008060006060848603121561269757600080fd5b83356126a281612641565b925060208401356126b281612641565b929592945050506040919091013590565b600080604083850312156126d657600080fd5b8235915060208301356126e881612641565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612731576127316126f3565b604052919050565b60006001600160401b03831115612752576127526126f3565b612765601f8401601f1916602001612709565b905082815283838301111561277957600080fd5b828260208301376000602084830101529392505050565b6000602082840312156127a257600080fd5b81356001600160401b038111156127b857600080fd5b8201601f810184136127c957600080fd5b611c4584823560208401612739565b600060208083850312156127eb57600080fd5b82356001600160401b038082111561280257600080fd5b818501915085601f83011261281657600080fd5b813581811115612828576128286126f3565b8060051b9150612839848301612709565b818152918301840191848101908884111561285357600080fd5b938501935b8385101561287157843582529385019390850190612858565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b81811015610e7e576128d483855180516001600160a01b031682526020808201516001600160401b0316908301526040908101511515910152565b9284019260609290920191600101612899565b6000602082840312156128f957600080fd5b81356110a581612641565b6000806020838503121561291757600080fd5b82356001600160401b038082111561292e57600080fd5b818501915085601f83011261294257600080fd5b81358181111561295157600080fd5b86602082850101111561257857600080fd5b6020808252825182820181905260009190848201906040850190845b81811015610e7e5783518352928401929184019160010161297f565b6000806000606084860312156129b057600080fd5b83356129bb81612641565b95602085013595506040909401359392505050565b803580151581146129e057600080fd5b919050565b600080604083850312156129f857600080fd5b8235612a0381612641565b9150612a11602084016129d0565b90509250929050565b60008060008060808587031215612a3057600080fd5b8435612a3b81612641565b93506020850135612a4b81612641565b92506040850135915060608501356001600160401b03811115612a6d57600080fd5b8501601f81018713612a7e57600080fd5b612a8d87823560208401612739565b91505092959194509250565b81516001600160a01b031681526020808301516001600160401b03169082015260408083015115159082015260608101610668565b60008060408385031215612ae157600080fd5b8235612aec81612641565b915060208301356126e881612641565b600060208284031215612b0e57600080fd5b6110a5826129d0565b634e487b7160e01b600052601160045260246000fd5b60008219821115612b4057612b40612b17565b500190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415612b6f57612b6f612b17565b5060010190565b600181811c90821680612b8a57607f821691505b60208210811415612bab57634e487b7160e01b600052602260045260246000fd5b50919050565b60008251612bc38184602087016125bd565b9190910192915050565b604081526000612be060408301856125e9565b8281036020840152612bf281856125e9565b95945050505050565b60008351612c0d8184602088016125bd565b835190830190612c218183602088016125bd565b01949350505050565b600060208284031215612c3c57600080fd5b81516110a581612641565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612c7f8160178501602088016125bd565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612cb08160288401602088016125bd565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612cef908301846125e9565b9695505050505050565b600060208284031215612d0b57600080fd5b81516110a58161258a565b6000816000190483118215151615612d3057612d30612b17565b500290565b600081612d4457612d44612b17565b506000190190565b634e487b7160e01b600052602160045260246000fdfe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929a26469706673582212207afb525681def0a4051e8b5a11544bafc5b0fe07534fa55cc38e9de868fa8d8464736f6c634300080900330000000000000000000000000000000000000000000000000000000000000080000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c100000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000002b68747470733a2f2f6d657461646174612e746572726170696e67656e657369732e636f6d2f746f6b656e2f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c329d2dc3685ed3be3209b33daf37f60347c969d000000000000000000000000b643c924632f71ac70a982ebc7e4099620f076c10000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c329d2dc3685ed3be3209b33daf37f60347c969d000000000000000000000000f1be574e5936bd41bcdfc54a4954f1d550d9498b
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102535760003560e01c8063715018a611610146578063a2309ff8116100c3578063d5abeb0111610087578063d5abeb011461053f578063dc33e68114610548578063e985e9c51461055b578063ee1cc9441461056e578063f2fde38b14610581578063f5b541a61461059457600080fd5b8063a2309ff8146104de578063b88d4fde146104e6578063c23dc68f146104f9578063c87b56dd14610519578063d547741f1461052c57600080fd5b806391d148541161010a57806391d148541461049557806395d89b41146104a857806399a2557a146104b0578063a217fddf146104c3578063a22cb465146104cb57600080fd5b8063715018a6146104365780637ba0e2e71461043e5780638462151c146104515780638da5cb5b146104715780638e825be01461048257600080fd5b806336568abe116101d45780635bbb2177116101985780635bbb2177146103c15780636301dccf146103e15780636352211e146104085780636c0360eb1461041b57806370a082311461042357600080fd5b806336568abe14610359578063390dad5f1461036c5780633ccfd60b1461039357806342842e0e1461039b57806355f804b3146103ae57600080fd5b806318160ddd1161021b57806318160ddd146102e857806323b872dd14610302578063248a9ca31461031557806325fd90f3146103395780632f2ff15d1461034657600080fd5b8063014b0c8a1461025857806301ffc9a71461026d57806306fdde0314610295578063081812fc146102aa578063095ea7b3146102d5575b600080fd5b61026b610266366004612516565b6105a9565b005b61028061027b3660046125a0565b61064e565b60405190151581526020015b60405180910390f35b61029d61066e565b60405161028c9190612615565b6102bd6102b8366004612628565b610700565b6040516001600160a01b03909116815260200161028c565b61026b6102e3366004612656565b610744565b60035460025403600019015b60405190815260200161028c565b61026b610310366004612682565b610817565b6102f4610323366004612628565b6000908152600160208190526040909120015490565b600a546102809060ff1681565b61026b6103543660046126c3565b610827565b61026b6103673660046126c3565b61084e565b6102f47fa935ad49455f7e8f11eb0a0d7865a0ce5ae2dcc1e65d3e41227a702e4e398a0c81565b61026b6108d1565b61026b6103a9366004612682565b6108ea565b61026b6103bc366004612790565b610905565b6103d46103cf3660046127d8565b6109f1565b60405161028c919061287d565b6102f47fe74c04bdb85741f90efadc0228949f2b97fc0c6a16334216c9bd13273891142b81565b6102bd610416366004612628565b610ab7565b61029d610ac2565b6102f46104313660046128e7565b610b50565b61026b610b9e565b61026b61044c366004612904565b610c04565b61046461045f3660046128e7565b610d82565b60405161028c9190612963565b6000546001600160a01b03166102bd565b61026b610490366004612656565b610e8a565b6102806104a33660046126c3565b610ee7565b61029d610f12565b6104646104be36600461299b565b610f21565b6102f4600081565b61026b6104d93660046129e5565b6110ac565b6102f4611142565b61026b6104f4366004612a1a565b611156565b61050c610507366004612628565b61119a565b60405161028c9190612a99565b61029d610527366004612628565b61120f565b61026b61053a3660046126c3565b611293565b6102f461014d81565b6102f46105563660046128e7565b6112ba565b610280610569366004612ace565b6112e4565b61026b61057c366004612afc565b6113d1565b61026b61058f3660046128e7565b611462565b6102f4600080516020612d6383398151915281565b600080516020612d638339815191526105c2813361152a565b61014d826105d36002546000190190565b6105dd9190612b2d565b11156105fc57604051638a164f6360e01b815260040160405180910390fd5b60005b828110156106485761063884848381811061061c5761061c612b45565b905060200201602081019061063191906128e7565b600161158e565b61064181612b5b565b90506105ff565b50505050565b6000610659826115a8565b806106685750610668826115f6565b92915050565b60606004805461067d90612b76565b80601f01602080910402602001604051908101604052809291908181526020018280546106a990612b76565b80156106f65780601f106106cb576101008083540402835291602001916106f6565b820191906000526020600020905b8154815290600101906020018083116106d957829003601f168201915b5050505050905090565b600061070b8261162b565b610728576040516333d1c03960e21b815260040160405180910390fd5b506000908152600860205260409020546001600160a01b031690565b600061074f82611660565b9050806001600160a01b0316836001600160a01b031614156107845760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b038216146107bb5761079e81336112e4565b6107bb576040516367d9dca160e11b815260040160405180910390fd5b60008281526008602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6108228383836116c9565b505050565b60008281526001602081905260409091200154610844813361152a565b610822838361186c565b6001600160a01b03811633146108c35760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6108cd82826118d7565b5050565b60006108dd813361152a565b6108e7334761193e565b50565b61082283838360405180602001604052806000815250611156565b600080516020612d6383398151915261091e813361152a565b610926611a57565b6040516020016109369190612bb1565b604051602081830303815290604052805190602001208260405160200161095d9190612bb1565b6040516020818303038152906040528051906020012014156109925760405163df82d43b60e01b815260040160405180910390fd5b600061099c611a57565b83519091506109b290600b90602086019061247d565b507f309b29ded109b9e28fb9885757b3e0096eb75c51d23aa4635d68bcd569f6adc181846040516109e4929190612bcd565b60405180910390a1505050565b80516060906000816001600160401b03811115610a1057610a106126f3565b604051908082528060200260200182016040528015610a5b57816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181610a2e5790505b50905060005b828114610aaf57610a8a858281518110610a7d57610a7d612b45565b602002602001015161119a565b828281518110610a9c57610a9c612b45565b6020908102919091010152600101610a61565b509392505050565b600061066882611660565b600b8054610acf90612b76565b80601f0160208091040260200160405190810160405280929190818152602001828054610afb90612b76565b8015610b485780601f10610b1d57610100808354040283529160200191610b48565b820191906000526020600020905b815481529060010190602001808311610b2b57829003601f168201915b505050505081565b60006001600160a01b038216610b79576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600760205260409020546001600160401b031690565b6000546001600160a01b03163314610bf85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108ba565b610c026000611a66565b565b600a5460ff161515600114610c2c5760405163914edb0f60e01b815260040160405180910390fd5b6000610c37336112ba565b1115610c5657604051630de2dc9360e41b815260040160405180910390fd5b61014d610c666002546000190190565b610c71906001612b2d565b1115610c9057604051638a164f6360e01b815260040160405180910390fd5b604080517fe74c04bdb85741f90efadc0228949f2b97fc0c6a16334216c9bd13273891142b60208201523391810191909152600090610ce79060600160405160208183030381529060405280519060200120611ab6565b90506000610d2b8285858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611b0492505050565b9050610d577fa935ad49455f7e8f11eb0a0d7865a0ce5ae2dcc1e65d3e41227a702e4e398a0c82610ee7565b1515600114610d7957604051638baa579f60e01b815260040160405180910390fd5b61064833610631565b60606000806000610d9285610b50565b90506000816001600160401b03811115610dae57610dae6126f3565b604051908082528060200260200182016040528015610dd7578160200160208202803683370190505b509050610dfd604080516060810182526000808252602082018190529181019190915290565b60015b838614610e7e57610e1081611b20565b9150816040015115610e2157610e76565b81516001600160a01b031615610e3657815194505b876001600160a01b0316856001600160a01b03161415610e765780838780600101985081518110610e6957610e69612b45565b6020026020010181815250505b600101610e00565b50909695505050505050565b600080516020612d63833981519152610ea3813361152a565b61014d82610eb46002546000190190565b610ebe9190612b2d565b1115610edd57604051638a164f6360e01b815260040160405180910390fd5b610822838361158e565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606005805461067d90612b76565b6060818310610f4357604051631960ccad60e11b815260040160405180910390fd5b600080610f4f60025490565b90506001851015610f5f57600194505b80841115610f6b578093505b6000610f7687610b50565b905084861015610f955785850381811015610f8f578091505b50610f99565b5060005b6000816001600160401b03811115610fb357610fb36126f3565b604051908082528060200260200182016040528015610fdc578160200160208202803683370190505b50905081610fef5793506110a592505050565b6000610ffa8861119a565b90506000816040015161100b575080515b885b88811415801561101d5750848714155b156110995761102b81611b20565b925082604001511561103c57611091565b82516001600160a01b03161561105157825191505b8a6001600160a01b0316826001600160a01b03161415611091578084888060010199508151811061108457611084612b45565b6020026020010181815250505b60010161100d565b50505092835250909150505b9392505050565b6001600160a01b0382163314156110d65760405163b06307db60e01b815260040160405180910390fd5b3360008181526009602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60006111516002546000190190565b905090565b6111618484846116c9565b6001600160a01b0383163b156106485761117d84848484611b55565b610648576040516368d2bf6b60e11b815260040160405180910390fd5b604080516060808201835260008083526020808401829052838501829052845192830185528183528201819052928101929092529060018310806111e057506002548310155b156111eb5792915050565b6111f483611b20565b90508060400151156112065792915050565b6110a583611c4d565b606061121a8261162b565b61123757604051630a14c4b560e41b815260040160405180910390fd5b6000611241611a57565b905080516000141561126257604051806020016040528060008152506110a5565b8061126c84611c7b565b60405160200161127d929190612bfb565b6040516020818303038152906040529392505050565b600082815260016020819052604090912001546112b0813361152a565b61082283836118d7565b6001600160a01b038116600090815260076020526040808220546001600160401b03911c16610668565b6001600160a01b03808316600090815260096020908152604080832093851683529290529081205460ff161561131c57506001610668565b600c546001600160a01b0316158015906113bb5750600c5460405163c455279160e01b81526001600160a01b03858116600483015284811692169063c45527919060240160206040518083038186803b15801561137857600080fd5b505afa15801561138c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b09190612c2a565b6001600160a01b0316145b156113c857506001610668565b50600092915050565b600080516020612d638339815191526113ea813361152a565b600a5460ff16151582151514156114145760405163df82d43b60e01b815260040160405180910390fd5b600a805460ff191683151590811790915560405160ff909116151581527f4f6846e1a6a026ffba330735c9ca2845cfe23bccb44541d241c637b8542fa7a09060200160405180910390a15050565b6000546001600160a01b031633146114bc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108ba565b6001600160a01b0381166115215760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108ba565b6108e781611a66565b6115348282610ee7565b6108cd5761154c816001600160a01b03166014611cca565b611557836020611cca565b604051602001611568929190612c47565b60408051601f198184030181529082905262461bcd60e51b82526108ba91600401612615565b6108cd828260405180602001604052806000815250611e65565b60006301ffc9a760e01b6001600160e01b0319831614806115d957506380ac58cd60e01b6001600160e01b03198316145b806106685750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b03198216637965db0b60e01b148061066857506301ffc9a760e01b6001600160e01b0319831614610668565b60008160011115801561163f575060025482105b8015610668575050600090815260066020526040902054600160e01b161590565b600081806001116116b0576002548110156116b057600081815260066020526040902054600160e01b81166116ae575b806110a5575060001901600081815260066020526040902054611690565b505b604051636f96cda160e11b815260040160405180910390fd5b60006116d482611660565b9050836001600160a01b0316816001600160a01b0316146117075760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b0386161480611725575061172585336112e4565b8061174057503361173584610700565b6001600160a01b0316145b90508061176057604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03841661178757604051633a954ecd60e21b815260040160405180910390fd5b600083815260086020908152604080832080546001600160a01b03191690556001600160a01b038881168452600783528184208054600019019055871683528083208054600101905585835260069091529020600160e11b4260a01b86178117909155821661182457600183016000818152600660205260409020546118225760025481146118225760008181526006602052604090208390555b505b82846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050505050565b6118768282610ee7565b6108cd5760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6118e18282610ee7565b156108cd5760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b8047101561198e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108ba565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146119db576040519150601f19603f3d011682016040523d82523d6000602084013e6119e0565b606091505b50509050806108225760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108ba565b6060600b805461067d90612b76565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610668611ac3611fd5565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000611b1385856120fc565b91509150610aaf8161216c565b604080516060810182526000808252602082018190529181019190915260008281526006602052604090205461066890612327565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611b8a903390899088908890600401612cbc565b602060405180830381600087803b158015611ba457600080fd5b505af1925050508015611bd4575060408051601f3d908101601f19168201909252611bd191810190612cf9565b60015b611c2f573d808015611c02576040519150601f19603f3d011682016040523d82523d6000602084013e611c07565b606091505b508051611c27576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6040805160608101825260008082526020820181905291810191909152610668611c7683611660565b612327565b604080516080810191829052607f0190826030600a8206018353600a90045b8015611cb857600183039250600a81066030018353600a9004611c9a565b50819003601f19909101908152919050565b60606000611cd9836002612d16565b611ce4906002612b2d565b6001600160401b03811115611cfb57611cfb6126f3565b6040519080825280601f01601f191660200182016040528015611d25576020820181803683370190505b509050600360fc1b81600081518110611d4057611d40612b45565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611d6f57611d6f612b45565b60200101906001600160f81b031916908160001a9053506000611d93846002612d16565b611d9e906001612b2d565b90505b6001811115611e16576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611dd257611dd2612b45565b1a60f81b828281518110611de857611de8612b45565b60200101906001600160f81b031916908160001a90535060049490941c93611e0f81612d35565b9050611da1565b5083156110a55760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016108ba565b6002546001600160a01b038416611e8e57604051622e076360e81b815260040160405180910390fd5b82611eac5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03841660008181526007602090815260408083208054680100000000000000018902019055848352600690915290204260a01b86176001861460e11b1790558190818501903b15611f81575b60405182906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4611f4a6000878480600101955087611b55565b611f67576040516368d2bf6b60e11b815260040160405180910390fd5b808210611eff578260025414611f7c57600080fd5b611fc6565b5b6040516001830192906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4808210611f82575b50600255610648600085838684565b6000306001600160a01b037f000000000000000000000000f68f9bf35312c228c9d213f31c477c92032d80b71614801561202e57507f000000000000000000000000000000000000000000000000000000000000000146145b1561205857507f7466b910302562d6f419c1b18ff81ce2e88d3ac5e2494afb88527e10a024627790565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f3f3e41e2c85c980af69bb6872c250dea5e376938fc43801dd01b9fc406ee68ef828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000808251604114156121335760208301516040840151606085015160001a61212787828585612361565b94509450505050612165565b82516040141561215d576020830151604084015161215286838361244e565b935093505050612165565b506000905060025b9250929050565b600081600481111561218057612180612d4c565b14156121895750565b600181600481111561219d5761219d612d4c565b14156121eb5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016108ba565b60028160048111156121ff576121ff612d4c565b141561224d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016108ba565b600381600481111561226157612261612d4c565b14156122ba5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016108ba565b60048160048111156122ce576122ce612d4c565b14156108e75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016108ba565b604080516060810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b90921615159082015290565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156123985750600090506003612445565b8460ff16601b141580156123b057508460ff16601c14155b156123c15750600090506004612445565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612415573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661243e57600060019250925050612445565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b0161246f87828885612361565b935093505050935093915050565b82805461248990612b76565b90600052602060002090601f0160209004810192826124ab57600085556124f1565b82601f106124c457805160ff19168380011785556124f1565b828001600101855582156124f1579182015b828111156124f15782518255916020019190600101906124d6565b506124fd929150612501565b5090565b5b808211156124fd5760008155600101612502565b6000806020838503121561252957600080fd5b82356001600160401b038082111561254057600080fd5b818501915085601f83011261255457600080fd5b81358181111561256357600080fd5b8660208260051b850101111561257857600080fd5b60209290920196919550909350505050565b6001600160e01b0319811681146108e757600080fd5b6000602082840312156125b257600080fd5b81356110a58161258a565b60005b838110156125d85781810151838201526020016125c0565b838111156106485750506000910152565b600081518084526126018160208601602086016125bd565b601f01601f19169290920160200192915050565b6020815260006110a560208301846125e9565b60006020828403121561263a57600080fd5b5035919050565b6001600160a01b03811681146108e757600080fd5b6000806040838503121561266957600080fd5b823561267481612641565b946020939093013593505050565b60008060006060848603121561269757600080fd5b83356126a281612641565b925060208401356126b281612641565b929592945050506040919091013590565b600080604083850312156126d657600080fd5b8235915060208301356126e881612641565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612731576127316126f3565b604052919050565b60006001600160401b03831115612752576127526126f3565b612765601f8401601f1916602001612709565b905082815283838301111561277957600080fd5b828260208301376000602084830101529392505050565b6000602082840312156127a257600080fd5b81356001600160401b038111156127b857600080fd5b8201601f810184136127c957600080fd5b611c4584823560208401612739565b600060208083850312156127eb57600080fd5b82356001600160401b038082111561280257600080fd5b818501915085601f83011261281657600080fd5b813581811115612828576128286126f3565b8060051b9150612839848301612709565b818152918301840191848101908884111561285357600080fd5b938501935b8385101561287157843582529385019390850190612858565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b81811015610e7e576128d483855180516001600160a01b031682526020808201516001600160401b0316908301526040908101511515910152565b9284019260609290920191600101612899565b6000602082840312156128f957600080fd5b81356110a581612641565b6000806020838503121561291757600080fd5b82356001600160401b038082111561292e57600080fd5b818501915085601f83011261294257600080fd5b81358181111561295157600080fd5b86602082850101111561257857600080fd5b6020808252825182820181905260009190848201906040850190845b81811015610e7e5783518352928401929184019160010161297f565b6000806000606084860312156129b057600080fd5b83356129bb81612641565b95602085013595506040909401359392505050565b803580151581146129e057600080fd5b919050565b600080604083850312156129f857600080fd5b8235612a0381612641565b9150612a11602084016129d0565b90509250929050565b60008060008060808587031215612a3057600080fd5b8435612a3b81612641565b93506020850135612a4b81612641565b92506040850135915060608501356001600160401b03811115612a6d57600080fd5b8501601f81018713612a7e57600080fd5b612a8d87823560208401612739565b91505092959194509250565b81516001600160a01b031681526020808301516001600160401b03169082015260408083015115159082015260608101610668565b60008060408385031215612ae157600080fd5b8235612aec81612641565b915060208301356126e881612641565b600060208284031215612b0e57600080fd5b6110a5826129d0565b634e487b7160e01b600052601160045260246000fd5b60008219821115612b4057612b40612b17565b500190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415612b6f57612b6f612b17565b5060010190565b600181811c90821680612b8a57607f821691505b60208210811415612bab57634e487b7160e01b600052602260045260246000fd5b50919050565b60008251612bc38184602087016125bd565b9190910192915050565b604081526000612be060408301856125e9565b8281036020840152612bf281856125e9565b95945050505050565b60008351612c0d8184602088016125bd565b835190830190612c218183602088016125bd565b01949350505050565b600060208284031215612c3c57600080fd5b81516110a581612641565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612c7f8160178501602088016125bd565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351612cb08160288401602088016125bd565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612cef908301846125e9565b9695505050505050565b600060208284031215612d0b57600080fd5b81516110a58161258a565b6000816000190483118215151615612d3057612d30612b17565b500290565b600081612d4457612d44612b17565b506000190190565b634e487b7160e01b600052602160045260246000fdfe97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929a26469706673582212207afb525681def0a4051e8b5a11544bafc5b0fe07534fa55cc38e9de868fa8d8464736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c100000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000002b68747470733a2f2f6d657461646174612e746572726170696e67656e657369732e636f6d2f746f6b656e2f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c329d2dc3685ed3be3209b33daf37f60347c969d000000000000000000000000b643c924632f71ac70a982ebc7e4099620f076c10000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c329d2dc3685ed3be3209b33daf37f60347c969d000000000000000000000000f1be574e5936bd41bcdfc54a4954f1d550d9498b
-----Decoded View---------------
Arg [0] : baseURI_ (string): https://metadata.terrapingenesis.com/token/
Arg [1] : osProxyRegistryAddress (address): 0xa5409ec958C83C3f309868babACA7c86DCB077c1
Arg [2] : operators (address[]): 0xC329D2dC3685eD3BE3209b33DAF37f60347c969d,0xb643c924632f71ac70a982Ebc7E4099620f076C1
Arg [3] : mintSigners (address[]): 0xC329D2dC3685eD3BE3209b33DAF37f60347c969d,0xf1Be574E5936BD41bCdfc54A4954F1d550d9498B
-----Encoded View---------------
13 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [4] : 000000000000000000000000000000000000000000000000000000000000002b
Arg [5] : 68747470733a2f2f6d657461646174612e746572726170696e67656e65736973
Arg [6] : 2e636f6d2f746f6b656e2f000000000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [8] : 000000000000000000000000c329d2dc3685ed3be3209b33daf37f60347c969d
Arg [9] : 000000000000000000000000b643c924632f71ac70a982ebc7e4099620f076c1
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [11] : 000000000000000000000000c329d2dc3685ed3be3209b33daf37f60347c969d
Arg [12] : 000000000000000000000000f1be574e5936bd41bcdfc54a4954f1d550d9498b
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 29 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
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.