Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
Overview
Max Total Supply
164 PIFF
Holders
38
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
3 PIFFLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
PifflePuppets
Compiler Version
v0.8.13+commit.abaa5c0e
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import "AccessControlEnumerable.sol"; import "ECDSA.sol"; import "BitMaps.sol"; import "IERC721.sol"; import "ERC721AQueryable.sol"; interface IERC20 { function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); } contract PifflePuppets is ERC721AQueryable, AccessControlEnumerable { using ECDSA for bytes32; using BitMaps for BitMaps.BitMap; using Strings for uint256; // Limit on totalSupply. Initialized on deployment. uint256 public immutable collectionSize; // Predetermined account that gets the profits. address payable public beneficiary; // URI base for token metadata. string public baseURI; string public tokenURISuffix = ".json"; // Minting price of one token. uint256 private _price; // Unix epoch seconds. Tokens may be minted until this moment. uint256 private _priceValidUntil; // Minting requires a valid signature by signer. (Off-chain whitelist check, etc.) address public signer; // Every minting slot can only be used once. Mark used slots in a BitMap. BitMaps.BitMap private _slots; event SignerChanged(address newSigner); event BeneficiaryChanged(address newBeneficiary); event MintPriceChanged(uint256 newPrice, uint newPriceValidUntil); constructor( string memory name, string memory symbol, string memory baseTokenURI, uint256 mintPrice, uint256 priceValidUntil, uint256 max, address[] memory admins, address payable beneficiary_, address signer_ ) ERC721A(name, symbol) { collectionSize = max; baseURI = baseTokenURI; beneficiary = beneficiary_; signer = signer_; // Set up admin accounts and ownership. _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); for (uint256 i = 0; i < admins.length; i++) { _grantRole(DEFAULT_ADMIN_ROLE, admins[i]); } setPrice(mintPrice, priceValidUntil); } function tokenURI(uint256 tokenId) public view virtual override(ERC721A, IERC721A) returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), tokenURISuffix)) : ""; } function setBaseURI(string memory baseURI_) external onlyRole(DEFAULT_ADMIN_ROLE) { baseURI = baseURI_; } function setTokenURISuffix(string memory suffix) external onlyRole(DEFAULT_ADMIN_ROLE) { tokenURISuffix = suffix; } // @notice Set minting price and until what timestamp (in epoch seconds) is the minting open with this price. function setPrice(uint256 mintPrice, uint256 priceValidUntil) public onlyRole(DEFAULT_ADMIN_ROLE) { _price = mintPrice; _priceValidUntil = priceValidUntil; emit MintPriceChanged(_price, _priceValidUntil); } // @return The minting price and the closing time in unix epoch seconds. function price() public view returns (uint256, uint256) { return (_price, _priceValidUntil); } // @notice Set a new signer address that is use to sign minting permits. function changeSigner(address newSigner) external onlyRole(DEFAULT_ADMIN_ROLE) { signer = newSigner; emit SignerChanged(signer); } function changeBeneficiary(address payable newBeneficiary) public onlyRole(DEFAULT_ADMIN_ROLE) { require(newBeneficiary != address(0), "Beneficiary must not be the zero address"); beneficiary = newBeneficiary; emit BeneficiaryChanged(newBeneficiary); } // @notice Check if a minting slot is used. // @return true if the minting slot is used. function slotUsed(uint256 slotId) public view returns (bool) { return _slots.get(slotId); } function mint(uint256 amount, uint256 slotId, uint256 validUntil, bytes memory signature) external payable { // Check signature. require(_canMint(msg.sender, amount, slotId, validUntil, signature), "PifflePuppets: Must have valid signing"); // Check amount. require(totalSupply() + amount <= collectionSize, "PifflePuppets: Cannot mint over collection size"); // Check price. require(msg.value >= (amount * _price), "PifflePuppets: Insufficient eth sent"); // Check temporal validity. require(block.timestamp <= validUntil, "PifflePuppets: Slot must be used before expiration time"); require(block.timestamp <= _priceValidUntil, "PifflePuppets: The price has expired"); // Check if the slot is still free and mark it used. require(!_slots.get(slotId), "PifflePuppets: Slot already used"); _slots.set(slotId); // Mint. _safeMint(msg.sender, amount); } function batchMint(address[] memory accounts, uint256[] memory amounts) external onlyRole(DEFAULT_ADMIN_ROLE) { require(accounts.length == amounts.length, "PifflePuppets: Incorrect length match for accounts and amounts"); uint256 originalSupply = totalSupply(); uint256 mintedAmount = 0; for (uint256 i = 0; i < accounts.length; i++) { _safeMint(accounts[i], amounts[i]); mintedAmount += amounts[i]; } require(originalSupply + mintedAmount <= collectionSize, "PifflePuppets: Cannot mint over collection size"); } function supportsInterface(bytes4 interfaceId) public view override(ERC721A, IERC721A, AccessControlEnumerable) returns (bool){ return AccessControlEnumerable.supportsInterface(interfaceId) || ERC721A.supportsInterface(interfaceId); } function _canMint(address minter, uint256 amount, uint256 slotId, uint256 validUntil, bytes memory signature) internal view returns (bool) { return keccak256(abi.encodePacked(minter, amount, slotId, validUntil)).toEthSignedMessageHash().recover(signature) == signer; } // @notice Rescue other tokens sent accidentally to this contract. function rescueERC721(IERC721 tokenToRescue, uint256 tokenId) external onlyRole(DEFAULT_ADMIN_ROLE) { tokenToRescue.safeTransferFrom(address(this), _msgSender(), tokenId); } // @notice Rescue other tokens sent accidentally to this contract. function rescueERC20(IERC20 tokenToRescue) external onlyRole(DEFAULT_ADMIN_ROLE) { tokenToRescue.transfer(_msgSender(), tokenToRescue.balanceOf(address(this))); } // @notice Send all of the native currency to predetermined beneficiary. function release() external { payable(beneficiary).send(address(this).balance); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "IAccessControlEnumerable.sol"; import "AccessControl.sol"; import "EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// 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 (last updated v4.6.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "IAccessControl.sol"; import "Context.sol"; import "Strings.sol"; import "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); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: 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/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 // OpenZeppelin Contracts (last updated v4.6.0) (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (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 = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/BitMaps.sol) pragma solidity ^0.8.0; /** * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential. * Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor]. */ library BitMaps { struct BitMap { mapping(uint256 => uint256) _data; } /** * @dev Returns whether the bit at `index` is set. */ function get(BitMap storage bitmap, uint256 index) internal view returns (bool) { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); return bitmap._data[bucket] & mask != 0; } /** * @dev Sets the bit at `index` to the boolean `value`. */ function setTo( BitMap storage bitmap, uint256 index, bool value ) internal { if (value) { set(bitmap, index); } else { unset(bitmap, index); } } /** * @dev Sets the bit at `index`. */ function set(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); bitmap._data[bucket] |= mask; } /** * @dev Unsets the bit at `index`. */ function unset(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); bitmap._data[bucket] &= ~mask; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * 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); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import "IERC721AQueryable.sol"; import "ERC721A.sol"; /** * @title ERC721AQueryable. * * @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` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) public view virtual 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[] calldata tokenIds) external view virtual 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 virtual 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 collections should be fine). */ function tokensOfOwner(address owner) external view virtual 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.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import "IERC721A.sol"; /** * @dev Interface of ERC721AQueryable. */ 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` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ 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 collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * 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(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @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() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 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`, * 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, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` 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 payable; /** * @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 payable; /** * @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); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import "IERC721A.sol"; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // 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 bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID 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` // - [232..255] `extraData` 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 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @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 virtual 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 virtual 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 virtual 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 virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual 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 auxiliary 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 auxiliary 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 virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ 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: [ERC165](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. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ 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, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * 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 initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev 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; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @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) public payable virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId].value; } /** * @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) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @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. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * 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 ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // 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] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // 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 `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @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 memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @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 Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns 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)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @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 for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _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] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _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] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, 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. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @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)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // 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] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // 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++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * 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 _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @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 virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
{ "evmVersion": "istanbul", "optimizer": { "enabled": true, "runs": 200 }, "libraries": { "PifflePuppets.sol": {} }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"baseTokenURI","type":"string"},{"internalType":"uint256","name":"mintPrice","type":"uint256"},{"internalType":"uint256","name":"priceValidUntil","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"},{"internalType":"address[]","name":"admins","type":"address[]"},{"internalType":"address payable","name":"beneficiary_","type":"address"},{"internalType":"address","name":"signer_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","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"},{"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":"address","name":"newBeneficiary","type":"address"}],"name":"BeneficiaryChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPriceValidUntil","type":"uint256"}],"name":"MintPriceChanged","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":false,"internalType":"address","name":"newSigner","type":"address"}],"name":"SignerChanged","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":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","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":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"batchMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"beneficiary","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"newBeneficiary","type":"address"}],"name":"changeBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSigner","type":"address"}],"name":"changeSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectionSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"uint24","name":"extraData","type":"uint24"}],"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":"uint24","name":"extraData","type":"uint24"}],"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":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"slotId","type":"uint256"},{"internalType":"uint256","name":"validUntil","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"release","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":"contract IERC20","name":"tokenToRescue","type":"address"}],"name":"rescueERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"tokenToRescue","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"rescueERC721","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":"payable","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":"payable","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":"uint256","name":"mintPrice","type":"uint256"},{"internalType":"uint256","name":"priceValidUntil","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"suffix","type":"string"}],"name":"setTokenURISuffix","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"slotId","type":"uint256"}],"name":"slotUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURISuffix","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":"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":"payable","type":"function"}]
Contract Creation Code
60e0604052600560a081905264173539b7b760d91b60c09081526200002891600c919062000573565b503480156200003657600080fd5b5060405162003dcb38038062003dcb8339810160408190526200005991620007c4565b8851899089906200007290600290602085019062000573565b5080516200008890600390602084019062000573565b5060008055505060808490528651620000a990600b9060208a019062000573565b50600a80546001600160a01b038085166001600160a01b031992831617909255600f805492841692909116919091179055620000e760003362000156565b60005b83518110156200013a57620001256000801b858381518110620001115762000111620008c0565b60200260200101516200015660201b60201c565b806200013181620008ec565b915050620000ea565b5062000147868662000199565b50505050505050505062000a49565b6200016d8282620001ee60201b62001a1c1760201c565b60008281526009602090815260409091206200019491839062001aa262000293821b17901c565b505050565b6000620001a681620002b3565b600d839055600e82905560408051848152602081018490527f2063f24eb8e50478aa99484fcf0f591be5a95d83129c7388c3da4bd776655e7a910160405180910390a1505050565b60008281526008602090815260408083206001600160a01b038516845290915290205460ff166200028f5760008281526008602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200024e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6000620002aa836001600160a01b038416620002c2565b90505b92915050565b620002bf813362000314565b50565b60008181526001830160205260408120546200030b57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620002ad565b506000620002ad565b60008281526008602090815260408083206001600160a01b038516845290915290205460ff166200028f5762000360816001600160a01b03166014620003ba60201b62001ab71760201c565b6200037683602062001ab7620003ba821b17811c565b6040516020016200038992919062000908565b60408051601f198184030181529082905262461bcd60e51b8252620003b19160040162000981565b60405180910390fd5b60606000620003cb836002620009b6565b620003d8906002620009d8565b6001600160401b03811115620003f257620003f262000619565b6040519080825280601f01601f1916602001820160405280156200041d576020820181803683370190505b509050600360fc1b816000815181106200043b576200043b620008c0565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106200046d576200046d620008c0565b60200101906001600160f81b031916908160001a905350600062000493846002620009b6565b620004a0906001620009d8565b90505b600181111562000522576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110620004d857620004d8620008c0565b1a60f81b828281518110620004f157620004f1620008c0565b60200101906001600160f81b031916908160001a90535060049490941c936200051a81620009f3565b9050620004a3565b508315620002aa5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401620003b1565b828054620005819062000a0d565b90600052602060002090601f016020900481019282620005a55760008555620005f0565b82601f10620005c057805160ff1916838001178555620005f0565b82800160010185558215620005f0579182015b82811115620005f0578251825591602001919060010190620005d3565b50620005fe92915062000602565b5090565b5b80821115620005fe576000815560010162000603565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200065a576200065a62000619565b604052919050565b60005b838110156200067f57818101518382015260200162000665565b838111156200068f576000848401525b50505050565b600082601f830112620006a757600080fd5b81516001600160401b03811115620006c357620006c362000619565b620006d8601f8201601f19166020016200062f565b818152846020838601011115620006ee57600080fd5b6200070182602083016020870162000662565b949350505050565b6001600160a01b0381168114620002bf57600080fd5b80516200072c8162000709565b919050565b600082601f8301126200074357600080fd5b815160206001600160401b0382111562000761576200076162000619565b8160051b620007728282016200062f565b92835284810182019282810190878511156200078d57600080fd5b83870192505b84831015620007b9578251620007a98162000709565b8252918301919083019062000793565b979650505050505050565b60008060008060008060008060006101208a8c031215620007e457600080fd5b89516001600160401b0380821115620007fc57600080fd5b6200080a8d838e0162000695565b9a5060208c01519150808211156200082157600080fd5b6200082f8d838e0162000695565b995060408c01519150808211156200084657600080fd5b620008548d838e0162000695565b985060608c0151975060808c0151965060a08c0151955060c08c01519150808211156200088057600080fd5b506200088f8c828d0162000731565b935050620008a060e08b016200071f565b9150620008b16101008b016200071f565b90509295985092959850929598565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201620009015762000901620008d6565b5060010190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516200094281601785016020880162000662565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516200097581602884016020880162000662565b01602801949350505050565b6020815260008251806020840152620009a281604085016020870162000662565b601f01601f19169190910160400192915050565b6000816000190483118215151615620009d357620009d3620008d6565b500290565b60008219821115620009ee57620009ee620008d6565b500190565b60008162000a055762000a05620008d6565b506000190190565b600181811c9082168062000a2257607f821691505b60208210810362000a4357634e487b7160e01b600052602260045260246000fd5b50919050565b60805161335862000a736000396000818161043001528181610c7c01526110b101526133586000f3fe60806040526004361061025c5760003560e01c80638462151c11610144578063b88d4fde116100b6578063d547741f1161007a578063d547741f1461071b578063d79818341461073b578063dbbc853b1461075b578063dc07065714610770578063e985e9c514610790578063f7d97577146107d957600080fd5b8063b88d4fde1461067b578063c23dc68f1461068e578063c87b56dd146106bb578063ca15c873146106db578063ccec3716146106fb57600080fd5b806399a2557a1161010857806399a2557a146105be578063a035b1fe146105de578063a217fddf14610606578063a22cb4651461061b578063a9852bfb1461063b578063aad2b7231461065b57600080fd5b80638462151c1461052757806386d1a69f146105545780639010d07c1461056957806391d148541461058957806395d89b41146105a957600080fd5b806336568abe116101dd57806355f804b3116101a157806355f804b3146104655780635bbb2177146104855780636352211e146104b257806368573107146104d25780636c0360eb146104f257806370a082311461050757600080fd5b806336568abe146103cb57806338af3eed146103eb57806342842e0e1461040b57806345c0f5331461041e5780634a9eee691461045257600080fd5b806318160ddd1161022457806318160ddd14610325578063238ac9331461034857806323b872dd14610368578063248a9ca31461037b5780632f2ff15d146103ab57600080fd5b806301ffc9a71461026157806306fdde0314610296578063081812fc146102b8578063095ea7b3146102f05780630be7f7fb14610305575b600080fd5b34801561026d57600080fd5b5061028161027c36600461294b565b6107f9565b60405190151581526020015b60405180910390f35b3480156102a257600080fd5b506102ab610819565b60405161028d91906129c0565b3480156102c457600080fd5b506102d86102d33660046129d3565b6108ab565b6040516001600160a01b03909116815260200161028d565b6103036102fe366004612a01565b6108ef565b005b34801561031157600080fd5b506102816103203660046129d3565b61098f565b34801561033157600080fd5b50600154600054035b60405190815260200161028d565b34801561035457600080fd5b50600f546102d8906001600160a01b031681565b610303610376366004612a2d565b6109b2565b34801561038757600080fd5b5061033a6103963660046129d3565b60009081526008602052604090206001015490565b3480156103b757600080fd5b506103036103c6366004612a6e565b610b4a565b3480156103d757600080fd5b506103036103e6366004612a6e565b610b74565b3480156103f757600080fd5b50600a546102d8906001600160a01b031681565b610303610419366004612a2d565b610bf7565b34801561042a57600080fd5b5061033a7f000000000000000000000000000000000000000000000000000000000000000081565b610303610460366004612b5b565b610c12565b34801561047157600080fd5b50610303610480366004612bb4565b610ea5565b34801561049157600080fd5b506104a56104a0366004612bfc565b610ec3565b60405161028d9190612cac565b3480156104be57600080fd5b506102d86104cd3660046129d3565b610f8e565b3480156104de57600080fd5b506103036104ed366004612d7c565b610f99565b3480156104fe57600080fd5b506102ab6110ff565b34801561051357600080fd5b5061033a610522366004612e3d565b61118d565b34801561053357600080fd5b50610547610542366004612e3d565b6111db565b60405161028d9190612e5a565b34801561056057600080fd5b506103036112e3565b34801561057557600080fd5b506102d8610584366004612e92565b61130d565b34801561059557600080fd5b506102816105a4366004612a6e565b61132c565b3480156105b557600080fd5b506102ab611357565b3480156105ca57600080fd5b506105476105d9366004612eb4565b611366565b3480156105ea57600080fd5b50600d54600e546040805192835260208301919091520161028d565b34801561061257600080fd5b5061033a600081565b34801561062757600080fd5b50610303610636366004612ef7565b6114dd565b34801561064757600080fd5b50610303610656366004612bb4565b611549565b34801561066757600080fd5b50610303610676366004612e3d565b611567565b610303610689366004612f25565b6115c8565b34801561069a57600080fd5b506106ae6106a93660046129d3565b61160c565b60405161028d9190612f78565b3480156106c757600080fd5b506102ab6106d63660046129d3565b611684565b3480156106e757600080fd5b5061033a6106f63660046129d3565b611752565b34801561070757600080fd5b50610303610716366004612e3d565b611769565b34801561072757600080fd5b50610303610736366004612a6e565b61185b565b34801561074757600080fd5b50610303610756366004612a01565b611880565b34801561076757600080fd5b506102ab6118fc565b34801561077c57600080fd5b5061030361078b366004612e3d565b611909565b34801561079c57600080fd5b506102816107ab366004612f86565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b3480156107e557600080fd5b506103036107f4366004612e92565b6119c9565b600061080482611c52565b80610813575061081382611c77565b92915050565b60606002805461082890612fb4565b80601f016020809104026020016040519081016040528092919081815260200182805461085490612fb4565b80156108a15780601f10610876576101008083540402835291602001916108a1565b820191906000526020600020905b81548152906001019060200180831161088457829003601f168201915b5050505050905090565b60006108b682611cc5565b6108d3576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60006108fa82610f8e565b9050336001600160a01b038216146109335761091681336107ab565b610933576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600881901c600090815260106020526040812054600160ff84161b161515610813565b60006109bd82611cec565b9050836001600160a01b0316816001600160a01b0316146109f05760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610a3d57610a2086336107ab565b610a3d57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610a6457604051633a954ecd60e21b815260040160405180910390fd5b8015610a6f57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003610b0157600184016000818152600460205260408120549003610aff576000548114610aff5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b600082815260086020526040902060010154610b6581611d53565b610b6f8383611d60565b505050565b6001600160a01b0381163314610be95760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610bf38282611d82565b5050565b610b6f838383604051806020016040528060008152506115c8565b610c1f3385858585611da4565b610c7a5760405162461bcd60e51b815260206004820152602660248201527f506966666c65507570706574733a204d75737420686176652076616c6964207360448201526569676e696e6760d01b6064820152608401610be0565b7f000000000000000000000000000000000000000000000000000000000000000084610ca96001546000540390565b610cb39190613004565b1115610cd15760405162461bcd60e51b8152600401610be09061301c565b600d54610cde908561306b565b341015610d395760405162461bcd60e51b8152602060048201526024808201527f506966666c65507570706574733a20496e73756666696369656e7420657468206044820152631cd95b9d60e21b6064820152608401610be0565b81421115610daf5760405162461bcd60e51b815260206004820152603760248201527f506966666c65507570706574733a20536c6f74206d757374206265207573656460448201527f206265666f72652065787069726174696f6e2074696d650000000000000000006064820152608401610be0565b600e54421115610e0d5760405162461bcd60e51b8152602060048201526024808201527f506966666c65507570706574733a2054686520707269636520686173206578706044820152631a5c995960e21b6064820152608401610be0565b600883901c600090815260106020526040902054600160ff85161b1615610e765760405162461bcd60e51b815260206004820181905260248201527f506966666c65507570706574733a20536c6f7420616c726561647920757365646044820152606401610be0565b600883901c60009081526010602052604090208054600160ff86161b179055610e9f3385611e75565b50505050565b6000610eb081611d53565b8151610b6f90600b90602085019061289c565b6060816000816001600160401b03811115610ee057610ee0612a9e565b604051908082528060200260200182016040528015610f3257816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181610efe5790505b50905060005b828114610f8557610f60868683818110610f5457610f5461308a565b9050602002013561160c565b828281518110610f7257610f7261308a565b6020908102919091010152600101610f38565b50949350505050565b600061081382611cec565b6000610fa481611d53565b815183511461101b5760405162461bcd60e51b815260206004820152603e60248201527f506966666c65507570706574733a20496e636f7272656374206c656e6774682060448201527f6d6174636820666f72206163636f756e747320616e6420616d6f756e747300006064820152608401610be0565b600061102a6001546000540390565b90506000805b85518110156110ae5761107586828151811061104e5761104e61308a565b60200260200101518683815181106110685761106861308a565b6020026020010151611e75565b8481815181106110875761108761308a565b60200260200101518261109a9190613004565b9150806110a6816130a0565b915050611030565b507f00000000000000000000000000000000000000000000000000000000000000006110da8284613004565b11156110f85760405162461bcd60e51b8152600401610be09061301c565b5050505050565b600b805461110c90612fb4565b80601f016020809104026020016040519081016040528092919081815260200182805461113890612fb4565b80156111855780601f1061115a57610100808354040283529160200191611185565b820191906000526020600020905b81548152906001019060200180831161116857829003601f168201915b505050505081565b60006001600160a01b0382166111b6576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b606060008060006111eb8561118d565b90506000816001600160401b0381111561120757611207612a9e565b604051908082528060200260200182016040528015611230578160200160208202803683370190505b50905061125d60408051608081018252600080825260208201819052918101829052606081019190915290565b60005b8386146112d75761127081611e8f565b915081604001516112cf5781516001600160a01b03161561129057815194505b876001600160a01b0316856001600160a01b0316036112cf57808387806001019850815181106112c2576112c261308a565b6020026020010181815250505b600101611260565b50909695505050505050565b600a546040516001600160a01b03909116904780156108fc02916000818181858888f15050505050565b60008281526009602052604081206113259083611ecb565b9392505050565b60009182526008602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606003805461082890612fb4565b606081831061138857604051631960ccad60e11b815260040160405180910390fd5b60008061139460005490565b9050808411156113a2578093505b60006113ad8761118d565b9050848610156113cc57858503818110156113c6578091505b506113d0565b5060005b6000816001600160401b038111156113ea576113ea612a9e565b604051908082528060200260200182016040528015611413578160200160208202803683370190505b5090508160000361142957935061132592505050565b60006114348861160c565b905060008160400151611445575080515b885b8881141580156114575750848714155b156114cc5761146581611e8f565b925082604001516114c45782516001600160a01b03161561148557825191505b8a6001600160a01b0316826001600160a01b0316036114c457808488806001019950815181106114b7576114b761308a565b6020026020010181815250505b600101611447565b505050928352509095945050505050565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600061155481611d53565b8151610b6f90600c90602085019061289c565b600061157281611d53565b600f80546001600160a01b0319166001600160a01b0384169081179091556040519081527f5719a5656c5cfdaafa148ecf366fd3b0a7fae06449ce2a46225977fb7417e29d906020015b60405180910390a15050565b6115d38484846109b2565b6001600160a01b0383163b15610e9f576115ef84848484611ed7565b610e9f576040516368d2bf6b60e11b815260040160405180910390fd5b60408051608080820183526000808352602080840182905283850182905260608085018390528551938401865282845290830182905293820181905292810183905290915060005483106116605792915050565b61166983611e8f565b905080604001511561167b5792915050565b61132583611fc3565b606061168f82611cc5565b6116f35760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610be0565b6000600b805461170290612fb4565b90501161171e5760405180602001604052806000815250610813565b600b61172983611ff8565b600c60405160200161173d93929190613152565b60405160208183030381529060405292915050565b6000818152600960205260408120610813906120f8565b600061177481611d53565b6001600160a01b03821663a9059cbb336040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa1580156117c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ec9190613185565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611837573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6f919061319e565b60008281526008602052604090206001015461187681611d53565b610b6f8383611d82565b600061188b81611d53565b60408051632142170760e11b81523060048201523360248201526044810184905290516001600160a01b038516916342842e0e91606480830192600092919082900301818387803b1580156118df57600080fd5b505af11580156118f3573d6000803e3d6000fd5b50505050505050565b600c805461110c90612fb4565b600061191481611d53565b6001600160a01b03821661197b5760405162461bcd60e51b815260206004820152602860248201527f42656e6566696369617279206d757374206e6f7420626520746865207a65726f604482015267206164647265737360c01b6064820152608401610be0565b600a80546001600160a01b0319166001600160a01b0384169081179091556040519081527f373c72efabe4ef3e552ff77838be729f3bc3d8c586df0012902d1baa2377fa1d906020016115bc565b60006119d481611d53565b600d839055600e82905560408051848152602081018490527f2063f24eb8e50478aa99484fcf0f591be5a95d83129c7388c3da4bd776655e7a910160405180910390a1505050565b611a26828261132c565b610bf35760008281526008602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611a5e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611325836001600160a01b038416612102565b60606000611ac683600261306b565b611ad1906002613004565b6001600160401b03811115611ae857611ae8612a9e565b6040519080825280601f01601f191660200182016040528015611b12576020820181803683370190505b509050600360fc1b81600081518110611b2d57611b2d61308a565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611b5c57611b5c61308a565b60200101906001600160f81b031916908160001a9053506000611b8084600261306b565b611b8b906001613004565b90505b6001811115611c03576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611bbf57611bbf61308a565b1a60f81b828281518110611bd557611bd561308a565b60200101906001600160f81b031916908160001a90535060049490941c93611bfc816131bb565b9050611b8e565b5083156113255760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610be0565b60006001600160e01b03198216635a05180f60e01b1480610813575061081382612151565b60006301ffc9a760e01b6001600160e01b031983161480611ca857506380ac58cd60e01b6001600160e01b03198316145b806108135750506001600160e01b031916635b5e139f60e01b1490565b6000805482108015610813575050600090815260046020526040902054600160e01b161590565b600081600054811015611d3a5760008181526004602052604081205490600160e01b82169003611d38575b80600003611325575060001901600081815260046020526040902054611d17565b505b604051636f96cda160e11b815260040160405180910390fd5b611d5d8133612186565b50565b611d6a8282611a1c565b6000828152600960205260409020610b6f9082611aa2565b611d8c82826121ea565b6000828152600960205260409020610b6f9082612251565b600f546040516bffffffffffffffffffffffff19606088901b1660208201526034810186905260548101859052607481018490526000916001600160a01b031690611e61908490611e5b90609401604051602081830303815290604052805190602001206040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90612266565b6001600160a01b0316149695505050505050565b610bf382826040518060200160405280600081525061228a565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610813906122f0565b60006113258383612337565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611f0c9033908990889088906004016131d2565b6020604051808303816000875af1925050508015611f47575060408051601f3d908101601f19168201909252611f449181019061320f565b60015b611fa5573d808015611f75576040519150601f19603f3d011682016040523d82523d6000602084013e611f7a565b606091505b508051600003611f9d576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b604080516080810182526000808252602082018190529181018290526060810191909152610813611ff383611cec565b6122f0565b60608160000361201f5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156120495780612033816130a0565b91506120429050600a83613242565b9150612023565b6000816001600160401b0381111561206357612063612a9e565b6040519080825280601f01601f19166020018201604052801561208d576020820181803683370190505b5090505b8415611fbb576120a2600183613256565b91506120af600a8661326d565b6120ba906030613004565b60f81b8183815181106120cf576120cf61308a565b60200101906001600160f81b031916908160001a9053506120f1600a86613242565b9450612091565b6000610813825490565b600081815260018301602052604081205461214957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610813565b506000610813565b60006001600160e01b03198216637965db0b60e01b148061081357506301ffc9a760e01b6001600160e01b0319831614610813565b612190828261132c565b610bf3576121a8816001600160a01b03166014611ab7565b6121b3836020611ab7565b6040516020016121c4929190613281565b60408051601f198184030181529082905262461bcd60e51b8252610be0916004016129c0565b6121f4828261132c565b15610bf35760008281526008602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611325836001600160a01b038416612361565b60008060006122758585612454565b91509150612282816124c2565b509392505050565b6122948383612678565b6001600160a01b0383163b15610b6f576000548281035b6122be6000868380600101945086611ed7565b6122db576040516368d2bf6b60e11b815260040160405180910390fd5b8181106122ab5781600054146110f857600080fd5b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b600082600001828154811061234e5761234e61308a565b9060005260206000200154905092915050565b6000818152600183016020526040812054801561244a576000612385600183613256565b855490915060009061239990600190613256565b90508181146123fe5760008660000182815481106123b9576123b961308a565b90600052602060002001549050808760000184815481106123dc576123dc61308a565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061240f5761240f6132f6565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610813565b6000915050610813565b600080825160410361248a5760208301516040840151606085015160001a61247e87828585612776565b945094505050506124bb565b82516040036124b357602083015160408401516124a8868383612863565b9350935050506124bb565b506000905060025b9250929050565b60008160048111156124d6576124d661330c565b036124de5750565b60018160048111156124f2576124f261330c565b0361253f5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610be0565b60028160048111156125535761255361330c565b036125a05760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610be0565b60038160048111156125b4576125b461330c565b0361260c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610be0565b60048160048111156126205761262061330c565b03611d5d5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610be0565b600080549082900361269d5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461274c57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101612714565b508160000361276d57604051622e076360e81b815260040160405180910390fd5b60005550505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156127ad575060009050600361285a565b8460ff16601b141580156127c557508460ff16601c14155b156127d6575060009050600461285a565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561282a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166128535760006001925092505061285a565b9150600090505b94509492505050565b6000806001600160ff1b0383168161288060ff86901c601b613004565b905061288e87828885612776565b935093505050935093915050565b8280546128a890612fb4565b90600052602060002090601f0160209004810192826128ca5760008555612910565b82601f106128e357805160ff1916838001178555612910565b82800160010185558215612910579182015b828111156129105782518255916020019190600101906128f5565b5061291c929150612920565b5090565b5b8082111561291c5760008155600101612921565b6001600160e01b031981168114611d5d57600080fd5b60006020828403121561295d57600080fd5b813561132581612935565b60005b8381101561298357818101518382015260200161296b565b83811115610e9f5750506000910152565b600081518084526129ac816020860160208601612968565b601f01601f19169290920160200192915050565b6020815260006113256020830184612994565b6000602082840312156129e557600080fd5b5035919050565b6001600160a01b0381168114611d5d57600080fd5b60008060408385031215612a1457600080fd5b8235612a1f816129ec565b946020939093013593505050565b600080600060608486031215612a4257600080fd5b8335612a4d816129ec565b92506020840135612a5d816129ec565b929592945050506040919091013590565b60008060408385031215612a8157600080fd5b823591506020830135612a93816129ec565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612adc57612adc612a9e565b604052919050565b60006001600160401b03831115612afd57612afd612a9e565b612b10601f8401601f1916602001612ab4565b9050828152838383011115612b2457600080fd5b828260208301376000602084830101529392505050565b600082601f830112612b4c57600080fd5b61132583833560208501612ae4565b60008060008060808587031215612b7157600080fd5b84359350602085013592506040850135915060608501356001600160401b03811115612b9c57600080fd5b612ba887828801612b3b565b91505092959194509250565b600060208284031215612bc657600080fd5b81356001600160401b03811115612bdc57600080fd5b8201601f81018413612bed57600080fd5b611fbb84823560208401612ae4565b60008060208385031215612c0f57600080fd5b82356001600160401b0380821115612c2657600080fd5b818501915085601f830112612c3a57600080fd5b813581811115612c4957600080fd5b8660208260051b8501011115612c5e57600080fd5b60209290920196919550909350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b818110156112d757612cdb838551612c70565b9284019260809290920191600101612cc8565b60006001600160401b03821115612d0757612d07612a9e565b5060051b60200190565b600082601f830112612d2257600080fd5b81356020612d37612d3283612cee565b612ab4565b82815260059290921b84018101918181019086841115612d5657600080fd5b8286015b84811015612d715780358352918301918301612d5a565b509695505050505050565b60008060408385031215612d8f57600080fd5b82356001600160401b0380821115612da657600080fd5b818501915085601f830112612dba57600080fd5b81356020612dca612d3283612cee565b82815260059290921b84018101918181019089841115612de957600080fd5b948201945b83861015612e10578535612e01816129ec565b82529482019490820190612dee565b96505086013592505080821115612e2657600080fd5b50612e3385828601612d11565b9150509250929050565b600060208284031215612e4f57600080fd5b8135611325816129ec565b6020808252825182820181905260009190848201906040850190845b818110156112d757835183529284019291840191600101612e76565b60008060408385031215612ea557600080fd5b50508035926020909101359150565b600080600060608486031215612ec957600080fd5b8335612ed4816129ec565b95602085013595506040909401359392505050565b8015158114611d5d57600080fd5b60008060408385031215612f0a57600080fd5b8235612f15816129ec565b91506020830135612a9381612ee9565b60008060008060808587031215612f3b57600080fd5b8435612f46816129ec565b93506020850135612f56816129ec565b92506040850135915060608501356001600160401b03811115612b9c57600080fd5b608081016108138284612c70565b60008060408385031215612f9957600080fd5b8235612fa4816129ec565b91506020830135612a93816129ec565b600181811c90821680612fc857607f821691505b602082108103612fe857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561301757613017612fee565b500190565b6020808252602f908201527f506966666c65507570706574733a2043616e6e6f74206d696e74206f7665722060408201526e636f6c6c656374696f6e2073697a6560881b606082015260800190565b600081600019048311821515161561308557613085612fee565b500290565b634e487b7160e01b600052603260045260246000fd5b6000600182016130b2576130b2612fee565b5060010190565b8054600090600181811c90808316806130d357607f831692505b602080841082036130f457634e487b7160e01b600052602260045260246000fd5b818015613108576001811461311957613146565b60ff19861689528489019650613146565b60008881526020902060005b8681101561313e5781548b820152908501908301613125565b505084890196505b50505050505092915050565b600061315e82866130b9565b845161316e818360208901612968565b61317a818301866130b9565b979650505050505050565b60006020828403121561319757600080fd5b5051919050565b6000602082840312156131b057600080fd5b815161132581612ee9565b6000816131ca576131ca612fee565b506000190190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061320590830184612994565b9695505050505050565b60006020828403121561322157600080fd5b815161132581612935565b634e487b7160e01b600052601260045260246000fd5b6000826132515761325161322c565b500490565b60008282101561326857613268612fee565b500390565b60008261327c5761327c61322c565b500690565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516132b9816017850160208801612968565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516132ea816028840160208801612968565b01602801949350505050565b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052602160045260246000fdfea2646970667358221220e9a30c500af16c7821a8f4262878b1413f42d857fafb48a93176c37358578b1164736f6c634300080d00330000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000011c37937e08000000000000000000000000000000000000000000000000000000000000632b3b4d00000000000000000000000000000000000000000000000000000000000010680000000000000000000000000000000000000000000000000000000000000200000000000000000000000000968d814b591ef645b123e557fe888f848e6f0f57000000000000000000000000f46e92f654cfbb32b97ff47cc9ae4b928d902778000000000000000000000000000000000000000000000000000000000000000e506966666c65205075707065747300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045049464600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002168747470733a2f2f6d657461646174612e62616b65642e6b696e6f732e6f6e652f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000009d581733387c4c74b7d68364f20942b53b294db1000000000000000000000000420690fa453fb7839d626188e65282e0a781a357000000000000000000000000455341c8d28af2589433c018e019a2bb796704fa
Deployed Bytecode
0x60806040526004361061025c5760003560e01c80638462151c11610144578063b88d4fde116100b6578063d547741f1161007a578063d547741f1461071b578063d79818341461073b578063dbbc853b1461075b578063dc07065714610770578063e985e9c514610790578063f7d97577146107d957600080fd5b8063b88d4fde1461067b578063c23dc68f1461068e578063c87b56dd146106bb578063ca15c873146106db578063ccec3716146106fb57600080fd5b806399a2557a1161010857806399a2557a146105be578063a035b1fe146105de578063a217fddf14610606578063a22cb4651461061b578063a9852bfb1461063b578063aad2b7231461065b57600080fd5b80638462151c1461052757806386d1a69f146105545780639010d07c1461056957806391d148541461058957806395d89b41146105a957600080fd5b806336568abe116101dd57806355f804b3116101a157806355f804b3146104655780635bbb2177146104855780636352211e146104b257806368573107146104d25780636c0360eb146104f257806370a082311461050757600080fd5b806336568abe146103cb57806338af3eed146103eb57806342842e0e1461040b57806345c0f5331461041e5780634a9eee691461045257600080fd5b806318160ddd1161022457806318160ddd14610325578063238ac9331461034857806323b872dd14610368578063248a9ca31461037b5780632f2ff15d146103ab57600080fd5b806301ffc9a71461026157806306fdde0314610296578063081812fc146102b8578063095ea7b3146102f05780630be7f7fb14610305575b600080fd5b34801561026d57600080fd5b5061028161027c36600461294b565b6107f9565b60405190151581526020015b60405180910390f35b3480156102a257600080fd5b506102ab610819565b60405161028d91906129c0565b3480156102c457600080fd5b506102d86102d33660046129d3565b6108ab565b6040516001600160a01b03909116815260200161028d565b6103036102fe366004612a01565b6108ef565b005b34801561031157600080fd5b506102816103203660046129d3565b61098f565b34801561033157600080fd5b50600154600054035b60405190815260200161028d565b34801561035457600080fd5b50600f546102d8906001600160a01b031681565b610303610376366004612a2d565b6109b2565b34801561038757600080fd5b5061033a6103963660046129d3565b60009081526008602052604090206001015490565b3480156103b757600080fd5b506103036103c6366004612a6e565b610b4a565b3480156103d757600080fd5b506103036103e6366004612a6e565b610b74565b3480156103f757600080fd5b50600a546102d8906001600160a01b031681565b610303610419366004612a2d565b610bf7565b34801561042a57600080fd5b5061033a7f000000000000000000000000000000000000000000000000000000000000106881565b610303610460366004612b5b565b610c12565b34801561047157600080fd5b50610303610480366004612bb4565b610ea5565b34801561049157600080fd5b506104a56104a0366004612bfc565b610ec3565b60405161028d9190612cac565b3480156104be57600080fd5b506102d86104cd3660046129d3565b610f8e565b3480156104de57600080fd5b506103036104ed366004612d7c565b610f99565b3480156104fe57600080fd5b506102ab6110ff565b34801561051357600080fd5b5061033a610522366004612e3d565b61118d565b34801561053357600080fd5b50610547610542366004612e3d565b6111db565b60405161028d9190612e5a565b34801561056057600080fd5b506103036112e3565b34801561057557600080fd5b506102d8610584366004612e92565b61130d565b34801561059557600080fd5b506102816105a4366004612a6e565b61132c565b3480156105b557600080fd5b506102ab611357565b3480156105ca57600080fd5b506105476105d9366004612eb4565b611366565b3480156105ea57600080fd5b50600d54600e546040805192835260208301919091520161028d565b34801561061257600080fd5b5061033a600081565b34801561062757600080fd5b50610303610636366004612ef7565b6114dd565b34801561064757600080fd5b50610303610656366004612bb4565b611549565b34801561066757600080fd5b50610303610676366004612e3d565b611567565b610303610689366004612f25565b6115c8565b34801561069a57600080fd5b506106ae6106a93660046129d3565b61160c565b60405161028d9190612f78565b3480156106c757600080fd5b506102ab6106d63660046129d3565b611684565b3480156106e757600080fd5b5061033a6106f63660046129d3565b611752565b34801561070757600080fd5b50610303610716366004612e3d565b611769565b34801561072757600080fd5b50610303610736366004612a6e565b61185b565b34801561074757600080fd5b50610303610756366004612a01565b611880565b34801561076757600080fd5b506102ab6118fc565b34801561077c57600080fd5b5061030361078b366004612e3d565b611909565b34801561079c57600080fd5b506102816107ab366004612f86565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b3480156107e557600080fd5b506103036107f4366004612e92565b6119c9565b600061080482611c52565b80610813575061081382611c77565b92915050565b60606002805461082890612fb4565b80601f016020809104026020016040519081016040528092919081815260200182805461085490612fb4565b80156108a15780601f10610876576101008083540402835291602001916108a1565b820191906000526020600020905b81548152906001019060200180831161088457829003601f168201915b5050505050905090565b60006108b682611cc5565b6108d3576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60006108fa82610f8e565b9050336001600160a01b038216146109335761091681336107ab565b610933576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600881901c600090815260106020526040812054600160ff84161b161515610813565b60006109bd82611cec565b9050836001600160a01b0316816001600160a01b0316146109f05760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610a3d57610a2086336107ab565b610a3d57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610a6457604051633a954ecd60e21b815260040160405180910390fd5b8015610a6f57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003610b0157600184016000818152600460205260408120549003610aff576000548114610aff5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b600082815260086020526040902060010154610b6581611d53565b610b6f8383611d60565b505050565b6001600160a01b0381163314610be95760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610bf38282611d82565b5050565b610b6f838383604051806020016040528060008152506115c8565b610c1f3385858585611da4565b610c7a5760405162461bcd60e51b815260206004820152602660248201527f506966666c65507570706574733a204d75737420686176652076616c6964207360448201526569676e696e6760d01b6064820152608401610be0565b7f000000000000000000000000000000000000000000000000000000000000106884610ca96001546000540390565b610cb39190613004565b1115610cd15760405162461bcd60e51b8152600401610be09061301c565b600d54610cde908561306b565b341015610d395760405162461bcd60e51b8152602060048201526024808201527f506966666c65507570706574733a20496e73756666696369656e7420657468206044820152631cd95b9d60e21b6064820152608401610be0565b81421115610daf5760405162461bcd60e51b815260206004820152603760248201527f506966666c65507570706574733a20536c6f74206d757374206265207573656460448201527f206265666f72652065787069726174696f6e2074696d650000000000000000006064820152608401610be0565b600e54421115610e0d5760405162461bcd60e51b8152602060048201526024808201527f506966666c65507570706574733a2054686520707269636520686173206578706044820152631a5c995960e21b6064820152608401610be0565b600883901c600090815260106020526040902054600160ff85161b1615610e765760405162461bcd60e51b815260206004820181905260248201527f506966666c65507570706574733a20536c6f7420616c726561647920757365646044820152606401610be0565b600883901c60009081526010602052604090208054600160ff86161b179055610e9f3385611e75565b50505050565b6000610eb081611d53565b8151610b6f90600b90602085019061289c565b6060816000816001600160401b03811115610ee057610ee0612a9e565b604051908082528060200260200182016040528015610f3257816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181610efe5790505b50905060005b828114610f8557610f60868683818110610f5457610f5461308a565b9050602002013561160c565b828281518110610f7257610f7261308a565b6020908102919091010152600101610f38565b50949350505050565b600061081382611cec565b6000610fa481611d53565b815183511461101b5760405162461bcd60e51b815260206004820152603e60248201527f506966666c65507570706574733a20496e636f7272656374206c656e6774682060448201527f6d6174636820666f72206163636f756e747320616e6420616d6f756e747300006064820152608401610be0565b600061102a6001546000540390565b90506000805b85518110156110ae5761107586828151811061104e5761104e61308a565b60200260200101518683815181106110685761106861308a565b6020026020010151611e75565b8481815181106110875761108761308a565b60200260200101518261109a9190613004565b9150806110a6816130a0565b915050611030565b507f00000000000000000000000000000000000000000000000000000000000010686110da8284613004565b11156110f85760405162461bcd60e51b8152600401610be09061301c565b5050505050565b600b805461110c90612fb4565b80601f016020809104026020016040519081016040528092919081815260200182805461113890612fb4565b80156111855780601f1061115a57610100808354040283529160200191611185565b820191906000526020600020905b81548152906001019060200180831161116857829003601f168201915b505050505081565b60006001600160a01b0382166111b6576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b606060008060006111eb8561118d565b90506000816001600160401b0381111561120757611207612a9e565b604051908082528060200260200182016040528015611230578160200160208202803683370190505b50905061125d60408051608081018252600080825260208201819052918101829052606081019190915290565b60005b8386146112d75761127081611e8f565b915081604001516112cf5781516001600160a01b03161561129057815194505b876001600160a01b0316856001600160a01b0316036112cf57808387806001019850815181106112c2576112c261308a565b6020026020010181815250505b600101611260565b50909695505050505050565b600a546040516001600160a01b03909116904780156108fc02916000818181858888f15050505050565b60008281526009602052604081206113259083611ecb565b9392505050565b60009182526008602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606003805461082890612fb4565b606081831061138857604051631960ccad60e11b815260040160405180910390fd5b60008061139460005490565b9050808411156113a2578093505b60006113ad8761118d565b9050848610156113cc57858503818110156113c6578091505b506113d0565b5060005b6000816001600160401b038111156113ea576113ea612a9e565b604051908082528060200260200182016040528015611413578160200160208202803683370190505b5090508160000361142957935061132592505050565b60006114348861160c565b905060008160400151611445575080515b885b8881141580156114575750848714155b156114cc5761146581611e8f565b925082604001516114c45782516001600160a01b03161561148557825191505b8a6001600160a01b0316826001600160a01b0316036114c457808488806001019950815181106114b7576114b761308a565b6020026020010181815250505b600101611447565b505050928352509095945050505050565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600061155481611d53565b8151610b6f90600c90602085019061289c565b600061157281611d53565b600f80546001600160a01b0319166001600160a01b0384169081179091556040519081527f5719a5656c5cfdaafa148ecf366fd3b0a7fae06449ce2a46225977fb7417e29d906020015b60405180910390a15050565b6115d38484846109b2565b6001600160a01b0383163b15610e9f576115ef84848484611ed7565b610e9f576040516368d2bf6b60e11b815260040160405180910390fd5b60408051608080820183526000808352602080840182905283850182905260608085018390528551938401865282845290830182905293820181905292810183905290915060005483106116605792915050565b61166983611e8f565b905080604001511561167b5792915050565b61132583611fc3565b606061168f82611cc5565b6116f35760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610be0565b6000600b805461170290612fb4565b90501161171e5760405180602001604052806000815250610813565b600b61172983611ff8565b600c60405160200161173d93929190613152565b60405160208183030381529060405292915050565b6000818152600960205260408120610813906120f8565b600061177481611d53565b6001600160a01b03821663a9059cbb336040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa1580156117c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ec9190613185565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611837573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6f919061319e565b60008281526008602052604090206001015461187681611d53565b610b6f8383611d82565b600061188b81611d53565b60408051632142170760e11b81523060048201523360248201526044810184905290516001600160a01b038516916342842e0e91606480830192600092919082900301818387803b1580156118df57600080fd5b505af11580156118f3573d6000803e3d6000fd5b50505050505050565b600c805461110c90612fb4565b600061191481611d53565b6001600160a01b03821661197b5760405162461bcd60e51b815260206004820152602860248201527f42656e6566696369617279206d757374206e6f7420626520746865207a65726f604482015267206164647265737360c01b6064820152608401610be0565b600a80546001600160a01b0319166001600160a01b0384169081179091556040519081527f373c72efabe4ef3e552ff77838be729f3bc3d8c586df0012902d1baa2377fa1d906020016115bc565b60006119d481611d53565b600d839055600e82905560408051848152602081018490527f2063f24eb8e50478aa99484fcf0f591be5a95d83129c7388c3da4bd776655e7a910160405180910390a1505050565b611a26828261132c565b610bf35760008281526008602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611a5e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611325836001600160a01b038416612102565b60606000611ac683600261306b565b611ad1906002613004565b6001600160401b03811115611ae857611ae8612a9e565b6040519080825280601f01601f191660200182016040528015611b12576020820181803683370190505b509050600360fc1b81600081518110611b2d57611b2d61308a565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611b5c57611b5c61308a565b60200101906001600160f81b031916908160001a9053506000611b8084600261306b565b611b8b906001613004565b90505b6001811115611c03576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611bbf57611bbf61308a565b1a60f81b828281518110611bd557611bd561308a565b60200101906001600160f81b031916908160001a90535060049490941c93611bfc816131bb565b9050611b8e565b5083156113255760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610be0565b60006001600160e01b03198216635a05180f60e01b1480610813575061081382612151565b60006301ffc9a760e01b6001600160e01b031983161480611ca857506380ac58cd60e01b6001600160e01b03198316145b806108135750506001600160e01b031916635b5e139f60e01b1490565b6000805482108015610813575050600090815260046020526040902054600160e01b161590565b600081600054811015611d3a5760008181526004602052604081205490600160e01b82169003611d38575b80600003611325575060001901600081815260046020526040902054611d17565b505b604051636f96cda160e11b815260040160405180910390fd5b611d5d8133612186565b50565b611d6a8282611a1c565b6000828152600960205260409020610b6f9082611aa2565b611d8c82826121ea565b6000828152600960205260409020610b6f9082612251565b600f546040516bffffffffffffffffffffffff19606088901b1660208201526034810186905260548101859052607481018490526000916001600160a01b031690611e61908490611e5b90609401604051602081830303815290604052805190602001206040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90612266565b6001600160a01b0316149695505050505050565b610bf382826040518060200160405280600081525061228a565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610813906122f0565b60006113258383612337565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611f0c9033908990889088906004016131d2565b6020604051808303816000875af1925050508015611f47575060408051601f3d908101601f19168201909252611f449181019061320f565b60015b611fa5573d808015611f75576040519150601f19603f3d011682016040523d82523d6000602084013e611f7a565b606091505b508051600003611f9d576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b604080516080810182526000808252602082018190529181018290526060810191909152610813611ff383611cec565b6122f0565b60608160000361201f5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156120495780612033816130a0565b91506120429050600a83613242565b9150612023565b6000816001600160401b0381111561206357612063612a9e565b6040519080825280601f01601f19166020018201604052801561208d576020820181803683370190505b5090505b8415611fbb576120a2600183613256565b91506120af600a8661326d565b6120ba906030613004565b60f81b8183815181106120cf576120cf61308a565b60200101906001600160f81b031916908160001a9053506120f1600a86613242565b9450612091565b6000610813825490565b600081815260018301602052604081205461214957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610813565b506000610813565b60006001600160e01b03198216637965db0b60e01b148061081357506301ffc9a760e01b6001600160e01b0319831614610813565b612190828261132c565b610bf3576121a8816001600160a01b03166014611ab7565b6121b3836020611ab7565b6040516020016121c4929190613281565b60408051601f198184030181529082905262461bcd60e51b8252610be0916004016129c0565b6121f4828261132c565b15610bf35760008281526008602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611325836001600160a01b038416612361565b60008060006122758585612454565b91509150612282816124c2565b509392505050565b6122948383612678565b6001600160a01b0383163b15610b6f576000548281035b6122be6000868380600101945086611ed7565b6122db576040516368d2bf6b60e11b815260040160405180910390fd5b8181106122ab5781600054146110f857600080fd5b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b600082600001828154811061234e5761234e61308a565b9060005260206000200154905092915050565b6000818152600183016020526040812054801561244a576000612385600183613256565b855490915060009061239990600190613256565b90508181146123fe5760008660000182815481106123b9576123b961308a565b90600052602060002001549050808760000184815481106123dc576123dc61308a565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061240f5761240f6132f6565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610813565b6000915050610813565b600080825160410361248a5760208301516040840151606085015160001a61247e87828585612776565b945094505050506124bb565b82516040036124b357602083015160408401516124a8868383612863565b9350935050506124bb565b506000905060025b9250929050565b60008160048111156124d6576124d661330c565b036124de5750565b60018160048111156124f2576124f261330c565b0361253f5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610be0565b60028160048111156125535761255361330c565b036125a05760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610be0565b60038160048111156125b4576125b461330c565b0361260c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610be0565b60048160048111156126205761262061330c565b03611d5d5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610be0565b600080549082900361269d5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461274c57808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101612714565b508160000361276d57604051622e076360e81b815260040160405180910390fd5b60005550505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156127ad575060009050600361285a565b8460ff16601b141580156127c557508460ff16601c14155b156127d6575060009050600461285a565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561282a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166128535760006001925092505061285a565b9150600090505b94509492505050565b6000806001600160ff1b0383168161288060ff86901c601b613004565b905061288e87828885612776565b935093505050935093915050565b8280546128a890612fb4565b90600052602060002090601f0160209004810192826128ca5760008555612910565b82601f106128e357805160ff1916838001178555612910565b82800160010185558215612910579182015b828111156129105782518255916020019190600101906128f5565b5061291c929150612920565b5090565b5b8082111561291c5760008155600101612921565b6001600160e01b031981168114611d5d57600080fd5b60006020828403121561295d57600080fd5b813561132581612935565b60005b8381101561298357818101518382015260200161296b565b83811115610e9f5750506000910152565b600081518084526129ac816020860160208601612968565b601f01601f19169290920160200192915050565b6020815260006113256020830184612994565b6000602082840312156129e557600080fd5b5035919050565b6001600160a01b0381168114611d5d57600080fd5b60008060408385031215612a1457600080fd5b8235612a1f816129ec565b946020939093013593505050565b600080600060608486031215612a4257600080fd5b8335612a4d816129ec565b92506020840135612a5d816129ec565b929592945050506040919091013590565b60008060408385031215612a8157600080fd5b823591506020830135612a93816129ec565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612adc57612adc612a9e565b604052919050565b60006001600160401b03831115612afd57612afd612a9e565b612b10601f8401601f1916602001612ab4565b9050828152838383011115612b2457600080fd5b828260208301376000602084830101529392505050565b600082601f830112612b4c57600080fd5b61132583833560208501612ae4565b60008060008060808587031215612b7157600080fd5b84359350602085013592506040850135915060608501356001600160401b03811115612b9c57600080fd5b612ba887828801612b3b565b91505092959194509250565b600060208284031215612bc657600080fd5b81356001600160401b03811115612bdc57600080fd5b8201601f81018413612bed57600080fd5b611fbb84823560208401612ae4565b60008060208385031215612c0f57600080fd5b82356001600160401b0380821115612c2657600080fd5b818501915085601f830112612c3a57600080fd5b813581811115612c4957600080fd5b8660208260051b8501011115612c5e57600080fd5b60209290920196919550909350505050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b818110156112d757612cdb838551612c70565b9284019260809290920191600101612cc8565b60006001600160401b03821115612d0757612d07612a9e565b5060051b60200190565b600082601f830112612d2257600080fd5b81356020612d37612d3283612cee565b612ab4565b82815260059290921b84018101918181019086841115612d5657600080fd5b8286015b84811015612d715780358352918301918301612d5a565b509695505050505050565b60008060408385031215612d8f57600080fd5b82356001600160401b0380821115612da657600080fd5b818501915085601f830112612dba57600080fd5b81356020612dca612d3283612cee565b82815260059290921b84018101918181019089841115612de957600080fd5b948201945b83861015612e10578535612e01816129ec565b82529482019490820190612dee565b96505086013592505080821115612e2657600080fd5b50612e3385828601612d11565b9150509250929050565b600060208284031215612e4f57600080fd5b8135611325816129ec565b6020808252825182820181905260009190848201906040850190845b818110156112d757835183529284019291840191600101612e76565b60008060408385031215612ea557600080fd5b50508035926020909101359150565b600080600060608486031215612ec957600080fd5b8335612ed4816129ec565b95602085013595506040909401359392505050565b8015158114611d5d57600080fd5b60008060408385031215612f0a57600080fd5b8235612f15816129ec565b91506020830135612a9381612ee9565b60008060008060808587031215612f3b57600080fd5b8435612f46816129ec565b93506020850135612f56816129ec565b92506040850135915060608501356001600160401b03811115612b9c57600080fd5b608081016108138284612c70565b60008060408385031215612f9957600080fd5b8235612fa4816129ec565b91506020830135612a93816129ec565b600181811c90821680612fc857607f821691505b602082108103612fe857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561301757613017612fee565b500190565b6020808252602f908201527f506966666c65507570706574733a2043616e6e6f74206d696e74206f7665722060408201526e636f6c6c656374696f6e2073697a6560881b606082015260800190565b600081600019048311821515161561308557613085612fee565b500290565b634e487b7160e01b600052603260045260246000fd5b6000600182016130b2576130b2612fee565b5060010190565b8054600090600181811c90808316806130d357607f831692505b602080841082036130f457634e487b7160e01b600052602260045260246000fd5b818015613108576001811461311957613146565b60ff19861689528489019650613146565b60008881526020902060005b8681101561313e5781548b820152908501908301613125565b505084890196505b50505050505092915050565b600061315e82866130b9565b845161316e818360208901612968565b61317a818301866130b9565b979650505050505050565b60006020828403121561319757600080fd5b5051919050565b6000602082840312156131b057600080fd5b815161132581612ee9565b6000816131ca576131ca612fee565b506000190190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061320590830184612994565b9695505050505050565b60006020828403121561322157600080fd5b815161132581612935565b634e487b7160e01b600052601260045260246000fd5b6000826132515761325161322c565b500490565b60008282101561326857613268612fee565b500390565b60008261327c5761327c61322c565b500690565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516132b9816017850160208801612968565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516132ea816028840160208801612968565b01602801949350505050565b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052602160045260246000fdfea2646970667358221220e9a30c500af16c7821a8f4262878b1413f42d857fafb48a93176c37358578b1164736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000011c37937e08000000000000000000000000000000000000000000000000000000000000632b3b4d00000000000000000000000000000000000000000000000000000000000010680000000000000000000000000000000000000000000000000000000000000200000000000000000000000000968d814b591ef645b123e557fe888f848e6f0f57000000000000000000000000f46e92f654cfbb32b97ff47cc9ae4b928d902778000000000000000000000000000000000000000000000000000000000000000e506966666c65205075707065747300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045049464600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002168747470733a2f2f6d657461646174612e62616b65642e6b696e6f732e6f6e652f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000009d581733387c4c74b7d68364f20942b53b294db1000000000000000000000000420690fa453fb7839d626188e65282e0a781a357000000000000000000000000455341c8d28af2589433c018e019a2bb796704fa
-----Decoded View---------------
Arg [0] : name (string): Piffle Puppets
Arg [1] : symbol (string): PIFF
Arg [2] : baseTokenURI (string): https://metadata.baked.kinos.one/
Arg [3] : mintPrice (uint256): 80000000000000000
Arg [4] : priceValidUntil (uint256): 1663777613
Arg [5] : max (uint256): 4200
Arg [6] : admins (address[]): 0x9d581733387c4c74B7D68364F20942B53b294DB1,0x420690fa453FB7839d626188e65282E0a781A357,0x455341c8d28aF2589433c018e019a2bb796704FA
Arg [7] : beneficiary_ (address): 0x968d814b591eF645b123e557FE888f848E6f0f57
Arg [8] : signer_ (address): 0xF46E92F654cfbb32B97FF47cC9aE4b928D902778
-----Encoded View---------------
20 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [2] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [3] : 000000000000000000000000000000000000000000000000011c37937e080000
Arg [4] : 00000000000000000000000000000000000000000000000000000000632b3b4d
Arg [5] : 0000000000000000000000000000000000000000000000000000000000001068
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000200
Arg [7] : 000000000000000000000000968d814b591ef645b123e557fe888f848e6f0f57
Arg [8] : 000000000000000000000000f46e92f654cfbb32b97ff47cc9ae4b928d902778
Arg [9] : 000000000000000000000000000000000000000000000000000000000000000e
Arg [10] : 506966666c652050757070657473000000000000000000000000000000000000
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [12] : 5049464600000000000000000000000000000000000000000000000000000000
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000021
Arg [14] : 68747470733a2f2f6d657461646174612e62616b65642e6b696e6f732e6f6e65
Arg [15] : 2f00000000000000000000000000000000000000000000000000000000000000
Arg [16] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [17] : 0000000000000000000000009d581733387c4c74b7d68364f20942b53b294db1
Arg [18] : 000000000000000000000000420690fa453fb7839d626188e65282e0a781a357
Arg [19] : 000000000000000000000000455341c8d28af2589433c018e019a2bb796704fa
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.