{ "language": "Solidity", "sources": { "contracts/SwagSkulls.sol": { "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.13;\n\nimport \"erc721a/contracts/extensions/ERC721AQueryable.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\n/*\nkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk\nkkkkkkkkkkkkkkkkkkkxxkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxxxxkkkkkkkkkkkkkkkkkkkkkk\nkkkxxkkkkkkkkkkkxxxkkkxkkkkkkkkkkOOOOOOOkOOOkkkkkkkkxxkxxxkkxkkkkkkkkkkkkkkkxxkk\nkkxkkxxkkkkkkkkxkkkkxxxkkkkOkkdlc:;,,,,,,,;:cloxkOkkkxxxxxkkkkkkkkkkkkkxxxkkkxkk\nkkkkkkxxkkkkkkkkkkkkkkkkkxo:,.. ..'',,'''. .';ldkkkkkkkkkkkkkkkkkkkkkxkxxkkk\nkkkkkkkkkkkkkkkkkkkkkkxl;. .;lddkXNWWWWNNx..co:'. .'cdkOkkkkxkkkkxxkkkkkkkkkkkk\nkkkkkkkkkxkkkkkkkkkkxc. 'lxxxKNxkWMMMMMMK; 'oONN0d;. .;dkkkkkxxxxxxxkOkkkkkkkkk\nkkkkkkxxxxxkkkkkkkkl. ;xOd:,c0MMMMMMMMMMXkd,'kWMMMW0l. .;dkkkkxxxkxxkOkkkkkkkkk\nkkkkkkxxkxxkkkxkkd, ,k0l,;xXWMMMMMMMMMMMMWOdKMMMMMMMWKl. .ckOkkkkkkkkkkkkkkkkkk\nkkkkkkkxkxxxkkkko. .oXk';kNMMMMMMMMMMMMMMMN0NMMMMMMMMMMWO, :xkkkkkkxxkkkkkkkkkk\nkkkkkkkkkkkkkkko. .xWWKONMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMK: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kkkkkkkxxxkxxxkkkkkkkkkkkkkkk\nkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkOkkkkkkkkkkkkkkkkklancexwasxherextookkkk\nkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk\n*/\n\n/**\n * @title Swag Skulls\n * @author Swag Golf\n */\ncontract SwagSkulls is ERC721AQueryable, Ownable {\n\n using ECDSA for bytes32;\n\n uint public _maximumSupply = 8888;\n bool private _maximumSupplyLocked = false;\n uint256 private _mintingPrice;\n uint256 private _maxMintingBatchQuantity = 10;\n address private _mintingSigner;\n bool private _publicMintAllowed = false;\n mapping ( address => uint256 ) private privateMintAddressToQuantity;\n\n bool private _isRevealed = false;\n string public _revealUri;\n string public _prerevealUri;\n\n address public _withdrawalAddress;\n\n function _startTokenId() internal pure override returns (uint256) {\n return 1;\n }\n\n function startTokenId() external pure returns (uint256) {\n return _startTokenId();\n }\n\n function setMaximumSupply( \n uint maximumSupply\n )\n external \n onlyOwner \n {\n require( !_maximumSupplyLocked, \"Max supply is locked and cannot be changed\" );\n _maximumSupply = maximumSupply;\n }\n\n function lockMaximumSupply(\n bool isLocked\n )\n external\n onlyOwner \n {\n require( isLocked != _maximumSupplyLocked, \"New value idential to old value\" );\n require( !_maximumSupplyLocked, \"Max supply is locked and cannot be changed\" );\n\n _maximumSupplyLocked = isLocked;\n }\n\n function setMintingSigner(\n address mintingSigner \n )\n external\n onlyOwner\n {\n _mintingSigner = mintingSigner;\n }\n\n function setPublicMintAllowed(\n bool publicMintAllowed\n )\n external\n onlyOwner \n {\n _publicMintAllowed = publicMintAllowed;\n }\n\n function setMintingPrice(\n uint256 mintingPrice\n )\n external\n onlyOwner \n {\n _mintingPrice = mintingPrice;\n }\n\n function setMaxMintingBatchQuantity(\n uint256 maxMintingBatchQuantity\n )\n external\n onlyOwner \n {\n _maxMintingBatchQuantity = maxMintingBatchQuantity;\n }\n\n function setRevealUri(\n string memory revealUri\n )\n external \n onlyOwner \n {\n require( !_isRevealed, \"Reveal has already been done\" );\n _revealUri = revealUri;\n }\n\n function setIsRevealed(\n bool isRevealed\n )\n external \n onlyOwner \n {\n require( !_isRevealed, \"Reveal has already been done\" );\n _isRevealed = isRevealed;\n }\n\n constructor( \n uint256 mintingPrice, \n address mintingSigner,\n uint256 maxMintingBatchQuantity,\n string memory prerevealUri,\n address withdrawalAddress ) ERC721A( \"Swag Skulls\", \"SWAG\" ) \n {\n _mintingPrice = mintingPrice;\n _mintingSigner = mintingSigner;\n _maxMintingBatchQuantity = maxMintingBatchQuantity;\n _prerevealUri = prerevealUri;\n _withdrawalAddress = withdrawalAddress;\n }\n\n function hashMessage(\n address addressTo\n )\n public\n pure\n returns ( bytes32 ) \n {\n return keccak256( abi.encodePacked( addressTo ) );\n }\n\n function mint(\n uint256 quantity, \n bytes memory signedMessage) \n external \n payable\n {\n require( (totalSupply() + quantity) <= _maximumSupply, \"Minting would exceed max supply\" );\n require( quantity <= _maxMintingBatchQuantity, \"Attempt to mint more than maximum allowed\" );\n require( msg.value >= ( quantity * _mintingPrice ), \"Invalid payment amount\" );\n\n bytes32 recomputedHash = hashMessage( msg.sender );\n require( verifyMessageSigner( recomputedHash, signedMessage, _mintingSigner ), \"Signature doesn't match\");\n\n if( !_publicMintAllowed )\n {\n require( ( privateMintAddressToQuantity[ msg.sender ] + quantity ) <= _maxMintingBatchQuantity, \"Mint request exceeds maximum during private minting period\" );\n privateMintAddressToQuantity[ msg.sender ] += quantity;\n }\n \n _mint( msg.sender, quantity );\n } \n\n function verifyMessageSigner(\n bytes32 hashedMessage, \n bytes memory signedMessage,\n address expectedSigner) \n private \n pure \n returns ( bool ) {\n \n return ECDSA.toEthSignedMessageHash( hashedMessage ).recover( signedMessage ) == expectedSigner;\n } \n\n function ownerMint(\n address to,\n uint256 quantity )\n external\n onlyOwner \n {\n require( (totalSupply() + quantity) <= _maximumSupply, \"Minting would exceed max supply\" );\n _mint( to, quantity );\n }\n\n function tokenURI(\n uint256 tokenId ) \n public \n view \n override( ERC721A, IERC721A ) \n returns ( string memory ) \n {\n require( _exists( tokenId ), \"URI query for nonexistent token\" );\n\n if ( _isRevealed ) {\n return string( abi.encodePacked( _revealUri, _toString( tokenId ), \".json\" ) );\n } else {\n return _prerevealUri;\n }\n }\n\n //reminder: Never set to Lance's address!!\n function setWithdrawalAddress( address newAddress ) \n external \n onlyOwner \n {\n _withdrawalAddress = newAddress;\n }\n\n function withdraw() \n external \n onlyOwner \n {\n (bool success, ) = _withdrawalAddress.call{value: address(this).balance}(\"\");\n require(success);\n }\n}" }, "erc721a/contracts/extensions/ERC721AQueryable.sol": { "content": "// SPDX-License-Identifier: MIT\n// ERC721A Contracts v4.1.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 * - `extraData` = `0`\n *\n * If the `tokenId` is burned:\n * - `addr` = `
`\n * - `startTimestamp` = `