Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
NFT
Overview
Max Total Supply
11,212 EMERGED
Holders
6,483
Market
Volume (24H)
0.008 ETH
Min Price (24H)
$24.87 @ 0.008000 ETH
Max Price (24H)
$24.87 @ 0.008000 ETH
Other Info
Token Contract
Balance
1 EMERGEDLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
Lacoste
Compiler Version
v0.8.4+commit.c7e474f2
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: UNLICENSED /* Lacoste UNDW3: The Emerge is a digital collection of 11,212 unique PFPs that lives on the Ethereum blockchain and acting as Round 2 of the UNDW3 experience. The Emerge NFTs are subject to the End User Terms - Lacoste NFT : https://www.lacoste.com/fr/terms-undw3-pfp.html ©Lacoste 2022 */ pragma solidity ^0.8.0; // import { console } from "hardhat/console.sol"; import { ERC721A } from "erc721a/contracts/ERC721A.sol"; import { ERC721AQueryable } from "erc721a/contracts/extensions/ERC721AQueryable.sol"; import { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol"; import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import { IERC173 } from "./IERC173.sol"; import { VRFConsumerBase } from "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; contract Lacoste is ERC721A, ERC721AQueryable, AccessControl, IERC173, VRFConsumerBase { address private _manager; uint256 immutable public maxSupply; bytes32 public root; uint256 public seed; bool public isRevealed; event SetBaseURI(string newURI); event SetRoot(bytes32 indexed oldRoot, bytes32 indexed newRoot); event RequestSeed(bytes32 requestId); event SetSeed(uint256 seed); error MaxSupplyReached(); error InvalidMerkleProof(); error AlreadyRevealed(); error NotEnoughLink(); string private _uri; string public contractURI; bytes32 public vrfKeyHash; uint256 public vrfFee; constructor( address admin, address manager, uint256 _maxSupply, string memory uri, string memory _contractURI, address vrfCoordinator, address link, bytes32 keyHash, uint256 fee ) ERC721A("Lacoste UNDW3: The Emerge", "EMERGED") VRFConsumerBase(vrfCoordinator, link) { _setupRole(DEFAULT_ADMIN_ROLE, admin); _setManager(manager); _setURI(uri); maxSupply = _maxSupply; contractURI = _contractURI; vrfKeyHash = keyHash; vrfFee = fee; } function setContractURI(string memory newURI) external onlyRole(DEFAULT_ADMIN_ROLE) { contractURI = newURI; } function setVRFParameters(bytes32 keyHash, uint256 fee) external onlyRole(DEFAULT_ADMIN_ROLE) { vrfKeyHash = keyHash; vrfFee = fee; } function _setManager(address manager) private { address old = _manager; _manager = manager; emit OwnershipTransferred(old, _manager); } function owner() view override external returns(address) { return _manager; } function transferOwnership(address newOwner) external override onlyRole(DEFAULT_ADMIN_ROLE) { _setManager(newOwner); } function setRoot(bytes32 _root) external onlyRole(DEFAULT_ADMIN_ROLE) { bytes32 old = root; root = _root; emit SetRoot(old, _root); } function mint(address to, bytes32[] calldata proof) external { bytes32 leaf = keccak256(abi.encodePacked(to, totalSupply())); if (totalSupply() == maxSupply) revert MaxSupplyReached(); if (!MerkleProof.verifyCalldata(proof, root, leaf)) revert InvalidMerkleProof(); _mint(to, 1); } function _setURI(string memory newURI) private { _uri = newURI; emit SetBaseURI(newURI); } function reveal() external onlyRole(DEFAULT_ADMIN_ROLE) returns (bytes32) { if (isRevealed) revert AlreadyRevealed(); if (LINK.balanceOf(address(this)) < vrfFee) revert NotEnoughLink(); isRevealed = true; bytes32 requestId = requestRandomness(vrfKeyHash, vrfFee); emit RequestSeed(requestId); return requestId; } function fulfillRandomness(bytes32, uint256 randomness) internal override { seed = randomness; emit SetSeed(randomness); } function setURI(string memory newURI) external onlyRole(DEFAULT_ADMIN_ROLE) { _setURI(newURI); } function _baseURI() internal view override returns (string memory) { return _uri; } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721A, AccessControl, IERC165) returns (bool) { return ERC721A.supportsInterface(interfaceId) || AccessControl.supportsInterface(interfaceId) || interfaceId == 0x7f5828d0; // EIP-173 } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/LinkTokenInterface.sol"; import "./VRFRequestIDBase.sol"; /** **************************************************************************** * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE * * @dev Reggie the Random Oracle (not his real job) wants to provide randomness * @dev to Vera the verifier in such a way that Vera can be sure he's not * @dev making his output up to suit himself. Reggie provides Vera a public key * @dev to which he knows the secret key. Each time Vera provides a seed to * @dev Reggie, he gives back a value which is computed completely * @dev deterministically from the seed and the secret key. * * @dev Reggie provides a proof by which Vera can verify that the output was * @dev correctly computed once Reggie tells it to her, but without that proof, * @dev the output is indistinguishable to her from a uniform random sample * @dev from the output space. * * @dev The purpose of this contract is to make it easy for unrelated contracts * @dev to talk to Vera the verifier about the work Reggie is doing, to provide * @dev simple access to a verifiable source of randomness. * ***************************************************************************** * @dev USAGE * * @dev Calling contracts must inherit from VRFConsumerBase, and can * @dev initialize VRFConsumerBase's attributes in their constructor as * @dev shown: * * @dev contract VRFConsumer { * @dev constructor(<other arguments>, address _vrfCoordinator, address _link) * @dev VRFConsumerBase(_vrfCoordinator, _link) public { * @dev <initialization with other arguments goes here> * @dev } * @dev } * * @dev The oracle will have given you an ID for the VRF keypair they have * @dev committed to (let's call it keyHash), and have told you the minimum LINK * @dev price for VRF service. Make sure your contract has sufficient LINK, and * @dev call requestRandomness(keyHash, fee, seed), where seed is the input you * @dev want to generate randomness from. * * @dev Once the VRFCoordinator has received and validated the oracle's response * @dev to your request, it will call your contract's fulfillRandomness method. * * @dev The randomness argument to fulfillRandomness is the actual random value * @dev generated from your seed. * * @dev The requestId argument is generated from the keyHash and the seed by * @dev makeRequestId(keyHash, seed). If your contract could have concurrent * @dev requests open, you can use the requestId to track which seed is * @dev associated with which randomness. See VRFRequestIDBase.sol for more * @dev details. (See "SECURITY CONSIDERATIONS" for principles to keep in mind, * @dev if your contract could have multiple requests in flight simultaneously.) * * @dev Colliding `requestId`s are cryptographically impossible as long as seeds * @dev differ. (Which is critical to making unpredictable randomness! See the * @dev next section.) * * ***************************************************************************** * @dev SECURITY CONSIDERATIONS * * @dev A method with the ability to call your fulfillRandomness method directly * @dev could spoof a VRF response with any random value, so it's critical that * @dev it cannot be directly called by anything other than this base contract * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method). * * @dev For your users to trust that your contract's random behavior is free * @dev from malicious interference, it's best if you can write it so that all * @dev behaviors implied by a VRF response are executed *during* your * @dev fulfillRandomness method. If your contract must store the response (or * @dev anything derived from it) and use it later, you must ensure that any * @dev user-significant behavior which depends on that stored value cannot be * @dev manipulated by a subsequent VRF request. * * @dev Similarly, both miners and the VRF oracle itself have some influence * @dev over the order in which VRF responses appear on the blockchain, so if * @dev your contract could have multiple VRF requests in flight simultaneously, * @dev you must ensure that the order in which the VRF responses arrive cannot * @dev be used to manipulate your contract's user-significant behavior. * * @dev Since the ultimate input to the VRF is mixed with the block hash of the * @dev block in which the request is made, user-provided seeds have no impact * @dev on its economic security properties. They are only included for API * @dev compatability with previous versions of this contract. * * @dev Since the block hash of the block which contains the requestRandomness * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful * @dev miner could, in principle, fork the blockchain to evict the block * @dev containing the request, forcing the request to be included in a * @dev different block with a different hash, and therefore a different input * @dev to the VRF. However, such an attack would incur a substantial economic * @dev cost. This cost scales with the number of blocks the VRF oracle waits * @dev until it calls responds to a request. */ abstract contract VRFConsumerBase is VRFRequestIDBase { /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. See "SECURITY CONSIDERATIONS" above for important * @notice principles to keep in mind when implementing your fulfillRandomness * @notice method. * * @dev VRFConsumerBase expects its subcontracts to have a method with this * @dev signature, and will call it once it has verified the proof * @dev associated with the randomness. (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomness the VRF output */ function fulfillRandomness(bytes32 requestId, uint256 randomness) internal virtual; /** * @dev In order to keep backwards compatibility we have kept the user * seed field around. We remove the use of it because given that the blockhash * enters later, it overrides whatever randomness the used seed provides. * Given that it adds no security, and can easily lead to misunderstandings, * we have removed it from usage and can now provide a simpler API. */ uint256 private constant USER_SEED_PLACEHOLDER = 0; /** * @notice requestRandomness initiates a request for VRF output given _seed * * @dev The fulfillRandomness method receives the output, once it's provided * @dev by the Oracle, and verified by the vrfCoordinator. * * @dev The _keyHash must already be registered with the VRFCoordinator, and * @dev the _fee must exceed the fee specified during registration of the * @dev _keyHash. * * @dev The _seed parameter is vestigial, and is kept only for API * @dev compatibility with older versions. It can't *hurt* to mix in some of * @dev your own randomness, here, but it's not necessary because the VRF * @dev oracle will mix the hash of the block containing your request into the * @dev VRF seed it ultimately uses. * * @param _keyHash ID of public key against which randomness is generated * @param _fee The amount of LINK to send with the request * * @return requestId unique ID for this request * * @dev The returned requestId can be used to distinguish responses to * @dev concurrent requests. It is passed as the first argument to * @dev fulfillRandomness. */ function requestRandomness(bytes32 _keyHash, uint256 _fee) internal returns (bytes32 requestId) { LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, USER_SEED_PLACEHOLDER)); // This is the seed passed to VRFCoordinator. The oracle will mix this with // the hash of the block containing this request to obtain the seed/input // which is finally passed to the VRF cryptographic machinery. uint256 vRFSeed = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]); // nonces[_keyHash] must stay in sync with // VRFCoordinator.nonces[_keyHash][this], which was incremented by the above // successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest). // This provides protection against the user repeating their input seed, // which would result in a predictable/duplicate output, if multiple such // requests appeared in the same block. nonces[_keyHash] = nonces[_keyHash] + 1; return makeRequestId(_keyHash, vRFSeed); } LinkTokenInterface internal immutable LINK; address private immutable vrfCoordinator; // Nonces for each VRF key from which randomness has been requested. // // Must stay in sync with VRFCoordinator[_keyHash][this] mapping(bytes32 => uint256) /* keyHash */ /* nonce */ private nonces; /** * @param _vrfCoordinator address of VRFCoordinator contract * @param _link address of LINK token contract * * @dev https://docs.chain.link/docs/link-token-contracts */ constructor(address _vrfCoordinator, address _link) { vrfCoordinator = _vrfCoordinator; LINK = LinkTokenInterface(_link); } // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external { require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill"); fulfillRandomness(requestId, randomness); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract VRFRequestIDBase { /** * @notice returns the seed which is actually input to the VRF coordinator * * @dev To prevent repetition of VRF output due to repetition of the * @dev user-supplied seed, that seed is combined in a hash with the * @dev user-specific nonce, and the address of the consuming contract. The * @dev risk of repetition is mostly mitigated by inclusion of a blockhash in * @dev the final seed, but the nonce does protect against repetition in * @dev requests which are included in a single block. * * @param _userSeed VRF seed input provided by user * @param _requester Address of the requesting contract * @param _nonce User-specific nonce at the time of the request */ function makeVRFInputSeed( bytes32 _keyHash, uint256 _userSeed, address _requester, uint256 _nonce ) internal pure returns (uint256) { return uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce))); } /** * @notice Returns the id for this request * @param _keyHash The serviceAgreement ID to be used for this request * @param _vRFInputSeed The seed to be passed directly to the VRF * @return The id for this request * * @dev Note that _vRFInputSeed is not the seed passed by the consuming * @dev contract, but the one generated by makeVRFInputSeed */ function makeRequestId(bytes32 _keyHash, uint256 _vRFInputSeed) internal pure returns (bytes32) { return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface LinkTokenInterface { function allowance(address owner, address spender) external view returns (uint256 remaining); function approve(address spender, uint256 value) external returns (bool success); function balanceOf(address owner) external view returns (uint256 balance); function decimals() external view returns (uint8 decimalPlaces); function decreaseApproval(address spender, uint256 addedValue) external returns (bool success); function increaseApproval(address spender, uint256 subtractedValue) external; function name() external view returns (string memory tokenName); function symbol() external view returns (string memory tokenSymbol); function totalSupply() external view returns (uint256 totalTokensIssued); function transfer(address to, uint256 value) external returns (bool success); function transferAndCall( address to, uint256 value, bytes calldata data ) external returns (bool success); function transferFrom( address from, address to, uint256 value ) external returns (bool success); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @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. * * May emit a {RoleGranted} event. */ 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. * * May emit a {RoleRevoked} event. */ 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`. * * May emit a {RoleRevoked} event. */ 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. * * May emit a {RoleGranted} event. * * [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. * * May emit a {RoleGranted} event. */ 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. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`, * consuming from one or the other at each step according to the instructions given by * `proofFlags`. * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof} * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// 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: Unlicense pragma solidity ^0.8.0; import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /// @title ERC-173 Contract Ownership Standard /// Note: the ERC-165 identifier for this interface is 0x7f5828d0 interface IERC173 is IERC165 { /// @dev This emits when ownership of a contract changes. event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /// @notice Get the address of the owner /// @return The address of the owner. function owner() view external returns(address); /// @notice Set the address of the new owner of the contract /// @dev Set _newOwner to address(0) to renounce any ownership. /// @param _newOwner The address of the new owner of the contract function transferOwnership(address _newOwner) external; }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.1.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev ERC721 token receiver interface. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, * including the Metadata extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at `_startTokenId()` * (defaults to 0, e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Mask of an entry in packed address data. uint256 private constant BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant BITMASK_NEXT_INITIALIZED = 1 << 225; // The 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 tokenId of the next token to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See `_packedOwnershipOf` implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [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 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see `_totalMinted`. */ function totalSupply() public view override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { // Counter underflow is impossible as _currentIndex does not decrement, // and it is initialized to `_startTokenId()` unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view returns (uint256) { return _burnCounter; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes of the XOR of // all function selectors in the interface. See: https://eips.ethereum.org/EIPS/eip-165 // e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)` return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> BITPOS_NUMBER_MINTED) & BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> BITPOS_NUMBER_BURNED) & BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the 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 { 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; } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & BITMASK_BURNED == 0) { // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. // // We can directly compare the packed value. // If the address is zero, packed is zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> BITPOS_START_TIMESTAMP); ownership.burned = packed & BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> BITPOS_EXTRA_DATA); } /** * Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev 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 See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } /** * @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)) } } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { if (operator == _msgSenderERC721A()) revert ApproveToCaller(); _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), */ function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & BITMASK_BURNED == 0; // and not burned. } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ''); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _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 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 { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` 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 tokenId = startTokenId; uint256 end = startTokenId + quantity; do { emit Transfer(address(0), to, tokenId++); } while (tokenId < end); _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 { 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 Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { mapping(uint256 => address) storage tokenApprovalsPtr = _tokenApprovals; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId]`. assembly { // Compute the slot. mstore(0x00, tokenId) mstore(0x20, tokenApprovalsPtr.slot) approvedAddressSlot := keccak256(0x00, 0x40) // Load the slot's value from storage. approvedAddress := sload(approvedAddressSlot) } } /** * @dev Returns whether the `approvedAddress` is equals to `from` or `msgSender`. */ function _isOwnerOrApproved( address approvedAddress, address from, address msgSender ) private pure returns (bool result) { assembly { // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean. from := and(from, BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, BITMASK_ADDRESS) // `msgSender == from || msgSender == approvedAddress`. result := or(eq(msgSender, from), eq(msgSender, approvedAddress)) } } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isOwnerOrApproved(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 `_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) = _getApprovedAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isOwnerOrApproved(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++; } } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal { 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 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; } /** * @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 Hook that is called before a set of serially-ordered token ids are about to be transferred. * This includes minting. * And also called before burning one token. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. * This includes minting. * And also called after one token has been burned. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function _toString(uint256 value) internal pure returns (string memory ptr) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), // but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged. // We will need 1 32-byte word to store the length, // and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 3 * 32 = 128. ptr := add(mload(0x40), 128) // Update the free memory pointer to allocate. mstore(0x40, ptr) // Cache the end of the memory to calculate the length later. let end := ptr // We write the string from the rightmost digit to the leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // Costs a bit more than early returning for the zero case, // but cheaper in terms of deployment and overall runtime costs. for { // Initialize and perform the first pass without check. let temp := value // Move the pointer 1 byte leftwards to point to an empty character slot. ptr := sub(ptr, 1) // Write the character to the pointer. 48 is the ASCII index of '0'. mstore8(ptr, add(48, mod(temp, 10))) temp := div(temp, 10) } temp { // Keep dividing `temp` until zero. temp := div(temp, 10) } { // Body of the for loop. ptr := sub(ptr, 1) mstore8(ptr, add(48, mod(temp, 10))) } let length := sub(end, ptr) // Move the pointer 32 bytes leftwards to make room for the length. ptr := sub(ptr, 32) // Store the length. mstore(ptr, length) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.1.0 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of an ERC721A compliant contract. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * The caller cannot approve to their own address. */ error ApproveToCaller(); /** * 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(); struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set through `_extraData`. uint24 extraData; } /** * @dev Returns the total amount of tokens stored by the contract. * * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens. */ function totalSupply() external view returns (uint256); // ============================== // IERC165 // ============================== /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================== // IERC721 // ============================== /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================== // IERC721Metadata // ============================== /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================== // IERC2309 // ============================== /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` (inclusive) is transferred from `from` to `to`, * as defined in the ERC2309 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.1.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AQueryable.sol'; import '../ERC721A.sol'; /** * @title ERC721A Queryable * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable { /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * - `addr` = `address(0)` * - `startTimestamp` = `0` * - `burned` = `false` * - `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 override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; } ownership = _ownershipAt(tokenId); if (ownership.burned) { return ownership; } return _ownershipOf(tokenId); } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view override returns (TokenOwnership[] memory) { unchecked { uint256 tokenIdsLength = tokenIds.length; TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength); for (uint256 i; i != tokenIdsLength; ++i) { ownerships[i] = explicitOwnershipOf(tokenIds[i]); } return ownerships; } } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start` < `stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view override returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); uint256 tokenIdsIdx; uint256 stopLimit = _nextTokenId(); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, stopLimit)`. if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`, // to cater for cases where `balanceOf(owner)` is too big. if (start < stop) { uint256 rangeLength = stop - start; if (rangeLength < tokenIdsMaxLength) { tokenIdsMaxLength = rangeLength; } } else { tokenIdsMaxLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength); if (tokenIdsMaxLength == 0) { return tokenIds; } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`. // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range. if (!ownership.burned) { currOwnershipAddr = ownership.addr; } for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } // Downsize the array to fit. assembly { mstore(tokenIds, tokenIdsIdx) } return tokenIds; } } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(totalSupply) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K pfp collections should be fine). */ function tokensOfOwner(address owner) external view override returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; address currOwnershipAddr; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); TokenOwnership memory ownership; for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } return tokenIds; } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.1.0 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of an ERC721AQueryable compliant contract. */ interface IERC721AQueryable is IERC721A { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * - `addr` = `address(0)` * - `startTimestamp` = `0` * - `burned` = `false` * * If the `tokenId` is burned: * - `addr` = `<Address of owner before token was burned>` * - `startTimestamp` = `<Timestamp when token was burned>` * - `burned = `true` * * Otherwise: * - `addr` = `<Address of owner>` * - `startTimestamp` = `<Timestamp of start of ownership>` * - `burned = `false` */ function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory); /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory); /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start` < `stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view returns (uint256[] memory); /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(totalSupply) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K pfp collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
{ "evmVersion": "istanbul", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"manager","type":"address"},{"internalType":"uint256","name":"_maxSupply","type":"uint256"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"string","name":"_contractURI","type":"string"},{"internalType":"address","name":"vrfCoordinator","type":"address"},{"internalType":"address","name":"link","type":"address"},{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyRevealed","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidMerkleProof","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MaxSupplyReached","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NotEnoughLink","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":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":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"}],"name":"RequestSeed","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":"string","name":"newURI","type":"string"}],"name":"SetBaseURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"oldRoot","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newRoot","type":"bytes32"}],"name":"SetRoot","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"seed","type":"uint256"}],"name":"SetSeed","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":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"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":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isRevealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"rawFulfillRandomness","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":[],"name":"reveal","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":[],"name":"root","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"seed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"newURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_root","type":"bytes32"}],"name":"setRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"keyHash","type":"bytes32"},{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"setVRFParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vrfFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vrfKeyHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60e06040523480156200001157600080fd5b5060405162002c0138038062002c018339810160408190526200003491620003d6565b604080518082018252601981527f4c61636f73746520554e4457333a2054686520456d65726765000000000000006020808301918252835180850190945260078452661153515491d15160ca1b908401528151879387939290916200009c9160029162000284565b508051620000b290600390602084019062000284565b5060008081556001600160601b0319606095861b811660a0529390941b90921660805250620000e49190508a6200012c565b620000ef886200013c565b620000fa866200018e565b60c087905284516200011490600f90602088019062000284565b50601091909155601155506200056195505050505050565b620001388282620001e0565b5050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8051620001a390600e90602084019062000284565b507f23c8c9488efebfd474e85a7956de6f39b17c7ab88502d42a623db2d8e382bbaa81604051620001d59190620004a6565b60405180910390a150565b60008281526008602090815260408083206001600160a01b038516845290915290205460ff16620001385760008281526008602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620002403390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b82805462000292906200050e565b90600052602060002090601f016020900481019282620002b6576000855562000301565b82601f10620002d157805160ff191683800117855562000301565b8280016001018555821562000301579182015b8281111562000301578251825591602001919060010190620002e4565b506200030f92915062000313565b5090565b5b808211156200030f576000815560010162000314565b80516001600160a01b03811681146200034257600080fd5b919050565b600082601f83011262000358578081fd5b81516001600160401b03808211156200037557620003756200054b565b604051601f8301601f19908116603f01168101908282118183101715620003a057620003a06200054b565b81604052838152866020858801011115620003b9578485fd5b620003cc846020830160208901620004db565b9695505050505050565b60008060008060008060008060006101208a8c031215620003f5578485fd5b620004008a6200032a565b98506200041060208b016200032a565b60408b015160608c015191995097506001600160401b038082111562000434578687fd5b620004428d838e0162000347565b975060808c015191508082111562000458578687fd5b50620004678c828d0162000347565b9550506200047860a08b016200032a565b93506200048860c08b016200032a565b925060e08a015191506101008a015190509295985092959850929598565b6020815260008251806020840152620004c7816040850160208701620004db565b601f01601f19169190910160400192915050565b60005b83811015620004f8578181015183820152602001620004de565b8381111562000508576000848401525b50505050565b600181811c908216806200052357607f821691505b602082108114156200054557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b60805160601c60a05160601c60c051612655620005ac600039600081816105000152610b69015260008181610d6f01526117af01526000818161106c015261178001526126556000f3fe608060405234801561001057600080fd5b50600436106102485760003560e01c80638462151c1161013b578063b88d4fde116100b8578063dab5f3401161007c578063dab5f34014610522578063e8a3d48514610535578063e985e9c51461053d578063ebf0c71714610579578063f2fde38b1461058257600080fd5b8063b88d4fde146104a2578063c23dc68f146104b5578063c87b56dd146104d5578063d547741f146104e8578063d5abeb01146104fb57600080fd5b806395d89b41116100ff57806395d89b411461046457806399a2557a1461046c578063a217fddf1461047f578063a22cb46514610487578063a475b5dd1461049a57600080fd5b80638462151c146103fa5780638da5cb5b1461041a57806391d148541461042b578063938e3d7b1461043e57806394985ddd1461045157600080fd5b80632f2ff15d116101c95780635bbb21771161018d5780635bbb2177146103985780636352211e146103b857806370a08231146103cb5780637bf32270146103de5780637d94792a146103f157600080fd5b80632f2ff15d1461033f57806336568abe146103525780633ae5213e1461036557806342842e0e1461037857806354214f691461038b57600080fd5b8063095ea7b311610210578063095ea7b3146102e15780631017507d146102f457806318160ddd146102fd57806323b872dd14610309578063248a9ca31461031c57600080fd5b806301ffc9a71461024d57806302fe530514610275578063041d443e1461028a57806306fdde03146102a1578063081812fc146102b6575b600080fd5b61026061025b366004612226565b610595565b60405190151581526020015b60405180910390f35b61028861028336600461225e565b6105d0565b005b61029360105481565b60405190815260200161026c565b6102a96105e8565b60405161026c91906124ae565b6102c96102c43660046121cb565b61067a565b6040516001600160a01b03909116815260200161026c565b6102886102ef3660046120ad565b6106be565b61029360115481565b60015460005403610293565b610288610317366004611f44565b61075e565b61029361032a3660046121cb565b60009081526008602052604090206001015490565b61028861034d3660046121e3565b6108ef565b6102886103603660046121e3565b610919565b610288610373366004612205565b610998565b610288610386366004611f44565b6109af565b600d546102609060ff1681565b6103ab6103a6366004612108565b6109ca565b60405161026c9190612434565b6102c96103c63660046121cb565b610ac1565b6102936103d9366004611ef8565b610acc565b6102886103ec366004611ff7565b610b1a565b610293600c5481565b61040d610408366004611ef8565b610bf0565b60405161026c9190612476565b600a546001600160a01b03166102c9565b6102606104393660046121e3565b610d1b565b61028861044c36600461225e565b610d46565b61028861045f366004612205565b610d64565b6102a9610de6565b61040d61047a3660046120d6565b610df5565b610293600081565b610288610495366004612077565b610f8e565b610293611024565b6102886104b0366004611f7f565b61116e565b6104c86104c33660046121cb565b6111b2565b60405161026c91906124c1565b6102a96104e33660046121cb565b61122a565b6102886104f63660046121e3565b6112ae565b6102937f000000000000000000000000000000000000000000000000000000000000000081565b6102886105303660046121cb565b6112d3565b6102a9611318565b61026061054b366004611f12565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b610293600b5481565b610288610590366004611ef8565b6113a6565b60006105a0826113ba565b806105af57506105af82611408565b806105ca57506307f5828d60e41b6001600160e01b03198316145b92915050565b60006105db8161143d565b6105e48261144a565b5050565b6060600280546105f790612579565b80601f016020809104026020016040519081016040528092919081815260200182805461062390612579565b80156106705780601f1061064557610100808354040283529160200191610670565b820191906000526020600020905b81548152906001019060200180831161065357829003601f168201915b5050505050905090565b600061068582611498565b6106a2576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60006106c982610ac1565b9050336001600160a01b03821614610702576106e5813361054b565b610702576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000610769826114bf565b9050836001600160a01b0316816001600160a01b03161461079c5760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b038816909114176107e9576107cc863361054b565b6107e957604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661081057604051633a954ecd60e21b815260040160405180910390fd5b801561081b57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040902055600160e11b83166108a657600184016000818152600460205260409020546108a45760005481146108a45760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b60008281526008602052604090206001015461090a8161143d565b6109148383611520565b505050565b6001600160a01b038116331461098e5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105e482826115a6565b60006109a38161143d565b50601091909155601155565b6109148383836040518060200160405280600081525061116e565b80516060906000816001600160401b038111156109f757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610a4957816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181610a155790505b50905060005b828114610ab957610a86858281518110610a7957634e487b7160e01b600052603260045260246000fd5b60200260200101516111b2565b828281518110610aa657634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600101610a4f565b509392505050565b60006105ca826114bf565b60006001600160a01b038216610af5576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b600083610b2a6001546000540390565b60405160609290921b6bffffffffffffffffffffffff1916602083015260348201526054016040516020818303038152906040528051906020012090507f0000000000000000000000000000000000000000000000000000000000000000610b956001546000540390565b1415610bb45760405163d05cb60960e01b815260040160405180910390fd5b610bc28383600b548461160d565b610bdf5760405163582f497d60e11b815260040160405180910390fd5b610bea846001611627565b50505050565b60606000806000610c0085610acc565b90506000816001600160401b03811115610c2a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610c53578160200160208202803683370190505b509050610c8060408051608081018252600080825260208201819052918101829052606081019190915290565b60005b838614610d0f57610c9381611704565b9150816040015115610ca457610d07565b81516001600160a01b031615610cb957815194505b876001600160a01b0316856001600160a01b03161415610d075780838780600101985081518110610cfa57634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505b600101610c83565b50909695505050505050565b60009182526008602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610d518161143d565b815161091490600f906020850190611df5565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610ddc5760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610985565b6105e48282611740565b6060600380546105f790612579565b6060818310610e1757604051631960ccad60e11b815260040160405180910390fd5b600080610e2360005490565b905080841115610e31578093505b6000610e3c87610acc565b905084861015610e5b5785850381811015610e55578091505b50610e5f565b5060005b6000816001600160401b03811115610e8757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610eb0578160200160208202803683370190505b50905081610ec3579350610f8792505050565b6000610ece886111b2565b905060008160400151610edf575080515b885b888114158015610ef15750848714155b15610f7b57610eff81611704565b9250826040015115610f1057610f73565b82516001600160a01b031615610f2557825191505b8a6001600160a01b0316826001600160a01b03161415610f735780848880600101995081518110610f6657634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505b600101610ee1565b50505092835250909150505b9392505050565b6001600160a01b038216331415610fb85760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000806110308161143d565b600d5460ff16156110545760405163a89ac15160e01b815260040160405180910390fd5b6011546040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a082319060240160206040518083038186803b1580156110b657600080fd5b505afa1580156110ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ee91906122a3565b101561110d576040516324d5d56760e11b815260040160405180910390fd5b600d805460ff1916600117905560105460115460009161112c9161177c565b90507fc9fb1069aa71a6c0d425d0ea73df68799061dfd5b9e73db451db5210f3057aab8160405161115f91815260200190565b60405180910390a191505b5090565b61117984848461075e565b6001600160a01b0383163b15610bea5761119584848484611907565b610bea576040516368d2bf6b60e11b815260040160405180910390fd5b60408051608080820183526000808352602080840182905283850182905260608085018390528551938401865282845290830182905293820181905292810183905290915060005483106112065792915050565b61120f83611704565b90508060400151156112215792915050565b610f87836119fb565b606061123582611498565b61125257604051630a14c4b560e41b815260040160405180910390fd5b600061125c611a30565b905080516000141561127d5760405180602001604052806000815250610f87565b8061128784611a3f565b604051602001611298929190612323565b6040516020818303038152906040529392505050565b6000828152600860205260409020600101546112c98161143d565b61091483836115a6565b60006112de8161143d565b600b805490839055604051839082907f47c6fa20e7c85465f2cf6b3948b04379e845605699f65d9c93809936d653dbc090600090a3505050565b600f805461132590612579565b80601f016020809104026020016040519081016040528092919081815260200182805461135190612579565b801561139e5780601f106113735761010080835404028352916020019161139e565b820191906000526020600020905b81548152906001019060200180831161138157829003601f168201915b505050505081565b60006113b18161143d565b6105e482611a8e565b60006301ffc9a760e01b6001600160e01b0319831614806113eb57506380ac58cd60e01b6001600160e01b03198316145b806105ca5750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b03198216637965db0b60e01b14806105ca57506301ffc9a760e01b6001600160e01b03198316146105ca565b6114478133611ae0565b50565b805161145d90600e906020840190611df5565b507f23c8c9488efebfd474e85a7956de6f39b17c7ab88502d42a623db2d8e382bbaa8160405161148d91906124ae565b60405180910390a150565b60008054821080156105ca575050600090815260046020526040902054600160e01b161590565b60008160005481101561150757600081815260046020526040902054600160e01b8116611505575b80610f875750600019016000818152600460205260409020546114e7565b505b604051636f96cda160e11b815260040160405180910390fd5b61152a8282610d1b565b6105e45760008281526008602090815260408083206001600160a01b03851684529091529020805460ff191660011790556115623390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6115b08282610d1b565b156105e45760008281526008602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008261161b868685611b44565b1490505b949350505050565b6000546001600160a01b03831661165057604051622e076360e81b815260040160405180910390fd5b8161166e5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038316600081815260056020526040902080546801000000000000000185020190554260a01b6001841460e11b1717600082815260046020526040902055808281015b6040516001830192906001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48082106116b85760005550505050565b6040805160808101825260008082526020820181905291810182905260608101919091526000828152600460205260409020546105ca90611b9e565b600c8190556040518181527f6a9cc4527f7248c017f54010aaeee552b5bd1c1b7a7b20b02d61d9e45ea7df599060200160405180910390a15050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f0000000000000000000000000000000000000000000000000000000000000000848660006040516020016117ec929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161181993929190612404565b602060405180830381600087803b15801561183357600080fd5b505af1158015611847573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186b91906121af565b50600083815260096020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529190526118c79060016124ff565b60008581526009602052604090205561161f8482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061193c9033908990889088906004016123c7565b602060405180830381600087803b15801561195657600080fd5b505af1925050508015611986575060408051601f3d908101601f1916820190925261198391810190612242565b60015b6119e1573d8080156119b4576040519150601f19603f3d011682016040523d82523d6000602084013e6119b9565b606091505b5080516119d9576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061161f565b6040805160808101825260008082526020820181905291810182905260608101919091526105ca611a2b836114bf565b611b9e565b6060600e80546105f790612579565b604080516080810191829052607f0190826030600a8206018353600a90045b8015611a7c57600183039250600a81066030018353600a9004611a5e565b50819003601f19909101908152919050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611aea8282610d1b565b6105e457611b02816001600160a01b03166014611be5565b611b0d836020611be5565b604051602001611b1e929190612352565b60408051601f198184030181529082905262461bcd60e51b8252610985916004016124ae565b600081815b84811015611b9557611b8182878784818110611b7557634e487b7160e01b600052603260045260246000fd5b90506020020135611dc6565b915080611b8d816125b4565b915050611b49565b50949350505050565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b60606000611bf4836002612517565b611bff9060026124ff565b6001600160401b03811115611c2457634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611c4e576020820181803683370190505b509050600360fc1b81600081518110611c7757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611cb457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000611cd8846002612517565b611ce39060016124ff565b90505b6001811115611d77576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611d2557634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110611d4957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93611d7081612562565b9050611ce6565b508315610f875760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610985565b6000818310611de2576000828152602084905260409020610f87565b6000838152602083905260409020610f87565b828054611e0190612579565b90600052602060002090601f016020900481019282611e235760008555611e69565b82601f10611e3c57805160ff1916838001178555611e69565b82800160010185558215611e69579182015b82811115611e69578251825591602001919060010190611e4e565b5061116a9291505b8082111561116a5760008155600101611e71565b60006001600160401b03831115611e9e57611e9e6125e5565b611eb1601f8401601f19166020016124cf565b9050828152838383011115611ec557600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b0381168114611ef357600080fd5b919050565b600060208284031215611f09578081fd5b610f8782611edc565b60008060408385031215611f24578081fd5b611f2d83611edc565b9150611f3b60208401611edc565b90509250929050565b600080600060608486031215611f58578081fd5b611f6184611edc565b9250611f6f60208501611edc565b9150604084013590509250925092565b60008060008060808587031215611f94578081fd5b611f9d85611edc565b9350611fab60208601611edc565b92506040850135915060608501356001600160401b03811115611fcc578182fd5b8501601f81018713611fdc578182fd5b611feb87823560208401611e85565b91505092959194509250565b60008060006040848603121561200b578283fd5b61201484611edc565b925060208401356001600160401b038082111561202f578384fd5b818601915086601f830112612042578384fd5b813581811115612050578485fd5b8760208260051b8501011115612064578485fd5b6020830194508093505050509250925092565b60008060408385031215612089578182fd5b61209283611edc565b915060208301356120a2816125fb565b809150509250929050565b600080604083850312156120bf578182fd5b6120c883611edc565b946020939093013593505050565b6000806000606084860312156120ea578283fd5b6120f384611edc565b95602085013595506040909401359392505050565b6000602080838503121561211a578182fd5b82356001600160401b0380821115612130578384fd5b818501915085601f830112612143578384fd5b813581811115612155576121556125e5565b8060051b91506121668483016124cf565b8181528481019084860184860187018a1015612180578788fd5b8795505b838610156121a2578035835260019590950194918601918601612184565b5098975050505050505050565b6000602082840312156121c0578081fd5b8151610f87816125fb565b6000602082840312156121dc578081fd5b5035919050565b600080604083850312156121f5578182fd5b82359150611f3b60208401611edc565b60008060408385031215612217578182fd5b50508035926020909101359150565b600060208284031215612237578081fd5b8135610f8781612609565b600060208284031215612253578081fd5b8151610f8781612609565b60006020828403121561226f578081fd5b81356001600160401b03811115612284578182fd5b8201601f81018413612294578182fd5b61161f84823560208401611e85565b6000602082840312156122b4578081fd5b5051919050565b600081518084526122d3816020860160208601612536565b601f01601f19169290920160200192915050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b60008351612335818460208801612536565b835190830190612349818360208801612536565b01949350505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161238a816017850160208801612536565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516123bb816028840160208801612536565b01602801949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906123fa908301846122bb565b9695505050505050565b60018060a01b038416815282602082015260606040820152600061242b60608301846122bb565b95945050505050565b6020808252825182820181905260009190848201906040850190845b81811015610d0f576124638385516122e7565b9284019260809290920191600101612450565b6020808252825182820181905260009190848201906040850190845b81811015610d0f57835183529284019291840191600101612492565b602081526000610f8760208301846122bb565b608081016105ca82846122e7565b604051601f8201601f191681016001600160401b03811182821017156124f7576124f76125e5565b604052919050565b60008219821115612512576125126125cf565b500190565b6000816000190483118215151615612531576125316125cf565b500290565b60005b83811015612551578181015183820152602001612539565b83811115610bea5750506000910152565b600081612571576125716125cf565b506000190190565b600181811c9082168061258d57607f821691505b602082108114156125ae57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156125c8576125c86125cf565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b801515811461144757600080fd5b6001600160e01b03198116811461144757600080fdfea264697066735822122004f9fa76fa57aa4fb19591965a509dae8c9cca4b8f77ba292972504672add89d64736f6c634300080400330000000000000000000000005d2c752f94b717e36d962ec050b0844ce460188b0000000000000000000000009adf72c03cb5fbd0f8bec9d0ba96a76b52819b9b0000000000000000000000000000000000000000000000000000000000002bcc000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952000000000000000000000000514910771af9ca656af840dff83e8264ecf986caaa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af4450000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000000000000000043697066733a2f2f6261667962656968747235693478756733347967716b687a6d6173616e6d757865636b757768366b3733666873696c7a6a377776363777367475342f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050697066733a2f2f6261667962656964626b79357567753562677a766d6d63696175696b6e79627a6e626677326b7375376c79627632636d32327633727133786b6f6d2f636f6e74726163742e6a736f6e00000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102485760003560e01c80638462151c1161013b578063b88d4fde116100b8578063dab5f3401161007c578063dab5f34014610522578063e8a3d48514610535578063e985e9c51461053d578063ebf0c71714610579578063f2fde38b1461058257600080fd5b8063b88d4fde146104a2578063c23dc68f146104b5578063c87b56dd146104d5578063d547741f146104e8578063d5abeb01146104fb57600080fd5b806395d89b41116100ff57806395d89b411461046457806399a2557a1461046c578063a217fddf1461047f578063a22cb46514610487578063a475b5dd1461049a57600080fd5b80638462151c146103fa5780638da5cb5b1461041a57806391d148541461042b578063938e3d7b1461043e57806394985ddd1461045157600080fd5b80632f2ff15d116101c95780635bbb21771161018d5780635bbb2177146103985780636352211e146103b857806370a08231146103cb5780637bf32270146103de5780637d94792a146103f157600080fd5b80632f2ff15d1461033f57806336568abe146103525780633ae5213e1461036557806342842e0e1461037857806354214f691461038b57600080fd5b8063095ea7b311610210578063095ea7b3146102e15780631017507d146102f457806318160ddd146102fd57806323b872dd14610309578063248a9ca31461031c57600080fd5b806301ffc9a71461024d57806302fe530514610275578063041d443e1461028a57806306fdde03146102a1578063081812fc146102b6575b600080fd5b61026061025b366004612226565b610595565b60405190151581526020015b60405180910390f35b61028861028336600461225e565b6105d0565b005b61029360105481565b60405190815260200161026c565b6102a96105e8565b60405161026c91906124ae565b6102c96102c43660046121cb565b61067a565b6040516001600160a01b03909116815260200161026c565b6102886102ef3660046120ad565b6106be565b61029360115481565b60015460005403610293565b610288610317366004611f44565b61075e565b61029361032a3660046121cb565b60009081526008602052604090206001015490565b61028861034d3660046121e3565b6108ef565b6102886103603660046121e3565b610919565b610288610373366004612205565b610998565b610288610386366004611f44565b6109af565b600d546102609060ff1681565b6103ab6103a6366004612108565b6109ca565b60405161026c9190612434565b6102c96103c63660046121cb565b610ac1565b6102936103d9366004611ef8565b610acc565b6102886103ec366004611ff7565b610b1a565b610293600c5481565b61040d610408366004611ef8565b610bf0565b60405161026c9190612476565b600a546001600160a01b03166102c9565b6102606104393660046121e3565b610d1b565b61028861044c36600461225e565b610d46565b61028861045f366004612205565b610d64565b6102a9610de6565b61040d61047a3660046120d6565b610df5565b610293600081565b610288610495366004612077565b610f8e565b610293611024565b6102886104b0366004611f7f565b61116e565b6104c86104c33660046121cb565b6111b2565b60405161026c91906124c1565b6102a96104e33660046121cb565b61122a565b6102886104f63660046121e3565b6112ae565b6102937f0000000000000000000000000000000000000000000000000000000000002bcc81565b6102886105303660046121cb565b6112d3565b6102a9611318565b61026061054b366004611f12565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b610293600b5481565b610288610590366004611ef8565b6113a6565b60006105a0826113ba565b806105af57506105af82611408565b806105ca57506307f5828d60e41b6001600160e01b03198316145b92915050565b60006105db8161143d565b6105e48261144a565b5050565b6060600280546105f790612579565b80601f016020809104026020016040519081016040528092919081815260200182805461062390612579565b80156106705780601f1061064557610100808354040283529160200191610670565b820191906000526020600020905b81548152906001019060200180831161065357829003601f168201915b5050505050905090565b600061068582611498565b6106a2576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b60006106c982610ac1565b9050336001600160a01b03821614610702576106e5813361054b565b610702576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000610769826114bf565b9050836001600160a01b0316816001600160a01b03161461079c5760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b038816909114176107e9576107cc863361054b565b6107e957604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661081057604051633a954ecd60e21b815260040160405180910390fd5b801561081b57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040902055600160e11b83166108a657600184016000818152600460205260409020546108a45760005481146108a45760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b60008281526008602052604090206001015461090a8161143d565b6109148383611520565b505050565b6001600160a01b038116331461098e5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105e482826115a6565b60006109a38161143d565b50601091909155601155565b6109148383836040518060200160405280600081525061116e565b80516060906000816001600160401b038111156109f757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610a4957816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181610a155790505b50905060005b828114610ab957610a86858281518110610a7957634e487b7160e01b600052603260045260246000fd5b60200260200101516111b2565b828281518110610aa657634e487b7160e01b600052603260045260246000fd5b6020908102919091010152600101610a4f565b509392505050565b60006105ca826114bf565b60006001600160a01b038216610af5576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b600083610b2a6001546000540390565b60405160609290921b6bffffffffffffffffffffffff1916602083015260348201526054016040516020818303038152906040528051906020012090507f0000000000000000000000000000000000000000000000000000000000002bcc610b956001546000540390565b1415610bb45760405163d05cb60960e01b815260040160405180910390fd5b610bc28383600b548461160d565b610bdf5760405163582f497d60e11b815260040160405180910390fd5b610bea846001611627565b50505050565b60606000806000610c0085610acc565b90506000816001600160401b03811115610c2a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610c53578160200160208202803683370190505b509050610c8060408051608081018252600080825260208201819052918101829052606081019190915290565b60005b838614610d0f57610c9381611704565b9150816040015115610ca457610d07565b81516001600160a01b031615610cb957815194505b876001600160a01b0316856001600160a01b03161415610d075780838780600101985081518110610cfa57634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505b600101610c83565b50909695505050505050565b60009182526008602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610d518161143d565b815161091490600f906020850190611df5565b336001600160a01b037f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb79521614610ddc5760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610985565b6105e48282611740565b6060600380546105f790612579565b6060818310610e1757604051631960ccad60e11b815260040160405180910390fd5b600080610e2360005490565b905080841115610e31578093505b6000610e3c87610acc565b905084861015610e5b5785850381811015610e55578091505b50610e5f565b5060005b6000816001600160401b03811115610e8757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610eb0578160200160208202803683370190505b50905081610ec3579350610f8792505050565b6000610ece886111b2565b905060008160400151610edf575080515b885b888114158015610ef15750848714155b15610f7b57610eff81611704565b9250826040015115610f1057610f73565b82516001600160a01b031615610f2557825191505b8a6001600160a01b0316826001600160a01b03161415610f735780848880600101995081518110610f6657634e487b7160e01b600052603260045260246000fd5b6020026020010181815250505b600101610ee1565b50505092835250909150505b9392505050565b6001600160a01b038216331415610fb85760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000806110308161143d565b600d5460ff16156110545760405163a89ac15160e01b815260040160405180910390fd5b6011546040516370a0823160e01b81523060048201527f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316906370a082319060240160206040518083038186803b1580156110b657600080fd5b505afa1580156110ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ee91906122a3565b101561110d576040516324d5d56760e11b815260040160405180910390fd5b600d805460ff1916600117905560105460115460009161112c9161177c565b90507fc9fb1069aa71a6c0d425d0ea73df68799061dfd5b9e73db451db5210f3057aab8160405161115f91815260200190565b60405180910390a191505b5090565b61117984848461075e565b6001600160a01b0383163b15610bea5761119584848484611907565b610bea576040516368d2bf6b60e11b815260040160405180910390fd5b60408051608080820183526000808352602080840182905283850182905260608085018390528551938401865282845290830182905293820181905292810183905290915060005483106112065792915050565b61120f83611704565b90508060400151156112215792915050565b610f87836119fb565b606061123582611498565b61125257604051630a14c4b560e41b815260040160405180910390fd5b600061125c611a30565b905080516000141561127d5760405180602001604052806000815250610f87565b8061128784611a3f565b604051602001611298929190612323565b6040516020818303038152906040529392505050565b6000828152600860205260409020600101546112c98161143d565b61091483836115a6565b60006112de8161143d565b600b805490839055604051839082907f47c6fa20e7c85465f2cf6b3948b04379e845605699f65d9c93809936d653dbc090600090a3505050565b600f805461132590612579565b80601f016020809104026020016040519081016040528092919081815260200182805461135190612579565b801561139e5780601f106113735761010080835404028352916020019161139e565b820191906000526020600020905b81548152906001019060200180831161138157829003601f168201915b505050505081565b60006113b18161143d565b6105e482611a8e565b60006301ffc9a760e01b6001600160e01b0319831614806113eb57506380ac58cd60e01b6001600160e01b03198316145b806105ca5750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b03198216637965db0b60e01b14806105ca57506301ffc9a760e01b6001600160e01b03198316146105ca565b6114478133611ae0565b50565b805161145d90600e906020840190611df5565b507f23c8c9488efebfd474e85a7956de6f39b17c7ab88502d42a623db2d8e382bbaa8160405161148d91906124ae565b60405180910390a150565b60008054821080156105ca575050600090815260046020526040902054600160e01b161590565b60008160005481101561150757600081815260046020526040902054600160e01b8116611505575b80610f875750600019016000818152600460205260409020546114e7565b505b604051636f96cda160e11b815260040160405180910390fd5b61152a8282610d1b565b6105e45760008281526008602090815260408083206001600160a01b03851684529091529020805460ff191660011790556115623390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6115b08282610d1b565b156105e45760008281526008602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60008261161b868685611b44565b1490505b949350505050565b6000546001600160a01b03831661165057604051622e076360e81b815260040160405180910390fd5b8161166e5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038316600081815260056020526040902080546801000000000000000185020190554260a01b6001841460e11b1717600082815260046020526040902055808281015b6040516001830192906001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48082106116b85760005550505050565b6040805160808101825260008082526020820181905291810182905260608101919091526000828152600460205260409020546105ca90611b9e565b600c8190556040518181527f6a9cc4527f7248c017f54010aaeee552b5bd1c1b7a7b20b02d61d9e45ea7df599060200160405180910390a15050565b60007f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316634000aea07f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952848660006040516020016117ec929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161181993929190612404565b602060405180830381600087803b15801561183357600080fd5b505af1158015611847573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186b91906121af565b50600083815260096020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529190526118c79060016124ff565b60008581526009602052604090205561161f8482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061193c9033908990889088906004016123c7565b602060405180830381600087803b15801561195657600080fd5b505af1925050508015611986575060408051601f3d908101601f1916820190925261198391810190612242565b60015b6119e1573d8080156119b4576040519150601f19603f3d011682016040523d82523d6000602084013e6119b9565b606091505b5080516119d9576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061161f565b6040805160808101825260008082526020820181905291810182905260608101919091526105ca611a2b836114bf565b611b9e565b6060600e80546105f790612579565b604080516080810191829052607f0190826030600a8206018353600a90045b8015611a7c57600183039250600a81066030018353600a9004611a5e565b50819003601f19909101908152919050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611aea8282610d1b565b6105e457611b02816001600160a01b03166014611be5565b611b0d836020611be5565b604051602001611b1e929190612352565b60408051601f198184030181529082905262461bcd60e51b8252610985916004016124ae565b600081815b84811015611b9557611b8182878784818110611b7557634e487b7160e01b600052603260045260246000fd5b90506020020135611dc6565b915080611b8d816125b4565b915050611b49565b50949350505050565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b60606000611bf4836002612517565b611bff9060026124ff565b6001600160401b03811115611c2457634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611c4e576020820181803683370190505b509050600360fc1b81600081518110611c7757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611cb457634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000611cd8846002612517565b611ce39060016124ff565b90505b6001811115611d77576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611d2557634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110611d4957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93611d7081612562565b9050611ce6565b508315610f875760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610985565b6000818310611de2576000828152602084905260409020610f87565b6000838152602083905260409020610f87565b828054611e0190612579565b90600052602060002090601f016020900481019282611e235760008555611e69565b82601f10611e3c57805160ff1916838001178555611e69565b82800160010185558215611e69579182015b82811115611e69578251825591602001919060010190611e4e565b5061116a9291505b8082111561116a5760008155600101611e71565b60006001600160401b03831115611e9e57611e9e6125e5565b611eb1601f8401601f19166020016124cf565b9050828152838383011115611ec557600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b0381168114611ef357600080fd5b919050565b600060208284031215611f09578081fd5b610f8782611edc565b60008060408385031215611f24578081fd5b611f2d83611edc565b9150611f3b60208401611edc565b90509250929050565b600080600060608486031215611f58578081fd5b611f6184611edc565b9250611f6f60208501611edc565b9150604084013590509250925092565b60008060008060808587031215611f94578081fd5b611f9d85611edc565b9350611fab60208601611edc565b92506040850135915060608501356001600160401b03811115611fcc578182fd5b8501601f81018713611fdc578182fd5b611feb87823560208401611e85565b91505092959194509250565b60008060006040848603121561200b578283fd5b61201484611edc565b925060208401356001600160401b038082111561202f578384fd5b818601915086601f830112612042578384fd5b813581811115612050578485fd5b8760208260051b8501011115612064578485fd5b6020830194508093505050509250925092565b60008060408385031215612089578182fd5b61209283611edc565b915060208301356120a2816125fb565b809150509250929050565b600080604083850312156120bf578182fd5b6120c883611edc565b946020939093013593505050565b6000806000606084860312156120ea578283fd5b6120f384611edc565b95602085013595506040909401359392505050565b6000602080838503121561211a578182fd5b82356001600160401b0380821115612130578384fd5b818501915085601f830112612143578384fd5b813581811115612155576121556125e5565b8060051b91506121668483016124cf565b8181528481019084860184860187018a1015612180578788fd5b8795505b838610156121a2578035835260019590950194918601918601612184565b5098975050505050505050565b6000602082840312156121c0578081fd5b8151610f87816125fb565b6000602082840312156121dc578081fd5b5035919050565b600080604083850312156121f5578182fd5b82359150611f3b60208401611edc565b60008060408385031215612217578182fd5b50508035926020909101359150565b600060208284031215612237578081fd5b8135610f8781612609565b600060208284031215612253578081fd5b8151610f8781612609565b60006020828403121561226f578081fd5b81356001600160401b03811115612284578182fd5b8201601f81018413612294578182fd5b61161f84823560208401611e85565b6000602082840312156122b4578081fd5b5051919050565b600081518084526122d3816020860160208601612536565b601f01601f19169290920160200192915050565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b60008351612335818460208801612536565b835190830190612349818360208801612536565b01949350505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161238a816017850160208801612536565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516123bb816028840160208801612536565b01602801949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906123fa908301846122bb565b9695505050505050565b60018060a01b038416815282602082015260606040820152600061242b60608301846122bb565b95945050505050565b6020808252825182820181905260009190848201906040850190845b81811015610d0f576124638385516122e7565b9284019260809290920191600101612450565b6020808252825182820181905260009190848201906040850190845b81811015610d0f57835183529284019291840191600101612492565b602081526000610f8760208301846122bb565b608081016105ca82846122e7565b604051601f8201601f191681016001600160401b03811182821017156124f7576124f76125e5565b604052919050565b60008219821115612512576125126125cf565b500190565b6000816000190483118215151615612531576125316125cf565b500290565b60005b83811015612551578181015183820152602001612539565b83811115610bea5750506000910152565b600081612571576125716125cf565b506000190190565b600181811c9082168061258d57607f821691505b602082108114156125ae57634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156125c8576125c86125cf565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b801515811461144757600080fd5b6001600160e01b03198116811461144757600080fdfea264697066735822122004f9fa76fa57aa4fb19591965a509dae8c9cca4b8f77ba292972504672add89d64736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005d2c752f94b717e36d962ec050b0844ce460188b0000000000000000000000009adf72c03cb5fbd0f8bec9d0ba96a76b52819b9b0000000000000000000000000000000000000000000000000000000000002bcc000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952000000000000000000000000514910771af9ca656af840dff83e8264ecf986caaa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af4450000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000000000000000043697066733a2f2f6261667962656968747235693478756733347967716b687a6d6173616e6d757865636b757768366b3733666873696c7a6a377776363777367475342f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050697066733a2f2f6261667962656964626b79357567753562677a766d6d63696175696b6e79627a6e626677326b7375376c79627632636d32327633727133786b6f6d2f636f6e74726163742e6a736f6e00000000000000000000000000000000
-----Decoded View---------------
Arg [0] : admin (address): 0x5d2C752f94B717E36d962ec050B0844Ce460188b
Arg [1] : manager (address): 0x9Adf72c03cb5fbD0f8bEc9D0ba96A76B52819B9B
Arg [2] : _maxSupply (uint256): 11212
Arg [3] : uri (string): ipfs://bafybeihtr5i4xug34ygqkhzmasanmuxeckuwh6k73fhsilzj7wv67w6tu4/
Arg [4] : _contractURI (string): ipfs://bafybeidbky5ugu5bgzvmmciauiknybznbfw2ksu7lybv2cm22v3rq3xkom/contract.json
Arg [5] : vrfCoordinator (address): 0xf0d54349aDdcf704F77AE15b96510dEA15cb7952
Arg [6] : link (address): 0x514910771AF9Ca656af840dff83E8264EcF986CA
Arg [7] : keyHash (bytes32): 0xaa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445
Arg [8] : fee (uint256): 2000000000000000000
-----Encoded View---------------
17 Constructor Arguments found :
Arg [0] : 0000000000000000000000005d2c752f94b717e36d962ec050b0844ce460188b
Arg [1] : 0000000000000000000000009adf72c03cb5fbd0f8bec9d0ba96a76b52819b9b
Arg [2] : 0000000000000000000000000000000000000000000000000000000000002bcc
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [4] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [5] : 000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952
Arg [6] : 000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
Arg [7] : aa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445
Arg [8] : 0000000000000000000000000000000000000000000000001bc16d674ec80000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000043
Arg [10] : 697066733a2f2f6261667962656968747235693478756733347967716b687a6d
Arg [11] : 6173616e6d757865636b757768366b3733666873696c7a6a3777763637773674
Arg [12] : 75342f0000000000000000000000000000000000000000000000000000000000
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000050
Arg [14] : 697066733a2f2f6261667962656964626b79357567753562677a766d6d636961
Arg [15] : 75696b6e79627a6e626677326b7375376c79627632636d32327633727133786b
Arg [16] : 6f6d2f636f6e74726163742e6a736f6e00000000000000000000000000000000
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.