{ "language": "Solidity", "sources": { "contracts/manifold/lazyclaim/ERC721LazyPayableClaim.sol": { "content": "// SPDX-License-Identifier: MIT\n// solhint-disable reason-string\npragma solidity ^0.8.0;\n\nimport \"@manifoldxyz/creator-core-solidity/contracts/core/IERC721CreatorCore.sol\";\nimport \"@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol\";\nimport \"@manifoldxyz/creator-core-solidity/contracts/extensions/ICreatorExtensionTokenURI.sol\";\n\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC165.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\n\nimport \"./IERC721LazyPayableClaim.sol\";\nimport \"../../libraries/delegation-registry/IDelegationRegistry.sol\";\n\n/**\n * @title Lazy Payable Claim\n * @author manifold.xyz\n * @notice Lazy payable claim with optional whitelist ERC721 tokens\n */\ncontract ERC721LazyPayableClaim is IERC165, IERC721LazyPayableClaim, ICreatorExtensionTokenURI, ReentrancyGuard {\n using Strings for uint256;\n\n string private constant ARWEAVE_PREFIX = \"https://arweave.net/\";\n string private constant IPFS_PREFIX = \"ipfs://\";\n uint256 private constant MINT_INDEX_BITMASK = 0xFF;\n // solhint-disable-next-line\n address public immutable DELEGATION_REGISTRY;\n uint32 private constant MAX_UINT_32 = 0xffffffff;\n uint256 private constant MAX_UINT_256 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;\n\n // stores mapping from tokenId to the claim it represents\n // { contractAddress => { tokenId => Claim } }\n mapping(address => mapping(uint256 => Claim)) private _claims;\n\n // ONLY USED FOR NON-MERKLE MINTS: stores the number of tokens minted per wallet per claim, in order to limit maximum\n // { contractAddress => { claimIndex => { walletAddress => walletMints } } }\n mapping(address => mapping(uint256 => mapping(address => uint256))) private _mintsPerWallet;\n\n // ONLY USED FOR MERKLE MINTS: stores mapping from claim to indices minted\n // { contractAddress => {claimIndex => { claimIndexOffset => index } } }\n mapping(address => mapping(uint256 => mapping(uint256 => uint256))) private _claimMintIndices;\n\n struct TokenClaim {\n uint224 claimIndex;\n uint32 mintOrder;\n }\n // stores which tokenId corresponds to which claimIndex, used to generate token uris\n // { contractAddress => { tokenId => TokenClaim } }\n mapping(address => mapping(uint256 => TokenClaim)) private _tokenClaims;\n\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165) returns (bool) {\n return interfaceId == type(IERC721LazyPayableClaim).interfaceId ||\n interfaceId == type(ICreatorExtensionTokenURI).interfaceId ||\n interfaceId == type(IERC165).interfaceId;\n }\n\n constructor(address delegationRegistry) {\n DELEGATION_REGISTRY = delegationRegistry;\n }\n\n /**\n * @notice This extension is shared, not single-creator. So we must ensure\n * that a claim's initializer is an admin on the creator contract\n * @param creatorContractAddress the address of the creator contract to check the admin against\n */\n modifier creatorAdminRequired(address creatorContractAddress) {\n AdminControl creatorCoreContract = AdminControl(creatorContractAddress);\n require(creatorCoreContract.isAdmin(msg.sender), \"Wallet is not an administrator for contract\");\n _;\n }\n\n /**\n * See {IERC721LazyClaim-initializeClaim}.\n */\n function initializeClaim(\n address creatorContractAddress,\n uint256 claimIndex,\n ClaimParameters calldata claimParameters\n ) external override creatorAdminRequired(creatorContractAddress) {\n // Revert if claim at claimIndex already exists\n require(_claims[creatorContractAddress][claimIndex].storageProtocol == StorageProtocol.INVALID, \"Claim already initialized\");\n\n // Sanity checks\n require(claimParameters.storageProtocol != StorageProtocol.INVALID, \"Cannot initialize with invalid storage protocol\");\n require(claimParameters.endDate == 0 || claimParameters.startDate < claimParameters.endDate, \"Cannot have startDate greater than or equal to endDate\");\n require(claimParameters.merkleRoot == \"\" || claimParameters.walletMax == 0, \"Cannot provide both mintsPerWallet and merkleRoot\");\n\n // Create the claim\n _claims[creatorContractAddress][claimIndex] = Claim({\n total: 0,\n totalMax: claimParameters.totalMax,\n walletMax: claimParameters.walletMax,\n startDate: claimParameters.startDate,\n endDate: claimParameters.endDate,\n storageProtocol: claimParameters.storageProtocol,\n identical: claimParameters.identical,\n merkleRoot: claimParameters.merkleRoot,\n location: claimParameters.location,\n cost: claimParameters.cost,\n paymentReceiver: claimParameters.paymentReceiver\n });\n\n emit ClaimInitialized(creatorContractAddress, claimIndex, msg.sender);\n }\n\n /**\n * See {IERC721LazyClaim-udpateClaim}.\n */\n function updateClaim(\n address creatorContractAddress,\n uint256 claimIndex,\n ClaimParameters calldata claimParameters\n ) external override creatorAdminRequired(creatorContractAddress) {\n // Sanity checks\n require(_claims[creatorContractAddress][claimIndex].storageProtocol != StorageProtocol.INVALID, \"Claim not initialized\");\n require(claimParameters.storageProtocol != StorageProtocol.INVALID, \"Cannot set invalid storage protocol\");\n require(claimParameters.endDate == 0 || claimParameters.startDate < claimParameters.endDate, \"Cannot have startDate greater than or equal to endDate\");\n\n // Overwrite the existing claim\n _claims[creatorContractAddress][claimIndex] = Claim({\n total: _claims[creatorContractAddress][claimIndex].total,\n totalMax: claimParameters.totalMax,\n walletMax: claimParameters.walletMax,\n startDate: claimParameters.startDate,\n endDate: claimParameters.endDate,\n storageProtocol: claimParameters.storageProtocol,\n identical: claimParameters.identical,\n merkleRoot: claimParameters.merkleRoot,\n location: claimParameters.location,\n cost: claimParameters.cost,\n paymentReceiver: claimParameters.paymentReceiver\n });\n }\n\n /**\n * See {IERC721LazyClaim-updateTokenURIParams}.\n */\n function updateTokenURIParams(\n address creatorContractAddress, uint256 claimIndex,\n StorageProtocol storageProtocol,\n bool identical,\n string calldata location\n ) external override creatorAdminRequired(creatorContractAddress) {\n Claim memory claim = _claims[creatorContractAddress][claimIndex];\n require(_claims[creatorContractAddress][claimIndex].storageProtocol != StorageProtocol.INVALID, \"Claim not initialized\");\n require(storageProtocol != StorageProtocol.INVALID, \"Cannot set invalid storage protocol\");\n\n // Overwrite the existing claim\n _claims[creatorContractAddress][claimIndex] = Claim({\n total: claim.total,\n totalMax: claim.totalMax,\n walletMax: claim.walletMax,\n startDate: claim.startDate,\n endDate: claim.endDate,\n storageProtocol: storageProtocol,\n identical: identical,\n merkleRoot: claim.merkleRoot,\n location: location,\n cost: claim.cost,\n paymentReceiver: claim.paymentReceiver\n });\n }\n\n /**\n * See {IERC721LazyClaim-getClaim}.\n */\n function getClaim(address creatorContractAddress, uint256 claimIndex) external override view returns(Claim memory claim) {\n claim = _claims[creatorContractAddress][claimIndex];\n require(claim.storageProtocol != StorageProtocol.INVALID, \"Claim not initialized\");\n }\n\n /**\n * See {IERC721LazyClaim-checkMintIndex}.\n */\n function checkMintIndex(address creatorContractAddress, uint256 claimIndex, uint32 mintIndex) public override view returns(bool) {\n Claim storage claim = _claims[creatorContractAddress][claimIndex];\n require(claim.storageProtocol != StorageProtocol.INVALID, \"Claim not initialized\");\n require(claim.merkleRoot != \"\", \"Can only check merkle claims\");\n uint256 claimMintIndex = mintIndex >> 8;\n uint256 claimMintTracking = _claimMintIndices[creatorContractAddress][claimIndex][claimMintIndex];\n uint256 mintBitmask = 1 << (mintIndex & MINT_INDEX_BITMASK);\n return mintBitmask & claimMintTracking != 0;\n }\n\n /**\n * See {IERC721LazyClaim-checkMintIndices}.\n */\n function checkMintIndices(address creatorContractAddress, uint256 claimIndex, uint32[] calldata mintIndices) external override view returns(bool[] memory minted) {\n uint256 mintIndicesLength = mintIndices.length;\n minted = new bool[](mintIndices.length);\n for (uint256 i = 0; i < mintIndicesLength;) {\n minted[i] = checkMintIndex(creatorContractAddress, claimIndex, mintIndices[i]);\n unchecked{ ++i; }\n }\n }\n\n /**\n * See {IERC721LazyClaim-getTotalMints}.\n */\n function getTotalMints(address minter, address creatorContractAddress, uint256 claimIndex) external override view returns(uint32) {\n Claim storage claim = _claims[creatorContractAddress][claimIndex];\n require(claim.storageProtocol != StorageProtocol.INVALID, \"Claim not initialized\");\n require(claim.walletMax != 0, \"Can only retrieve for non-merkle claims with walletMax\");\n return uint32(_mintsPerWallet[creatorContractAddress][claimIndex][minter]);\n }\n\n /**\n * See {IERC721LazyClaim-mint}.\n */\n function mint(address creatorContractAddress, uint256 claimIndex, uint32 mintIndex, bytes32[] calldata merkleProof, address mintFor) external payable override {\n Claim storage claim = _claims[creatorContractAddress][claimIndex];\n // Safely retrieve the claim\n require(claim.storageProtocol != StorageProtocol.INVALID, \"Claim not initialized\");\n\n // Check price\n require(msg.value == claim.cost, \"Must pay more.\");\n\n // Check timestamps\n require(claim.startDate == 0 || claim.startDate < block.timestamp, \"Transaction before start date\");\n require(claim.endDate == 0 || claim.endDate >= block.timestamp, \"Transaction after end date\");\n\n // Check totalMax\n require(claim.totalMax == 0 || claim.total < claim.totalMax, \"Maximum tokens already minted for this claim\");\n\n if (claim.merkleRoot != \"\") {\n // Merkle mint\n _checkMerkleAndUpdate(claim, creatorContractAddress, claimIndex, mintIndex, merkleProof, mintFor);\n } else {\n // Non-merkle mint\n if (claim.walletMax != 0) {\n require(_mintsPerWallet[creatorContractAddress][claimIndex][msg.sender] < claim.walletMax, \"Maximum tokens already minted for this wallet\");\n unchecked{ _mintsPerWallet[creatorContractAddress][claimIndex][msg.sender]++; }\n }\n }\n unchecked{ claim.total++; }\n\n // Do mint\n uint256 newTokenId = IERC721CreatorCore(creatorContractAddress).mintExtension(msg.sender);\n\n // Insert the new tokenId into _tokenClaims for the current claim address & index\n _tokenClaims[creatorContractAddress][newTokenId] = TokenClaim(uint224(claimIndex), claim.total);\n // solhint-disable-next-line\n (bool sent, ) = claim.paymentReceiver.call{value: msg.value}(\"\");\n require(sent, \"Failed to transfer to receiver\");\n\n emit ClaimMint(creatorContractAddress, claimIndex);\n }\n\n /**\n * See {IERC721LazyClaim-mintBatch}.\n */\n function mintBatch(address creatorContractAddress, uint256 claimIndex, uint16 mintCount, uint32[] calldata mintIndices, bytes32[][] calldata merkleProofs, address mintFor) external payable override {\n Claim storage claim = _claims[creatorContractAddress][claimIndex];\n \n // Safely retrieve the claim\n require(claim.storageProtocol != StorageProtocol.INVALID, \"Claim not initialized\");\n\n // Check price\n require(msg.value == claim.cost * mintCount, \"Must pay more.\");\n\n // Check timestamps\n require(claim.startDate == 0 || claim.startDate < block.timestamp, \"Transaction before start date\");\n require(claim.endDate == 0 || claim.endDate >= block.timestamp, \"Transaction after end date\");\n\n // Check totalMax\n require(claim.totalMax == 0 || claim.total+mintCount <= claim.totalMax, \"Too many requested for this claim\");\n \n uint256 newMintIndex = claim.total+1;\n unchecked{ claim.total += mintCount; }\n\n if (claim.merkleRoot != \"\") {\n require(mintCount == mintIndices.length && mintCount == merkleProofs.length, \"Invalid input\");\n // Merkle mint\n for (uint256 i = 0; i < mintCount;) {\n uint32 mintIndex = mintIndices[i];\n bytes32[] memory merkleProof = merkleProofs[i];\n \n _checkMerkleAndUpdate(claim, creatorContractAddress, claimIndex, mintIndex, merkleProof, mintFor);\n unchecked { ++i; }\n }\n } else {\n // Non-merkle mint\n if (claim.walletMax != 0) {\n require(_mintsPerWallet[creatorContractAddress][claimIndex][msg.sender]+mintCount <= claim.walletMax, \"Too many requested for this wallet\");\n unchecked{ _mintsPerWallet[creatorContractAddress][claimIndex][msg.sender] += mintCount; }\n }\n \n }\n uint256[] memory newTokenIds = IERC721CreatorCore(creatorContractAddress).mintExtensionBatch(msg.sender, mintCount);\n for (uint256 i = 0; i < mintCount;) {\n _tokenClaims[creatorContractAddress][newTokenIds[i]] = TokenClaim(uint224(claimIndex), uint32(newMintIndex+i));\n unchecked { ++i; }\n }\n // solhint-disable-next-line\n (bool sent, ) = claim.paymentReceiver.call{value: msg.value}(\"\");\n require(sent, \"Failed to transfer to receiver\");\n\n emit ClaimMintBatch(creatorContractAddress, claimIndex, mintCount);\n }\n\n /**\n * See {IERC721LazyClaim-airdrop}.\n */\n function airdrop(address creatorContractAddress, uint256 claimIndex, address[] calldata recipients,\n uint16[] calldata amounts) external override creatorAdminRequired(creatorContractAddress) {\n require(recipients.length == amounts.length, \"Unequal number of recipients and amounts provided\");\n\n // Fetch the claim, create newMintIndex to keep track of token ids created by the airdrop\n Claim storage claim = _claims[creatorContractAddress][claimIndex];\n uint256 newMintIndex = claim.total+1;\n\n for (uint256 i = 0; i < recipients.length;) {\n // Airdrop the tokens\n uint256[] memory newTokenIds = IERC721CreatorCore(creatorContractAddress).mintExtensionBatch(recipients[i], amounts[i]);\n \n // Register the tokenClaims, so that tokenURI will work for airdropped tokens\n for (uint256 j = 0; j < newTokenIds.length;) {\n _tokenClaims[creatorContractAddress][newTokenIds[j]] = TokenClaim(uint224(claimIndex), uint32(newMintIndex+j));\n unchecked { ++j; }\n }\n\n // Increment claim.total and newMintIndex for the next airdrop\n unchecked{ claim.total += uint32(newTokenIds.length); }\n unchecked{ newMintIndex += newTokenIds.length; }\n\n unchecked{ ++i; }\n }\n }\n\n /**\n * Helper to check merkle proof and whether or not the mintIndex was consumed. Also updates the consumed counts\n */\n function _checkMerkleAndUpdate(Claim storage claim, address creatorContractAddress, uint256 claimIndex, uint32 mintIndex, bytes32[] memory merkleProof, address mintFor) private {\n // Merkle mint\n bytes32 leaf;\n if (mintFor == msg.sender) {\n leaf = keccak256(abi.encodePacked(msg.sender, mintIndex));\n } else {\n // Direct verification failed, try delegate verification\n IDelegationRegistry dr = IDelegationRegistry(DELEGATION_REGISTRY);\n require(dr.checkDelegateForContract(msg.sender, mintFor, address(this)), \"Invalid delegate\");\n leaf = keccak256(abi.encodePacked(mintFor, mintIndex));\n }\n require(MerkleProof.verify(merkleProof, claim.merkleRoot, leaf), \"Could not verify merkle proof\");\n\n // Check if mintIndex has been minted\n uint256 claimMintIndex = mintIndex >> 8;\n uint256 claimMintTracking = _claimMintIndices[creatorContractAddress][claimIndex][claimMintIndex];\n uint256 mintBitmask = 1 << (mintIndex & MINT_INDEX_BITMASK);\n require(mintBitmask & claimMintTracking == 0, \"Already minted\");\n _claimMintIndices[creatorContractAddress][claimIndex][claimMintIndex] = claimMintTracking | mintBitmask;\n }\n\n /**\n * See {ICreatorExtensionTokenURI-tokenURI}.\n */\n function tokenURI(address creatorContractAddress, uint256 tokenId) external override view returns(string memory uri) {\n TokenClaim memory tokenClaim = _tokenClaims[creatorContractAddress][tokenId];\n require(tokenClaim.claimIndex > 0, \"Token does not exist\");\n Claim memory claim = _claims[creatorContractAddress][tokenClaim.claimIndex];\n\n string memory prefix = \"\";\n if (claim.storageProtocol == StorageProtocol.ARWEAVE) {\n prefix = ARWEAVE_PREFIX;\n } else if (claim.storageProtocol == StorageProtocol.IPFS) {\n prefix = IPFS_PREFIX;\n }\n uri = string(abi.encodePacked(prefix, claim.location));\n\n // Depending on params, we may want to append a suffix to location\n if (!claim.identical) {\n uri = string(abi.encodePacked(uri, \"/\", uint256(tokenClaim.mintOrder).toString()));\n }\n }\n}\n" }, "contracts/libraries/delegation-registry/IDelegationRegistry.sol": { "content": "// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.9;\n\n/**\n * @title An immutable registry contract to be deployed as a standalone primitive\n * @dev See EIP-5639, new project launches can read previous cold wallet -> hot wallet delegations\n * from here and integrate those permissions into their flow\n */\ninterface IDelegationRegistry {\n /// @notice Delegation type\n enum DelegationType {\n NONE,\n ALL,\n CONTRACT,\n TOKEN\n }\n\n /// @notice Info about a single delegation, used for onchain enumeration\n struct DelegationInfo {\n DelegationType type_;\n address vault;\n address delegate;\n address contract_;\n uint256 tokenId;\n }\n\n /// @notice Info about a single contract-level delegation\n struct ContractDelegation {\n address contract_;\n address delegate;\n }\n\n /// @notice Info about a single token-level delegation\n struct TokenDelegation {\n address contract_;\n uint256 tokenId;\n address delegate;\n }\n\n /// @notice Emitted when a user delegates their entire wallet\n event DelegateForAll(address vault, address delegate, bool value);\n\n /// @notice Emitted when a user delegates a specific contract\n event DelegateForContract(address vault, address delegate, address contract_, bool value);\n\n /// @notice Emitted when a user delegates a specific token\n event DelegateForToken(address vault, address delegate, address contract_, uint256 tokenId, bool value);\n\n /// @notice Emitted when a user revokes all delegations\n event RevokeAllDelegates(address vault);\n\n /// @notice Emitted when a user revoes all delegations for a given delegate\n event RevokeDelegate(address vault, address delegate);\n\n /**\n * ----------- WRITE -----------\n */\n\n /**\n * @notice Allow the delegate to act on your behalf for all contracts\n * @param delegate The hotwallet to act on your behalf\n * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking\n */\n function delegateForAll(address delegate, bool value) external;\n\n /**\n * @notice Allow the delegate to act on your behalf for a specific contract\n * @param delegate The hotwallet to act on your behalf\n * @param contract_ The address for the contract you're delegating\n * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking\n */\n function delegateForContract(address delegate, address contract_, bool value) external;\n\n /**\n * @notice Allow the delegate to act on your behalf for a specific token\n * @param delegate The hotwallet to act on your behalf\n * @param contract_ The address for the contract you're delegating\n * @param tokenId The token id for the token you're delegating\n * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking\n */\n function delegateForToken(address delegate, address contract_, uint256 tokenId, bool value) external;\n\n /**\n * @notice Revoke all delegates\n */\n function revokeAllDelegates() external;\n\n /**\n * @notice Revoke a specific delegate for all their permissions\n * @param delegate The hotwallet to revoke\n */\n function revokeDelegate(address delegate) external;\n\n /**\n * @notice Remove yourself as a delegate for a specific vault\n * @param vault The vault which delegated to the msg.sender, and should be removed\n */\n function revokeSelf(address vault) external;\n\n /**\n * ----------- READ -----------\n */\n\n /**\n * @notice Returns all active delegations a given delegate is able to claim on behalf of\n * @param delegate The delegate that you would like to retrieve delegations for\n * @return info Array of DelegationInfo structs\n */\n function getDelegationsByDelegate(address delegate) external view returns (DelegationInfo[] memory);\n\n /**\n * @notice Returns an array of wallet-level delegates for a given vault\n * @param vault The cold wallet who issued the delegation\n * @return addresses Array of wallet-level delegates for a given vault\n */\n function getDelegatesForAll(address vault) external view returns (address[] memory);\n\n /**\n * @notice Returns an array of contract-level delegates for a given vault and contract\n * @param vault The cold wallet who issued the delegation\n * @param contract_ The address for the contract you're delegating\n * @return addresses Array of contract-level delegates for a given vault and contract\n */\n function getDelegatesForContract(address vault, address contract_) external view returns (address[] memory);\n\n /**\n * @notice Returns an array of contract-level delegates for a given vault's token\n * @param vault The cold wallet who issued the delegation\n * @param contract_ The address for the contract holding the token\n * @param tokenId The token id for the token you're delegating\n * @return addresses Array of contract-level delegates for a given vault's token\n */\n function getDelegatesForToken(address vault, address contract_, uint256 tokenId)\n external\n view\n returns (address[] memory);\n\n /**\n * @notice Returns all contract-level delegations for a given vault\n * @param vault The cold wallet who issued the delegations\n * @return delegations Array of ContractDelegation structs\n */\n function getContractLevelDelegations(address vault)\n external\n view\n returns (ContractDelegation[] memory delegations);\n\n /**\n * @notice Returns all token-level delegations for a given vault\n * @param vault The cold wallet who issued the delegations\n * @return delegations Array of TokenDelegation structs\n */\n function getTokenLevelDelegations(address vault) external view returns (TokenDelegation[] memory delegations);\n\n /**\n * @notice Returns true if the address is delegated to act on the entire vault\n * @param delegate The hotwallet to act on your behalf\n * @param vault The cold wallet who issued the delegation\n */\n function checkDelegateForAll(address delegate, address vault) external view returns (bool);\n\n /**\n * @notice Returns true if the address is delegated to act on your behalf for a token contract or an entire vault\n * @param delegate The hotwallet to act on your behalf\n * @param contract_ The address for the contract you're delegating\n * @param vault The cold wallet who issued the delegation\n */\n function checkDelegateForContract(address delegate, address vault, address contract_)\n external\n view\n returns (bool);\n\n /**\n * @notice Returns true if the address is delegated to act on your behalf for a specific token, the token's contract or an entire vault\n * @param delegate The hotwallet to act on your behalf\n * @param contract_ The address for the contract you're delegating\n * @param tokenId The token id for the token you're delegating\n * @param vault The cold wallet who issued the delegation\n */\n function checkDelegateForToken(address delegate, address vault, address contract_, uint256 tokenId)\n external\n view\n returns (bool);\n}\n" }, "contracts/manifold/lazyclaim/IERC721LazyPayableClaim.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\n/**\n * Lazy Payable Claim interface\n */\ninterface IERC721LazyPayableClaim {\n enum StorageProtocol { INVALID, NONE, ARWEAVE, IPFS }\n\n struct ClaimParameters {\n uint32 totalMax;\n uint32 walletMax;\n uint48 startDate;\n uint48 endDate;\n StorageProtocol storageProtocol;\n bool identical;\n bytes32 merkleRoot;\n string location;\n uint cost;\n address payable paymentReceiver;\n }\n\n struct Claim {\n uint32 total;\n uint32 totalMax;\n uint32 walletMax;\n uint48 startDate;\n uint48 endDate;\n StorageProtocol storageProtocol;\n bool identical;\n bytes32 merkleRoot;\n string location;\n uint cost;\n address payable paymentReceiver;\n }\n\n event ClaimInitialized(address indexed creatorContract, uint256 indexed claimIndex, address initializer);\n event ClaimMint(address indexed creatorContract, uint256 indexed claimIndex);\n event ClaimMintBatch(address indexed creatorContract, uint256 indexed claimIndex, uint16 mintCount);\n\n /**\n * @notice initialize a new claim, emit initialize event, and return the newly created index\n * @param creatorContractAddress the creator contract the claim will mint tokens for\n * @param claimIndex the index of the claim in the list of creatorContractAddress' _claims\n * @param claimParameters the parameters which will affect the minting behavior of the claim\n */\n function initializeClaim(address creatorContractAddress, uint256 claimIndex, ClaimParameters calldata claimParameters) external;\n\n /**\n * @notice update an existing claim at claimIndex\n * @param creatorContractAddress the creator contract corresponding to the claim\n * @param claimIndex the index of the claim in the list of creatorContractAddress' _claims\n * @param claimParameters the parameters which will affect the minting behavior of the claim\n */\n function updateClaim(address creatorContractAddress, uint256 claimIndex, ClaimParameters calldata claimParameters) external;\n\n /**\n * @notice update tokenURI parameters for an existing claim at claimIndex\n * @param creatorContractAddress the creator contract corresponding to the claim\n * @param claimIndex the index of the claim in the list of creatorContractAddress' _claims\n * @param storageProtocol the new storage protocol\n * @param identical the new value of identical\n * @param location the new location\n */\n function updateTokenURIParams(address creatorContractAddress, uint256 claimIndex, StorageProtocol storageProtocol, bool identical, string calldata location) external;\n\n /**\n * @notice get a claim corresponding to a creator contract and index\n * @param creatorContractAddress the address of the creator contract\n * @param claimIndex the index of the claim\n * @return the claim object\n */\n function getClaim(address creatorContractAddress, uint256 claimIndex) external view returns(Claim memory);\n\n /**\n * @notice check if a mint index has been consumed or not (only for merkle claims)\n *\n * @param creatorContractAddress the address of the creator contract for the claim\n * @param claimIndex the index of the claim\n * @param mintIndex the mint index of the claim\n * @return whether or not the mint index was consumed\n */\n function checkMintIndex(address creatorContractAddress, uint256 claimIndex, uint32 mintIndex) external view returns(bool);\n\n /**\n * @notice check if multiple mint indices has been consumed or not (only for merkle claims)\n *\n * @param creatorContractAddress the address of the creator contract for the claim\n * @param claimIndex the index of the claim\n * @param mintIndices the mint index of the claim\n * @return whether or not the mint index was consumed\n */\n function checkMintIndices(address creatorContractAddress, uint256 claimIndex, uint32[] calldata mintIndices) external view returns(bool[] memory);\n\n /**\n * @notice get mints made for a wallet (only for non-merkle claims with walletMax)\n *\n * @param minter the address of the minting address\n * @param creatorContractAddress the address of the creator contract for the claim\n * @param claimIndex the index of the claim\n * @return how many mints the minter has made\n */\n function getTotalMints(address minter, address creatorContractAddress, uint256 claimIndex) external view returns(uint32);\n\n /**\n * @notice allow a wallet to lazily claim a token according to parameters\n * @param creatorContractAddress the creator contract address\n * @param claimIndex the index of the claim for which we will mint\n * @param mintIndex the mint index (only needed for merkle claims)\n * @param merkleProof if the claim has a merkleRoot, verifying merkleProof ensures that address + minterValue was used to construct it (only needed for merkle claims)\n */\n function mint(address creatorContractAddress, uint256 claimIndex, uint32 mintIndex, bytes32[] calldata merkleProof, address mintFor) external payable;\n\n /**\n * @notice allow a wallet to lazily claim a token according to parameters\n * @param creatorContractAddress the creator contract address\n * @param claimIndex the index of the claim for which we will mint\n * @param mintCount the number of claims to mint\n * @param mintIndices the mint index (only needed for merkle claims)\n * @param merkleProofs if the claim has a merkleRoot, verifying merkleProof ensures that address + minterValue was used to construct it (only needed for merkle claims)\n */\n function mintBatch(address creatorContractAddress, uint256 claimIndex, uint16 mintCount, uint32[] calldata mintIndices, bytes32[][] calldata merkleProofs, address mintFor) external payable;\n\n /**\n * @notice allow admin to airdrop arbitrary tokens \n * @param creatorContractAddress the creator contract the claim will mint tokens for\n * @param claimIndex the index of the claim in the list of creatorContractAddress' _claims\n * @param recipients addresses to airdrop to\n * @param amounts number of tokens to airdrop to each address in addresses\n */\n function airdrop(address creatorContractAddress, uint256 claimIndex, address[] calldata recipients, uint16[] calldata amounts) external;\n}\n" }, "@openzeppelin/contracts/utils/Strings.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" }, "@openzeppelin/contracts/interfaces/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/introspection/IERC165.sol\";\n" }, "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.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 proofs can be generated using the JavaScript library\n * https://github.com/miguelmota/merkletreejs[merkletreejs].\n * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.\n *\n * See `test/utils/cryptography/MerkleProof.test.js` for some examples.\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 */\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 proved to be a part of a Merkle tree defined by\n * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\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 * _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 the sibling nodes in `proof`,\n * consuming from one or the other at each step according to the instructions given by\n * `proofFlags`.\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 * _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" }, "@openzeppelin/contracts/security/ReentrancyGuard.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" }, "@manifoldxyz/creator-core-solidity/contracts/extensions/ICreatorExtensionTokenURI.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Implement this if you want your extension to have overloadable URI's\n */\ninterface ICreatorExtensionTokenURI is IERC165 {\n\n /**\n * Get the uri for a given creator/tokenId\n */\n function tokenURI(address creator, uint256 tokenId) external view returns (string memory);\n}\n" }, "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/ERC165.sol\";\nimport \"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\nimport \"./IAdminControl.sol\";\n\nabstract contract AdminControl is Ownable, IAdminControl, ERC165 {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n // Track registered admins\n EnumerableSet.AddressSet private _admins;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {\n return interfaceId == type(IAdminControl).interfaceId\n || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Only allows approved admins to call the specified function\n */\n modifier adminRequired() {\n require(owner() == msg.sender || _admins.contains(msg.sender), \"AdminControl: Must be owner or admin\");\n _;\n } \n\n /**\n * @dev See {IAdminControl-getAdmins}.\n */\n function getAdmins() external view override returns (address[] memory admins) {\n admins = new address[](_admins.length());\n for (uint i = 0; i < _admins.length(); i++) {\n admins[i] = _admins.at(i);\n }\n return admins;\n }\n\n /**\n * @dev See {IAdminControl-approveAdmin}.\n */\n function approveAdmin(address admin) external override onlyOwner {\n if (!_admins.contains(admin)) {\n emit AdminApproved(admin, msg.sender);\n _admins.add(admin);\n }\n }\n\n /**\n * @dev See {IAdminControl-revokeAdmin}.\n */\n function revokeAdmin(address admin) external override onlyOwner {\n if (_admins.contains(admin)) {\n emit AdminRevoked(admin, msg.sender);\n _admins.remove(admin);\n }\n }\n\n /**\n * @dev See {IAdminControl-isAdmin}.\n */\n function isAdmin(address admin) public override view returns (bool) {\n return (owner() == admin || _admins.contains(admin));\n }\n\n}" }, "@manifoldxyz/creator-core-solidity/contracts/core/IERC721CreatorCore.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"./ICreatorCore.sol\";\n\n/**\n * @dev Core ERC721 creator interface\n */\ninterface IERC721CreatorCore is ICreatorCore {\n\n /**\n * @dev mint a token with no extension. Can only be called by an admin.\n * Returns tokenId minted\n */\n function mintBase(address to) external returns (uint256);\n\n /**\n * @dev mint a token with no extension. Can only be called by an admin.\n * Returns tokenId minted\n */\n function mintBase(address to, string calldata uri) external returns (uint256);\n\n /**\n * @dev batch mint a token with no extension. Can only be called by an admin.\n * Returns tokenId minted\n */\n function mintBaseBatch(address to, uint16 count) external returns (uint256[] memory);\n\n /**\n * @dev batch mint a token with no extension. Can only be called by an admin.\n * Returns tokenId minted\n */\n function mintBaseBatch(address to, string[] calldata uris) external returns (uint256[] memory);\n\n /**\n * @dev mint a token. Can only be called by a registered extension.\n * Returns tokenId minted\n */\n function mintExtension(address to) external returns (uint256);\n\n /**\n * @dev mint a token. Can only be called by a registered extension.\n * Returns tokenId minted\n */\n function mintExtension(address to, string calldata uri) external returns (uint256);\n\n /**\n * @dev batch mint a token. Can only be called by a registered extension.\n * Returns tokenIds minted\n */\n function mintExtensionBatch(address to, uint16 count) external returns (uint256[] memory);\n\n /**\n * @dev batch mint a token. Can only be called by a registered extension.\n * Returns tokenId minted\n */\n function mintExtensionBatch(address to, string[] calldata uris) external returns (uint256[] memory);\n\n /**\n * @dev burn a token. Can only be called by token owner or approved address.\n * On burn, calls back to the registered extension's onBurn method\n */\n function burn(uint256 tokenId) external;\n\n}" }, "@openzeppelin/contracts/utils/introspection/IERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" }, "@manifoldxyz/libraries-solidity/contracts/access/IAdminControl.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Interface for admin control\n */\ninterface IAdminControl is IERC165 {\n\n event AdminApproved(address indexed account, address indexed sender);\n event AdminRevoked(address indexed account, address indexed sender);\n\n /**\n * @dev gets address of all admins\n */\n function getAdmins() external view returns (address[] memory);\n\n /**\n * @dev add an admin. Can only be called by contract owner.\n */\n function approveAdmin(address admin) external;\n\n /**\n * @dev remove an admin. Can only be called by contract owner.\n */\n function revokeAdmin(address admin) external;\n\n /**\n * @dev checks whether or not given address is an admin\n * Returns True if they are\n */\n function isAdmin(address admin) external view returns (bool);\n\n}" }, "@openzeppelin/contracts/access/Ownable.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" }, "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" }, "@openzeppelin/contracts/utils/introspection/ERC165.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" }, "@manifoldxyz/creator-core-solidity/contracts/core/ICreatorCore.sol": { "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/// @author: manifold.xyz\n\nimport \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\n/**\n * @dev Core creator interface\n */\ninterface ICreatorCore is IERC165 {\n\n event ExtensionRegistered(address indexed extension, address indexed sender);\n event ExtensionUnregistered(address indexed extension, address indexed sender);\n event ExtensionBlacklisted(address indexed extension, address indexed sender);\n event MintPermissionsUpdated(address indexed extension, address indexed permissions, address indexed sender);\n event RoyaltiesUpdated(uint256 indexed tokenId, address payable[] receivers, uint256[] basisPoints);\n event DefaultRoyaltiesUpdated(address payable[] receivers, uint256[] basisPoints);\n event ExtensionRoyaltiesUpdated(address indexed extension, address payable[] receivers, uint256[] basisPoints);\n event ExtensionApproveTransferUpdated(address indexed extension, bool enabled);\n\n /**\n * @dev gets address of all extensions\n */\n function getExtensions() external view returns (address[] memory);\n\n /**\n * @dev add an extension. Can only be called by contract owner or admin.\n * extension address must point to a contract implementing ICreatorExtension.\n * Returns True if newly added, False if already added.\n */\n function registerExtension(address extension, string calldata baseURI) external;\n\n /**\n * @dev add an extension. Can only be called by contract owner or admin.\n * extension address must point to a contract implementing ICreatorExtension.\n * Returns True if newly added, False if already added.\n */\n function registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) external;\n\n /**\n * @dev add an extension. Can only be called by contract owner or admin.\n * Returns True if removed, False if already removed.\n */\n function unregisterExtension(address extension) external;\n\n /**\n * @dev blacklist an extension. Can only be called by contract owner or admin.\n * This function will destroy all ability to reference the metadata of any tokens created\n * by the specified extension. It will also unregister the extension if needed.\n * Returns True if removed, False if already removed.\n */\n function blacklistExtension(address extension) external;\n\n /**\n * @dev set the baseTokenURI of an extension. Can only be called by extension.\n */\n function setBaseTokenURIExtension(string calldata uri) external;\n\n /**\n * @dev set the baseTokenURI of an extension. Can only be called by extension.\n * For tokens with no uri configured, tokenURI will return \"uri+tokenId\"\n */\n function setBaseTokenURIExtension(string calldata uri, bool identical) external;\n\n /**\n * @dev set the common prefix of an extension. Can only be called by extension.\n * If configured, and a token has a uri set, tokenURI will return \"prefixURI+tokenURI\"\n * Useful if you want to use ipfs/arweave\n */\n function setTokenURIPrefixExtension(string calldata prefix) external;\n\n /**\n * @dev set the tokenURI of a token extension. Can only be called by extension that minted token.\n */\n function setTokenURIExtension(uint256 tokenId, string calldata uri) external;\n\n /**\n * @dev set the tokenURI of a token extension for multiple tokens. Can only be called by extension that minted token.\n */\n function setTokenURIExtension(uint256[] memory tokenId, string[] calldata uri) external;\n\n /**\n * @dev set the baseTokenURI for tokens with no extension. Can only be called by owner/admin.\n * For tokens with no uri configured, tokenURI will return \"uri+tokenId\"\n */\n function setBaseTokenURI(string calldata uri) external;\n\n /**\n * @dev set the common prefix for tokens with no extension. Can only be called by owner/admin.\n * If configured, and a token has a uri set, tokenURI will return \"prefixURI+tokenURI\"\n * Useful if you want to use ipfs/arweave\n */\n function setTokenURIPrefix(string calldata prefix) external;\n\n /**\n * @dev set the tokenURI of a token with no extension. Can only be called by owner/admin.\n */\n function setTokenURI(uint256 tokenId, string calldata uri) external;\n\n /**\n * @dev set the tokenURI of multiple tokens with no extension. Can only be called by owner/admin.\n */\n function setTokenURI(uint256[] memory tokenIds, string[] calldata uris) external;\n\n /**\n * @dev set a permissions contract for an extension. Used to control minting.\n */\n function setMintPermissions(address extension, address permissions) external;\n\n /**\n * @dev Configure so transfers of tokens created by the caller (must be extension) gets approval\n * from the extension before transferring\n */\n function setApproveTransferExtension(bool enabled) external;\n\n /**\n * @dev get the extension of a given token\n */\n function tokenExtension(uint256 tokenId) external view returns (address);\n\n /**\n * @dev Set default royalties\n */\n function setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) external;\n\n /**\n * @dev Set royalties of a token\n */\n function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external;\n\n /**\n * @dev Set royalties of an extension\n */\n function setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) external;\n\n /**\n * @dev Get royalites of a token. Returns list of receivers and basisPoints\n */\n function getRoyalties(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);\n \n // Royalty support for various other standards\n function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory);\n function getFeeBps(uint256 tokenId) external view returns (uint[] memory);\n function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);\n function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);\n\n}\n" }, "@openzeppelin/contracts/utils/Context.sol": { "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" } }, "settings": { "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } } }