{ "language": "Solidity", "sources": { "contracts/FreeHead.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.8.9 <0.9.0;\n\nimport \"erc721a/contracts/extensions/ERC721ABurnable.sol\";\nimport 'erc721a/contracts/extensions/ERC721AQueryable.sol';\nimport '@openzeppelin/contracts/access/Ownable.sol';\nimport '@openzeppelin/contracts/utils/cryptography/MerkleProof.sol';\n\ncontract FreeHead is ERC721ABurnable, ERC721AQueryable, Ownable{\n using Strings for uint256;\n\n bytes32 public merkleRoot;\n string public headLocation;\n string public hiddenMetadata;\n bool public isRevealed;\n bool public whitelistMintEnabled;\n bool public burnEnabled;\n bool public burnMintEnabled;\n\n mapping(address => bool) public whitelistClaimed;\n mapping(address => bool) public burntHeadClaimed;\n\n uint256 public constant maxSupply = 6000;\n uint256 public constant maxMintAmountPerTx = 2;\n\n\n\n constructor(string memory _hiddenMetadata) ERC721A(\"HuemanHead\", \"HEADZ\") {\n hiddenMetadata = _hiddenMetadata;\n }\n\n modifier mintCompliance(uint256 _mintAmount) {\n require(_mintAmount > 0 && _mintAmount <= maxMintAmountPerTx, 'Invalid mint amount!');\n require(totalSupply() + _mintAmount <= maxSupply, 'Max supply exceeded!');\n _;\n }\n\n function whitelistMint(uint256 _mintAmount, bytes32[] calldata _merkleProof) public mintCompliance(_mintAmount){\n require(whitelistMintEnabled, 'The whitelist sale is not enabled!');\n require(!whitelistClaimed[_msgSender()], 'Address already claimed!');\n bytes32 leaf = keccak256(abi.encodePacked(_msgSender()));\n require(MerkleProof.verify(_merkleProof, merkleRoot, leaf), 'Invalid proof!');\n\n whitelistClaimed[_msgSender()] = true;\n _safeMint(_msgSender(), _mintAmount);\n }\n\n \n function mintForAddress(uint256 _mintAmount, address _receiver) public onlyOwner {\n require(totalSupply() + _mintAmount <= maxSupply, 'Max supply exceeded!');\n _safeMint(_receiver, _mintAmount);\n }\n\n function burnMint() public {\n require(burnMintEnabled, \"This minting is not enabled\");\n require(_numberBurned(_msgSender()) >= 15);\n require(!burntHeadClaimed[_msgSender()], \"Address already claimed a burnt head.\");\n\n burntHeadClaimed[_msgSender()] = true;\n _safeMint(_msgSender(), 1);\n }\n \n function setHeadLocation(string memory _location) public onlyOwner {\n headLocation = _location;\n }\n\n function setPlaceHolderURI(string memory _URI) public onlyOwner {\n hiddenMetadata = _URI;\n }\n\n function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner {\n merkleRoot = _merkleRoot;\n }\n\n function setWhitelistMintEnabled(bool _state) public onlyOwner {\n whitelistMintEnabled = _state;\n }\n\n function setBurnEnabled(bool _state) public onlyOwner {\n burnEnabled = _state;\n }\n\n\n function setRevealed(bool _state) public onlyOwner {\n isRevealed = _state;\n }\n\n function setBurnMintEnabled(bool _state) public onlyOwner {\n burnMintEnabled = _state;\n }\n\n\n\n\n function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) {\n require(_exists(_tokenId), 'ERC721Metadata: URI query for nonexistent token');\n\n if (isRevealed == false) {\n return hiddenMetadata;\n }\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _tokenId.toString(), \".json\")) : '';\n }\n\n function _baseURI() internal view virtual override returns (string memory) {\n return headLocation;\n }\n function _startTokenId() internal view virtual override returns (uint256) {\n return 1;\n }\n\n \n function burn(uint256 tokenId) public virtual override {\n require(burnEnabled, \"Burning is not enabled!\");\n _burn(tokenId, true);\n }\n\n function burnedByAddress(address _user) public view returns(uint256){\n return _numberBurned(_user);\n }\n}\n\n\n\n" }, "erc721a/contracts/extensions/ERC721ABurnable.sol": { "content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v3.3.0\n// Creator: Chiru Labs\n\npragma solidity ^0.8.4;\n\nimport './IERC721ABurnable.sol';\nimport '../ERC721A.sol';\n\n/**\n * @title ERC721A Burnable Token\n * @dev ERC721A Token that can be irreversibly burned (destroyed).\n */\nabstract contract ERC721ABurnable is ERC721A, IERC721ABurnable {\n /**\n * @dev Burns `tokenId`. See {ERC721A-_burn}.\n *\n * Requirements:\n *\n * - The caller must own `tokenId` or be an approved operator.\n */\n function burn(uint256 tokenId) public virtual override {\n _burn(tokenId, true);\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` = `