{ "language": "Solidity", "sources": { "contracts/TaiChiPandas.sol": { "content": "// SPDX-License-Identifier: MIT\n\n// Freelance Developer ==> http://twitter.com/FudMonk\n\npragma solidity >=0.8.9 <0.9.0;\n\nimport \"erc721a/contracts/extensions/ERC721AQueryable.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/finance/PaymentSplitter.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\n\ncontract TaiChiPandas is\n ERC721AQueryable,\n PaymentSplitter,\n Ownable,\n ReentrancyGuard\n{\n using Strings for uint256;\n\n uint256 public teamReserve;\n\n bytes32 public merkleRoot;\n\n bytes32 public freemerkleRoot;\n uint256 public freeMinted;\n mapping(address => bool) public freelistClaimed;\n\n string public uriPrefix = \"\";\n string public uriSuffix = \".json\";\n string public hiddenMetadataUri;\n\n uint256 public cost;\n uint256 public maxSupply;\n uint256 public freeSupply;\n uint256 public maxMintAmountPerTx;\n\n uint256 private payeeLength;\n\n bool public paused = true;\n bool public whitelistMintEnabled = false;\n bool public freelistMintEnabled = false;\n bool public reserved = true;\n bool public revealed = false;\n\n constructor(\n string memory _tokenName,\n string memory _tokenSymbol,\n uint256 _cost,\n uint256 _maxSupply,\n uint256 _freeSupply,\n uint256 _teamReserve,\n address[] memory _payee,\n uint256[] memory _shares,\n uint256 _maxMintAmountPerTx,\n string memory _hiddenMetadataUri\n ) ERC721A(_tokenName, _tokenSymbol) PaymentSplitter(_payee, _shares) {\n setCost(_cost);\n maxSupply = _maxSupply;\n freeSupply = _freeSupply;\n teamReserve = _teamReserve;\n payeeLength = _payee.length;\n setMaxMintAmountPerTx(_maxMintAmountPerTx);\n setHiddenMetadataUri(_hiddenMetadataUri);\n _safeMint(_msgSender(), _teamReserve);\n freeMinted = 0;\n }\n\n modifier mintCompliance(uint256 _mintAmount) {\n require(\n _mintAmount > 0 && _mintAmount <= maxMintAmountPerTx,\n \"Invalid mint amount!\"\n );\n if (reserved) {\n require(\n totalSupply() + _mintAmount <= maxSupply - freeSupply,\n \"Reserved\"\n );\n } else {\n require(\n totalSupply() + _mintAmount <= maxSupply,\n \"Max supply exceeded!\"\n );\n }\n _;\n }\n\n modifier freeCompliance(uint256 _mintAmount) {\n require(\n _mintAmount > 0 && _mintAmount <= maxMintAmountPerTx,\n \"Invalid mint amount!\"\n );\n require(\n freeMinted + _mintAmount <= freeSupply,\n \"Free supply exceeded!\"\n );\n require(\n totalSupply() + _mintAmount <= maxSupply,\n \"Max supply exceeded!\"\n );\n _;\n }\n\n modifier mintPriceCompliance(uint256 _mintAmount) {\n require(msg.value >= cost * _mintAmount, \"Insufficient funds!\");\n _;\n }\n\n function whitelistMint(uint256 _mintAmount, bytes32[] calldata _merkleProof)\n public\n payable\n mintCompliance(_mintAmount)\n mintPriceCompliance(_mintAmount)\n {\n // Verify whitelist requirements\n require(whitelistMintEnabled, \"The whitelist sale is not enabled!\");\n bytes32 leaf = keccak256(abi.encodePacked(_msgSender()));\n require(\n MerkleProof.verify(_merkleProof, merkleRoot, leaf),\n \"Invalid proof!\"\n );\n\n _safeMint(_msgSender(), _mintAmount);\n }\n\n\n function freelistMint(uint256 _mintAmount, bytes32[] calldata _merkleProof)\n public\n payable\n freeCompliance(_mintAmount)\n {\n // Verify whitelist requirements\n require(freelistMintEnabled, \"The freelist sale is not enabled!\");\n require(!freelistClaimed[_msgSender()], \"Address already claimed!\");\n bytes32 leaf = keccak256(abi.encodePacked(_msgSender()));\n require(\n MerkleProof.verify(_merkleProof, freemerkleRoot, leaf),\n \"Invalid proof!\"\n );\n\n freeMinted += _mintAmount;\n freelistClaimed[_msgSender()] = true;\n _safeMint(_msgSender(), _mintAmount);\n }\n\n function mint(uint256 _mintAmount)\n public\n payable\n mintCompliance(_mintAmount)\n mintPriceCompliance(_mintAmount)\n {\n require(!paused, \"The contract is paused!\");\n\n _safeMint(_msgSender(), _mintAmount);\n }\n\n function mintForAddress(uint256 _mintAmount, address _receiver)\n public\n mintCompliance(_mintAmount)\n onlyOwner\n {\n _safeMint(_receiver, _mintAmount);\n }\n\n function _startTokenId() internal view virtual override returns (uint256) {\n return 1;\n }\n\n function tokenURI(uint256 _tokenId)\n public\n view\n virtual\n override\n returns (string memory)\n {\n require(\n _exists(_tokenId),\n \"ERC721Metadata: URI query for nonexistent token\"\n );\n\n if (revealed == false) {\n return hiddenMetadataUri;\n }\n\n string memory currentBaseURI = _baseURI();\n return\n bytes(currentBaseURI).length > 0\n ? string(\n abi.encodePacked(\n currentBaseURI,\n _tokenId.toString(),\n uriSuffix\n )\n )\n : \"\";\n }\n\n function setRevealed(bool _state) public onlyOwner {\n revealed = _state;\n }\n\n function setCost(uint256 _cost) public onlyOwner {\n cost = _cost;\n }\n\n function setMaxMintAmountPerTx(uint256 _maxMintAmountPerTx)\n public\n onlyOwner\n {\n maxMintAmountPerTx = _maxMintAmountPerTx;\n }\n\n function setHiddenMetadataUri(string memory _hiddenMetadataUri)\n public\n onlyOwner\n {\n hiddenMetadataUri = _hiddenMetadataUri;\n }\n\n function setUriPrefix(string memory _uriPrefix) public onlyOwner {\n uriPrefix = _uriPrefix;\n }\n\n function setUriSuffix(string memory _uriSuffix) public onlyOwner {\n uriSuffix = _uriSuffix;\n }\n\n function setPaused(bool _state) public onlyOwner {\n paused = _state;\n }\n\n function setReserved() public onlyOwner {\n reserved = !reserved;\n }\n\n function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner {\n merkleRoot = _merkleRoot;\n }\n\n function setfreeMerkleRoot(bytes32 _merkleRoot) public onlyOwner {\n freemerkleRoot = _merkleRoot;\n }\n\n function setWhitelistMintEnabled(bool _state) public onlyOwner {\n whitelistMintEnabled = _state;\n }\n\n function setfreelistMintEnabled(bool _state) public onlyOwner {\n freelistMintEnabled = _state;\n }\n\n function releaseAll() external onlyOwner {\n for (uint256 i = 0; i < payeeLength; i++) {\n release(payable(payee(i)));\n }\n }\n\n function _baseURI() internal view virtual override returns (string memory) {\n return uriPrefix;\n }\n}\n" }, "erc721a/contracts/extensions/ERC721AQueryable.sol": { "content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v3.3.0\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport './IERC721AQueryable.sol';\nimport '../ERC721A.sol';\n\n/**\n * @title ERC721A Queryable\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 * - `addr` = `address(0)`\n * - `startTimestamp` = `0`\n * - `burned` = `false`\n *\n * If the `tokenId` is burned:\n * - `addr` = `
`\n * - `startTimestamp` = `