ERC-721
Overview
Max Total Supply
260 NS
Holders
142
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
2 NSLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
NaturalStatic
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity ^0.8.17; import {ERC721A} from "ERC721A/ERC721A.sol"; import {MerkleProof} from "openzeppelin/utils/cryptography/MerkleProof.sol"; import {Strings} from "openzeppelin/utils/Strings.sol"; import {Base64} from "openzeppelin/utils/Base64.sol"; import {Ownable} from "openzeppelin/access/Ownable.sol"; import "solady/src/utils/SafeTransferLib.sol"; import "openzeppelin/token/common/ERC2981.sol"; import {IDelegationRegistry} from "delegate-registry/src/IDelegationRegistry.sol"; import "artblocks-contracts/contracts/libs/0.8.x/BytecodeStorage.sol"; // errors error NotAllowListed(); error NotDelegate(); error PriceIncorrect(); error MintSupplyExceeded(); error MaxMintExceeded(); error NotAllowListPhase(); error NotPublicMintPhase(); error IndexOutOfRange(); error CodeFrozen(); contract NaturalStatic is ERC721A, Ownable, ERC2981 { using BytecodeStorage for string; event Minted(uint256 tokenId, uint256 seed); enum PHASE { NOT_ACTIVE, ALLOW_LIST, PUBLIC_MINT } // constants uint256 public constant MINT_SUPPLY = 416; uint256 public constant MINT_PRICE = 0.1 ether; uint256 public constant ALLOWLIST_MINT_PRICE = 0.1 ether; address private constant _DELEGATION_REGISTRY = 0x00000000000076A84feF008CDAbe6409d2FE638B; string private constant _DESCRIPTION = "Natural Static is a generative NFT series that feeds video of natural motion into a pixel-based water simulation, creating representations of physical motion that are highly digital and deeply analog. Jonathan Chomko, 2023."; string[] private VIDEO_SPEEDS = ["Normal", "Half"]; string[] private FEEDBACK_MODE = ["Increment", "Decrement", "RGBIncrement", "RGBDecrement"]; string[] private COLOUR_MODES = [ "Gold", "RedBlue", "Blue", "Dark", "Light", "Gray", "Actual", "RGBRedBlue", "RGBLight", "RGBGold", "RGBDark", "RGBBlue", "RGBGray" ]; string public baseURI = "https://arweave.net/OxlirWSVjrnevbd2CmZStX7BnWcKJx_mrQzDd8kVNhI"; bytes32 public merkleRoot = 0x53980f941adfd166a42bf508a6ea690541eb1096e6db49a28c86461dc84c4cc1; address public fundsRecipient = 0x1A3E3367A39BEc5c710095f0F81fC5ED422860B1; mapping(uint256 => uint256) private _artworkSeeds; bool public isCodeFrozen = false; mapping(uint256 => address) public projectScriptChunks; uint8 public phase = uint8(PHASE.NOT_ACTIVE); constructor() ERC721A("Natural Static", "NS") { _setDefaultRoyalty(fundsRecipient, 1000); } // script writing and reading function addProjectScript(string memory script, uint256 index) external onlyOwner { if (isCodeFrozen) revert CodeFrozen(); address scriptChunk = script.writeToBytecode(); projectScriptChunks[index] = scriptChunk; } function readProjectScript(uint256 index) external view returns (string memory) { return BytecodeStorage.readFromBytecode(projectScriptChunks[index]); } function freezeCode() external onlyOwner { isCodeFrozen = true; } // setters function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner { merkleRoot = _merkleRoot; } function setBaseURI(string memory _baseURI) external onlyOwner { baseURI = _baseURI; } function setFundsRecipient(address _fundsRecipient) external onlyOwner { fundsRecipient = _fundsRecipient; } function setDefaultRoyalty(address _royaltyRecipient, uint96 _feeNumerator) external onlyOwner { _setDefaultRoyalty(_royaltyRecipient, _feeNumerator); } function setPhase(uint256 newPhase) external onlyOwner { phase = uint8(newPhase); } // mint function mintAllowList(uint256 _quantity, bytes32[] calldata _proof) external payable onlyWhenAllowlistPhase isBelowOrEqualsMintSupply(_quantity) { if (_quantity > 5) revert MaxMintExceeded(); if (!isAllowListed(msg.sender, _proof)) revert NotAllowListed(); uint256 totalPrice = ALLOWLIST_MINT_PRICE * _quantity; if (msg.value != totalPrice) revert PriceIncorrect(); _adminMint(msg.sender, _quantity); } function mintAllowListAsDelegate(uint256 _quantity, address vault, bytes32[] calldata _proof) external payable onlyWhenAllowlistPhase isBelowOrEqualsMintSupply(_quantity) { if (_quantity > 5) revert MaxMintExceeded(); if (!IDelegationRegistry(_DELEGATION_REGISTRY).checkDelegateForAll(msg.sender, vault)) revert NotDelegate(); if (!isAllowListed(vault, _proof)) revert NotAllowListed(); uint256 totalPrice = ALLOWLIST_MINT_PRICE * _quantity; if (msg.value != totalPrice) revert PriceIncorrect(); _adminMint(msg.sender, _quantity); } function mint(uint256 _quantity) external payable onlyWhenPublicMintPhase isBelowOrEqualsMintSupply(_quantity) { if (_quantity > 5) revert MaxMintExceeded(); uint256 totalPrice = MINT_PRICE * _quantity; if (msg.value != totalPrice) revert PriceIncorrect(); _adminMint(msg.sender, _quantity); } function adminMint(address _to, uint256 _quantity) external onlyOwner isBelowOrEqualsMintSupply(_quantity) { _adminMint(_to, _quantity); } function _adminMint(address _to, uint256 _quantity) internal { uint256 newTokenId; for (uint256 i = 0; i < _quantity; i++) { newTokenId = _totalMinted() + i; _createArtworkSeed(newTokenId); emit Minted(newTokenId, _artworkSeeds[newTokenId]); } _mint(_to, _quantity); } function isAllowListed(address _wallet, bytes32[] calldata _proof) public view returns (bool) { return MerkleProof.verify(_proof, merkleRoot, keccak256(abi.encodePacked(_wallet))); } // metadata function _createArtworkSeed(uint256 tokenId) internal { _artworkSeeds[tokenId] = uint256(keccak256(abi.encodePacked(block.timestamp, msg.sender, tokenId))); } function getArtworkSeed(uint256 tokenId) external view returns (uint256) { return _artworkSeeds[tokenId]; } function generateValueFromSeed(uint256 seed, uint8 index, uint256 range) internal pure returns (uint256) { if (index > 31) revert IndexOutOfRange(); return ((seed >> (index * 8)) & 0xFF) % range; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { return generateURIFromBase(tokenId, baseURI); } function generateURIFromBase(uint256 tokenId, string memory _baseURI) public view virtual returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); uint256 seed = _artworkSeeds[tokenId]; string memory animationUrl = string( abi.encodePacked(_baseURI, "/index.html?hash=", Strings.toString(seed), "&videobase=", _baseURI, "/videos") ); string memory imageUrl = string(abi.encodePacked(_baseURI, "/thumbnails/", Strings.toString(tokenId), ".gif")); string memory json = Base64.encode( bytes( string( abi.encodePacked( '{"name": "Natural Static #', Strings.toString(tokenId), '", "description": "', _DESCRIPTION, "\\n \\nFullscreen: ", animationUrl, "\\n \\nVideo Info: ", getVideoInfo(tokenId), '", "image": "', imageUrl, '", "animation_url": "', animationUrl, '", ', _generateTraits(tokenId), "}" ) ) ) ); string memory output = string(abi.encodePacked("data:application/json;base64,", json)); return output; } function getVideoInfo(uint256 tokenId) public view virtual returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); return string(abi.encodePacked(baseURI, "/video-info/", Strings.toString(tokenId), ".json")); } function _generateTraits(uint256 tokenId) internal view returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); uint256 seed = _artworkSeeds[tokenId]; string[5] memory traits = ["Video", "Video Speed", "Feedback Direction", "Feedback Speed", "Colour Mode"]; uint256[5] memory traitValues = _generateTraitValues(seed); string[5] memory traitStrings; // video id traitStrings[0] = Strings.toString(traitValues[0]); // video speed traitStrings[1] = VIDEO_SPEEDS[traitValues[1]]; // feedback direction traitStrings[2] = FEEDBACK_MODE[traitValues[2]]; // feedback speed traitStrings[3] = Strings.toString(traitValues[3]); // colour mode traitStrings[4] = COLOUR_MODES[traitValues[4]]; string memory output = string(abi.encodePacked('"attributes": [')); for (uint256 i = 0; i < traits.length; i++) { if (i > 0) { output = string(abi.encodePacked(output, ",")); } output = string(abi.encodePacked(output, _generateTrait(traits[i], traitStrings[i]))); } output = string(abi.encodePacked(output, "]")); return output; } function _generateTraitValues(uint256 seed) internal view returns (uint256[5] memory) { uint256[5] memory traitValues; uint256 feedbackMode = generateValueFromSeed(seed, 2, FEEDBACK_MODE.length); uint256 colorMode; uint256 feedbackSpeed; if (feedbackMode == 0) { colorMode = generateValueFromSeed(seed, 3, 9); } else if (feedbackMode == 1) { colorMode = generateValueFromSeed(seed, 3, 9); } else if (feedbackMode == 2) { colorMode = generateValueFromSeed(seed, 3, 7) + 5; } else if (feedbackMode == 3) { colorMode = generateValueFromSeed(seed, 3, 5) + 7; } if (feedbackMode < 2) { feedbackSpeed = generateValueFromSeed(seed, 5, 3) + 2; } else { feedbackSpeed = generateValueFromSeed(seed, 5, 4) + 2; } traitValues[0] = generateValueFromSeed(seed, 0, 208); traitValues[1] = generateValueFromSeed(seed, 1, VIDEO_SPEEDS.length); traitValues[2] = feedbackMode; traitValues[3] = feedbackSpeed; traitValues[4] = colorMode; return traitValues; } function _generateTrait(string memory traitType, string memory value) internal pure returns (string memory) { return string(abi.encodePacked('{"trait_type": "', traitType, '", "value": "', value, '"}')); } // withdraw function withdraw() external payable onlyOwner { uint256 balance = address(this).balance; SafeTransferLib.forceSafeTransferETH(fundsRecipient, balance); } // modifiers modifier isBelowOrEqualsMintSupply(uint256 _amount) { if ((_totalMinted() + _amount) > MINT_SUPPLY) revert MintSupplyExceeded(); _; } modifier onlyWhenAllowlistPhase() { if (phase != uint8(PHASE.ALLOW_LIST)) revert NotAllowListPhase(); _; } modifier onlyWhenPublicMintPhase() { if (phase != uint8(PHASE.PUBLIC_MINT)) revert NotPublicMintPhase(); _; } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721A, ERC2981) returns (bool) { return ERC721A.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) public payable virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * 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. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ 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 simultaneously proven to be a part of a merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _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} * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _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 sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds 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 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proofLen - 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 from 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) { require(proofPos == proofLen, "MerkleProof: invalid multiproof"); unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds 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 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proofLen - 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 from 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) { require(proofPos == proofLen, "MerkleProof: invalid multiproof"); unchecked { 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 (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _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) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @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] = _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); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol) pragma solidity ^0.8.0; /** * @dev Provides a set of functions to operate with Base64 strings. * * _Available since v4.5._ */ library Base64 { /** * @dev Base64 Encoding/Decoding Table */ string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /** * @dev Converts a `bytes` to its Bytes64 `string` representation. */ function encode(bytes memory data) internal pure returns (string memory) { /** * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol */ if (data.length == 0) return ""; // Loads the table into memory string memory table = _TABLE; // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter // and split into 4 numbers of 6 bits. // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up // - `data.length + 2` -> Round up // - `/ 3` -> Number of 3-bytes chunks // - `4 *` -> 4 characters for each chunk string memory result = new string(4 * ((data.length + 2) / 3)); /// @solidity memory-safe-assembly assembly { // Prepare the lookup table (skip the first "length" byte) let tablePtr := add(table, 1) // Prepare result pointer, jump over length let resultPtr := add(result, 32) // Run over the input, 3 bytes at a time for { let dataPtr := data let endPtr := add(data, mload(data)) } lt(dataPtr, endPtr) { } { // Advance 3 bytes dataPtr := add(dataPtr, 3) let input := mload(dataPtr) // To write each character, shift the 3 bytes (18 bits) chunk // 4 times in blocks of 6 bits for each character (18, 12, 6, 0) // and apply logical AND with 0x3F which is the number of // the previous character in the ASCII table prior to the Base64 Table // The result is then added to the table to get the character to write, // and finally write it in the result pointer but with a left shift // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F)))) resultPtr := add(resultPtr, 1) // Advance } // When data `bytes` is not exactly 3 bytes long // it is padded with `=` characters at the end switch mod(mload(data), 3) case 1 { mstore8(sub(resultPtr, 1), 0x3d) mstore8(sub(resultPtr, 2), 0x3d) } case 2 { mstore8(sub(resultPtr, 1), 0x3d) } } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// /// @dev Note: /// - For ETH transfers, please use `forceSafeTransferETH` for gas griefing protection. /// - For ERC20s, this implementation won't check that a token has code, /// responsibility is delegated to the caller. library SafeTransferLib { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ETH transfer has failed. error ETHTransferFailed(); /// @dev The ERC20 `transferFrom` has failed. error TransferFromFailed(); /// @dev The ERC20 `transfer` has failed. error TransferFailed(); /// @dev The ERC20 `approve` has failed. error ApproveFailed(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes. uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300; /// @dev Suggested gas stipend for contract receiving ETH to perform a few /// storage reads and writes, but low enough to prevent griefing. uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ETH OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // If gas griefing protection is needed, please use the force variants. // // The regular variants: // - Forwards all remaining gas to the target. // - Reverts if the target reverts. // - Reverts if the current contract has insufficient balance. // // The force variants: // - Forwards with an optional gas stipend // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). // - If the target reverts, or if the gas stipend is exhausted, // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. // - Reverts if the current contract has insufficient balance. // // The try variants: // - Forwards with a mandatory gas stipend. // - Instead of reverting, returns whether the transfer succeeded. /// @dev Sends `amount` (in wei) ETH to `to`. function safeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gas(), to, amount, gas(), 0x00, gas(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Sends all the ETH in the current contract to `to`. function safeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // Transfer all the ETH and check if it succeeded or not. if iszero(call(gas(), to, selfbalance(), gas(), 0x00, gas(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(gasStipend, to, amount, gas(), 0x00, gas(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { returndatacopy(gas(), returndatasize(), shr(20, gas())) // For gas estimation. } } } } /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. function forceSafeTransferAllETH(address to, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gasStipend, to, selfbalance(), gas(), 0x00, gas(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { returndatacopy(gas(), returndatasize(), shr(20, gas())) // For gas estimation. } } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, gas(), 0x00, gas(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { returndatacopy(gas(), returndatasize(), shr(20, gas())) // For gas estimation. } } } } /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), gas(), 0x00, gas(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { returndatacopy(gas(), returndatasize(), shr(20, gas())) // For gas estimation. } } } } /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, amount, gas(), 0x00, gas(), 0x00) } } /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. function trySafeTransferAllETH(address to, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, selfbalance(), gas(), 0x00, gas(), 0x00) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for /// the current contract to manage. function safeTransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends all of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have their entire balance approved for /// the current contract to manage. function safeTransferAllFrom(address token, address from, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransfer(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sends all of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransferAll(address token, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. mstore(0x20, address()) // Store the address of the current contract. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x14, to) // Store the `to` argument. amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// Reverts upon failure. function safeApprove(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, /// then retries the approval again (some tokens, e.g. USDT, requires this). /// Reverts upon failure. function safeApproveWithRetry(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, retrying upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x34, 0) // Store 0 for the `amount`. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. pop(call(gas(), token, 0, 0x10, 0x44, 0x00, 0x00)) // Reset the approval. mstore(0x34, amount) // Store back the original `amount`. // Retry the approval, reverting upon failure. if iszero( and( or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Returns the amount of ERC20 `token` owned by `account`. /// Returns zero if the `token` does not exist. function balanceOf(address token, address account) internal view returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x14, account) // Store the `account` argument. mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. amount := mul( mload(0x20), and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) ) ) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: CC0-1.0 pragma solidity ^0.8.17; /** * @title An immutable registry contract to be deployed as a standalone primitive * @dev See EIP-5639, new project launches can read previous cold wallet -> hot wallet delegations * from here and integrate those permissions into their flow */ interface IDelegationRegistry { /// @notice Delegation type enum DelegationType { NONE, ALL, CONTRACT, TOKEN } /// @notice Info about a single delegation, used for onchain enumeration struct DelegationInfo { DelegationType type_; address vault; address delegate; address contract_; uint256 tokenId; } /// @notice Info about a single contract-level delegation struct ContractDelegation { address contract_; address delegate; } /// @notice Info about a single token-level delegation struct TokenDelegation { address contract_; uint256 tokenId; address delegate; } /// @notice Emitted when a user delegates their entire wallet event DelegateForAll(address vault, address delegate, bool value); /// @notice Emitted when a user delegates a specific contract event DelegateForContract(address vault, address delegate, address contract_, bool value); /// @notice Emitted when a user delegates a specific token event DelegateForToken(address vault, address delegate, address contract_, uint256 tokenId, bool value); /// @notice Emitted when a user revokes all delegations event RevokeAllDelegates(address vault); /// @notice Emitted when a user revoes all delegations for a given delegate event RevokeDelegate(address vault, address delegate); /** * ----------- WRITE ----------- */ /** * @notice Allow the delegate to act on your behalf for all contracts * @param delegate The hotwallet to act on your behalf * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForAll(address delegate, bool value) external; /** * @notice Allow the delegate to act on your behalf for a specific contract * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForContract(address delegate, address contract_, bool value) external; /** * @notice Allow the delegate to act on your behalf for a specific token * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param tokenId The token id for the token you're delegating * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking */ function delegateForToken(address delegate, address contract_, uint256 tokenId, bool value) external; /** * @notice Revoke all delegates */ function revokeAllDelegates() external; /** * @notice Revoke a specific delegate for all their permissions * @param delegate The hotwallet to revoke */ function revokeDelegate(address delegate) external; /** * @notice Remove yourself as a delegate for a specific vault * @param vault The vault which delegated to the msg.sender, and should be removed */ function revokeSelf(address vault) external; /** * ----------- READ ----------- */ /** * @notice Returns all active delegations a given delegate is able to claim on behalf of * @param delegate The delegate that you would like to retrieve delegations for * @return info Array of DelegationInfo structs */ function getDelegationsByDelegate(address delegate) external view returns (DelegationInfo[] memory); /** * @notice Returns an array of wallet-level delegates for a given vault * @param vault The cold wallet who issued the delegation * @return addresses Array of wallet-level delegates for a given vault */ function getDelegatesForAll(address vault) external view returns (address[] memory); /** * @notice Returns an array of contract-level delegates for a given vault and contract * @param vault The cold wallet who issued the delegation * @param contract_ The address for the contract you're delegating * @return addresses Array of contract-level delegates for a given vault and contract */ function getDelegatesForContract(address vault, address contract_) external view returns (address[] memory); /** * @notice Returns an array of contract-level delegates for a given vault's token * @param vault The cold wallet who issued the delegation * @param contract_ The address for the contract holding the token * @param tokenId The token id for the token you're delegating * @return addresses Array of contract-level delegates for a given vault's token */ function getDelegatesForToken(address vault, address contract_, uint256 tokenId) external view returns (address[] memory); /** * @notice Returns all contract-level delegations for a given vault * @param vault The cold wallet who issued the delegations * @return delegations Array of ContractDelegation structs */ function getContractLevelDelegations(address vault) external view returns (ContractDelegation[] memory delegations); /** * @notice Returns all token-level delegations for a given vault * @param vault The cold wallet who issued the delegations * @return delegations Array of TokenDelegation structs */ function getTokenLevelDelegations(address vault) external view returns (TokenDelegation[] memory delegations); /** * @notice Returns true if the address is delegated to act on the entire vault * @param delegate The hotwallet to act on your behalf * @param vault The cold wallet who issued the delegation */ function checkDelegateForAll(address delegate, address vault) external view returns (bool); /** * @notice Returns true if the address is delegated to act on your behalf for a token contract or an entire vault * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param vault The cold wallet who issued the delegation */ function checkDelegateForContract(address delegate, address vault, address contract_) external view returns (bool); /** * @notice Returns true if the address is delegated to act on your behalf for a specific token, the token's contract or an entire vault * @param delegate The hotwallet to act on your behalf * @param contract_ The address for the contract you're delegating * @param tokenId The token id for the token you're delegating * @param vault The cold wallet who issued the delegation */ function checkDelegateForToken(address delegate, address vault, address contract_, uint256 tokenId) external view returns (bool); }
// SPDX-License-Identifier: LGPL-3.0-only // Created By: Art Blocks Inc. pragma solidity ^0.8.0; /** * @title Art Blocks Script Storage Library * @notice Utilize contract bytecode as persistant storage for large chunks of script string data. * * @author Art Blocks Inc. * @author Modified from 0xSequence (https://github.com/0xsequence/sstore2/blob/master/contracts/SSTORE2.sol) * @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SSTORE2.sol) * * @dev Compared to the above two rerferenced libraries, this contracts-as-storage implementation makes a few * notably different design decisions: * - uses the `string` data type for input/output on reads, rather than speaking in bytes directly * - exposes "delete" functionality, allowing no-longer-used storage to be purged from chain state * - stores the "writer" address (library user) in the deployed contract bytes, which is useful for both: * a) providing necessary information for safe deletion; and * b) allowing this to be introspected on-chain * Also, given that much of this library is written in assembly, this library makes use of a slightly * different convention (when compared to the rest of the Art Blocks smart contract repo) around * pre-defining return values in some cases in order to simplify need to directly memory manage these * return values. */ library BytecodeStorage { //---------------------------------------------------------------------------------------------------------------// // Starting Index | Size | Ending Index | Description // //---------------------------------------------------------------------------------------------------------------// // 0 | N/A | 0 | // // 0 | 72 | 72 | the bytes of the gated-cleanup-logic allowing for `selfdestruct`ion // // 72 | 32 | 104 | the 32 bytes for storing the deploying contract's (0-padded) address // //---------------------------------------------------------------------------------------------------------------// // Define the offset for where the "logic bytes" end, and the "data bytes" begin. Note that this is a manually // calculated value, and must be updated if the above table is changed. It is expected that tests will fail // loudly if these values are not updated in-step with eachother. uint256 internal constant DATA_OFFSET = 104; uint256 internal constant ADDRESS_OFFSET = 72; /*////////////////////////////////////////////////////////////// WRITE LOGIC //////////////////////////////////////////////////////////////*/ /** * @notice Write a string to contract bytecode * @param _data string to be written to contract. No input validation is performed on this parameter. * @return address_ address of deployed contract with bytecode containing concat(gated-cleanup-logic, address, data) */ function writeToBytecode( string memory _data ) internal returns (address address_) { // prefix bytecode with bytes memory creationCode = abi.encodePacked( //---------------------------------------------------------------------------------------------------------------// // Opcode | Opcode + Arguments | Description | Stack View // //---------------------------------------------------------------------------------------------------------------// // (0) creation code returns all code in the contract except for the first 11 (0B in hex) bytes, as these 11 // bytes are the creation code itself which we do not want to store in the deployed storage contract result //---------------------------------------------------------------------------------------------------------------// // 0x60 | 0x60_0B | PUSH1 11 | codeOffset // // 0x59 | 0x59 | MSIZE | 0 codeOffset // // 0x81 | 0x81 | DUP2 | codeOffset 0 codeOffset // // 0x38 | 0x38 | CODESIZE | codeSize codeOffset 0 codeOffset // // 0x03 | 0x03 | SUB | (codeSize - codeOffset) 0 codeOffset // // 0x80 | 0x80 | DUP | (codeSize - codeOffset) (codeSize - codeOffset) 0 codeOffset // // 0x92 | 0x92 | SWAP3 | codeOffset (codeSize - codeOffset) 0 (codeSize - codeOffset) // // 0x59 | 0x59 | MSIZE | 0 codeOffset (codeSize - codeOffset) 0 (codeSize - codeOffset) // // 0x39 | 0x39 | CODECOPY | 0 (codeSize - codeOffset) // // 0xf3 | 0xf3 | RETURN | // //---------------------------------------------------------------------------------------------------------------// // (11 bytes) hex"60_0B_59_81_38_03_80_92_59_39_F3", //---------------------------------------------------------------------------------------------------------------// // Opcode | Opcode + Arguments | Description | Stack View // //---------------------------------------------------------------------------------------------------------------// // (1a) conditional logic for determing purge-gate (only the bytecode contract deployer can `selfdestruct`) //---------------------------------------------------------------------------------------------------------------// // 0x60 | 0x60_20 | PUSH1 32 | 32 // // 0x60 | 0x60_48 | PUSH1 72 (*) | contractOffset 32 // // 0x60 | 0x60_00 | PUSH1 0 | 0 contractOffset 32 // // 0x39 | 0x39 | CODECOPY | // // 0x60 | 0x60_00 | PUSH1 0 | 0 // // 0x51 | 0x51 | MLOAD | byteDeployerAddress // // 0x33 | 0x33 | CALLER | msg.sender byteDeployerAddress // // 0x14 | 0x14 | EQ | (msg.sender == byteDeployerAddress) // //---------------------------------------------------------------------------------------------------------------// // (12 bytes: 0-11 in deployed contract) hex"60_20_60_48_60_00_39_60_00_51_33_14", //---------------------------------------------------------------------------------------------------------------// // (1b) load up the destination jump address for `(2a) calldata length check` logic, jump or raise `invalid` op-code //---------------------------------------------------------------------------------------------------------------// // 0x60 | 0x60_10 | PUSH1 16 (^) | jumpDestination (msg.sender == byteDeployerAddress) // // 0x57 | 0x57 | JUMPI | // // 0xFE | 0xFE | INVALID | // //---------------------------------------------------------------------------------------------------------------// // (4 bytes: 12-15 in deployed contract) hex"60_10_57_FE", //---------------------------------------------------------------------------------------------------------------// // (2a) conditional logic for determing purge-gate (only if calldata length is 1 byte) //---------------------------------------------------------------------------------------------------------------// // 0x5B | 0x5B | JUMPDEST (16) | // // 0x60 | 0x60_01 | PUSH1 1 | 1 // // 0x36 | 0x36 | CALLDATASIZE | calldataSize 1 // // 0x14 | 0x14 | EQ | (calldataSize == 1) // //---------------------------------------------------------------------------------------------------------------// // (5 bytes: 16-20 in deployed contract) hex"5B_60_01_36_14", //---------------------------------------------------------------------------------------------------------------// // (2b) load up the destination jump address for `(3a) calldata value check` logic, jump or raise `invalid` op-code //---------------------------------------------------------------------------------------------------------------// // 0x60 | 0x60_19 | PUSH1 25 (^) | jumpDestination (calldataSize == 1) // // 0x57 | 0x57 | JUMPI | // // 0xFE | 0xFE | INVALID | // //---------------------------------------------------------------------------------------------------------------// // (4 bytes: 21-24 in deployed contract) hex"60_19_57_FE", //---------------------------------------------------------------------------------------------------------------// // (3a) conditional logic for determing purge-gate (only if calldata is `0xFF`) //---------------------------------------------------------------------------------------------------------------// // 0x5B | 0x5B | JUMPDEST (25) | // // 0x60 | 0x60_00 | PUSH1 0 | 0 // // 0x35 | 0x35 | CALLDATALOAD | calldata // // 0x7F | 0x7F_FF_00_..._00 | PUSH32 0xFF00...00 | 0xFF0...00 calldata // // 0x14 | 0x14 | EQ | (0xFF00...00 == calldata) // //---------------------------------------------------------------------------------------------------------------// // (4 bytes: 25-28 in deployed contract) hex"5B_60_00_35", // (33 bytes: 29-61 in deployed contract) hex"7F_FF_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00", // (1 byte: 62 in deployed contract) hex"14", //---------------------------------------------------------------------------------------------------------------// // (3b) load up the destination jump address for actual purging (4), jump or raise `invalid` op-code //---------------------------------------------------------------------------------------------------------------// // 0x60 | 0x60_43 | PUSH1 67 (^) | jumpDestination (0xFF00...00 == calldata) // // 0x57 | 0x57 | JUMPI | // // 0xFE | 0xFE | INVALID | // //---------------------------------------------------------------------------------------------------------------// // (4 bytes: 63-66 in deployed contract) hex"60_43_57_FE", //---------------------------------------------------------------------------------------------------------------// // (4) perform actual purging //---------------------------------------------------------------------------------------------------------------// // 0x5B | 0x5B | JUMPDEST (67) | // // 0x60 | 0x60_00 | PUSH1 0 | 0 // // 0x51 | 0x51 | MLOAD | byteDeployerAddress // // 0xFF | 0xFF | SELFDESTRUCT | // //---------------------------------------------------------------------------------------------------------------// // (5 bytes: 67-71 in deployed contract) hex"5B_60_00_51_FF", //---------------------------------------------------------------------------------------------------------------// // (*) Note: this value must be adjusted if selfdestruct purge logic is adjusted, to refer to the correct start // // offset for where the `msg.sender` address was stored in deployed bytecode. // // // // (^) Note: this value must be adjusted if portions of the selfdestruct purge logic are adjusted. // //---------------------------------------------------------------------------------------------------------------// // // store the deploying-contract's address (to be used to gate and call `selfdestruct`), // with expected 0-padding to fit a 20-byte address into a 30-byte slot. // // note: it is important that this address is the executing contract's address // (the address that represents the client-application smart contract of this library) // which means that it is the responsibility of the client-application smart contract // to determine how deletes are gated (or if they are exposed at all) as it is only // this contract that will be able to call `purgeBytecode` as the `CALLER` that is // checked above (op-code 0x33). hex"00_00_00_00_00_00_00_00_00_00_00_00", // left-pad 20-byte address with 12 0x00 bytes address(this), // uploaded data (stored as bytecode) comes last _data ); assembly { // deploy a new contract with the generated creation code. // start 32 bytes into creationCode to avoid copying the byte length. address_ := create(0, add(creationCode, 0x20), mload(creationCode)) } // address must be non-zero if contract was deployed successfully require(address_ != address(0), "ContractAsStorage: Write Error"); } /*////////////////////////////////////////////////////////////// READ LOGIC //////////////////////////////////////////////////////////////*/ /** * @notice Read a string from contract bytecode * @param _address address of deployed contract with bytecode containing concat(gated-cleanup-logic, address, data) * @return data string read from contract bytecode */ function readFromBytecode( address _address ) internal view returns (string memory data) { // get the size of the bytecode uint256 bytecodeSize = _bytecodeSizeAt(_address); // handle case where address contains code < DATA_OFFSET // note: the first check here also captures the case where // (bytecodeSize == 0) implicitly, but we add the second check of // (bytecodeSize == 0) as a fall-through that will never execute // unless `DATA_OFFSET` is set to 0 at some point. if ((bytecodeSize < DATA_OFFSET) || (bytecodeSize == 0)) { revert("ContractAsStorage: Read Error"); } // handle case where address contains code >= DATA_OFFSET // decrement by DATA_OFFSET to account for purge logic uint256 size; unchecked { size = bytecodeSize - DATA_OFFSET; } assembly { // allocate free memory data := mload(0x40) // update free memory pointer // use and(x, not(0x1f) as cheaper equivalent to sub(x, mod(x, 0x20)). // adding 0x1f to size + logic above ensures the free memory pointer // remains word-aligned, following the Solidity convention. mstore(0x40, add(data, and(add(add(size, 0x20), 0x1f), not(0x1f)))) // store length of data in first 32 bytes mstore(data, size) // copy code to memory, excluding the gated-cleanup-logic and address extcodecopy(_address, add(data, 0x20), DATA_OFFSET, size) } } /** * @notice Get address for deployer for given contract bytecode * @param _address address of deployed contract with bytecode containing concat(gated-cleanup-logic, address, data) * @return writerAddress address read from contract bytecode */ function getWriterAddressForBytecode( address _address ) internal view returns (address) { // get the size of the data uint256 bytecodeSize = _bytecodeSizeAt(_address); // handle case where address contains code < DATA_OFFSET // note: the first check here also captures the case where // (bytecodeSize == 0) implicitly, but we add the second check of // (bytecodeSize == 0) as a fall-through that will never execute // unless `DATA_OFFSET` is set to 0 at some point. if ((bytecodeSize < DATA_OFFSET) || (bytecodeSize == 0)) { revert("ContractAsStorage: Read Error"); } assembly { // allocate free memory let writerAddress := mload(0x40) // shift free memory pointer by one slot mstore(0x40, add(mload(0x40), 0x20)) // copy the 32-byte address of the data contract writer to memory // note: this relies on the assumption noted at the top-level of // this file that the storage layout for the deployed // contracts-as-storage contract looks like: // | gated-cleanup-logic | deployer-address (padded) | data | extcodecopy( _address, writerAddress, ADDRESS_OFFSET, 0x20 // full 32-bytes, as address is expected to be zero-padded ) return( writerAddress, 0x20 // return size is entire slot, as it is zero-padded ) } } /*////////////////////////////////////////////////////////////// DELETE LOGIC //////////////////////////////////////////////////////////////*/ /** * @notice Purge contract bytecode for cleanup purposes * note: Although this does reduce usage of Ethereum state, it does not reduce the gas costs of removal * transactions. We believe this is the best behavior at the time of writing, and do not expect this to * result in any breaking changes in the future. All current proposals to change the self-destruct opcode * are backwards compatible, but may result in not removing the bytecode from the blockchain state. This * implementation is compatible with that architecture, as it does not rely on the bytecode being removed * from the blockchain state (as opposed to using a CREATE2 style opcode when creating bytecode contracts, * which could be used in a way that may rely on the bytecode being removed from the blockchain state, * e.g. replacing a contract at a given deployed address). * @param _address address of deployed contract with bytecode containing concat(gated-cleanup-logic, address, data) * @dev This contract is only callable by the address of the contract that originally deployed the bytecode * being purged. If this method is called by any other address, it will revert with the `INVALID` op-code. * Additionally, for security purposes, the contract must be called with calldata `0xFF` to ensure that * the `selfdestruct` op-code is intentionally being invoked, otherwise the `INVALID` op-code will be raised. */ function purgeBytecode(address _address) internal { // deployed bytecode (above) handles all logic for purging state, so no // call data is expected to be passed along to perform data purge (bool success /* `data` not needed */, ) = _address.call(hex"FF"); if (!success) { revert("ContractAsStorage: Delete Error"); } } /*////////////////////////////////////////////////////////////// INTERNAL HELPER LOGIC //////////////////////////////////////////////////////////////*/ /** @notice Returns the size of the bytecode at address `_address` @param _address address that may or may not contain bytecode @return size size of the bytecode code at `_address` */ function _bytecodeSizeAt( address _address ) private view returns (uint256 size) { assembly { size := extcodesize(_address) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external payable; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// 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.9.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo( uint256 tokenId, uint256 salePrice ) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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); }
{ "remappings": [ "ERC721A/=lib/ERC721A/contracts/", "delegate-registry/=lib/delegate-registry/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/openzeppelin-contracts/contracts/", "solady/=lib/solady/", "artblocks-contracts/=lib/artblocks-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"CodeFrozen","type":"error"},{"inputs":[],"name":"IndexOutOfRange","type":"error"},{"inputs":[],"name":"MaxMintExceeded","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintSupplyExceeded","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NotAllowListPhase","type":"error"},{"inputs":[],"name":"NotAllowListed","type":"error"},{"inputs":[],"name":"NotDelegate","type":"error"},{"inputs":[],"name":"NotPublicMintPhase","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"PriceIncorrect","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":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"seed","type":"uint256"}],"name":"Minted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"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":"ALLOWLIST_MINT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"script","type":"string"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"addProjectScript","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"adminMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freezeCode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fundsRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"_baseURI","type":"string"}],"name":"generateURIFromBase","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getArtworkSeed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getVideoInfo","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_wallet","type":"address"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"isAllowListed","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":"isCodeFrozen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"mintAllowList","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"address","name":"vault","type":"address"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"mintAllowListAsDelegate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"phase","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"projectScriptChunks","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"readProjectScript","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint96","name":"_feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fundsRecipient","type":"address"}],"name":"setFundsRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPhase","type":"uint256"}],"name":"setPhase","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":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
600660c090815265139bdc9b585b60d21b60e05260809081526101406040526004610100908152632430b63360e11b6101205260a0526200004590600b90600262000534565b50604051806080016040528060405180604001604052806009815260200168125b98dc995b595b9d60ba1b815250815260200160405180604001604052806009815260200168111958dc995b595b9d60ba1b81525081526020016040518060400160405280600c81526020016b1491d0925b98dc995b595b9d60a21b81525081526020016040518060400160405280600c81526020016b1491d0911958dc995b595b9d60a21b815250815250600c9060046200010392919062000591565b50604080516101e08101825260046101a082018181526311dbdb1960e21b6101c0840152825282518084018452600780825266526564426c756560c81b602083810191909152808501929092528451808601865283815263426c756560e01b818401528486015284518086018652838152634461726b60e01b818401526060850152845180860186526005815264131a59da1d60da1b81840152608085015284518086018652928352634772617960e01b8383015260a08401929092528351808501855260068152651058dd1d585b60d21b8183015260c084015283518085018552600a815269524742526564426c756560b01b8183015260e08401528351808501855260088152671491d0931a59da1d60c21b8183015261010084015283518085018552828152661491d091dbdb1960ca1b8183015261012084015283518085018552828152665247424461726b60c81b818301526101408401528351808501855282815266524742426c756560c81b818301526101608401528351808501909452908352665247424772617960c81b90830152610180810191909152620002b090600d9081620005dc565b506040518060600160405280603f815260200162003bfe603f9139600e90620002da908262000746565b507f53980f941adfd166a42bf508a6ea690541eb1096e6db49a28c86461dc84c4cc1600f55601080546001600160a01b031916731a3e3367a39bec5c710095f0f81fc5ed422860b11790556012805460ff199081169091556014805490911690553480156200034857600080fd5b506040518060400160405280600e81526020016d4e61747572616c2053746174696360901b815250604051806040016040528060028152602001614e5360f01b81525081600290816200039c919062000746565b506003620003ab828262000746565b50506000805550620003bd33620003dd565b601054620003d7906001600160a01b03166103e86200042f565b62000812565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127106001600160601b0382161115620004a35760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b60648201526084015b60405180910390fd5b6001600160a01b038216620004fb5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c69642072656365697665720000000000000060448201526064016200049a565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b8280548282559060005260206000209081019282156200057f579160200282015b828111156200057f57825182906200056e908262000746565b509160200191906001019062000555565b506200058d92915062000627565b5090565b8280548282559060005260206000209081019282156200057f579160200282015b828111156200057f5782518290620005cb908262000746565b5091602001919060010190620005b2565b8280548282559060005260206000209081019282156200057f579160200282015b828111156200057f578251829062000616908262000746565b5091602001919060010190620005fd565b808211156200058d5760006200063e828262000648565b5060010162000627565b5080546200065690620006b7565b6000825580601f1062000667575050565b601f0160209004906000526020600020908101906200068791906200068a565b50565b5b808211156200058d57600081556001016200068b565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620006cc57607f821691505b602082108103620006ed57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200074157600081815260208120601f850160051c810160208610156200071c5750805b601f850160051c820191505b818110156200073d5782815560010162000728565b5050505b505050565b81516001600160401b03811115620007625762000762620006a1565b6200077a81620007738454620006b7565b84620006f3565b602080601f831160018114620007b25760008415620007995750858301515b600019600386901b1c1916600185901b1785556200073d565b600085815260208120601f198616915b82811015620007e357888601518255948401946001909101908401620007c2565b5085821015620008025787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6133dc80620008226000396000f3fe6080604052600436106102675760003560e01c8063696239db11610144578063a0712d68116100b6578063c87b56dd1161007a578063c87b56dd146106dc578063e58306f9146106fc578063e985e9c51461071c578063eb26ae7614610765578063f2fde38b14610785578063fa05a657146107a557600080fd5b8063a0712d681461066a578063a22cb4651461067d578063b1c9fe6e1461069d578063b88d4fde146106c9578063c002d23d1461059057600080fd5b8063715018a611610108578063715018a6146105cc5780637cb64759146105e15780637ee0e0f5146106015780638da5cb5b1461062157806395d89b411461063f5780639dfbcde81461065457600080fd5b8063696239db146105465780636c0360eb146105665780636c94f0e21461057b5780636e46be801461059057806370a08231146105ac57600080fd5b80632eb4a7ab116101dd5780634ba5d278116101a15780634ba5d2781461047657806355f804b3146104ac578063596257b3146104cc5780635bbc7401146104ec5780636352211e14610506578063677621691461052657600080fd5b80632eb4a7ab146103f85780633b6fd2cf1461040e5780633ccfd60b1461042e57806342842e0e146104365780634a690e7f1461044957600080fd5b8063095ea7b31161022f578063095ea7b31461033057806310a7eb5d1461034357806318160ddd1461036357806323b872dd146103865780632a55205a146103995780632cc82655146103d857600080fd5b806301ffc9a71461026c57806304634d8d146102a157806306fdde03146102c357806307433e46146102e5578063081812fc146102f8575b600080fd5b34801561027857600080fd5b5061028c6102873660046125ec565b6107b8565b60405190151581526020015b60405180910390f35b3480156102ad57600080fd5b506102c16102bc366004612625565b6107d8565b005b3480156102cf57600080fd5b506102d86107ee565b60405161029891906126b8565b6102c16102f336600461270f565b610880565b34801561030457600080fd5b50610318610313366004612768565b610a08565b6040516001600160a01b039091168152602001610298565b6102c161033e366004612781565b610a4c565b34801561034f57600080fd5b506102c161035e3660046127ab565b610aec565b34801561036f57600080fd5b50600154600054035b604051908152602001610298565b6102c16103943660046127c6565b610b16565b3480156103a557600080fd5b506103b96103b4366004612802565b610cab565b604080516001600160a01b039093168352602083019190915201610298565b3480156103e457600080fd5b506102c16103f3366004612768565b610d59565b34801561040457600080fd5b50610378600f5481565b34801561041a57600080fd5b50601054610318906001600160a01b031681565b6102c1610d77565b6102c16104443660046127c6565b610d9a565b34801561045557600080fd5b50610378610464366004612768565b60009081526011602052604090205490565b34801561048257600080fd5b50610318610491366004612768565b6013602052600090815260409020546001600160a01b031681565b3480156104b857600080fd5b506102c16104c73660046128cf565b610dba565b3480156104d857600080fd5b506102d86104e7366004612903565b610dce565b3480156104f857600080fd5b5060125461028c9060ff1681565b34801561051257600080fd5b50610318610521366004612768565b610efa565b34801561053257600080fd5b5061028c610541366004612949565b610f05565b34801561055257600080fd5b506102c161056136600461299b565b610f80565b34801561057257600080fd5b506102d8610fe8565b34801561058757600080fd5b506102c1611076565b34801561059c57600080fd5b5061037867016345785d8a000081565b3480156105b857600080fd5b506103786105c73660046127ab565b61108d565b3480156105d857600080fd5b506102c16110db565b3480156105ed57600080fd5b506102c16105fc366004612768565b6110ef565b34801561060d57600080fd5b506102d861061c366004612768565b6110fc565b34801561062d57600080fd5b506008546001600160a01b0316610318565b34801561064b57600080fd5b506102d8611120565b34801561066057600080fd5b506103786101a081565b6102c1610678366004612768565b61112f565b34801561068957600080fd5b506102c16106983660046129ed565b6111ee565b3480156106a957600080fd5b506014546106b79060ff1681565b60405160ff9091168152602001610298565b6102c16106d7366004612a19565b61125a565b3480156106e857600080fd5b506102d86106f7366004612768565b6112a4565b34801561070857600080fd5b506102c1610717366004612781565b61133a565b34801561072857600080fd5b5061028c610737366004612a94565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561077157600080fd5b506102d8610780366004612768565b611383565b34801561079157600080fd5b506102c16107a03660046127ab565b6113dd565b6102c16107b3366004612ac7565b611458565b60006107c382611546565b806107d257506107d282611594565b92915050565b6107e06115c9565b6107ea8282611623565b5050565b6060600280546107fd90612af9565b80601f016020809104026020016040519081016040528092919081815260200182805461082990612af9565b80156108765780601f1061084b57610100808354040283529160200191610876565b820191906000526020600020905b81548152906001019060200180831161085957829003601f168201915b5050505050905090565b60145460ff166001146108a6576040516332a3759b60e11b815260040160405180910390fd5b836101a0816108b460005490565b6108be9190612b43565b11156108dd57604051633b27957560e11b815260040160405180910390fd5b60058511156108ff57604051633ce95f8560e11b815260040160405180910390fd5b604051634e1cade160e11b81523360048201526001600160a01b03851660248201526d76a84fef008cdabe6409d2fe638b90639c395bc290604401602060405180830381865afa158015610957573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097b9190612b56565b61099857604051631db3b85960e01b815260040160405180910390fd5b6109a3848484610f05565b6109c057604051630e5060e160e21b815260040160405180910390fd5b60006109d48667016345785d8a0000612b73565b90508034146109f657604051630eab4a2360e21b815260040160405180910390fd5b610a003387611720565b505050505050565b6000610a13826117fb565b610a30576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610a5782610efa565b9050336001600160a01b03821614610a9057610a738133610737565b610a90576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b610af46115c9565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000610b2182611822565b9050836001600160a01b0316816001600160a01b031614610b545760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610ba157610b848633610737565b610ba157604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610bc857604051633a954ecd60e21b815260040160405180910390fd5b8015610bd357600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003610c6557600184016000818152600460205260408120549003610c63576000548114610c635760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4610a00565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610d205750604080518082019091526009546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610d3f906001600160601b031687612b73565b610d499190612ba0565b91519350909150505b9250929050565b610d616115c9565b6014805460ff191660ff92909216919091179055565b610d7f6115c9565b6010544790610d97906001600160a01b031682611890565b50565b610db58383836040518060200160405280600081525061125a565b505050565b610dc26115c9565b600e6107ea8282612bfa565b6060610dd9836117fb565b610df657604051630a14c4b560e41b815260040160405180910390fd5b6000838152601160205260408120549083610e10836118da565b85604051602001610e2393929190612cd5565b6040516020818303038152906040529050600084610e40876118da565b604051602001610e51929190612d62565b60405160208183030381529060405290506000610ec9610e70886118da565b60405180610100016040528060df81526020016132c860df913985610e948b611383565b8688610e9f8e61196c565b604051602001610eb59796959493929190612dba565b604051602081830303815290604052611df3565b9050600081604051602001610ede9190612f17565b60408051808303601f1901815291905298975050505050505050565b60006107d282611822565b6000610f7883838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050600f546040516001600160601b031960608b901b166020820152909250603401905060405160208183030381529060405280519060200120611f45565b949350505050565b610f886115c9565b60125460ff1615610fac576040516387b2673b60e01b815260040160405180910390fd5b6000610fb783611f5b565b60009283526013602052604090922080546001600160a01b0319166001600160a01b03909316929092179091555050565b600e8054610ff590612af9565b80601f016020809104026020016040519081016040528092919081815260200182805461102190612af9565b801561106e5780601f106110435761010080835404028352916020019161106e565b820191906000526020600020905b81548152906001019060200180831161105157829003601f168201915b505050505081565b61107e6115c9565b6012805460ff19166001179055565b60006001600160a01b0382166110b6576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6110e36115c9565b6110ed6000611fe9565b565b6110f76115c9565b600f55565b6000818152601360205260409020546060906107d2906001600160a01b031661203b565b6060600380546107fd90612af9565b60145460ff1660021461115557604051638590f88560e01b815260040160405180910390fd5b806101a08161116360005490565b61116d9190612b43565b111561118c57604051633b27957560e11b815260040160405180910390fd5b60058211156111ae57604051633ce95f8560e11b815260040160405180910390fd5b60006111c28367016345785d8a0000612b73565b90508034146111e457604051630eab4a2360e21b815260040160405180910390fd5b610db53384611720565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611265848484610b16565b6001600160a01b0383163b1561129e57611281848484846120c6565b61129e576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b60606107d282600e80546112b790612af9565b80601f01602080910402602001604051908101604052809291908181526020018280546112e390612af9565b80156113305780601f1061130557610100808354040283529160200191611330565b820191906000526020600020905b81548152906001019060200180831161131357829003601f168201915b5050505050610dce565b6113426115c9565b806101a08161135060005490565b61135a9190612b43565b111561137957604051633b27957560e11b815260040160405180910390fd5b610db58383611720565b606061138e826117fb565b6113ab57604051630a14c4b560e41b815260040160405180910390fd5b600e6113b6836118da565b6040516020016113c7929190612f5c565b6040516020818303038152906040529050919050565b6113e56115c9565b6001600160a01b03811661144f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b610d9781611fe9565b60145460ff1660011461147e576040516332a3759b60e11b815260040160405180910390fd5b826101a08161148c60005490565b6114969190612b43565b11156114b557604051633b27957560e11b815260040160405180910390fd5b60058411156114d757604051633ce95f8560e11b815260040160405180910390fd5b6114e2338484610f05565b6114ff57604051630e5060e160e21b815260040160405180910390fd5b60006115138567016345785d8a0000612b73565b905080341461153557604051630eab4a2360e21b815260040160405180910390fd5b61153f3386611720565b5050505050565b60006301ffc9a760e01b6001600160e01b03198316148061157757506380ac58cd60e01b6001600160e01b03198316145b806107d25750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b0319821663152a902d60e11b14806107d257506301ffc9a760e01b6001600160e01b03198316146107d2565b6008546001600160a01b031633146110ed5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611446565b6127106001600160601b03821611156116915760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401611446565b6001600160a01b0382166116e75760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401611446565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b6000805b828110156117f0578061173660005490565b6117409190612b43565b915061179782604080514260208201526001600160601b03193360601b16918101919091526054810182905260740160408051601f1981840301815291815281516020928301206000938452601190925290912055565b600082815260116020908152604091829020548251858152918201527f8a9dcf4e150b1153011b29fec302d5be0c13e84fa8f56ab78587f778a32a90dd910160405180910390a1806117e881613013565b915050611724565b50610db583836121b1565b60008054821080156107d2575050600090815260046020526040902054600160e01b161590565b6000816000548110156118775760008181526004602052604081205490600160e01b82169003611875575b8060000361186e57506000190160008181526004602052604090205461184d565b9392505050565b505b604051636f96cda160e11b815260040160405180910390fd5b804710156118a65763b12d13eb6000526004601cfd5b60005a60005a8486620186a0f16107ea57816000526073600b5360ff6020536016600b82f06107ea575a60141c3d5a3e5050565b606060006118e7836122af565b60010190506000816001600160401b0381111561190657611906612824565b6040519080825280601f01601f191660200182016040528015611930576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461193a57509392505050565b6060611977826117fb565b61199457604051630a14c4b560e41b815260040160405180910390fd5b600082815260116020908152604080832054815160e081018352600560a0820190815264566964656f60d81b60c0830152815282518084018452600b8082526a159a59195bc814dc19595960aa1b82870152828601919091528351808501855260128152712332b2b23130b1b5902234b932b1ba34b7b760711b818701528285015283518085018552600e81526d11995959189858dac814dc19595960921b818701526060830152835180850190945283526a436f6c6f7572204d6f646560a81b93830193909352608083019190915291611a6e83612387565b9050611a78612591565b611a898260005b60200201516118da565b81526020820151600b80549091908110611aa557611aa561302c565b906000526020600020018054611aba90612af9565b80601f0160208091040260200160405190810160405280929190818152602001828054611ae690612af9565b8015611b335780601f10611b0857610100808354040283529160200191611b33565b820191906000526020600020905b815481529060010190602001808311611b1657829003601f168201915b505050505081600160058110611b4b57611b4b61302c565b6020020152600c826002602002015181548110611b6a57611b6a61302c565b906000526020600020018054611b7f90612af9565b80601f0160208091040260200160405190810160405280929190818152602001828054611bab90612af9565b8015611bf85780601f10611bcd57610100808354040283529160200191611bf8565b820191906000526020600020905b815481529060010190602001808311611bdb57829003601f168201915b505050505081600260058110611c1057611c1061302c565b6020020152611c20826003611a7f565b60608201526080820151600d80549091908110611c3f57611c3f61302c565b906000526020600020018054611c5490612af9565b80601f0160208091040260200160405190810160405280929190818152602001828054611c8090612af9565b8015611ccd5780601f10611ca257610100808354040283529160200191611ccd565b820191906000526020600020905b815481529060010190602001808311611cb057829003601f168201915b505050505081600460058110611ce557611ce561302c565b60200201819052506000604051602001611d14906e2261747472696275746573223a205b60881b8152600f0190565b604051602081830303815290604052905060005b6005811015611dc6578015611d5a5781604051602001611d489190613042565b60405160208183030381529060405291505b81611d91868360058110611d7057611d7061302c565b6020020151858460058110611d8757611d8761302c565b60200201516124a6565b604051602001611da2929190613067565b60405160208183030381529060405291508080611dbe90613013565b915050611d28565b5080604051602001611dd89190613096565b60408051601f19818403018152919052979650505050505050565b60608151600003611e1257505060408051602081019091526000815290565b60006040518060600160405280604081526020016132886040913990506000600384516002611e419190612b43565b611e4b9190612ba0565b611e56906004612b73565b6001600160401b03811115611e6d57611e6d612824565b6040519080825280601f01601f191660200182016040528015611e97576020820181803683370190505b509050600182016020820185865187015b80821015611f03576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250611ea8565b5050600386510660018114611f1f5760028114611f3257611f3a565b603d6001830353603d6002830353611f3a565b603d60018303535b509195945050505050565b600082611f5285846124d2565b14949350505050565b6000803083604051602001611f719291906130bb565b60405160208183030381529060405290508051602082016000f091506001600160a01b038216611fe35760405162461bcd60e51b815260206004820152601e60248201527f436f6e7472616374417353746f726167653a205772697465204572726f7200006044820152606401611446565b50919050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6060813b606881108061204c575080155b156120995760405162461bcd60e51b815260206004820152601d60248201527f436f6e7472616374417353746f726167653a2052656164204572726f720000006044820152606401611446565b604080516028198301601f19168101909152606719820180825290925080606860208501863c5050919050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906120fb90339089908890889060040161318c565b6020604051808303816000875af1925050508015612136575060408051601f3d908101601f19168201909252612133918101906131bf565b60015b612194573d808015612164576040519150601f19603f3d011682016040523d82523d6000602084013e612169565b606091505b50805160000361218c576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b60008054908290036121d65760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461228557808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a460010161224d565b50816000036122a657604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106122ee5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061231a576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061233857662386f26fc10000830492506010015b6305f5e1008310612350576305f5e100830492506008015b612710831061236457612710830492506004015b60648310612376576064830492506002015b600a83106107d25760010192915050565b61238f6125b8565b6123976125b8565b60006123aa846002600c8054905061251f565b9050600080826000036123cb576123c4866003600961251f565b9150612423565b826001036123e0576123c4866003600961251f565b82600203612400576123f5866003600761251f565b6123c4906005612b43565b8260030361242357612415866003600561251f565b612420906007612b43565b91505b600283101561244b57612439866005600361251f565b612444906002612b43565b9050612466565b612458866005600461251f565b612463906002612b43565b90505b61247386600060d061251f565b8452600b5461248690879060019061251f565b602085015260408401929092526060830191909152608082015292915050565b606082826040516020016124bb9291906131dc565b604051602081830303815290604052905092915050565b600081815b845181101561251757612503828683815181106124f6576124f661302c565b6020026020010151612565565b91508061250f81613013565b9150506124d7565b509392505050565b6000601f8360ff16111561254657604051631390f2a160e01b815260040160405180910390fd5b81612552846008613250565b60ff1685901c60ff16610f789190613273565b600081831061258157600082815260208490526040902061186e565b5060009182526020526040902090565b6040518060a001604052806005905b60608152602001906001900390816125a05790505090565b6040518060a001604052806005906020820280368337509192915050565b6001600160e01b031981168114610d9757600080fd5b6000602082840312156125fe57600080fd5b813561186e816125d6565b80356001600160a01b038116811461262057600080fd5b919050565b6000806040838503121561263857600080fd5b61264183612609565b915060208301356001600160601b038116811461265d57600080fd5b809150509250929050565b60005b8381101561268357818101518382015260200161266b565b50506000910152565b600081518084526126a4816020860160208601612668565b601f01601f19169290920160200192915050565b60208152600061186e602083018461268c565b60008083601f8401126126dd57600080fd5b5081356001600160401b038111156126f457600080fd5b6020830191508360208260051b8501011115610d5257600080fd5b6000806000806060858703121561272557600080fd5b8435935061273560208601612609565b925060408501356001600160401b0381111561275057600080fd5b61275c878288016126cb565b95989497509550505050565b60006020828403121561277a57600080fd5b5035919050565b6000806040838503121561279457600080fd5b61279d83612609565b946020939093013593505050565b6000602082840312156127bd57600080fd5b61186e82612609565b6000806000606084860312156127db57600080fd5b6127e484612609565b92506127f260208501612609565b9150604084013590509250925092565b6000806040838503121561281557600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60006001600160401b038084111561285457612854612824565b604051601f8501601f19908116603f0116810190828211818310171561287c5761287c612824565b8160405280935085815286868601111561289557600080fd5b858560208301376000602087830101525050509392505050565b600082601f8301126128c057600080fd5b61186e8383356020850161283a565b6000602082840312156128e157600080fd5b81356001600160401b038111156128f757600080fd5b610f78848285016128af565b6000806040838503121561291657600080fd5b8235915060208301356001600160401b0381111561293357600080fd5b61293f858286016128af565b9150509250929050565b60008060006040848603121561295e57600080fd5b61296784612609565b925060208401356001600160401b0381111561298257600080fd5b61298e868287016126cb565b9497909650939450505050565b600080604083850312156129ae57600080fd5b82356001600160401b038111156129c457600080fd5b6129d0858286016128af565b95602094909401359450505050565b8015158114610d9757600080fd5b60008060408385031215612a0057600080fd5b612a0983612609565b9150602083013561265d816129df565b60008060008060808587031215612a2f57600080fd5b612a3885612609565b9350612a4660208601612609565b92506040850135915060608501356001600160401b03811115612a6857600080fd5b8501601f81018713612a7957600080fd5b612a888782356020840161283a565b91505092959194509250565b60008060408385031215612aa757600080fd5b612ab083612609565b9150612abe60208401612609565b90509250929050565b600080600060408486031215612adc57600080fd5b8335925060208401356001600160401b0381111561298257600080fd5b600181811c90821680612b0d57607f821691505b602082108103611fe357634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156107d2576107d2612b2d565b600060208284031215612b6857600080fd5b815161186e816129df565b80820281158282048414176107d2576107d2612b2d565b634e487b7160e01b600052601260045260246000fd5b600082612baf57612baf612b8a565b500490565b601f821115610db557600081815260208120601f850160051c81016020861015612bdb5750805b601f850160051c820191505b81811015610a0057828155600101612be7565b81516001600160401b03811115612c1357612c13612824565b612c2781612c218454612af9565b84612bb4565b602080601f831160018114612c5c5760008415612c445750858301515b600019600386901b1c1916600185901b178555610a00565b600085815260208120601f198616915b82811015612c8b57888601518255948401946001909101908401612c6c565b5085821015612ca95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008151612ccb818560208601612668565b9290920192915050565b60008451612ce7818460208901612668565b702f696e6465782e68746d6c3f686173683d60781b9083019081528451612d15816011840160208901612668565b6a26766964656f626173653d60a81b601192909101918201528351612d4181601c840160208801612668565b662f766964656f7360c81b601c929091019182015260230195945050505050565b60008351612d74818460208801612668565b6b2f7468756d626e61696c732f60a01b9083019081528351612d9d81600c840160208801612668565b631733b4b360e11b600c9290910191820152601001949350505050565b7f7b226e616d65223a20224e61747572616c205374617469632023000000000000815260008851612df281601a850160208d01612668565b72111610113232b9b1b934b83a34b7b7111d101160691b601a918401918201528851612e2581602d840160208d01612668565b7002e37102e37233ab63639b1b932b2b71d1607d1b602d92909101918201528751612e5781603e840160208c01612668565b7002e37102e372b34b232b79024b733379d1607d1b603e92909101918201528651612e8981604f840160208b01612668565b6c1116101134b6b0b3b2911d101160991b604f9290910191820152612f09612efc612ef6612ee7612ee1612ec0605c87018c612cb9565b741116101130b734b6b0ba34b7b72fbab936111d101160591b815260150190565b89612cb9565b6201116160ed1b815260030190565b86612cb9565b607d60f81b815260010190565b9a9950505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251612f4f81601d850160208701612668565b91909101601d0192915050565b6000808454612f6a81612af9565b60018281168015612f825760018114612f9757612fc6565b60ff1984168752821515830287019450612fc6565b8860005260208060002060005b85811015612fbd5781548a820152908401908201612fa4565b50505082870194505b505050506b2f766964656f2d696e666f2f60a01b81528351612fef81600c840160208801612668565b613009600c8284010164173539b7b760d91b815260050190565b9695505050505050565b60006001820161302557613025612b2d565b5060010190565b634e487b7160e01b600052603260045260246000fd5b60008251613054818460208701612668565b600b60fa1b920191825250600101919050565b60008351613079818460208801612668565b83519083019061308d818360208801612668565b01949350505050565b600082516130a8818460208701612668565b605d60f81b920191825250600101919050565b6a600b5981380380925939f360a81b81526b1808181218000e5800144cc560a21b600b8201526330082bff60e11b60178201526416d8004d8560da1b601b82015263300cabff60e11b6020820152635b60003560e01b6024820152617fff60f01b6028820152600060488201819052600560fa1b6049830152633021abff60e11b604a830152645b600051ff60d81b604e8301526131606053830160008152600c0190565b613176818660601b6001600160601b0319169052565b6131836014820185612cb9565b95945050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906130099083018461268c565b6000602082840312156131d157600080fd5b815161186e816125d6565b6f3d913a3930b4ba2fba3cb832911d101160811b81528251600090613208816010850160208801612668565b6c111610113b30b63ab2911d101160991b601091840191820152835161323581601d840160208801612668565b61227d60f01b601d9290910191820152601f01949350505050565b60ff818116838216029081169081811461326c5761326c612b2d565b5092915050565b60008261328257613282612b8a565b50069056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f4e61747572616c2053746174696320697320612067656e65726174697665204e465420736572696573207468617420666565647320766964656f206f66206e61747572616c206d6f74696f6e20696e746f206120706978656c2d62617365642077617465722073696d756c6174696f6e2c206372656174696e6720726570726573656e746174696f6e73206f6620706879736963616c206d6f74696f6e20746861742061726520686967686c79206469676974616c20616e6420646565706c7920616e616c6f672e204a6f6e617468616e2043686f6d6b6f2c20323032332ea264697066735822122012eba0f1949224d46536e1a5a3768a85c6399707a8eb529d093f0d0d60cd9b2764736f6c6343000811003368747470733a2f2f617277656176652e6e65742f4f786c69725753566a726e6576626432436d5a53745837426e57634b4a785f6d72517a4464386b564e6849
Deployed Bytecode
0x6080604052600436106102675760003560e01c8063696239db11610144578063a0712d68116100b6578063c87b56dd1161007a578063c87b56dd146106dc578063e58306f9146106fc578063e985e9c51461071c578063eb26ae7614610765578063f2fde38b14610785578063fa05a657146107a557600080fd5b8063a0712d681461066a578063a22cb4651461067d578063b1c9fe6e1461069d578063b88d4fde146106c9578063c002d23d1461059057600080fd5b8063715018a611610108578063715018a6146105cc5780637cb64759146105e15780637ee0e0f5146106015780638da5cb5b1461062157806395d89b411461063f5780639dfbcde81461065457600080fd5b8063696239db146105465780636c0360eb146105665780636c94f0e21461057b5780636e46be801461059057806370a08231146105ac57600080fd5b80632eb4a7ab116101dd5780634ba5d278116101a15780634ba5d2781461047657806355f804b3146104ac578063596257b3146104cc5780635bbc7401146104ec5780636352211e14610506578063677621691461052657600080fd5b80632eb4a7ab146103f85780633b6fd2cf1461040e5780633ccfd60b1461042e57806342842e0e146104365780634a690e7f1461044957600080fd5b8063095ea7b31161022f578063095ea7b31461033057806310a7eb5d1461034357806318160ddd1461036357806323b872dd146103865780632a55205a146103995780632cc82655146103d857600080fd5b806301ffc9a71461026c57806304634d8d146102a157806306fdde03146102c357806307433e46146102e5578063081812fc146102f8575b600080fd5b34801561027857600080fd5b5061028c6102873660046125ec565b6107b8565b60405190151581526020015b60405180910390f35b3480156102ad57600080fd5b506102c16102bc366004612625565b6107d8565b005b3480156102cf57600080fd5b506102d86107ee565b60405161029891906126b8565b6102c16102f336600461270f565b610880565b34801561030457600080fd5b50610318610313366004612768565b610a08565b6040516001600160a01b039091168152602001610298565b6102c161033e366004612781565b610a4c565b34801561034f57600080fd5b506102c161035e3660046127ab565b610aec565b34801561036f57600080fd5b50600154600054035b604051908152602001610298565b6102c16103943660046127c6565b610b16565b3480156103a557600080fd5b506103b96103b4366004612802565b610cab565b604080516001600160a01b039093168352602083019190915201610298565b3480156103e457600080fd5b506102c16103f3366004612768565b610d59565b34801561040457600080fd5b50610378600f5481565b34801561041a57600080fd5b50601054610318906001600160a01b031681565b6102c1610d77565b6102c16104443660046127c6565b610d9a565b34801561045557600080fd5b50610378610464366004612768565b60009081526011602052604090205490565b34801561048257600080fd5b50610318610491366004612768565b6013602052600090815260409020546001600160a01b031681565b3480156104b857600080fd5b506102c16104c73660046128cf565b610dba565b3480156104d857600080fd5b506102d86104e7366004612903565b610dce565b3480156104f857600080fd5b5060125461028c9060ff1681565b34801561051257600080fd5b50610318610521366004612768565b610efa565b34801561053257600080fd5b5061028c610541366004612949565b610f05565b34801561055257600080fd5b506102c161056136600461299b565b610f80565b34801561057257600080fd5b506102d8610fe8565b34801561058757600080fd5b506102c1611076565b34801561059c57600080fd5b5061037867016345785d8a000081565b3480156105b857600080fd5b506103786105c73660046127ab565b61108d565b3480156105d857600080fd5b506102c16110db565b3480156105ed57600080fd5b506102c16105fc366004612768565b6110ef565b34801561060d57600080fd5b506102d861061c366004612768565b6110fc565b34801561062d57600080fd5b506008546001600160a01b0316610318565b34801561064b57600080fd5b506102d8611120565b34801561066057600080fd5b506103786101a081565b6102c1610678366004612768565b61112f565b34801561068957600080fd5b506102c16106983660046129ed565b6111ee565b3480156106a957600080fd5b506014546106b79060ff1681565b60405160ff9091168152602001610298565b6102c16106d7366004612a19565b61125a565b3480156106e857600080fd5b506102d86106f7366004612768565b6112a4565b34801561070857600080fd5b506102c1610717366004612781565b61133a565b34801561072857600080fd5b5061028c610737366004612a94565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561077157600080fd5b506102d8610780366004612768565b611383565b34801561079157600080fd5b506102c16107a03660046127ab565b6113dd565b6102c16107b3366004612ac7565b611458565b60006107c382611546565b806107d257506107d282611594565b92915050565b6107e06115c9565b6107ea8282611623565b5050565b6060600280546107fd90612af9565b80601f016020809104026020016040519081016040528092919081815260200182805461082990612af9565b80156108765780601f1061084b57610100808354040283529160200191610876565b820191906000526020600020905b81548152906001019060200180831161085957829003601f168201915b5050505050905090565b60145460ff166001146108a6576040516332a3759b60e11b815260040160405180910390fd5b836101a0816108b460005490565b6108be9190612b43565b11156108dd57604051633b27957560e11b815260040160405180910390fd5b60058511156108ff57604051633ce95f8560e11b815260040160405180910390fd5b604051634e1cade160e11b81523360048201526001600160a01b03851660248201526d76a84fef008cdabe6409d2fe638b90639c395bc290604401602060405180830381865afa158015610957573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097b9190612b56565b61099857604051631db3b85960e01b815260040160405180910390fd5b6109a3848484610f05565b6109c057604051630e5060e160e21b815260040160405180910390fd5b60006109d48667016345785d8a0000612b73565b90508034146109f657604051630eab4a2360e21b815260040160405180910390fd5b610a003387611720565b505050505050565b6000610a13826117fb565b610a30576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610a5782610efa565b9050336001600160a01b03821614610a9057610a738133610737565b610a90576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b610af46115c9565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000610b2182611822565b9050836001600160a01b0316816001600160a01b031614610b545760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610ba157610b848633610737565b610ba157604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610bc857604051633a954ecd60e21b815260040160405180910390fd5b8015610bd357600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003610c6557600184016000818152600460205260408120549003610c63576000548114610c635760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4610a00565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610d205750604080518082019091526009546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610d3f906001600160601b031687612b73565b610d499190612ba0565b91519350909150505b9250929050565b610d616115c9565b6014805460ff191660ff92909216919091179055565b610d7f6115c9565b6010544790610d97906001600160a01b031682611890565b50565b610db58383836040518060200160405280600081525061125a565b505050565b610dc26115c9565b600e6107ea8282612bfa565b6060610dd9836117fb565b610df657604051630a14c4b560e41b815260040160405180910390fd5b6000838152601160205260408120549083610e10836118da565b85604051602001610e2393929190612cd5565b6040516020818303038152906040529050600084610e40876118da565b604051602001610e51929190612d62565b60405160208183030381529060405290506000610ec9610e70886118da565b60405180610100016040528060df81526020016132c860df913985610e948b611383565b8688610e9f8e61196c565b604051602001610eb59796959493929190612dba565b604051602081830303815290604052611df3565b9050600081604051602001610ede9190612f17565b60408051808303601f1901815291905298975050505050505050565b60006107d282611822565b6000610f7883838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050600f546040516001600160601b031960608b901b166020820152909250603401905060405160208183030381529060405280519060200120611f45565b949350505050565b610f886115c9565b60125460ff1615610fac576040516387b2673b60e01b815260040160405180910390fd5b6000610fb783611f5b565b60009283526013602052604090922080546001600160a01b0319166001600160a01b03909316929092179091555050565b600e8054610ff590612af9565b80601f016020809104026020016040519081016040528092919081815260200182805461102190612af9565b801561106e5780601f106110435761010080835404028352916020019161106e565b820191906000526020600020905b81548152906001019060200180831161105157829003601f168201915b505050505081565b61107e6115c9565b6012805460ff19166001179055565b60006001600160a01b0382166110b6576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6110e36115c9565b6110ed6000611fe9565b565b6110f76115c9565b600f55565b6000818152601360205260409020546060906107d2906001600160a01b031661203b565b6060600380546107fd90612af9565b60145460ff1660021461115557604051638590f88560e01b815260040160405180910390fd5b806101a08161116360005490565b61116d9190612b43565b111561118c57604051633b27957560e11b815260040160405180910390fd5b60058211156111ae57604051633ce95f8560e11b815260040160405180910390fd5b60006111c28367016345785d8a0000612b73565b90508034146111e457604051630eab4a2360e21b815260040160405180910390fd5b610db53384611720565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611265848484610b16565b6001600160a01b0383163b1561129e57611281848484846120c6565b61129e576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b60606107d282600e80546112b790612af9565b80601f01602080910402602001604051908101604052809291908181526020018280546112e390612af9565b80156113305780601f1061130557610100808354040283529160200191611330565b820191906000526020600020905b81548152906001019060200180831161131357829003601f168201915b5050505050610dce565b6113426115c9565b806101a08161135060005490565b61135a9190612b43565b111561137957604051633b27957560e11b815260040160405180910390fd5b610db58383611720565b606061138e826117fb565b6113ab57604051630a14c4b560e41b815260040160405180910390fd5b600e6113b6836118da565b6040516020016113c7929190612f5c565b6040516020818303038152906040529050919050565b6113e56115c9565b6001600160a01b03811661144f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b610d9781611fe9565b60145460ff1660011461147e576040516332a3759b60e11b815260040160405180910390fd5b826101a08161148c60005490565b6114969190612b43565b11156114b557604051633b27957560e11b815260040160405180910390fd5b60058411156114d757604051633ce95f8560e11b815260040160405180910390fd5b6114e2338484610f05565b6114ff57604051630e5060e160e21b815260040160405180910390fd5b60006115138567016345785d8a0000612b73565b905080341461153557604051630eab4a2360e21b815260040160405180910390fd5b61153f3386611720565b5050505050565b60006301ffc9a760e01b6001600160e01b03198316148061157757506380ac58cd60e01b6001600160e01b03198316145b806107d25750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b0319821663152a902d60e11b14806107d257506301ffc9a760e01b6001600160e01b03198316146107d2565b6008546001600160a01b031633146110ed5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611446565b6127106001600160601b03821611156116915760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401611446565b6001600160a01b0382166116e75760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401611446565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b6000805b828110156117f0578061173660005490565b6117409190612b43565b915061179782604080514260208201526001600160601b03193360601b16918101919091526054810182905260740160408051601f1981840301815291815281516020928301206000938452601190925290912055565b600082815260116020908152604091829020548251858152918201527f8a9dcf4e150b1153011b29fec302d5be0c13e84fa8f56ab78587f778a32a90dd910160405180910390a1806117e881613013565b915050611724565b50610db583836121b1565b60008054821080156107d2575050600090815260046020526040902054600160e01b161590565b6000816000548110156118775760008181526004602052604081205490600160e01b82169003611875575b8060000361186e57506000190160008181526004602052604090205461184d565b9392505050565b505b604051636f96cda160e11b815260040160405180910390fd5b804710156118a65763b12d13eb6000526004601cfd5b60005a60005a8486620186a0f16107ea57816000526073600b5360ff6020536016600b82f06107ea575a60141c3d5a3e5050565b606060006118e7836122af565b60010190506000816001600160401b0381111561190657611906612824565b6040519080825280601f01601f191660200182016040528015611930576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461193a57509392505050565b6060611977826117fb565b61199457604051630a14c4b560e41b815260040160405180910390fd5b600082815260116020908152604080832054815160e081018352600560a0820190815264566964656f60d81b60c0830152815282518084018452600b8082526a159a59195bc814dc19595960aa1b82870152828601919091528351808501855260128152712332b2b23130b1b5902234b932b1ba34b7b760711b818701528285015283518085018552600e81526d11995959189858dac814dc19595960921b818701526060830152835180850190945283526a436f6c6f7572204d6f646560a81b93830193909352608083019190915291611a6e83612387565b9050611a78612591565b611a898260005b60200201516118da565b81526020820151600b80549091908110611aa557611aa561302c565b906000526020600020018054611aba90612af9565b80601f0160208091040260200160405190810160405280929190818152602001828054611ae690612af9565b8015611b335780601f10611b0857610100808354040283529160200191611b33565b820191906000526020600020905b815481529060010190602001808311611b1657829003601f168201915b505050505081600160058110611b4b57611b4b61302c565b6020020152600c826002602002015181548110611b6a57611b6a61302c565b906000526020600020018054611b7f90612af9565b80601f0160208091040260200160405190810160405280929190818152602001828054611bab90612af9565b8015611bf85780601f10611bcd57610100808354040283529160200191611bf8565b820191906000526020600020905b815481529060010190602001808311611bdb57829003601f168201915b505050505081600260058110611c1057611c1061302c565b6020020152611c20826003611a7f565b60608201526080820151600d80549091908110611c3f57611c3f61302c565b906000526020600020018054611c5490612af9565b80601f0160208091040260200160405190810160405280929190818152602001828054611c8090612af9565b8015611ccd5780601f10611ca257610100808354040283529160200191611ccd565b820191906000526020600020905b815481529060010190602001808311611cb057829003601f168201915b505050505081600460058110611ce557611ce561302c565b60200201819052506000604051602001611d14906e2261747472696275746573223a205b60881b8152600f0190565b604051602081830303815290604052905060005b6005811015611dc6578015611d5a5781604051602001611d489190613042565b60405160208183030381529060405291505b81611d91868360058110611d7057611d7061302c565b6020020151858460058110611d8757611d8761302c565b60200201516124a6565b604051602001611da2929190613067565b60405160208183030381529060405291508080611dbe90613013565b915050611d28565b5080604051602001611dd89190613096565b60408051601f19818403018152919052979650505050505050565b60608151600003611e1257505060408051602081019091526000815290565b60006040518060600160405280604081526020016132886040913990506000600384516002611e419190612b43565b611e4b9190612ba0565b611e56906004612b73565b6001600160401b03811115611e6d57611e6d612824565b6040519080825280601f01601f191660200182016040528015611e97576020820181803683370190505b509050600182016020820185865187015b80821015611f03576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250611ea8565b5050600386510660018114611f1f5760028114611f3257611f3a565b603d6001830353603d6002830353611f3a565b603d60018303535b509195945050505050565b600082611f5285846124d2565b14949350505050565b6000803083604051602001611f719291906130bb565b60405160208183030381529060405290508051602082016000f091506001600160a01b038216611fe35760405162461bcd60e51b815260206004820152601e60248201527f436f6e7472616374417353746f726167653a205772697465204572726f7200006044820152606401611446565b50919050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6060813b606881108061204c575080155b156120995760405162461bcd60e51b815260206004820152601d60248201527f436f6e7472616374417353746f726167653a2052656164204572726f720000006044820152606401611446565b604080516028198301601f19168101909152606719820180825290925080606860208501863c5050919050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906120fb90339089908890889060040161318c565b6020604051808303816000875af1925050508015612136575060408051601f3d908101601f19168201909252612133918101906131bf565b60015b612194573d808015612164576040519150601f19603f3d011682016040523d82523d6000602084013e612169565b606091505b50805160000361218c576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b60008054908290036121d65760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461228557808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a460010161224d565b50816000036122a657604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106122ee5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061231a576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061233857662386f26fc10000830492506010015b6305f5e1008310612350576305f5e100830492506008015b612710831061236457612710830492506004015b60648310612376576064830492506002015b600a83106107d25760010192915050565b61238f6125b8565b6123976125b8565b60006123aa846002600c8054905061251f565b9050600080826000036123cb576123c4866003600961251f565b9150612423565b826001036123e0576123c4866003600961251f565b82600203612400576123f5866003600761251f565b6123c4906005612b43565b8260030361242357612415866003600561251f565b612420906007612b43565b91505b600283101561244b57612439866005600361251f565b612444906002612b43565b9050612466565b612458866005600461251f565b612463906002612b43565b90505b61247386600060d061251f565b8452600b5461248690879060019061251f565b602085015260408401929092526060830191909152608082015292915050565b606082826040516020016124bb9291906131dc565b604051602081830303815290604052905092915050565b600081815b845181101561251757612503828683815181106124f6576124f661302c565b6020026020010151612565565b91508061250f81613013565b9150506124d7565b509392505050565b6000601f8360ff16111561254657604051631390f2a160e01b815260040160405180910390fd5b81612552846008613250565b60ff1685901c60ff16610f789190613273565b600081831061258157600082815260208490526040902061186e565b5060009182526020526040902090565b6040518060a001604052806005905b60608152602001906001900390816125a05790505090565b6040518060a001604052806005906020820280368337509192915050565b6001600160e01b031981168114610d9757600080fd5b6000602082840312156125fe57600080fd5b813561186e816125d6565b80356001600160a01b038116811461262057600080fd5b919050565b6000806040838503121561263857600080fd5b61264183612609565b915060208301356001600160601b038116811461265d57600080fd5b809150509250929050565b60005b8381101561268357818101518382015260200161266b565b50506000910152565b600081518084526126a4816020860160208601612668565b601f01601f19169290920160200192915050565b60208152600061186e602083018461268c565b60008083601f8401126126dd57600080fd5b5081356001600160401b038111156126f457600080fd5b6020830191508360208260051b8501011115610d5257600080fd5b6000806000806060858703121561272557600080fd5b8435935061273560208601612609565b925060408501356001600160401b0381111561275057600080fd5b61275c878288016126cb565b95989497509550505050565b60006020828403121561277a57600080fd5b5035919050565b6000806040838503121561279457600080fd5b61279d83612609565b946020939093013593505050565b6000602082840312156127bd57600080fd5b61186e82612609565b6000806000606084860312156127db57600080fd5b6127e484612609565b92506127f260208501612609565b9150604084013590509250925092565b6000806040838503121561281557600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60006001600160401b038084111561285457612854612824565b604051601f8501601f19908116603f0116810190828211818310171561287c5761287c612824565b8160405280935085815286868601111561289557600080fd5b858560208301376000602087830101525050509392505050565b600082601f8301126128c057600080fd5b61186e8383356020850161283a565b6000602082840312156128e157600080fd5b81356001600160401b038111156128f757600080fd5b610f78848285016128af565b6000806040838503121561291657600080fd5b8235915060208301356001600160401b0381111561293357600080fd5b61293f858286016128af565b9150509250929050565b60008060006040848603121561295e57600080fd5b61296784612609565b925060208401356001600160401b0381111561298257600080fd5b61298e868287016126cb565b9497909650939450505050565b600080604083850312156129ae57600080fd5b82356001600160401b038111156129c457600080fd5b6129d0858286016128af565b95602094909401359450505050565b8015158114610d9757600080fd5b60008060408385031215612a0057600080fd5b612a0983612609565b9150602083013561265d816129df565b60008060008060808587031215612a2f57600080fd5b612a3885612609565b9350612a4660208601612609565b92506040850135915060608501356001600160401b03811115612a6857600080fd5b8501601f81018713612a7957600080fd5b612a888782356020840161283a565b91505092959194509250565b60008060408385031215612aa757600080fd5b612ab083612609565b9150612abe60208401612609565b90509250929050565b600080600060408486031215612adc57600080fd5b8335925060208401356001600160401b0381111561298257600080fd5b600181811c90821680612b0d57607f821691505b602082108103611fe357634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156107d2576107d2612b2d565b600060208284031215612b6857600080fd5b815161186e816129df565b80820281158282048414176107d2576107d2612b2d565b634e487b7160e01b600052601260045260246000fd5b600082612baf57612baf612b8a565b500490565b601f821115610db557600081815260208120601f850160051c81016020861015612bdb5750805b601f850160051c820191505b81811015610a0057828155600101612be7565b81516001600160401b03811115612c1357612c13612824565b612c2781612c218454612af9565b84612bb4565b602080601f831160018114612c5c5760008415612c445750858301515b600019600386901b1c1916600185901b178555610a00565b600085815260208120601f198616915b82811015612c8b57888601518255948401946001909101908401612c6c565b5085821015612ca95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008151612ccb818560208601612668565b9290920192915050565b60008451612ce7818460208901612668565b702f696e6465782e68746d6c3f686173683d60781b9083019081528451612d15816011840160208901612668565b6a26766964656f626173653d60a81b601192909101918201528351612d4181601c840160208801612668565b662f766964656f7360c81b601c929091019182015260230195945050505050565b60008351612d74818460208801612668565b6b2f7468756d626e61696c732f60a01b9083019081528351612d9d81600c840160208801612668565b631733b4b360e11b600c9290910191820152601001949350505050565b7f7b226e616d65223a20224e61747572616c205374617469632023000000000000815260008851612df281601a850160208d01612668565b72111610113232b9b1b934b83a34b7b7111d101160691b601a918401918201528851612e2581602d840160208d01612668565b7002e37102e37233ab63639b1b932b2b71d1607d1b602d92909101918201528751612e5781603e840160208c01612668565b7002e37102e372b34b232b79024b733379d1607d1b603e92909101918201528651612e8981604f840160208b01612668565b6c1116101134b6b0b3b2911d101160991b604f9290910191820152612f09612efc612ef6612ee7612ee1612ec0605c87018c612cb9565b741116101130b734b6b0ba34b7b72fbab936111d101160591b815260150190565b89612cb9565b6201116160ed1b815260030190565b86612cb9565b607d60f81b815260010190565b9a9950505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251612f4f81601d850160208701612668565b91909101601d0192915050565b6000808454612f6a81612af9565b60018281168015612f825760018114612f9757612fc6565b60ff1984168752821515830287019450612fc6565b8860005260208060002060005b85811015612fbd5781548a820152908401908201612fa4565b50505082870194505b505050506b2f766964656f2d696e666f2f60a01b81528351612fef81600c840160208801612668565b613009600c8284010164173539b7b760d91b815260050190565b9695505050505050565b60006001820161302557613025612b2d565b5060010190565b634e487b7160e01b600052603260045260246000fd5b60008251613054818460208701612668565b600b60fa1b920191825250600101919050565b60008351613079818460208801612668565b83519083019061308d818360208801612668565b01949350505050565b600082516130a8818460208701612668565b605d60f81b920191825250600101919050565b6a600b5981380380925939f360a81b81526b1808181218000e5800144cc560a21b600b8201526330082bff60e11b60178201526416d8004d8560da1b601b82015263300cabff60e11b6020820152635b60003560e01b6024820152617fff60f01b6028820152600060488201819052600560fa1b6049830152633021abff60e11b604a830152645b600051ff60d81b604e8301526131606053830160008152600c0190565b613176818660601b6001600160601b0319169052565b6131836014820185612cb9565b95945050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906130099083018461268c565b6000602082840312156131d157600080fd5b815161186e816125d6565b6f3d913a3930b4ba2fba3cb832911d101160811b81528251600090613208816010850160208801612668565b6c111610113b30b63ab2911d101160991b601091840191820152835161323581601d840160208801612668565b61227d60f01b601d9290910191820152601f01949350505050565b60ff818116838216029081169081811461326c5761326c612b2d565b5092915050565b60008261328257613282612b8a565b50069056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f4e61747572616c2053746174696320697320612067656e65726174697665204e465420736572696573207468617420666565647320766964656f206f66206e61747572616c206d6f74696f6e20696e746f206120706978656c2d62617365642077617465722073696d756c6174696f6e2c206372656174696e6720726570726573656e746174696f6e73206f6620706879736963616c206d6f74696f6e20746861742061726520686967686c79206469676974616c20616e6420646565706c7920616e616c6f672e204a6f6e617468616e2043686f6d6b6f2c20323032332ea264697066735822122012eba0f1949224d46536e1a5a3768a85c6399707a8eb529d093f0d0d60cd9b2764736f6c63430008110033
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.