{ "language": "Solidity", "sources": { "contracts/WarriorsOfAnkh.sol": { "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity >=0.8.9 <0.9.0;\r\n\r\nimport 'erc721a/contracts/extensions/ERC721AQueryable.sol';\r\nimport '@openzeppelin/contracts/access/Ownable.sol';\r\nimport '@openzeppelin/contracts/utils/cryptography/MerkleProof.sol';\r\nimport '@openzeppelin/contracts/security/ReentrancyGuard.sol';\r\nimport '@openzeppelin/contracts/utils/Strings.sol';\r\nimport 'operator-filter-registry/src/DefaultOperatorFilterer.sol';\r\n\r\n\r\ncontract WarriorsOfAnkh is ERC721AQueryable, Ownable, ReentrancyGuard, DefaultOperatorFilterer {\r\n\r\n\r\n using Strings for uint256;\r\n\r\n bytes32 public merkleRoot;\r\n\r\n mapping(address => bool) public whitelistClaimed;\r\n\r\n\r\n string public uriPrefix = 'ipfs://QmNqAAAQpKorPngsjrhWW2qNGNnUfcu3jUxtkncyvuoJe4/';\r\n string public uriSuffix = '.json';\r\n string public hiddenMetadataUri;\r\n\r\n \r\n uint256 public cost = 0;\r\n uint256 public maxSupply = 1800;\r\n\r\n uint256 public maxMintAmountPerTx = 1;\r\n\r\n\r\n bool public paused = true;\r\n bool public whitelistMintEnabled = false; \r\n\r\n bool public revealed = true;\r\n\r\n\r\n\r\n\r\n constructor(\r\n \r\n ) ERC721A(\"WarriorsOfAnkh\", \"ANKH\") {\r\n \r\n }\r\n modifier mintCompliance(uint256 _mintAmount) {\r\n require(_mintAmount > 0 && _mintAmount <= maxMintAmountPerTx, 'Invalid mint amount!');\r\n require(totalSupply() + _mintAmount <= maxSupply, 'Max supply exceeded!');\r\n _;\r\n }\r\n\r\n modifier mintPriceCompliance(uint256 _mintAmount) {\r\n require(msg.value >= cost * _mintAmount, 'Insufficient funds!');\r\n _;\r\n }\r\n\r\n function whitelistMint(uint256 _mintAmount, bytes32[] calldata _merkleProof) public payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {\r\n \r\n require(whitelistMintEnabled, 'The whitelist sale is not enabled!');\r\n\r\n require(!whitelistClaimed[_msgSender()], 'Address already claimed!');\r\n bytes32 leaf = keccak256(abi.encodePacked(_msgSender()));\r\n require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), 'Invalid proof!');\r\n\r\n whitelistClaimed[_msgSender()] = true;\r\n\r\n _safeMint(_msgSender(), _mintAmount);\r\n }\r\n\r\n\r\n\r\n function mint(uint256 _mintAmount) public payable mintCompliance(_mintAmount) mintPriceCompliance(_mintAmount) {\r\n require(!paused, 'The contract is paused!');\r\n\r\n _safeMint(_msgSender(), _mintAmount);\r\n }\r\n \r\n function mintForAddress(uint256 _mintAmount, address _receiver) public mintCompliance(_mintAmount) onlyOwner {\r\n _safeMint(_receiver, _mintAmount);\r\n }\r\n\r\n function migrate(address[] calldata migratedAddresses) public onlyOwner {\r\n for (uint256 i = 0; i < migratedAddresses.length; i++) {\r\n _safeMint(migratedAddresses[i], 1);\r\n }\r\n }\r\n\r\n function _startTokenId() internal view virtual override returns (uint256) {\r\n return 1;\r\n }\r\n\r\n function tokenURI(uint256 _tokenId) public view virtual override(ERC721A, IERC721Metadata) returns (string memory) {\r\n require(_exists(_tokenId), 'ERC721Metadata: URI query for nonexistent token');\r\n \r\n if (revealed == false) {\r\n return hiddenMetadataUri;\r\n }\r\n string memory currentBaseURI = _baseURI();\r\n return bytes(currentBaseURI).length > 0\r\n ? string(abi.encodePacked(currentBaseURI, _tokenId.toString(), uriSuffix))\r\n : '';\r\n }\r\n\r\n function airdrop(uint256 _mintAmount, address _receiver) public onlyOwner {\r\n _safeMint(_receiver, _mintAmount);\r\n }\r\n\r\n\r\n function setCost(uint256 _cost) public onlyOwner {\r\n cost = _cost;\r\n }\r\n\r\n function setMaxSupply(uint256 _maxSupply) public onlyOwner {\r\n maxSupply = _maxSupply;\r\n }\r\n\r\n function setMaxMintAmountPerTx(uint256 _maxMintAmountPerTx) public onlyOwner {\r\n maxMintAmountPerTx = _maxMintAmountPerTx;\r\n }\r\n\r\n function setHiddenMetadataUri(string memory _hiddenMetadataUri) public onlyOwner {\r\n hiddenMetadataUri = _hiddenMetadataUri;\r\n }\r\n function setUriPrefix(string memory _uriPrefix) public onlyOwner {\r\n uriPrefix = _uriPrefix;\r\n }\r\n\r\n function setUriSuffix(string memory _uriSuffix) public onlyOwner {\r\n uriSuffix = _uriSuffix;\r\n }\r\n\r\n function setPaused(bool _state) public onlyOwner {\r\n paused = _state;\r\n }\r\n\r\n function setRevealed(bool _state) public onlyOwner {\r\n revealed = _state;\r\n }\r\n\r\n function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner {\r\n merkleRoot = _merkleRoot;\r\n }\r\n\r\n function setWhitelistMintEnabled(bool _state) public onlyOwner {\r\n whitelistMintEnabled = _state;\r\n }\r\n\r\n\r\n\r\nfunction transferFrom(address from, address to, uint256 tokenId) public override(ERC721A, IERC721) onlyAllowedOperator(from) {\r\n super.transferFrom(from, to, tokenId);\r\n }\r\n\r\n function safeTransferFrom(address from, address to, uint256 tokenId) public override(ERC721A, IERC721) onlyAllowedOperator(from) {\r\n super.safeTransferFrom(from, to, tokenId);\r\n }\r\n\r\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public override(ERC721A, IERC721) onlyAllowedOperator(from) {\r\n super.safeTransferFrom(from, to, tokenId, data);\r\n }\r\n function withdraw() public onlyOwner nonReentrant {\r\n (bool os, ) = payable(owner()).call{value: address(this).balance}('');\r\n require(os);\r\n }\r\n\r\n function _baseURI() internal view virtual override returns (string memory) {\r\n return uriPrefix;\r\n }\r\n\r\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` = `