{ "language": "Solidity", "sources": { "contracts/Wilders.sol": { "content": "// SPDX-License-Identifier: UNLICENSED\n\n/*\n\nby Wumbo Labs\n*/\n\npragma solidity >=0.8.0 <0.9.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/token/common/ERC2981.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol\";\nimport { DefaultOperatorFilterer, OperatorFilterer } from \"./DefaultOperatorFilterer.sol\";\nimport \"./ERC721A.sol\";\nimport \"./ERC721ABurnable.sol\";\nimport \"./ERC721AQueryable.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\n\n\ncontract WILDERS is ERC721A, ERC721ABurnable, ERC721AQueryable, Ownable, ERC2981, DefaultOperatorFilterer {\n using Strings for uint256;\n\n uint256 constant maxSupply = 4444;\n uint256 constant mintPrice = 0.015 ether;\n uint256 public maxPerAddressWaitlistPublic = 50;\n string public baseURI = \"https://ipfs.filebase.io/ipfs/QmcYz9ZbDahJGXmWaEeKf3MYWmveSNc65Axn3U1Vb29dtG\";\n string public baseExtension = \".json\";\n\n bytes32 public waitlistRoot = 0xd831d80038b6f1e5003f9fbd36a6c0b7089ae458c57d73c26c723ec14a67793c;\n\n enum Status {\n NOTSTARTED,\n WAITLIST,\n PUBLIC,\n REVEAL\n }\n\n Status public state;\n\n constructor() ERC721A(\"Wilders\", \"WILDERS\") {\n }\n \n function getNumberMinted(address _address) external view returns(uint256) {\n return _numberMinted(_address);\n }\n\n function setState(Status _state) external onlyOwner {\n state = _state;\n }\n \n\n function isWaitlist(address sender, bytes32[] calldata proof) public view returns(bool) {\n return MerkleProof.verify(proof, waitlistRoot, keccak256(abi.encodePacked(sender)));\n }\n\n\n function mintWaitlist(bytes32[] calldata proof, uint256 amount) public payable {\n require(state == Status.WAITLIST, \"Wilders: Waitlist mint not started\");\n require(isWaitlist(msg.sender, proof), \"Wilders: Cannot mint waitlist\");\n require(amount + totalSupply() <= maxSupply, \"Wilders: Max supply exceeded\");\n require(_numberMinted(msg.sender) + amount < 2, \"Wilders: Exceeded total amount per address\");\n _safeMint(msg.sender, amount);\n }\n\n function mintPublic(uint256 amount) public payable {\n require(state == Status.PUBLIC, \"Wilders: Public mint not started\");\n require(amount + totalSupply() <= maxSupply, \"Wilders: Max supply exceeded\");\n require(_numberMinted(msg.sender) + amount <= maxPerAddressWaitlistPublic, \"Wilders: Exceeded total amount per address\");\n _safeMint(msg.sender, amount);\n }\n\n function mintDev(address _address, uint256 _quantity) external onlyOwner {\n require(totalSupply() + _quantity <= maxSupply, \"Wilders: Exceeds total supply\");\n _safeMint(_address, _quantity);\n }\n\n function tokenURI(uint256 tokenId)\n public\n view\n virtual\n override(ERC721A, IERC721A)\n returns (string memory)\n {\n require(\n _exists(tokenId),\n \"ERC721Metadata: URI query for nonexistent token\"\n );\n\n string memory currentBaseURI = _baseURI();\n if (state != Status.REVEAL) {\n return currentBaseURI;\n }\n\n return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : \"\";\n }\n\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n override(ERC721A, ERC2981, IERC721A)\n returns (bool) \n {\n return\n ERC2981.supportsInterface(interfaceId)\n || ERC721A.supportsInterface(interfaceId);\n }\n\n function _startTokenId() internal view virtual override returns (uint256) {\n return 1;\n }\n\n function setBaseURI(string memory _newBaseURI) public onlyOwner {\n baseURI = _newBaseURI;\n }\n\n function setBaseExtension(string memory _newBaseExtension) public onlyOwner {\n baseExtension = _newBaseExtension;\n }\n\n function _baseURI() internal view virtual override returns (string memory) {\n return baseURI;\n }\n\n function setWaitlistRoot(bytes32 _newRoot) public onlyOwner {\n waitlistRoot = _newRoot;\n }\n\n function setDefaultRoyalty(\n address _receiver,\n uint96 _feeNumerator\n )\n external\n onlyOwner\n {\n _setDefaultRoyalty(_receiver, _feeNumerator);\n }\n\n function deleteDefaultRoyalty()\n external\n onlyOwner\n {\n _deleteDefaultRoyalty();\n }\n\n function setTokenRoyalty(\n uint256 _tokenId,\n address _receiver,\n uint96 _feeNumerator\n )\n external\n onlyOwner\n {\n _setTokenRoyalty(_tokenId, _receiver, _feeNumerator);\n }\n\n function resetTokenRoyalty(\n uint256 tokenId\n )\n external\n onlyOwner\n {\n _resetTokenRoyalty(tokenId);\n }\n\n /* ------------ OpenSea Overrides --------------*/\n function transferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n )\n public\n payable\n override(ERC721A, IERC721A) \n onlyAllowedOperator(_from)\n {\n super.transferFrom(_from, _to, _tokenId);\n }\n\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n ) \n public\n payable\n override(ERC721A, IERC721A) \n onlyAllowedOperator(_from)\n {\n super.safeTransferFrom(_from, _to, _tokenId);\n }\n\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId,\n bytes memory _data\n )\n public\n payable\n override(ERC721A, IERC721A) \n onlyAllowedOperator(_from)\n {\n super.safeTransferFrom(_from, _to, _tokenId, _data);\n }\n\n function withdrawMoney() external onlyOwner {\n (bool success, ) = msg.sender.call{value: address(this).balance}(\"\");\n require(success, \"Withdraw failed.\");\n }\n}" }, "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Tree proofs.\n *\n * The tree and the proofs can be generated using our\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\n * You will find a quickstart guide in the readme.\n *\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\n * hashing, or use a hash function other than keccak256 for hashing leaves.\n * This is because the concatenation of a sorted pair of internal nodes in\n * the merkle tree could be reinterpreted as a leaf value.\n * OpenZeppelin's JavaScript library generates merkle trees that are safe\n * against this attack out of the box.\n */\nlibrary MerkleProof {\n /**\n * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n * defined by `root`. For this, a `proof` must be provided, containing\n * sibling hashes on the branch from the leaf to the root of the tree. Each\n * pair of leaves and each pair of pre-images are assumed to be sorted.\n */\n function verify(\n bytes32[] memory proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProof(proof, leaf) == root;\n }\n\n /**\n * @dev Calldata version of {verify}\n *\n * _Available since v4.7._\n */\n function verifyCalldata(\n bytes32[] calldata proof,\n bytes32 root,\n bytes32 leaf\n ) internal pure returns (bool) {\n return processProofCalldata(proof, leaf) == root;\n }\n\n /**\n * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\n * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n * hash matches the root of the tree. When processing the proof, the pairs\n * of leafs & pre-images are assumed to be sorted.\n *\n * _Available since v4.4._\n */\n function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Calldata version of {processProof}\n *\n * _Available since v4.7._\n */\n function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\n bytes32 computedHash = leaf;\n for (uint256 i = 0; i < proof.length; i++) {\n computedHash = _hashPair(computedHash, proof[i]);\n }\n return computedHash;\n }\n\n /**\n * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerify(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProof(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Calldata version of {multiProofVerify}\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function multiProofVerifyCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32 root,\n bytes32[] memory leaves\n ) internal pure returns (bool) {\n return processMultiProofCalldata(proof, proofFlags, leaves) == root;\n }\n\n /**\n * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction\n * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another\n * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false\n * respectively.\n *\n * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree\n * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the\n * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).\n *\n * _Available since v4.7._\n */\n function processMultiProof(\n bytes32[] memory proof,\n bool[] memory proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n return hashes[totalHashes - 1];\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n /**\n * @dev Calldata version of {processMultiProof}.\n *\n * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n *\n * _Available since v4.7._\n */\n function processMultiProofCalldata(\n bytes32[] calldata proof,\n bool[] calldata proofFlags,\n bytes32[] memory leaves\n ) internal pure returns (bytes32 merkleRoot) {\n // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n // the merkle tree.\n uint256 leavesLen = leaves.length;\n uint256 totalHashes = proofFlags.length;\n\n // Check proof validity.\n require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n bytes32[] memory hashes = new bytes32[](totalHashes);\n uint256 leafPos = 0;\n uint256 hashPos = 0;\n uint256 proofPos = 0;\n // At each step, we compute the next hash using two values:\n // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n // get the next hash.\n // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n // `proof` array.\n for (uint256 i = 0; i < totalHashes; i++) {\n bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n hashes[i] = _hashPair(a, b);\n }\n\n if (totalHashes > 0) {\n return hashes[totalHashes - 1];\n } else if (leavesLen > 0) {\n return leaves[0];\n } else {\n return proof[0];\n }\n }\n\n function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\n return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\n }\n\n function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n /// @solidity memory-safe-assembly\n assembly {\n mstore(0x00, a)\n mstore(0x20, b)\n value := keccak256(0x00, 0x40)\n }\n }\n}\n" }, "contracts/ERC721AQueryable.sol": { "content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.2.3\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport './IERC721AQueryable.sol';\nimport './ERC721A.sol';\n\n/**\n * @title ERC721AQueryable.\n *\n * @dev ERC721A subclass with convenience query functions.\n */\nabstract contract ERC721AQueryable is ERC721A, IERC721AQueryable {\n /**\n * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting.\n *\n * If the `tokenId` is out of bounds:\n *\n * - `addr = address(0)`\n * - `startTimestamp = 0`\n * - `burned = false`\n * - `extraData = 0`\n *\n * If the `tokenId` is burned:\n *\n * - `addr =
`\n * - `startTimestamp =