ERC-721
Overview
Max Total Supply
891 CR
Holders
300
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
5 CRLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
CandyRepublic
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import "./ERC721SeaDrop.sol"; import { IERC721 } from "lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol"; import { IERC2981 } from "lib/openzeppelin-contracts/contracts/interfaces/IERC2981.sol"; import { MerkleProof } from "./lib/MerkleProof.sol"; interface IERC5639 { /** * @notice Returns true if the address is delegated to act on the entire vault * @param delegate The hotwallet to act on your behalf * @param vault The cold wallet who issued the delegation */ function checkDelegateForAll(address delegate, address vault) external view returns (bool); } contract CandyRepublic is ERC721SeaDrop { // ============================================================= // CONSTANTS // ============================================================= // The Genesis NFT Collection smart contract address address private constant _GENESIS_COLLECTION_ADDRESS = 0x1Be6f6BAc65573b68FEfBdf89c5c1FA7f3A5805b; // The CandyRepublic address address private constant _CANDY = 0xa0e091347827eC3fFC0E85389b8f0014E2895f15; // The CandyRepublic secondary address address private constant _CANDY_2 = 0x4C90a5584aBfe69462b6Dec304A78a59FE18b2b4; // The Delegeate cash address address private constant _DELEGATE_CASH_ADDRESS = 0x00000000000076A84feF008CDAbe6409d2FE638B; // The OpenSea Registry smart contract address address private constant _PROXY_REGISTRY_ADDRESS = 0xa5409ec958C83C3f309868babACA7c86DCB077c1; // NFT total supply uint256 private constant _TOTAL_SUPPLY = 6250; // NFT sale window uint256 private constant _MINT_START = 1677175200; // Genesis + Derivative = OG_WINDOW uint256 private constant _OG_WINDOW_START = _MINT_START; uint256 private constant _OG_WINDOW_END = _OG_WINDOW_START + 6 hours; // Prospects + Whitelist A = WHITELIST_WINDOW uint256 private constant _WHITELIST_WINDOW_START = _MINT_START + 2 hours; uint256 private constant _WHITELIST_WINDOW_END = _WHITELIST_WINDOW_START + 4 hours; // Whitelist B = FINAL_WINDOW uint256 private constant _FINAL_WINDOW_START = _MINT_START + 6 hours; uint256 private constant _FINAL_WINDOW_END = _FINAL_WINDOW_START + 2 hours; // Public mint uint256 private constant _PUBLIC_WINDOW_START = _FINAL_WINDOW_END; uint256 private constant _PUBLIC_WINDOW_END = _PUBLIC_WINDOW_START + 1 hours; // The maxmimum mint/wallet uint256 private constant _MINT_PRICE = 0.08 ether; uint256 private constant _MINT_PRICE_PROSPECT = 0.07 ether; uint256 private constant _MINT_CAP = 2; uint256 private constant _DERIVATIVES_FREE_MINT_CAP = 1; uint256 private constant _PUBLIC_MINT_CAP = 1; uint256 private constant _GENESIS_BITMAP_LENGTH = 2; // ============================================================= // STORAGE // ============================================================= // The merkle tree root hash for the genesis addresses. bytes32 private _DERIVATIVES_WHITELIST_ROOT = 0x126095171d42ac1451766cfb60a5782db96c342ec125d1ddf9daaeeedfe0e090; // The merkle tree root hash for the prospects addresses. bytes32 private _WHITELIST_PROSPECT_ROOT = 0xc488b8656c7c3ee37169e932772c4b8660d18a09978030f7ffb9d1f52f31104c; // The merkle tree root hash for the whitelistA addresses. bytes32 private _WHITELIST_A_ROOT = 0x00e8e92031a3ebb515ac5cc188d169f561c00232a10c64c4101ea8dbcfaf6751; // The merkle tree root hash for the whitelistB addresses. bytes32 private _WHITELIST_B_ROOT = 0xaf7f27a81fe9f7e5a51250d23b12306d01061a9a833c24723e1988f0fbecd23e; // Bitmap representing used genesis token ids uint256 private GenesisBitmap = 0; bool private didReserve = false; // Burning Mechanism bool public burnEnabled = false; uint256[5] public unburnable; // For public mint mapping(address => bool) public didMintPublic; constructor( string memory name_, string memory symbol_, string memory baseURI_, address[] memory seaDropAllowlist ) ERC721SeaDrop(name_, symbol_, seaDropAllowlist) { _tokenBaseURI = baseURI_; } function reserveTeam() external onlyOwner { // Ensure the sender can call it once. require(!didReserve); didReserve = true; _mint(_CANDY, 250); } function configureWhitelists( bytes32 derivatives, bytes32 prospects, bytes32 whitelistA, bytes32 whitelistB ) external onlyOwner { _DERIVATIVES_WHITELIST_ROOT = derivatives; _WHITELIST_PROSPECT_ROOT = prospects; _WHITELIST_A_ROOT = whitelistA; _WHITELIST_B_ROOT = whitelistB; } function isWhitelist( bytes32[] calldata proof, bytes32 leaf, bytes32 root ) internal pure returns (bool) { return MerkleProof.verifyCalldata(proof, root, leaf); } function inOGPeriod() internal view returns (bool) { return block.timestamp >= _OG_WINDOW_START && block.timestamp <= _OG_WINDOW_END; } function inWhitelistPeriod() internal view returns (bool) { return block.timestamp >= _WHITELIST_WINDOW_START && block.timestamp <= _WHITELIST_WINDOW_END; } function inFinalPeriod() internal view returns (bool) { return block.timestamp >= _FINAL_WINDOW_START && block.timestamp <= _FINAL_WINDOW_END; } function inPublicPeriod() internal view returns (bool) { return block.timestamp >= _PUBLIC_WINDOW_START && block.timestamp <= _PUBLIC_WINDOW_END; } function getGenesisBitmap() external view returns (uint256) { return GenesisBitmap; } function getPrice( address wallet, uint256 mintType, uint256 quantity ) public view returns (uint256) { // 1: Derivatives if (mintType == 1) { uint256 numberMinted = _numberMinted(wallet); if (quantity == 2 || numberMinted == 1) { return _MINT_PRICE; } return 0; } // 2: Prospects if (mintType == 2) { return quantity * _MINT_PRICE_PROSPECT; } // Other: WhitelistA/B return quantity * _MINT_PRICE; } function genesisMint(uint256[] calldata genesisTokenID, address vault) external { require(tx.origin == msg.sender, "Caller is Smart Contract"); require(inOGPeriod(), "Not in mint window!"); uint256[] memory genesisTokenIDMemory = genesisTokenID; uint256 genesisLength = genesisTokenIDMemory.length; uint256 currentSupply = totalSupply(); require( (2 * genesisLength) + currentSupply <= _TOTAL_SUPPLY, "Exceeding Limit!" ); uint256 mintQuantity; uint256 mintedFromThatNFT; uint256 finalOring; uint256 memoryGenesis = GenesisBitmap; uint256 shifting; IERC721 GenesisSmartContract = IERC721(_GENESIS_COLLECTION_ADDRESS); address requester = msg.sender; if (vault != address(0)) { IERC5639 DelegateRegistry = IERC5639(_DELEGATE_CASH_ADDRESS); require( DelegateRegistry.checkDelegateForAll(msg.sender, vault), "Not delegate!" ); requester = vault; } for (uint256 index; index < genesisLength; ) { require( GenesisSmartContract.ownerOf(genesisTokenIDMemory[index]) == requester, "Not owner of tokenID!" ); shifting = 2 * (genesisTokenIDMemory[index] - 1); mintedFromThatNFT = (memoryGenesis & (3 << shifting)) >> shifting; if (mintedFromThatNFT == 0) { mintQuantity += _GENESIS_BITMAP_LENGTH; finalOring = finalOring ^ (3 << shifting); } unchecked { ++index; } } require(mintQuantity > 0, "Can't mint anymore!"); // Set genesis bitmap GenesisBitmap = (memoryGenesis ^ finalOring); _mint(msg.sender, mintQuantity); } function derivativeMint( bytes32[] calldata derivativeProof, uint256 quantity ) external payable { require(tx.origin == msg.sender, "Caller is Smart Contract"); // Check for correct window period require(inWhitelistPeriod(), "Not in mint window!"); // Check total supply uint256 currentSupply = totalSupply(); require( currentSupply + quantity <= _TOTAL_SUPPLY, "Exceeding 6250 NFTs!" ); // Check mint cap uint256 numberMinted = _numberMinted(msg.sender); require( numberMinted + quantity <= _MINT_CAP, "Can't mint more than 2!" ); // Check if whitelisted require( isWhitelist( derivativeProof, keccak256(abi.encodePacked(msg.sender)), _DERIVATIVES_WHITELIST_ROOT ), "Not whitelisted!" ); // Check if paid the correct ammount of ETH require( msg.value == getPrice(msg.sender, 1, quantity), "Incorrect payment value!" ); _mint(msg.sender, quantity); } function whitelistProspectMint( bytes32[] calldata whitelistProof, uint256 quantity ) external payable { require(tx.origin == msg.sender, "Caller is Smart Contract"); // Check for correct window period require(inWhitelistPeriod(), "Not in mint window!"); // Check total supply uint256 currentSupply = totalSupply(); require( currentSupply + quantity <= _TOTAL_SUPPLY, "Exceeding 6250 NFTs!" ); // Check mint cap uint256 numberMinted = _numberMinted(msg.sender); require( numberMinted + quantity <= _MINT_CAP, "Can't mint more than 2!" ); // Check if whitelisted require( isWhitelist( whitelistProof, keccak256(abi.encodePacked(msg.sender)), _WHITELIST_PROSPECT_ROOT ), "Not whitelisted!" ); // Check if paid the correct ammount of ETH require( msg.value == getPrice(msg.sender, 2, quantity), "Incorrect Payment Value!" ); _mint(msg.sender, quantity); } function whitelistAMint(bytes32[] calldata whitelistProof, uint256 quantity) external payable { require(tx.origin == msg.sender, "Caller is Smart Contract"); // Check for correct window period require(inWhitelistPeriod(), "Not in mint window!"); // Check total supply uint256 currentSupply = totalSupply(); require( currentSupply + quantity <= _TOTAL_SUPPLY, "Exceeding 6250 NFTs!" ); // Check mint cap uint256 numberMinted = _numberMinted(msg.sender); require( numberMinted + quantity <= _MINT_CAP, "Can't mint more than 2!" ); // Check if whitelisted require( isWhitelist( whitelistProof, keccak256(abi.encodePacked(msg.sender)), _WHITELIST_A_ROOT ), "Not whitelisted!" ); // Check if paid the correct ammount of ETH require( msg.value == getPrice(msg.sender, 3, quantity), "Incorrect Payment Value!" ); _mint(msg.sender, quantity); } function whitelistBMint(bytes32[] calldata whitelistProof, uint256 quantity) external payable { require(tx.origin == msg.sender, "Caller is Smart Contract"); // Check for correct window period require(inFinalPeriod(), "Not in mint window!"); // Check total supply uint256 currentSupply = totalSupply(); require( currentSupply + quantity <= _TOTAL_SUPPLY, "Exceeding 6250 NFTs!" ); // Check mint cap uint256 numberMinted = _numberMinted(msg.sender); require( numberMinted + quantity <= _MINT_CAP, "Can't mint more than 2!" ); // Check if whitelisted require( isWhitelist( whitelistProof, keccak256(abi.encodePacked(msg.sender)), _WHITELIST_B_ROOT ), "Not whitelisted!" ); // Check if paid the correct ammount of ETH require( msg.value == getPrice(msg.sender, 3, quantity), "Incorrect Payment Value!" ); _mint(msg.sender, quantity); } function publicMint(uint256 quantity) external payable { require(tx.origin == msg.sender, "Caller is Smart Contract"); // Check for correct window period require(inPublicPeriod(), "Not in mint window!"); // Check total supply uint256 currentSupply = totalSupply(); require( currentSupply + quantity <= _TOTAL_SUPPLY, "Exceeding 6250 NFTs!" ); require(quantity == _PUBLIC_MINT_CAP, "Can't mint more than 1!"); // Mint once! require(!didMintPublic[msg.sender], "Already minted public mint!"); // Check if paid the correct ammount of ETH require( msg.value == getPrice(msg.sender, 3, quantity), "Incorrect Payment Value!" ); didMintPublic[msg.sender] = true; _mint(msg.sender, quantity); } // Withdraw ETH Funds function withdrawETHFunds() external onlyOwner { (bool success, ) = _CANDY.call{ value: address(this).balance }(""); require(success, "Transfer failed."); } function getNumberMinted(address _address) external view returns (uint256) { return _numberMinted(_address); } function enableBurn(uint256[5] calldata unburnables) external onlyOwner { unburnable = unburnables; burnEnabled = true; } function burn(uint256 tokenID) external { require(burnEnabled, "Burn not enabled!"); for (uint256 i; i < 5; ) { require(tokenID != unburnable[i], "Can't burn!"); unchecked { ++i; } } _burn(tokenID, true); } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId), ".json")) : ""; } /** * @notice Called with the sale price to determine how much royalty * is owed and to whom. * * @ param _tokenId The NFT asset queried for royalty information. * @param _salePrice The sale price of the NFT asset specified by * _tokenId. * * @return receiver Address of who should be sent the royalty payment. * @return royaltyAmount The royalty payment amount for _salePrice. */ function royaltyInfo( uint256, /* _tokenId */ uint256 _salePrice ) external pure override(ERC721ContractMetadata, IERC2981) returns (address receiver, uint256 royaltyAmount) { // Set the royalty amount to the sale price times the royalty basis // points divided by 10_000. royaltyAmount = (_salePrice * 300) / 10_000; // Set the receiver of the royalty. receiver = _CANDY_2; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { ERC721ContractMetadata, ISeaDropTokenContractMetadata } from "./ERC721ContractMetadata.sol"; import { INonFungibleSeaDropToken } from "./interfaces/INonFungibleSeaDropToken.sol"; import { ISeaDrop } from "./interfaces/ISeaDrop.sol"; import { AllowListData, PublicDrop, TokenGatedDropStage, SignedMintValidationParams } from "./lib/SeaDropStructs.sol"; import { ERC721SeaDropStructsErrorsAndEvents } from "./lib/ERC721SeaDropStructsErrorsAndEvents.sol"; import { ERC721A } from "lib/ERC721A/contracts/ERC721A.sol"; import { ReentrancyGuard } from "lib/solmate/src/utils/ReentrancyGuard.sol"; import { IERC165 } from "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol"; import { DefaultOperatorFilterer } from "lib/operator-filter-registry/src/DefaultOperatorFilterer.sol"; /** * @title ERC721SeaDrop * @author James Wenzel (emo.eth) * @author Ryan Ghods (ralxz.eth) * @author Stephan Min (stephanm.eth) * @notice ERC721SeaDrop is a token contract that contains methods * to properly interact with SeaDrop. */ contract ERC721SeaDrop is ERC721ContractMetadata, INonFungibleSeaDropToken, ERC721SeaDropStructsErrorsAndEvents, ReentrancyGuard, DefaultOperatorFilterer { /// @notice Track the allowed SeaDrop addresses. mapping(address => bool) internal _allowedSeaDrop; /// @notice Track the enumerated allowed SeaDrop addresses. address[] internal _enumeratedAllowedSeaDrop; /** * @dev Reverts if not an allowed SeaDrop contract. * This function is inlined instead of being a modifier * to save contract space from being inlined N times. * * @param seaDrop The SeaDrop address to check if allowed. */ function _onlyAllowedSeaDrop(address seaDrop) internal view { if (_allowedSeaDrop[seaDrop] != true) { revert OnlyAllowedSeaDrop(); } } /** * @notice Deploy the token contract with its name, symbol, * and allowed SeaDrop addresses. */ constructor( string memory name, string memory symbol, address[] memory allowedSeaDrop ) ERC721ContractMetadata(name, symbol) { // Put the length on the stack for more efficient access. uint256 allowedSeaDropLength = allowedSeaDrop.length; // Set the mapping for allowed SeaDrop contracts. for (uint256 i = 0; i < allowedSeaDropLength; ) { _allowedSeaDrop[allowedSeaDrop[i]] = true; unchecked { ++i; } } // Set the enumeration. _enumeratedAllowedSeaDrop = allowedSeaDrop; // Emit an event noting the contract deployment. emit SeaDropTokenDeployed(); } /** * @notice Update the allowed SeaDrop contracts. * Only the owner or administrator can use this function. * * @param allowedSeaDrop The allowed SeaDrop addresses. */ function updateAllowedSeaDrop(address[] calldata allowedSeaDrop) external virtual override onlyOwner { _updateAllowedSeaDrop(allowedSeaDrop); } /** * @notice Internal function to update the allowed SeaDrop contracts. * * @param allowedSeaDrop The allowed SeaDrop addresses. */ function _updateAllowedSeaDrop(address[] calldata allowedSeaDrop) internal { // Put the length on the stack for more efficient access. uint256 enumeratedAllowedSeaDropLength = _enumeratedAllowedSeaDrop .length; uint256 allowedSeaDropLength = allowedSeaDrop.length; // Reset the old mapping. for (uint256 i = 0; i < enumeratedAllowedSeaDropLength; ) { _allowedSeaDrop[_enumeratedAllowedSeaDrop[i]] = false; unchecked { ++i; } } // Set the new mapping for allowed SeaDrop contracts. for (uint256 i = 0; i < allowedSeaDropLength; ) { _allowedSeaDrop[allowedSeaDrop[i]] = true; unchecked { ++i; } } // Set the enumeration. _enumeratedAllowedSeaDrop = allowedSeaDrop; // Emit an event for the update. emit AllowedSeaDropUpdated(allowedSeaDrop); } /** * @dev Overrides the `_startTokenId` function from ERC721A * to start at token id `1`. * * This is to avoid future possible problems since `0` is usually * used to signal values that have not been set or have been removed. */ function _startTokenId() internal view virtual override returns (uint256) { return 1; } /** * @notice Mint tokens, restricted to the SeaDrop contract. * * @dev NOTE: If a token registers itself with multiple SeaDrop * contracts, the implementation of this function should guard * against reentrancy. If the implementing token uses * _safeMint(), or a feeRecipient with a malicious receive() hook * is specified, the token or fee recipients may be able to execute * another mint in the same transaction via a separate SeaDrop * contract. * This is dangerous if an implementing token does not correctly * update the minterNumMinted and currentTotalSupply values before * transferring minted tokens, as SeaDrop references these values * to enforce token limits on a per-wallet and per-stage basis. * * ERC721A tracks these values automatically, but this note and * nonReentrant modifier are left here to encourage best-practices * when referencing this contract. * * @param minter The address to mint to. * @param quantity The number of tokens to mint. */ function mintSeaDrop(address minter, uint256 quantity) external virtual override nonReentrant { // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(msg.sender); // Extra safety check to ensure the max supply is not exceeded. if (_totalMinted() + quantity > maxSupply()) { revert MintQuantityExceedsMaxSupply( _totalMinted() + quantity, maxSupply() ); } // Mint the quantity of tokens to the minter. _safeMint(minter, quantity); } /** * @notice Update the public drop data for this nft contract on SeaDrop. * Only the owner can use this function. * * @param seaDropImpl The allowed SeaDrop contract. * @param publicDrop The public drop data. */ function updatePublicDrop( address seaDropImpl, PublicDrop calldata publicDrop ) external virtual override { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Update the public drop data on SeaDrop. ISeaDrop(seaDropImpl).updatePublicDrop(publicDrop); } /** * @notice Update the allow list data for this nft contract on SeaDrop. * Only the owner can use this function. * * @param seaDropImpl The allowed SeaDrop contract. * @param allowListData The allow list data. */ function updateAllowList( address seaDropImpl, AllowListData calldata allowListData ) external virtual override { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Update the allow list on SeaDrop. ISeaDrop(seaDropImpl).updateAllowList(allowListData); } /** * @notice Update the token gated drop stage data for this nft contract * on SeaDrop. * Only the owner can use this function. * * Note: If two INonFungibleSeaDropToken tokens are doing * simultaneous token gated drop promotions for each other, * they can be minted by the same actor until * `maxTokenSupplyForStage` is reached. Please ensure the * `allowedNftToken` is not running an active drop during the * `dropStage` time period. * * @param seaDropImpl The allowed SeaDrop contract. * @param allowedNftToken The allowed nft token. * @param dropStage The token gated drop stage data. */ function updateTokenGatedDrop( address seaDropImpl, address allowedNftToken, TokenGatedDropStage calldata dropStage ) external virtual override { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Update the token gated drop stage. ISeaDrop(seaDropImpl).updateTokenGatedDrop(allowedNftToken, dropStage); } /** * @notice Update the drop URI for this nft contract on SeaDrop. * Only the owner can use this function. * * @param seaDropImpl The allowed SeaDrop contract. * @param dropURI The new drop URI. */ function updateDropURI(address seaDropImpl, string calldata dropURI) external virtual override { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Update the drop URI. ISeaDrop(seaDropImpl).updateDropURI(dropURI); } /** * @notice Update the creator payout address for this nft contract on * SeaDrop. * Only the owner can set the creator payout address. * * @param seaDropImpl The allowed SeaDrop contract. * @param payoutAddress The new payout address. */ function updateCreatorPayoutAddress( address seaDropImpl, address payoutAddress ) external { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Update the creator payout address. ISeaDrop(seaDropImpl).updateCreatorPayoutAddress(payoutAddress); } /** * @notice Update the allowed fee recipient for this nft contract * on SeaDrop. * Only the owner can set the allowed fee recipient. * * @param seaDropImpl The allowed SeaDrop contract. * @param feeRecipient The new fee recipient. * @param allowed If the fee recipient is allowed. */ function updateAllowedFeeRecipient( address seaDropImpl, address feeRecipient, bool allowed ) external virtual { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Update the allowed fee recipient. ISeaDrop(seaDropImpl).updateAllowedFeeRecipient(feeRecipient, allowed); } /** * @notice Update the server-side signers for this nft contract * on SeaDrop. * Only the owner can use this function. * * @param seaDropImpl The allowed SeaDrop contract. * @param signer The signer to update. * @param signedMintValidationParams Minimum and maximum parameters to * enforce for signed mints. */ function updateSignedMintValidationParams( address seaDropImpl, address signer, SignedMintValidationParams memory signedMintValidationParams ) external virtual override { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Update the signer. ISeaDrop(seaDropImpl).updateSignedMintValidationParams( signer, signedMintValidationParams ); } /** * @notice Update the allowed payers for this nft contract on SeaDrop. * Only the owner can use this function. * * @param seaDropImpl The allowed SeaDrop contract. * @param payer The payer to update. * @param allowed Whether the payer is allowed. */ function updatePayer( address seaDropImpl, address payer, bool allowed ) external virtual override { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Update the payer. ISeaDrop(seaDropImpl).updatePayer(payer, allowed); } /** * @notice Returns a set of mint stats for the address. * This assists SeaDrop in enforcing maxSupply, * maxTotalMintableByWallet, and maxTokenSupplyForStage checks. * * @dev NOTE: Implementing contracts should always update these numbers * before transferring any tokens with _safeMint() to mitigate * consequences of malicious onERC721Received() hooks. * * @param minter The minter address. */ function getMintStats(address minter) external view override returns ( uint256 minterNumMinted, uint256 currentTotalSupply, uint256 maxSupply ) { minterNumMinted = _numberMinted(minter); currentTotalSupply = _totalMinted(); maxSupply = _maxSupply; } /** * @notice Returns whether the interface is supported. * * @param interfaceId The interface id to check against. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721ContractMetadata) returns (bool) { return interfaceId == type(INonFungibleSeaDropToken).interfaceId || interfaceId == type(ISeaDropTokenContractMetadata).interfaceId || // ERC721ContractMetadata returns supportsInterface true for // EIP-2981 // ERC721A returns supportsInterface true for // ERC165, ERC721, ERC721Metadata super.supportsInterface(interfaceId); } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * - The `operator` must be allowed. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); } /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * - The `operator` mut be allowed. * * Emits an {Approval} event. */ function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) { super.approve(operator, tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - The operator must be allowed. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public override onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * - The operator must be allowed. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } /** * @notice Configure multiple properties at a time. * * Note: The individual configure methods should be used * to unset or reset any properties to zero, as this method * will ignore zero-value properties in the config struct. * * @param config The configuration struct. */ function multiConfigure(MultiConfigureStruct calldata config) external onlyOwner { if (config.maxSupply > 0) { this.setMaxSupply(config.maxSupply); } if (bytes(config.baseURI).length != 0) { this.setBaseURI(config.baseURI); } if (bytes(config.contractURI).length != 0) { this.setContractURI(config.contractURI); } if ( _cast(config.publicDrop.startTime != 0) | _cast(config.publicDrop.endTime != 0) == 1 ) { this.updatePublicDrop(config.seaDropImpl, config.publicDrop); } if (bytes(config.dropURI).length != 0) { this.updateDropURI(config.seaDropImpl, config.dropURI); } if (config.allowListData.merkleRoot != bytes32(0)) { this.updateAllowList(config.seaDropImpl, config.allowListData); } if (config.creatorPayoutAddress != address(0)) { this.updateCreatorPayoutAddress( config.seaDropImpl, config.creatorPayoutAddress ); } if (config.provenanceHash != bytes32(0)) { this.setProvenanceHash(config.provenanceHash); } if (config.allowedFeeRecipients.length > 0) { for (uint256 i = 0; i < config.allowedFeeRecipients.length; ) { this.updateAllowedFeeRecipient( config.seaDropImpl, config.allowedFeeRecipients[i], true ); unchecked { ++i; } } } if (config.disallowedFeeRecipients.length > 0) { for (uint256 i = 0; i < config.disallowedFeeRecipients.length; ) { this.updateAllowedFeeRecipient( config.seaDropImpl, config.disallowedFeeRecipients[i], false ); unchecked { ++i; } } } if (config.allowedPayers.length > 0) { for (uint256 i = 0; i < config.allowedPayers.length; ) { this.updatePayer( config.seaDropImpl, config.allowedPayers[i], true ); unchecked { ++i; } } } if (config.disallowedPayers.length > 0) { for (uint256 i = 0; i < config.disallowedPayers.length; ) { this.updatePayer( config.seaDropImpl, config.disallowedPayers[i], false ); unchecked { ++i; } } } if (config.tokenGatedDropStages.length > 0) { if ( config.tokenGatedDropStages.length != config.tokenGatedAllowedNftTokens.length ) { revert TokenGatedMismatch(); } for (uint256 i = 0; i < config.tokenGatedDropStages.length; ) { this.updateTokenGatedDrop( config.seaDropImpl, config.tokenGatedAllowedNftTokens[i], config.tokenGatedDropStages[i] ); unchecked { ++i; } } } if (config.disallowedTokenGatedAllowedNftTokens.length > 0) { for ( uint256 i = 0; i < config.disallowedTokenGatedAllowedNftTokens.length; ) { TokenGatedDropStage memory emptyStage; this.updateTokenGatedDrop( config.seaDropImpl, config.disallowedTokenGatedAllowedNftTokens[i], emptyStage ); unchecked { ++i; } } } if (config.signedMintValidationParams.length > 0) { if ( config.signedMintValidationParams.length != config.signers.length ) { revert SignersMismatch(); } for ( uint256 i = 0; i < config.signedMintValidationParams.length; ) { this.updateSignedMintValidationParams( config.seaDropImpl, config.signers[i], config.signedMintValidationParams[i] ); unchecked { ++i; } } } if (config.disallowedSigners.length > 0) { for (uint256 i = 0; i < config.disallowedSigners.length; ) { SignedMintValidationParams memory emptyParams; this.updateSignedMintValidationParams( config.seaDropImpl, config.disallowedSigners[i], emptyParams ); unchecked { ++i; } } } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; library MerkleProof { function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; uint256 length = proof.length; for (uint256 i = 0; i < length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { ISeaDropTokenContractMetadata } from "./interfaces/ISeaDropTokenContractMetadata.sol"; import { ERC721A } from "lib/ERC721A/contracts/ERC721A.sol"; import { TwoStepOwnable } from "lib/utility-contracts/src/TwoStepOwnable.sol"; import { IERC2981 } from "lib/openzeppelin-contracts/contracts/interfaces/IERC2981.sol"; import { IERC165 } from "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol"; /** * @title ERC721ContractMetadata * @author James Wenzel (emo.eth) * @author Ryan Ghods (ralxz.eth) * @author Stephan Min (stephanm.eth) * @notice ERC721ContractMetadata is a token contract that extends ERC721A * with additional metadata and ownership capabilities. */ contract ERC721ContractMetadata is ERC721A, TwoStepOwnable, ISeaDropTokenContractMetadata { /// @notice Track the max supply. uint256 _maxSupply; /// @notice Track the base URI for token metadata. string _tokenBaseURI; /// @notice Track the contract URI for contract metadata. string _contractURI; /// @notice Track the provenance hash for guaranteeing metadata order /// for random reveals. bytes32 _provenanceHash; /// @notice Track the royalty info: address to receive royalties, and /// royalty basis points. RoyaltyInfo _royaltyInfo; /** * @dev Reverts if the sender is not the owner or the contract itself. * This function is inlined instead of being a modifier * to save contract space from being inlined N times. */ function _onlyOwnerOrSelf() internal view { if ( _cast(msg.sender == owner()) | _cast(msg.sender == address(this)) == 0 ) { revert OnlyOwner(); } } /** * @notice Deploy the token contract with its name and symbol. */ constructor(string memory name, string memory symbol) ERC721A(name, symbol) {} /** * @notice Sets the base URI for the token metadata and emits an event. * * @param newBaseURI The new base URI to set. */ function setBaseURI(string calldata newBaseURI) external override { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Set the new base URI. _tokenBaseURI = newBaseURI; // Emit an event with the update. if (totalSupply() != 0) { emit BatchMetadataUpdate(1, _nextTokenId() - 1); } } /** * @notice Sets the contract URI for contract metadata. * * @param newContractURI The new contract URI. */ function setContractURI(string calldata newContractURI) external override { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Set the new contract URI. _contractURI = newContractURI; // Emit an event with the update. emit ContractURIUpdated(newContractURI); } /** * @notice Emit an event notifying metadata updates for * a range of token ids, according to EIP-4906. * * @param fromTokenId The start token id. * @param toTokenId The end token id. */ function emitBatchMetadataUpdate(uint256 fromTokenId, uint256 toTokenId) external { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Emit an event with the update. emit BatchMetadataUpdate(fromTokenId, toTokenId); } /** * @notice Sets the max token supply and emits an event. * * @param newMaxSupply The new max supply to set. */ function setMaxSupply(uint256 newMaxSupply) external { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Ensure the max supply does not exceed the maximum value of uint64. if (newMaxSupply > 2**64 - 1) { revert CannotExceedMaxSupplyOfUint64(newMaxSupply); } // Set the new max supply. _maxSupply = newMaxSupply; // Emit an event with the update. emit MaxSupplyUpdated(newMaxSupply); } /** * @notice Sets the provenance hash and emits an event. * * The provenance hash is used for random reveals, which * is a hash of the ordered metadata to show it has not been * modified after mint started. * * This function will revert after the first item has been minted. * * @param newProvenanceHash The new provenance hash to set. */ function setProvenanceHash(bytes32 newProvenanceHash) external { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Revert if any items have been minted. if (_totalMinted() > 0) { revert ProvenanceHashCannotBeSetAfterMintStarted(); } // Keep track of the old provenance hash for emitting with the event. bytes32 oldProvenanceHash = _provenanceHash; // Set the new provenance hash. _provenanceHash = newProvenanceHash; // Emit an event with the update. emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash); } /** * @notice Sets the address and basis points for royalties. * * @param newInfo The struct to configure royalties. */ function setRoyaltyInfo(RoyaltyInfo calldata newInfo) external { // Ensure the sender is only the owner or contract itself. _onlyOwnerOrSelf(); // Revert if the new royalty address is the zero address. if (newInfo.royaltyAddress == address(0)) { revert RoyaltyAddressCannotBeZeroAddress(); } // Revert if the new basis points is greater than 10_000. if (newInfo.royaltyBps > 10_000) { revert InvalidRoyaltyBasisPoints(newInfo.royaltyBps); } // Set the new royalty info. _royaltyInfo = newInfo; // Emit an event with the updated params. emit RoyaltyInfoUpdated(newInfo.royaltyAddress, newInfo.royaltyBps); } /** * @notice Returns the base URI for token metadata. */ function baseURI() external view override returns (string memory) { return _baseURI(); } /** * @notice Returns the base URI for the contract, which ERC721A uses * to return tokenURI. */ function _baseURI() internal view virtual override returns (string memory) { return _tokenBaseURI; } /** * @notice Returns the contract URI for contract metadata. */ function contractURI() external view override returns (string memory) { return _contractURI; } /** * @notice Returns the max token supply. */ function maxSupply() public view returns (uint256) { return _maxSupply; } /** * @notice Returns the provenance hash. * The provenance hash is used for random reveals, which * is a hash of the ordered metadata to show it is unmodified * after mint has started. */ function provenanceHash() external view override returns (bytes32) { return _provenanceHash; } /** * @notice Returns the address that receives royalties. */ function royaltyAddress() external view returns (address) { return _royaltyInfo.royaltyAddress; } /** * @notice Returns the royalty basis points out of 10_000. */ function royaltyBasisPoints() external view returns (uint256) { return _royaltyInfo.royaltyBps; } /** * @notice Called with the sale price to determine how much royalty * is owed and to whom. * * @ param _tokenId The NFT asset queried for royalty information. * @param _salePrice The sale price of the NFT asset specified by * _tokenId. * * @return receiver Address of who should be sent the royalty payment. * @return royaltyAmount The royalty payment amount for _salePrice. */ function royaltyInfo( uint256, /* _tokenId */ uint256 _salePrice ) external view virtual returns (address receiver, uint256 royaltyAmount) { // Put the royalty info on the stack for more efficient access. RoyaltyInfo storage info = _royaltyInfo; // Set the royalty amount to the sale price times the royalty basis // points divided by 10_000. royaltyAmount = (_salePrice * info.royaltyBps) / 10_000; // Set the receiver of the royalty. receiver = info.royaltyAddress; } /** * @notice Returns whether the interface is supported. * * @param interfaceId The interface id to check against. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721A) returns (bool) { return interfaceId == type(IERC2981).interfaceId || interfaceId == 0x49064906 || // ERC-4906 super.supportsInterface(interfaceId); } /** * @dev Internal pure function to cast a `bool` value to a `uint256` value. * * @param b The `bool` value to cast. * * @return u The `uint256` value. */ function _cast(bool b) internal pure returns (uint256 u) { assembly { u := b } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { ISeaDropTokenContractMetadata } from "./ISeaDropTokenContractMetadata.sol"; import { AllowListData, PublicDrop, TokenGatedDropStage, SignedMintValidationParams } from "../lib/SeaDropStructs.sol"; interface INonFungibleSeaDropToken is ISeaDropTokenContractMetadata { /** * @dev Revert with an error if a contract is not an allowed * SeaDrop address. */ error OnlyAllowedSeaDrop(); /** * @dev Emit an event when allowed SeaDrop contracts are updated. */ event AllowedSeaDropUpdated(address[] allowedSeaDrop); /** * @notice Update the allowed SeaDrop contracts. * Only the owner or administrator can use this function. * * @param allowedSeaDrop The allowed SeaDrop addresses. */ function updateAllowedSeaDrop(address[] calldata allowedSeaDrop) external; /** * @notice Mint tokens, restricted to the SeaDrop contract. * * @dev NOTE: If a token registers itself with multiple SeaDrop * contracts, the implementation of this function should guard * against reentrancy. If the implementing token uses * _safeMint(), or a feeRecipient with a malicious receive() hook * is specified, the token or fee recipients may be able to execute * another mint in the same transaction via a separate SeaDrop * contract. * This is dangerous if an implementing token does not correctly * update the minterNumMinted and currentTotalSupply values before * transferring minted tokens, as SeaDrop references these values * to enforce token limits on a per-wallet and per-stage basis. * * @param minter The address to mint to. * @param quantity The number of tokens to mint. */ function mintSeaDrop(address minter, uint256 quantity) external; /** * @notice Returns a set of mint stats for the address. * This assists SeaDrop in enforcing maxSupply, * maxTotalMintableByWallet, and maxTokenSupplyForStage checks. * * @dev NOTE: Implementing contracts should always update these numbers * before transferring any tokens with _safeMint() to mitigate * consequences of malicious onERC721Received() hooks. * * @param minter The minter address. */ function getMintStats(address minter) external view returns ( uint256 minterNumMinted, uint256 currentTotalSupply, uint256 maxSupply ); /** * @notice Update the public drop data for this nft contract on SeaDrop. * Only the owner or administrator can use this function. * * The administrator can only update `feeBps`. * * @param seaDropImpl The allowed SeaDrop contract. * @param publicDrop The public drop data. */ function updatePublicDrop( address seaDropImpl, PublicDrop calldata publicDrop ) external; /** * @notice Update the allow list data for this nft contract on SeaDrop. * Only the owner or administrator can use this function. * * @param seaDropImpl The allowed SeaDrop contract. * @param allowListData The allow list data. */ function updateAllowList( address seaDropImpl, AllowListData calldata allowListData ) external; /** * @notice Update the token gated drop stage data for this nft contract * on SeaDrop. * Only the owner or administrator can use this function. * * The administrator, when present, must first set `feeBps`. * * Note: If two INonFungibleSeaDropToken tokens are doing * simultaneous token gated drop promotions for each other, * they can be minted by the same actor until * `maxTokenSupplyForStage` is reached. Please ensure the * `allowedNftToken` is not running an active drop during the * `dropStage` time period. * * * @param seaDropImpl The allowed SeaDrop contract. * @param allowedNftToken The allowed nft token. * @param dropStage The token gated drop stage data. */ function updateTokenGatedDrop( address seaDropImpl, address allowedNftToken, TokenGatedDropStage calldata dropStage ) external; /** * @notice Update the drop URI for this nft contract on SeaDrop. * Only the owner or administrator can use this function. * * @param seaDropImpl The allowed SeaDrop contract. * @param dropURI The new drop URI. */ function updateDropURI(address seaDropImpl, string calldata dropURI) external; /** * @notice Update the creator payout address for this nft contract on * SeaDrop. * Only the owner can set the creator payout address. * * @param seaDropImpl The allowed SeaDrop contract. * @param payoutAddress The new payout address. */ function updateCreatorPayoutAddress( address seaDropImpl, address payoutAddress ) external; /** * @notice Update the allowed fee recipient for this nft contract * on SeaDrop. * Only the administrator can set the allowed fee recipient. * * @param seaDropImpl The allowed SeaDrop contract. * @param feeRecipient The new fee recipient. */ function updateAllowedFeeRecipient( address seaDropImpl, address feeRecipient, bool allowed ) external; /** * @notice Update the server-side signers for this nft contract * on SeaDrop. * Only the owner or administrator can use this function. * * @param seaDropImpl The allowed SeaDrop contract. * @param signer The signer to update. * @param signedMintValidationParams Minimum and maximum parameters * to enforce for signed mints. */ function updateSignedMintValidationParams( address seaDropImpl, address signer, SignedMintValidationParams memory signedMintValidationParams ) external; /** * @notice Update the allowed payers for this nft contract on SeaDrop. * Only the owner or administrator can use this function. * * @param seaDropImpl The allowed SeaDrop contract. * @param payer The payer to update. * @param allowed Whether the payer is allowed. */ function updatePayer( address seaDropImpl, address payer, bool allowed ) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { AllowListData, MintParams, PublicDrop, TokenGatedDropStage, TokenGatedMintParams, SignedMintValidationParams } from "../lib/SeaDropStructs.sol"; import { SeaDropErrorsAndEvents } from "../lib/SeaDropErrorsAndEvents.sol"; interface ISeaDrop is SeaDropErrorsAndEvents { /** * @notice Mint a public drop. * * @param nftContract The nft contract to mint. * @param feeRecipient The fee recipient. * @param minterIfNotPayer The mint recipient if different than the payer. * @param quantity The number of tokens to mint. */ function mintPublic( address nftContract, address feeRecipient, address minterIfNotPayer, uint256 quantity ) external payable; /** * @notice Mint from an allow list. * * @param nftContract The nft contract to mint. * @param feeRecipient The fee recipient. * @param minterIfNotPayer The mint recipient if different than the payer. * @param quantity The number of tokens to mint. * @param mintParams The mint parameters. * @param proof The proof for the leaf of the allow list. */ function mintAllowList( address nftContract, address feeRecipient, address minterIfNotPayer, uint256 quantity, MintParams calldata mintParams, bytes32[] calldata proof ) external payable; /** * @notice Mint with a server-side signature. * Note that a signature can only be used once. * * @param nftContract The nft contract to mint. * @param feeRecipient The fee recipient. * @param minterIfNotPayer The mint recipient if different than the payer. * @param quantity The number of tokens to mint. * @param mintParams The mint parameters. * @param salt The sale for the signed mint. * @param signature The server-side signature, must be an allowed * signer. */ function mintSigned( address nftContract, address feeRecipient, address minterIfNotPayer, uint256 quantity, MintParams calldata mintParams, uint256 salt, bytes calldata signature ) external payable; /** * @notice Mint as an allowed token holder. * This will mark the token id as redeemed and will revert if the * same token id is attempted to be redeemed twice. * * @param nftContract The nft contract to mint. * @param feeRecipient The fee recipient. * @param minterIfNotPayer The mint recipient if different than the payer. * @param mintParams The token gated mint params. */ function mintAllowedTokenHolder( address nftContract, address feeRecipient, address minterIfNotPayer, TokenGatedMintParams calldata mintParams ) external payable; /** * @notice Emits an event to notify update of the drop URI. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param dropURI The new drop URI. */ function updateDropURI(string calldata dropURI) external; /** * @notice Updates the public drop data for the nft contract * and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param publicDrop The public drop data. */ function updatePublicDrop(PublicDrop calldata publicDrop) external; /** * @notice Updates the allow list merkle root for the nft contract * and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param allowListData The allow list data. */ function updateAllowList(AllowListData calldata allowListData) external; /** * @notice Updates the token gated drop stage for the nft contract * and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * Note: If two INonFungibleSeaDropToken tokens are doing * simultaneous token gated drop promotions for each other, * they can be minted by the same actor until * `maxTokenSupplyForStage` is reached. Please ensure the * `allowedNftToken` is not running an active drop during * the `dropStage` time period. * * @param allowedNftToken The token gated nft token. * @param dropStage The token gated drop stage data. */ function updateTokenGatedDrop( address allowedNftToken, TokenGatedDropStage calldata dropStage ) external; /** * @notice Updates the creator payout address and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param payoutAddress The creator payout address. */ function updateCreatorPayoutAddress(address payoutAddress) external; /** * @notice Updates the allowed fee recipient and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param feeRecipient The fee recipient. * @param allowed If the fee recipient is allowed. */ function updateAllowedFeeRecipient(address feeRecipient, bool allowed) external; /** * @notice Updates the allowed server-side signers and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param signer The signer to update. * @param signedMintValidationParams Minimum and maximum parameters * to enforce for signed mints. */ function updateSignedMintValidationParams( address signer, SignedMintValidationParams calldata signedMintValidationParams ) external; /** * @notice Updates the allowed payer and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param payer The payer to add or remove. * @param allowed Whether to add or remove the payer. */ function updatePayer(address payer, bool allowed) external; /** * @notice Returns the public drop data for the nft contract. * * @param nftContract The nft contract. */ function getPublicDrop(address nftContract) external view returns (PublicDrop memory); /** * @notice Returns the creator payout address for the nft contract. * * @param nftContract The nft contract. */ function getCreatorPayoutAddress(address nftContract) external view returns (address); /** * @notice Returns the allow list merkle root for the nft contract. * * @param nftContract The nft contract. */ function getAllowListMerkleRoot(address nftContract) external view returns (bytes32); /** * @notice Returns if the specified fee recipient is allowed * for the nft contract. * * @param nftContract The nft contract. * @param feeRecipient The fee recipient. */ function getFeeRecipientIsAllowed(address nftContract, address feeRecipient) external view returns (bool); /** * @notice Returns an enumeration of allowed fee recipients for an * nft contract when fee recipients are enforced * * @param nftContract The nft contract. */ function getAllowedFeeRecipients(address nftContract) external view returns (address[] memory); /** * @notice Returns the server-side signers for the nft contract. * * @param nftContract The nft contract. */ function getSigners(address nftContract) external view returns (address[] memory); /** * @notice Returns the struct of SignedMintValidationParams for a signer. * * @param nftContract The nft contract. * @param signer The signer. */ function getSignedMintValidationParams(address nftContract, address signer) external view returns (SignedMintValidationParams memory); /** * @notice Returns the payers for the nft contract. * * @param nftContract The nft contract. */ function getPayers(address nftContract) external view returns (address[] memory); /** * @notice Returns if the specified payer is allowed * for the nft contract. * * @param nftContract The nft contract. * @param payer The payer. */ function getPayerIsAllowed(address nftContract, address payer) external view returns (bool); /** * @notice Returns the allowed token gated drop tokens for the nft contract. * * @param nftContract The nft contract. */ function getTokenGatedAllowedTokens(address nftContract) external view returns (address[] memory); /** * @notice Returns the token gated drop data for the nft contract * and token gated nft. * * @param nftContract The nft contract. * @param allowedNftToken The token gated nft token. */ function getTokenGatedDrop(address nftContract, address allowedNftToken) external view returns (TokenGatedDropStage memory); /** * @notice Returns whether the token id for a token gated drop has been * redeemed. * * @param nftContract The nft contract. * @param allowedNftToken The token gated nft token. * @param allowedNftTokenId The token gated nft token id to check. */ function getAllowedNftTokenIdIsRedeemed( address nftContract, address allowedNftToken, uint256 allowedNftTokenId ) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; /** * @notice A struct defining public drop data. * Designed to fit efficiently in one storage slot. * * @param mintPrice The mint price per token. (Up to 1.2m * of native token, e.g. ETH, MATIC) * @param startTime The start time, ensure this is not zero. * @param endTIme The end time, ensure this is not zero. * @param maxTotalMintableByWallet Maximum total number of mints a user is * allowed. (The limit for this field is * 2^16 - 1) * @param feeBps Fee out of 10_000 basis points to be * collected. * @param restrictFeeRecipients If false, allow any fee recipient; * if true, check fee recipient is allowed. */ struct PublicDrop { uint80 mintPrice; // 80/256 bits uint48 startTime; // 128/256 bits uint48 endTime; // 176/256 bits uint16 maxTotalMintableByWallet; // 224/256 bits uint16 feeBps; // 240/256 bits bool restrictFeeRecipients; // 248/256 bits } /** * @notice A struct defining token gated drop stage data. * Designed to fit efficiently in one storage slot. * * @param mintPrice The mint price per token. (Up to 1.2m * of native token, e.g.: ETH, MATIC) * @param maxTotalMintableByWallet Maximum total number of mints a user is * allowed. (The limit for this field is * 2^16 - 1) * @param startTime The start time, ensure this is not zero. * @param endTime The end time, ensure this is not zero. * @param dropStageIndex The drop stage index to emit with the event * for analytical purposes. This should be * non-zero since the public mint emits * with index zero. * @param maxTokenSupplyForStage The limit of token supply this stage can * mint within. (The limit for this field is * 2^16 - 1) * @param feeBps Fee out of 10_000 basis points to be * collected. * @param restrictFeeRecipients If false, allow any fee recipient; * if true, check fee recipient is allowed. */ struct TokenGatedDropStage { uint80 mintPrice; // 80/256 bits uint16 maxTotalMintableByWallet; // 96/256 bits uint48 startTime; // 144/256 bits uint48 endTime; // 192/256 bits uint8 dropStageIndex; // non-zero. 200/256 bits uint32 maxTokenSupplyForStage; // 232/256 bits uint16 feeBps; // 248/256 bits bool restrictFeeRecipients; // 256/256 bits } /** * @notice A struct defining mint params for an allow list. * An allow list leaf will be composed of `msg.sender` and * the following params. * * Note: Since feeBps is encoded in the leaf, backend should ensure * that feeBps is acceptable before generating a proof. * * @param mintPrice The mint price per token. * @param maxTotalMintableByWallet Maximum total number of mints a user is * allowed. * @param startTime The start time, ensure this is not zero. * @param endTime The end time, ensure this is not zero. * @param dropStageIndex The drop stage index to emit with the event * for analytical purposes. This should be * non-zero since the public mint emits with * index zero. * @param maxTokenSupplyForStage The limit of token supply this stage can * mint within. * @param feeBps Fee out of 10_000 basis points to be * collected. * @param restrictFeeRecipients If false, allow any fee recipient; * if true, check fee recipient is allowed. */ struct MintParams { uint256 mintPrice; uint256 maxTotalMintableByWallet; uint256 startTime; uint256 endTime; uint256 dropStageIndex; // non-zero uint256 maxTokenSupplyForStage; uint256 feeBps; bool restrictFeeRecipients; } /** * @notice A struct defining token gated mint params. * * @param allowedNftToken The allowed nft token contract address. * @param allowedNftTokenIds The token ids to redeem. */ struct TokenGatedMintParams { address allowedNftToken; uint256[] allowedNftTokenIds; } /** * @notice A struct defining allow list data (for minting an allow list). * * @param merkleRoot The merkle root for the allow list. * @param publicKeyURIs If the allowListURI is encrypted, a list of URIs * pointing to the public keys. Empty if unencrypted. * @param allowListURI The URI for the allow list. */ struct AllowListData { bytes32 merkleRoot; string[] publicKeyURIs; string allowListURI; } /** * @notice A struct defining minimum and maximum parameters to validate for * signed mints, to minimize negative effects of a compromised signer. * * @param minMintPrice The minimum mint price allowed. * @param maxMaxTotalMintableByWallet The maximum total number of mints allowed * by a wallet. * @param minStartTime The minimum start time allowed. * @param maxEndTime The maximum end time allowed. * @param maxMaxTokenSupplyForStage The maximum token supply allowed. * @param minFeeBps The minimum fee allowed. * @param maxFeeBps The maximum fee allowed. */ struct SignedMintValidationParams { uint80 minMintPrice; // 80/256 bits uint24 maxMaxTotalMintableByWallet; // 104/256 bits uint40 minStartTime; // 144/256 bits uint40 maxEndTime; // 184/256 bits uint40 maxMaxTokenSupplyForStage; // 224/256 bits uint16 minFeeBps; // 240/256 bits uint16 maxFeeBps; // 256/256 bits }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { AllowListData, PublicDrop, SignedMintValidationParams, TokenGatedDropStage } from "./SeaDropStructs.sol"; interface ERC721SeaDropStructsErrorsAndEvents { /** * @notice Revert with an error if mint exceeds the max supply. */ error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply); /** * @notice Revert with an error if the number of token gated * allowedNftTokens doesn't match the length of supplied * drop stages. */ error TokenGatedMismatch(); /** * @notice Revert with an error if the number of signers doesn't match * the length of supplied signedMintValidationParams */ error SignersMismatch(); /** * @notice An event to signify that a SeaDrop token contract was deployed. */ event SeaDropTokenDeployed(); /** * @notice A struct to configure multiple contract options at a time. */ struct MultiConfigureStruct { uint256 maxSupply; string baseURI; string contractURI; address seaDropImpl; PublicDrop publicDrop; string dropURI; AllowListData allowListData; address creatorPayoutAddress; bytes32 provenanceHash; address[] allowedFeeRecipients; address[] disallowedFeeRecipients; address[] allowedPayers; address[] disallowedPayers; // Token-gated address[] tokenGatedAllowedNftTokens; TokenGatedDropStage[] tokenGatedDropStages; address[] disallowedTokenGatedAllowedNftTokens; // Server-signed address[] signers; SignedMintValidationParams[] signedMintValidationParams; address[] disallowedSigners; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.2 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {OperatorFilterer} from "./OperatorFilterer.sol"; import {CANONICAL_CORI_SUBSCRIPTION} from "./lib/Constants.sol"; /** * @title DefaultOperatorFilterer * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription. * @dev Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract DefaultOperatorFilterer is OperatorFilterer { /// @dev The constructor that is called when the contract is being deployed. constructor() OperatorFilterer(CANONICAL_CORI_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Gas optimized reentrancy protection for smart contracts. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ReentrancyGuard.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/ReentrancyGuard.sol) abstract contract ReentrancyGuard { uint256 private locked = 1; modifier nonReentrant() virtual { require(locked == 1, "REENTRANCY"); locked = 2; _; locked = 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { IERC2981 } from "lib/openzeppelin-contracts/contracts/interfaces/IERC2981.sol"; interface ISeaDropTokenContractMetadata is IERC2981 { /** * @notice Throw if the max supply exceeds uint64, a limit * due to the storage of bit-packed variables in ERC721A. */ error CannotExceedMaxSupplyOfUint64(uint256 newMaxSupply); /** * @dev Revert with an error when attempting to set the provenance * hash after the mint has started. */ error ProvenanceHashCannotBeSetAfterMintStarted(); /** * @dev Revert if the royalty basis points is greater than 10_000. */ error InvalidRoyaltyBasisPoints(uint256 basisPoints); /** * @dev Revert if the royalty address is being set to the zero address. */ error RoyaltyAddressCannotBeZeroAddress(); /** * @dev Emit an event for token metadata reveals/updates, * according to EIP-4906. * * @param _fromTokenId The start token id. * @param _toTokenId The end token id. */ event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId); /** * @dev Emit an event when the URI for the collection-level metadata * is updated. */ event ContractURIUpdated(string newContractURI); /** * @dev Emit an event when the max token supply is updated. */ event MaxSupplyUpdated(uint256 newMaxSupply); /** * @dev Emit an event with the previous and new provenance hash after * being updated. */ event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash); /** * @dev Emit an event when the royalties info is updated. */ event RoyaltyInfoUpdated(address receiver, uint256 bps); /** * @notice A struct defining royalty info for the contract. */ struct RoyaltyInfo { address royaltyAddress; uint96 royaltyBps; } /** * @notice Sets the base URI for the token metadata and emits an event. * * @param tokenURI The new base URI to set. */ function setBaseURI(string calldata tokenURI) external; /** * @notice Sets the contract URI for contract metadata. * * @param newContractURI The new contract URI. */ function setContractURI(string calldata newContractURI) external; /** * @notice Sets the max supply and emits an event. * * @param newMaxSupply The new max supply to set. */ function setMaxSupply(uint256 newMaxSupply) external; /** * @notice Sets the provenance hash and emits an event. * * The provenance hash is used for random reveals, which * is a hash of the ordered metadata to show it has not been * modified after mint started. * * This function will revert after the first item has been minted. * * @param newProvenanceHash The new provenance hash to set. */ function setProvenanceHash(bytes32 newProvenanceHash) external; /** * @notice Sets the address and basis points for royalties. * * @param newInfo The struct to configure royalties. */ function setRoyaltyInfo(RoyaltyInfo calldata newInfo) external; /** * @notice Returns the base URI for token metadata. */ function baseURI() external view returns (string memory); /** * @notice Returns the contract URI. */ function contractURI() external view returns (string memory); /** * @notice Returns the max token supply. */ function maxSupply() external view returns (uint256); /** * @notice Returns the provenance hash. * The provenance hash is used for random reveals, which * is a hash of the ordered metadata to show it is unmodified * after mint has started. */ function provenanceHash() external view returns (bytes32); /** * @notice Returns the address that receives royalties. */ function royaltyAddress() external view returns (address); /** * @notice Returns the royalty basis points out of 10_000. */ function royaltyBasisPoints() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import {ConstructorInitializable} from "./ConstructorInitializable.sol"; /** @notice A two-step extension of Ownable, where the new owner must claim ownership of the contract after owner initiates transfer Owner can cancel the transfer at any point before the new owner claims ownership. Helpful in guarding against transferring ownership to an address that is unable to act as the Owner. */ abstract contract TwoStepOwnable is ConstructorInitializable { address private _owner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); address internal potentialOwner; event PotentialOwnerUpdated(address newPotentialAdministrator); error NewOwnerIsZeroAddress(); error NotNextOwner(); error OnlyOwner(); modifier onlyOwner() { _checkOwner(); _; } constructor() { _initialize(); } function _initialize() private onlyConstructor { _transferOwnership(msg.sender); } ///@notice Initiate ownership transfer to newPotentialOwner. Note: new owner will have to manually acceptOwnership ///@param newPotentialOwner address of potential new owner function transferOwnership(address newPotentialOwner) public virtual onlyOwner { if (newPotentialOwner == address(0)) { revert NewOwnerIsZeroAddress(); } potentialOwner = newPotentialOwner; emit PotentialOwnerUpdated(newPotentialOwner); } ///@notice Claim ownership of smart contract, after the current owner has initiated the process with transferOwnership function acceptOwnership() public virtual { address _potentialOwner = potentialOwner; if (msg.sender != _potentialOwner) { revert NotNextOwner(); } delete potentialOwner; emit PotentialOwnerUpdated(address(0)); _transferOwnership(_potentialOwner); } ///@notice cancel ownership transfer function cancelOwnershipTransfer() public virtual onlyOwner { delete potentialOwner; emit PotentialOwnerUpdated(address(0)); } function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (_owner != msg.sender) { revert OnlyOwner(); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.2 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; /** * @author emo.eth * @notice Abstract smart contract that provides an onlyUninitialized modifier which only allows calling when * from within a constructor of some sort, whether directly instantiating an inherting contract, * or when delegatecalling from a proxy */ abstract contract ConstructorInitializable { error AlreadyInitialized(); modifier onlyConstructor() { if (address(this).code.length != 0) { revert AlreadyInitialized(); } _; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { PublicDrop, TokenGatedDropStage, SignedMintValidationParams } from "./SeaDropStructs.sol"; interface SeaDropErrorsAndEvents { /** * @dev Revert with an error if the drop stage is not active. */ error NotActive( uint256 currentTimestamp, uint256 startTimestamp, uint256 endTimestamp ); /** * @dev Revert with an error if the mint quantity is zero. */ error MintQuantityCannotBeZero(); /** * @dev Revert with an error if the mint quantity exceeds the max allowed * to be minted per wallet. */ error MintQuantityExceedsMaxMintedPerWallet(uint256 total, uint256 allowed); /** * @dev Revert with an error if the mint quantity exceeds the max token * supply. */ error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply); /** * @dev Revert with an error if the mint quantity exceeds the max token * supply for the stage. * Note: The `maxTokenSupplyForStage` for public mint is * always `type(uint).max`. */ error MintQuantityExceedsMaxTokenSupplyForStage( uint256 total, uint256 maxTokenSupplyForStage ); /** * @dev Revert if the fee recipient is the zero address. */ error FeeRecipientCannotBeZeroAddress(); /** * @dev Revert if the fee recipient is not already included. */ error FeeRecipientNotPresent(); /** * @dev Revert if the fee basis points is greater than 10_000. */ error InvalidFeeBps(uint256 feeBps); /** * @dev Revert if the fee recipient is already included. */ error DuplicateFeeRecipient(); /** * @dev Revert if the fee recipient is restricted and not allowed. */ error FeeRecipientNotAllowed(); /** * @dev Revert if the creator payout address is the zero address. */ error CreatorPayoutAddressCannotBeZeroAddress(); /** * @dev Revert with an error if the received payment is incorrect. */ error IncorrectPayment(uint256 got, uint256 want); /** * @dev Revert with an error if the allow list proof is invalid. */ error InvalidProof(); /** * @dev Revert if a supplied signer address is the zero address. */ error SignerCannotBeZeroAddress(); /** * @dev Revert with an error if signer's signature is invalid. */ error InvalidSignature(address recoveredSigner); /** * @dev Revert with an error if a signer is not included in * the enumeration when removing. */ error SignerNotPresent(); /** * @dev Revert with an error if a payer is not included in * the enumeration when removing. */ error PayerNotPresent(); /** * @dev Revert with an error if a payer is already included in mapping * when adding. * Note: only applies when adding a single payer, as duplicates in * enumeration can be removed with updatePayer. */ error DuplicatePayer(); /** * @dev Revert with an error if the payer is not allowed. The minter must * pay for their own mint. */ error PayerNotAllowed(); /** * @dev Revert if a supplied payer address is the zero address. */ error PayerCannotBeZeroAddress(); /** * @dev Revert with an error if the sender does not * match the INonFungibleSeaDropToken interface. */ error OnlyINonFungibleSeaDropToken(address sender); /** * @dev Revert with an error if the sender of a token gated supplied * drop stage redeem is not the owner of the token. */ error TokenGatedNotTokenOwner( address nftContract, address allowedNftToken, uint256 allowedNftTokenId ); /** * @dev Revert with an error if the token id has already been used to * redeem a token gated drop stage. */ error TokenGatedTokenIdAlreadyRedeemed( address nftContract, address allowedNftToken, uint256 allowedNftTokenId ); /** * @dev Revert with an error if an empty TokenGatedDropStage is provided * for an already-empty TokenGatedDropStage. */ error TokenGatedDropStageNotPresent(); /** * @dev Revert with an error if an allowedNftToken is set to * the zero address. */ error TokenGatedDropAllowedNftTokenCannotBeZeroAddress(); /** * @dev Revert with an error if an allowedNftToken is set to * the drop token itself. */ error TokenGatedDropAllowedNftTokenCannotBeDropToken(); /** * @dev Revert with an error if supplied signed mint price is less than * the minimum specified. */ error InvalidSignedMintPrice(uint256 got, uint256 minimum); /** * @dev Revert with an error if supplied signed maxTotalMintableByWallet * is greater than the maximum specified. */ error InvalidSignedMaxTotalMintableByWallet(uint256 got, uint256 maximum); /** * @dev Revert with an error if supplied signed start time is less than * the minimum specified. */ error InvalidSignedStartTime(uint256 got, uint256 minimum); /** * @dev Revert with an error if supplied signed end time is greater than * the maximum specified. */ error InvalidSignedEndTime(uint256 got, uint256 maximum); /** * @dev Revert with an error if supplied signed maxTokenSupplyForStage * is greater than the maximum specified. */ error InvalidSignedMaxTokenSupplyForStage(uint256 got, uint256 maximum); /** * @dev Revert with an error if supplied signed feeBps is greater than * the maximum specified, or less than the minimum. */ error InvalidSignedFeeBps(uint256 got, uint256 minimumOrMaximum); /** * @dev Revert with an error if signed mint did not specify to restrict * fee recipients. */ error SignedMintsMustRestrictFeeRecipients(); /** * @dev Revert with an error if a signature for a signed mint has already * been used. */ error SignatureAlreadyUsed(); /** * @dev An event with details of a SeaDrop mint, for analytical purposes. * * @param nftContract The nft contract. * @param minter The mint recipient. * @param feeRecipient The fee recipient. * @param payer The address who payed for the tx. * @param quantityMinted The number of tokens minted. * @param unitMintPrice The amount paid for each token. * @param feeBps The fee out of 10_000 basis points collected. * @param dropStageIndex The drop stage index. Items minted * through mintPublic() have * dropStageIndex of 0. */ event SeaDropMint( address indexed nftContract, address indexed minter, address indexed feeRecipient, address payer, uint256 quantityMinted, uint256 unitMintPrice, uint256 feeBps, uint256 dropStageIndex ); /** * @dev An event with updated public drop data for an nft contract. */ event PublicDropUpdated( address indexed nftContract, PublicDrop publicDrop ); /** * @dev An event with updated token gated drop stage data * for an nft contract. */ event TokenGatedDropStageUpdated( address indexed nftContract, address indexed allowedNftToken, TokenGatedDropStage dropStage ); /** * @dev An event with updated allow list data for an nft contract. * * @param nftContract The nft contract. * @param previousMerkleRoot The previous allow list merkle root. * @param newMerkleRoot The new allow list merkle root. * @param publicKeyURI If the allow list is encrypted, the public key * URIs that can decrypt the list. * Empty if unencrypted. * @param allowListURI The URI for the allow list. */ event AllowListUpdated( address indexed nftContract, bytes32 indexed previousMerkleRoot, bytes32 indexed newMerkleRoot, string[] publicKeyURI, string allowListURI ); /** * @dev An event with updated drop URI for an nft contract. */ event DropURIUpdated(address indexed nftContract, string newDropURI); /** * @dev An event with the updated creator payout address for an nft * contract. */ event CreatorPayoutAddressUpdated( address indexed nftContract, address indexed newPayoutAddress ); /** * @dev An event with the updated allowed fee recipient for an nft * contract. */ event AllowedFeeRecipientUpdated( address indexed nftContract, address indexed feeRecipient, bool indexed allowed ); /** * @dev An event with the updated validation parameters for server-side * signers. */ event SignedMintValidationParamsUpdated( address indexed nftContract, address indexed signer, SignedMintValidationParams signedMintValidationParams ); /** * @dev An event with the updated payer for an nft contract. */ event PayerUpdated( address indexed nftContract, address indexed payer, bool indexed allowed ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol"; import {CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS} from "./lib/Constants.sol"; /** * @title OperatorFilterer * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry. * @dev This smart contract is meant to be inherited by token contracts so they can use the following: * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods. * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods. * Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract OperatorFilterer { /// @dev Emitted when an operator is not allowed. error OperatorNotAllowed(address operator); IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS); /// @dev The constructor that is called when the contract is being deployed. constructor(address subscriptionOrRegistrantToCopy, bool subscribe) { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { OPERATOR_FILTER_REGISTRY.register(address(this)); } } } } /** * @dev A helper function to check if an operator is allowed. */ modifier onlyAllowedOperator(address from) virtual { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from != msg.sender) { _checkFilterOperator(msg.sender); } _; } /** * @dev A helper function to check if an operator approval is allowed. */ modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } /** * @dev A helper function to check if an operator is allowed. */ function _checkFilterOperator(address operator) internal view virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { // under normal circumstances, this function will revert rather than return false, but inheriting contracts // may specify their own OperatorFilterRegistry implementations, which may behave differently if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E; address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { /** * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns * true if supplied registrant address is not registered. */ function isOperatorAllowed(address registrant, address operator) external view returns (bool); /** * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner. */ function register(address registrant) external; /** * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes. */ function registerAndSubscribe(address registrant, address subscription) external; /** * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another * address without subscribing. */ function registerAndCopyEntries(address registrant, address registrantToCopy) external; /** * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner. * Note that this does not remove any filtered addresses or codeHashes. * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes. */ function unregister(address addr) external; /** * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered. */ function updateOperator(address registrant, address operator, bool filtered) external; /** * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates. */ function updateOperators(address registrant, address[] calldata operators, bool filtered) external; /** * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered. */ function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; /** * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates. */ function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; /** * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous * subscription if present. * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case, * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be * used. */ function subscribe(address registrant, address registrantToSubscribe) external; /** * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes. */ function unsubscribe(address registrant, bool copyExistingEntries) external; /** * @notice Get the subscription address of a given registrant, if any. */ function subscriptionOf(address addr) external returns (address registrant); /** * @notice Get the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscribers(address registrant) external returns (address[] memory); /** * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscriberAt(address registrant, uint256 index) external returns (address); /** * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr. */ function copyEntriesOf(address registrant, address registrantToCopy) external; /** * @notice Returns true if operator is filtered by a given address or its subscription. */ function isOperatorFiltered(address registrant, address operator) external returns (bool); /** * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription. */ function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); /** * @notice Returns true if a codeHash is filtered by a given address or its subscription. */ function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); /** * @notice Returns a list of filtered operators for a given address or its subscription. */ function filteredOperators(address addr) external returns (address[] memory); /** * @notice Returns the set of filtered codeHashes for a given address or its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashes(address addr) external returns (bytes32[] memory); /** * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredOperatorAt(address registrant, uint256 index) external returns (address); /** * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); /** * @notice Returns true if an address has registered */ function isRegistered(address addr) external returns (bool); /** * @dev Convenience method to compute the code hash of an arbitrary contract */ function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { ISeaDrop } from "./interfaces/ISeaDrop.sol"; import { INonFungibleSeaDropToken } from "./interfaces/INonFungibleSeaDropToken.sol"; import { AllowListData, MintParams, PublicDrop, TokenGatedDropStage, TokenGatedMintParams, SignedMintValidationParams } from "./lib/SeaDropStructs.sol"; import { SafeTransferLib } from "lib/solmate/src/utils/SafeTransferLib.sol"; import { ReentrancyGuard } from "lib/solmate/src/utils/ReentrancyGuard.sol"; import { IERC721 } from "lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol"; import { IERC165 } from "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol"; import { ECDSA } from "lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol"; import { MerkleProof } from "lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol"; /** * @title SeaDrop * @author James Wenzel (emo.eth) * @author Ryan Ghods (ralxz.eth) * @author Stephan Min (stephanm.eth) * @notice SeaDrop is a contract to help facilitate ERC721 token drops * with functionality for public, allow list, server-side signed, * and token-gated drops. */ contract SeaDrop is ISeaDrop, ReentrancyGuard { using ECDSA for bytes32; /// @notice Track the public drops. mapping(address => PublicDrop) private _publicDrops; /// @notice Track the creator payout addresses. mapping(address => address) private _creatorPayoutAddresses; /// @notice Track the allow list merkle roots. mapping(address => bytes32) private _allowListMerkleRoots; /// @notice Track the allowed fee recipients. mapping(address => mapping(address => bool)) private _allowedFeeRecipients; /// @notice Track the enumerated allowed fee recipients. mapping(address => address[]) private _enumeratedFeeRecipients; /// @notice Track the parameters for allowed signers for server-side drops. mapping(address => mapping(address => SignedMintValidationParams)) private _signedMintValidationParams; /// @notice Track the signers for each server-side drop. mapping(address => address[]) private _enumeratedSigners; /// @notice Track the used signature digests. mapping(bytes32 => bool) private _usedDigests; /// @notice Track the allowed payers. mapping(address => mapping(address => bool)) private _allowedPayers; /// @notice Track the enumerated allowed payers. mapping(address => address[]) private _enumeratedPayers; /// @notice Track the token gated drop stages. mapping(address => mapping(address => TokenGatedDropStage)) private _tokenGatedDrops; /// @notice Track the tokens for token gated drops. mapping(address => address[]) private _enumeratedTokenGatedTokens; /// @notice Track the redeemed token IDs for token gated drop stages. mapping(address => mapping(address => mapping(uint256 => bool))) private _tokenGatedRedeemed; /// @notice Internal constants for EIP-712: Typed structured /// data hashing and signing bytes32 internal constant _SIGNED_MINT_TYPEHASH = // prettier-ignore keccak256( "SignedMint(" "address nftContract," "address minter," "address feeRecipient," "MintParams mintParams," "uint256 salt" ")" "MintParams(" "uint256 mintPrice," "uint256 maxTotalMintableByWallet," "uint256 startTime," "uint256 endTime," "uint256 dropStageIndex," "uint256 maxTokenSupplyForStage," "uint256 feeBps," "bool restrictFeeRecipients" ")" ); bytes32 internal constant _MINT_PARAMS_TYPEHASH = // prettier-ignore keccak256( "MintParams(" "uint256 mintPrice," "uint256 maxTotalMintableByWallet," "uint256 startTime," "uint256 endTime," "uint256 dropStageIndex," "uint256 maxTokenSupplyForStage," "uint256 feeBps," "bool restrictFeeRecipients" ")" ); bytes32 internal constant _EIP_712_DOMAIN_TYPEHASH = // prettier-ignore keccak256( "EIP712Domain(" "string name," "string version," "uint256 chainId," "address verifyingContract" ")" ); bytes32 internal constant _NAME_HASH = keccak256("SeaDrop"); bytes32 internal constant _VERSION_HASH = keccak256("1.0"); uint256 internal immutable _CHAIN_ID = block.chainid; bytes32 internal immutable _DOMAIN_SEPARATOR; /// @notice Constant for an unlimited `maxTokenSupplyForStage`. /// Used in `mintPublic` where no `maxTokenSupplyForStage` /// is stored in the `PublicDrop` struct. uint256 internal constant _UNLIMITED_MAX_TOKEN_SUPPLY_FOR_STAGE = type(uint256).max; /// @notice Constant for a public mint's `dropStageIndex`. /// Used in `mintPublic` where no `dropStageIndex` /// is stored in the `PublicDrop` struct. uint256 internal constant _PUBLIC_DROP_STAGE_INDEX = 0; /** * @notice Ensure only tokens implementing INonFungibleSeaDropToken can * call the update methods. */ modifier onlyINonFungibleSeaDropToken() virtual { if ( !IERC165(msg.sender).supportsInterface( type(INonFungibleSeaDropToken).interfaceId ) ) { revert OnlyINonFungibleSeaDropToken(msg.sender); } _; } /** * @notice Constructor for the contract deployment. */ constructor() { // Derive the domain separator. _DOMAIN_SEPARATOR = _deriveDomainSeparator(); } /** * @notice Mint a public drop. * * @param nftContract The nft contract to mint. * @param feeRecipient The fee recipient. * @param minterIfNotPayer The mint recipient if different than the payer. * @param quantity The number of tokens to mint. */ function mintPublic( address nftContract, address feeRecipient, address minterIfNotPayer, uint256 quantity ) external payable override { // Get the public drop data. PublicDrop memory publicDrop = _publicDrops[nftContract]; // Ensure that the drop has started. _checkActive(publicDrop.startTime, publicDrop.endTime); // Put the mint price on the stack. uint256 mintPrice = publicDrop.mintPrice; // Validate payment is correct for number minted. _checkCorrectPayment(quantity, mintPrice); // Get the minter address. address minter = minterIfNotPayer != address(0) ? minterIfNotPayer : msg.sender; // Ensure the payer is allowed if not the minter. if (minter != msg.sender) { if (!_allowedPayers[nftContract][msg.sender]) { revert PayerNotAllowed(); } } // Check that the minter is allowed to mint the desired quantity. _checkMintQuantity( nftContract, minter, quantity, publicDrop.maxTotalMintableByWallet, _UNLIMITED_MAX_TOKEN_SUPPLY_FOR_STAGE ); // Check that the fee recipient is allowed if restricted. _checkFeeRecipientIsAllowed( nftContract, feeRecipient, publicDrop.restrictFeeRecipients ); // Mint the token(s), split the payout, emit an event. _mintAndPay( nftContract, minter, quantity, mintPrice, _PUBLIC_DROP_STAGE_INDEX, publicDrop.feeBps, feeRecipient ); } /** * @notice Mint from an allow list. * * @param nftContract The nft contract to mint. * @param feeRecipient The fee recipient. * @param minterIfNotPayer The mint recipient if different than the payer. * @param quantity The number of tokens to mint. * @param mintParams The mint parameters. * @param proof The proof for the leaf of the allow list. */ function mintAllowList( address nftContract, address feeRecipient, address minterIfNotPayer, uint256 quantity, MintParams calldata mintParams, bytes32[] calldata proof ) external payable override { // Check that the drop stage is active. _checkActive(mintParams.startTime, mintParams.endTime); // Put the mint price on the stack. uint256 mintPrice = mintParams.mintPrice; // Validate payment is correct for number minted. _checkCorrectPayment(quantity, mintPrice); // Get the minter address. address minter = minterIfNotPayer != address(0) ? minterIfNotPayer : msg.sender; // Ensure the payer is allowed if not the minter. if (minter != msg.sender) { if (!_allowedPayers[nftContract][msg.sender]) { revert PayerNotAllowed(); } } // Check that the minter is allowed to mint the desired quantity. _checkMintQuantity( nftContract, minter, quantity, mintParams.maxTotalMintableByWallet, mintParams.maxTokenSupplyForStage ); // Check that the fee recipient is allowed if restricted. _checkFeeRecipientIsAllowed( nftContract, feeRecipient, mintParams.restrictFeeRecipients ); // Verify the proof. if ( !MerkleProof.verify( proof, _allowListMerkleRoots[nftContract], keccak256(abi.encode(minter, mintParams)) ) ) { revert InvalidProof(); } // Mint the token(s), split the payout, emit an event. _mintAndPay( nftContract, minter, quantity, mintPrice, mintParams.dropStageIndex, mintParams.feeBps, feeRecipient ); } /** * @notice Mint with a server-side signature. * Note that a signature can only be used once. * * @param nftContract The nft contract to mint. * @param feeRecipient The fee recipient. * @param minterIfNotPayer The mint recipient if different than the payer. * @param quantity The number of tokens to mint. * @param mintParams The mint parameters. * @param salt The salt for the signed mint. * @param signature The server-side signature, must be an allowed * signer. */ function mintSigned( address nftContract, address feeRecipient, address minterIfNotPayer, uint256 quantity, MintParams calldata mintParams, uint256 salt, bytes calldata signature ) external payable override { // Check that the drop stage is active. _checkActive(mintParams.startTime, mintParams.endTime); // Validate payment is correct for number minted. _checkCorrectPayment(quantity, mintParams.mintPrice); // Get the minter address. address minter = minterIfNotPayer != address(0) ? minterIfNotPayer : msg.sender; // Ensure the payer is allowed if not the minter. if (minter != msg.sender) { if (!_allowedPayers[nftContract][msg.sender]) { revert PayerNotAllowed(); } } // Check that the minter is allowed to mint the desired quantity. _checkMintQuantity( nftContract, minter, quantity, mintParams.maxTotalMintableByWallet, mintParams.maxTokenSupplyForStage ); // Check that the fee recipient is allowed if restricted. _checkFeeRecipientIsAllowed( nftContract, feeRecipient, mintParams.restrictFeeRecipients ); // Validate the signature in a block scope to avoid "stack too deep". { // Get the digest to verify the EIP-712 signature. bytes32 digest = _getDigest( nftContract, minter, feeRecipient, mintParams, salt ); // Ensure the digest has not already been used. if (_usedDigests[digest]) { revert SignatureAlreadyUsed(); } // Mark the digest as used. _usedDigests[digest] = true; // Use the recover method to see what address was used to create // the signature on this data. // Note that if the digest doesn't exactly match what was signed we'll // get a random recovered address. address recoveredAddress = digest.recover(signature); _validateSignerAndParams(nftContract, mintParams, recoveredAddress); } // Mint the token(s), split the payout, emit an event. _mintAndPay( nftContract, minter, quantity, mintParams.mintPrice, mintParams.dropStageIndex, mintParams.feeBps, feeRecipient ); } /** * @notice Enforce stored parameters for signed mints to mitigate * the effects of a malicious signer. */ function _validateSignerAndParams( address nftContract, MintParams memory mintParams, address signer ) internal view { SignedMintValidationParams memory signedMintValidationParams = _signedMintValidationParams[ nftContract ][signer]; // Check that SignedMintValidationParams have been initialized; if not, // this is an invalid signer. if (signedMintValidationParams.maxMaxTotalMintableByWallet == 0) { revert InvalidSignature(signer); } // Validate individual params. if (mintParams.mintPrice < signedMintValidationParams.minMintPrice) { revert InvalidSignedMintPrice( mintParams.mintPrice, signedMintValidationParams.minMintPrice ); } if ( mintParams.maxTotalMintableByWallet > signedMintValidationParams.maxMaxTotalMintableByWallet ) { revert InvalidSignedMaxTotalMintableByWallet( mintParams.maxTotalMintableByWallet, signedMintValidationParams.maxMaxTotalMintableByWallet ); } if (mintParams.startTime < signedMintValidationParams.minStartTime) { revert InvalidSignedStartTime( mintParams.startTime, signedMintValidationParams.minStartTime ); } if (mintParams.endTime > signedMintValidationParams.maxEndTime) { revert InvalidSignedEndTime( mintParams.endTime, signedMintValidationParams.maxEndTime ); } if ( mintParams.maxTokenSupplyForStage > signedMintValidationParams.maxMaxTokenSupplyForStage ) { revert InvalidSignedMaxTokenSupplyForStage( mintParams.maxTokenSupplyForStage, signedMintValidationParams.maxMaxTokenSupplyForStage ); } if (mintParams.feeBps > signedMintValidationParams.maxFeeBps) { revert InvalidSignedFeeBps( mintParams.feeBps, signedMintValidationParams.maxFeeBps ); } if (mintParams.feeBps < signedMintValidationParams.minFeeBps) { revert InvalidSignedFeeBps( mintParams.feeBps, signedMintValidationParams.minFeeBps ); } if (!mintParams.restrictFeeRecipients) { revert SignedMintsMustRestrictFeeRecipients(); } } /** * @notice Mint as an allowed token holder. * This will mark the token ids as redeemed and will revert if the * same token id is attempted to be redeemed twice. * * @param nftContract The nft contract to mint. * @param feeRecipient The fee recipient. * @param minterIfNotPayer The mint recipient if different than the payer. * @param mintParams The token gated mint params. */ function mintAllowedTokenHolder( address nftContract, address feeRecipient, address minterIfNotPayer, TokenGatedMintParams calldata mintParams ) external payable override { // Get the minter address. address minter = minterIfNotPayer != address(0) ? minterIfNotPayer : msg.sender; // Ensure the payer is allowed if not the minter. if (minter != msg.sender) { if (!_allowedPayers[nftContract][msg.sender]) { revert PayerNotAllowed(); } } // Put the allowedNftToken on the stack for more efficient access. address allowedNftToken = mintParams.allowedNftToken; // Set the dropStage to a variable. TokenGatedDropStage memory dropStage = _tokenGatedDrops[nftContract][ allowedNftToken ]; // Validate that the dropStage is active. _checkActive(dropStage.startTime, dropStage.endTime); // Check that the fee recipient is allowed if restricted. _checkFeeRecipientIsAllowed( nftContract, feeRecipient, dropStage.restrictFeeRecipients ); // Put the mint quantity on the stack for more efficient access. uint256 mintQuantity = mintParams.allowedNftTokenIds.length; // Validate payment is correct for number minted. _checkCorrectPayment(mintQuantity, dropStage.mintPrice); // Check that the minter is allowed to mint the desired quantity. _checkMintQuantity( nftContract, minter, mintQuantity, dropStage.maxTotalMintableByWallet, dropStage.maxTokenSupplyForStage ); // Iterate through each allowedNftTokenId // to ensure it is not already redeemed. for (uint256 i = 0; i < mintQuantity; ) { // Put the tokenId on the stack. uint256 tokenId = mintParams.allowedNftTokenIds[i]; // Check that the minter is the owner of the allowedNftTokenId. if (IERC721(allowedNftToken).ownerOf(tokenId) != minter) { revert TokenGatedNotTokenOwner( nftContract, allowedNftToken, tokenId ); } // Cache the storage pointer for cheaper access. mapping(uint256 => bool) storage redeemedTokenIds = _tokenGatedRedeemed[nftContract][ allowedNftToken ]; // Check that the token id has not already been redeemed. if (redeemedTokenIds[tokenId]) { revert TokenGatedTokenIdAlreadyRedeemed( nftContract, allowedNftToken, tokenId ); } // Mark the token id as redeemed. redeemedTokenIds[tokenId] = true; unchecked { ++i; } } // Mint the token(s), split the payout, emit an event. _mintAndPay( nftContract, minter, mintQuantity, dropStage.mintPrice, dropStage.dropStageIndex, dropStage.feeBps, feeRecipient ); } /** * @notice Check that the drop stage is active. * * @param startTime The drop stage start time. * @param endTime The drop stage end time. */ function _checkActive(uint256 startTime, uint256 endTime) internal view { if ( _cast(block.timestamp < startTime) | _cast(block.timestamp > endTime) == 1 ) { // Revert if the drop stage is not active. revert NotActive(block.timestamp, startTime, endTime); } } /** * @notice Check that the fee recipient is allowed. * * @param nftContract The nft contract. * @param feeRecipient The fee recipient. * @param restrictFeeRecipients If the fee recipients are restricted. */ function _checkFeeRecipientIsAllowed( address nftContract, address feeRecipient, bool restrictFeeRecipients ) internal view { // Ensure the fee recipient is not the zero address. if (feeRecipient == address(0)) { revert FeeRecipientCannotBeZeroAddress(); } // Revert if the fee recipient is restricted and not allowed. if (restrictFeeRecipients) if (!_allowedFeeRecipients[nftContract][feeRecipient]) { revert FeeRecipientNotAllowed(); } } /** * @notice Check that the wallet is allowed to mint the desired quantity. * * @param nftContract The nft contract. * @param minter The mint recipient. * @param quantity The number of tokens to mint. * @param maxTotalMintableByWallet The max allowed mints per wallet. * @param maxTokenSupplyForStage The max token supply for the drop stage. */ function _checkMintQuantity( address nftContract, address minter, uint256 quantity, uint256 maxTotalMintableByWallet, uint256 maxTokenSupplyForStage ) internal view { // Mint quantity of zero is not valid. if (quantity == 0) { revert MintQuantityCannotBeZero(); } // Get the mint stats. ( uint256 minterNumMinted, uint256 currentTotalSupply, uint256 maxSupply ) = INonFungibleSeaDropToken(nftContract).getMintStats(minter); // Ensure mint quantity doesn't exceed maxTotalMintableByWallet. if (quantity + minterNumMinted > maxTotalMintableByWallet) { revert MintQuantityExceedsMaxMintedPerWallet( quantity + minterNumMinted, maxTotalMintableByWallet ); } // Ensure mint quantity doesn't exceed maxSupply. if (quantity + currentTotalSupply > maxSupply) { revert MintQuantityExceedsMaxSupply( quantity + currentTotalSupply, maxSupply ); } // Ensure mint quantity doesn't exceed maxTokenSupplyForStage. if (quantity + currentTotalSupply > maxTokenSupplyForStage) { revert MintQuantityExceedsMaxTokenSupplyForStage( quantity + currentTotalSupply, maxTokenSupplyForStage ); } } /** * @notice Revert if the payment is not the quantity times the mint price. * * @param quantity The number of tokens to mint. * @param mintPrice The mint price per token. */ function _checkCorrectPayment(uint256 quantity, uint256 mintPrice) internal view { // Revert if the tx's value doesn't match the total cost. if (msg.value != quantity * mintPrice) { revert IncorrectPayment(msg.value, quantity * mintPrice); } } /** * @notice Split the payment payout for the creator and fee recipient. * * @param nftContract The nft contract. * @param feeRecipient The fee recipient. * @param feeBps The fee basis points. */ function _splitPayout( address nftContract, address feeRecipient, uint256 feeBps ) internal { // Revert if the fee basis points is greater than 10_000. if (feeBps > 10_000) { revert InvalidFeeBps(feeBps); } // Get the creator payout address. address creatorPayoutAddress = _creatorPayoutAddresses[nftContract]; // Ensure the creator payout address is not the zero address. if (creatorPayoutAddress == address(0)) { revert CreatorPayoutAddressCannotBeZeroAddress(); } // msg.value has already been validated by this point, so can use it directly. // If the fee is zero, just transfer to the creator and return. if (feeBps == 0) { SafeTransferLib.safeTransferETH(creatorPayoutAddress, msg.value); return; } // Get the fee amount. // Note that the fee amount is rounded down in favor of the creator. uint256 feeAmount = (msg.value * feeBps) / 10_000; // Get the creator payout amount. Fee amount is <= msg.value per above. uint256 payoutAmount; unchecked { payoutAmount = msg.value - feeAmount; } // Transfer the fee amount to the fee recipient. if (feeAmount > 0) { SafeTransferLib.safeTransferETH(feeRecipient, feeAmount); } // Transfer the creator payout amount to the creator. SafeTransferLib.safeTransferETH(creatorPayoutAddress, payoutAmount); } /** * @notice Mints a number of tokens, splits the payment, * and emits an event. * * @param nftContract The nft contract. * @param minter The mint recipient. * @param quantity The number of tokens to mint. * @param mintPrice The mint price per token. * @param dropStageIndex The drop stage index. * @param feeBps The fee basis points. * @param feeRecipient The fee recipient. */ function _mintAndPay( address nftContract, address minter, uint256 quantity, uint256 mintPrice, uint256 dropStageIndex, uint256 feeBps, address feeRecipient ) internal nonReentrant { // Mint the token(s). INonFungibleSeaDropToken(nftContract).mintSeaDrop(minter, quantity); if (mintPrice != 0) { // Split the payment between the creator and fee recipient. _splitPayout(nftContract, feeRecipient, feeBps); } // Emit an event for the mint. emit SeaDropMint( nftContract, minter, feeRecipient, msg.sender, quantity, mintPrice, feeBps, dropStageIndex ); } /** * @dev Internal view function to get the EIP-712 domain separator. If the * chainId matches the chainId set on deployment, the cached domain * separator will be returned; otherwise, it will be derived from * scratch. * * @return The domain separator. */ function _domainSeparator() internal view returns (bytes32) { // prettier-ignore return block.chainid == _CHAIN_ID ? _DOMAIN_SEPARATOR : _deriveDomainSeparator(); } /** * @dev Internal view function to derive the EIP-712 domain separator. * * @return The derived domain separator. */ function _deriveDomainSeparator() internal view returns (bytes32) { // prettier-ignore return keccak256( abi.encode( _EIP_712_DOMAIN_TYPEHASH, _NAME_HASH, _VERSION_HASH, block.chainid, address(this) ) ); } /** * @notice Returns the public drop data for the nft contract. * * @param nftContract The nft contract. */ function getPublicDrop(address nftContract) external view returns (PublicDrop memory) { return _publicDrops[nftContract]; } /** * @notice Returns the creator payout address for the nft contract. * * @param nftContract The nft contract. */ function getCreatorPayoutAddress(address nftContract) external view returns (address) { return _creatorPayoutAddresses[nftContract]; } /** * @notice Returns the allow list merkle root for the nft contract. * * @param nftContract The nft contract. */ function getAllowListMerkleRoot(address nftContract) external view returns (bytes32) { return _allowListMerkleRoots[nftContract]; } /** * @notice Returns if the specified fee recipient is allowed * for the nft contract. * * @param nftContract The nft contract. */ function getFeeRecipientIsAllowed(address nftContract, address feeRecipient) external view returns (bool) { return _allowedFeeRecipients[nftContract][feeRecipient]; } /** * @notice Returns an enumeration of allowed fee recipients for an * nft contract when fee recipients are enforced. * * @param nftContract The nft contract. */ function getAllowedFeeRecipients(address nftContract) external view returns (address[] memory) { return _enumeratedFeeRecipients[nftContract]; } /** * @notice Returns the server-side signers for the nft contract. * * @param nftContract The nft contract. */ function getSigners(address nftContract) external view returns (address[] memory) { return _enumeratedSigners[nftContract]; } /** * @notice Returns the struct of SignedMintValidationParams for a signer. * * @param nftContract The nft contract. * @param signer The signer. */ function getSignedMintValidationParams(address nftContract, address signer) external view returns (SignedMintValidationParams memory) { return _signedMintValidationParams[nftContract][signer]; } /** * @notice Returns the payers for the nft contract. * * @param nftContract The nft contract. */ function getPayers(address nftContract) external view returns (address[] memory) { return _enumeratedPayers[nftContract]; } /** * @notice Returns if the specified payer is allowed * for the nft contract. * * @param nftContract The nft contract. * @param payer The payer. */ function getPayerIsAllowed(address nftContract, address payer) external view returns (bool) { return _allowedPayers[nftContract][payer]; } /** * @notice Returns the allowed token gated drop tokens for the nft contract. * * @param nftContract The nft contract. */ function getTokenGatedAllowedTokens(address nftContract) external view returns (address[] memory) { return _enumeratedTokenGatedTokens[nftContract]; } /** * @notice Returns the token gated drop data for the nft contract * and token gated nft. * * @param nftContract The nft contract. * @param allowedNftToken The token gated nft token. */ function getTokenGatedDrop(address nftContract, address allowedNftToken) external view returns (TokenGatedDropStage memory) { return _tokenGatedDrops[nftContract][allowedNftToken]; } /** * @notice Returns whether the token id for a token gated drop has been * redeemed. * * @param nftContract The nft contract. * @param allowedNftToken The token gated nft token. * @param allowedNftTokenId The token gated nft token id to check. */ function getAllowedNftTokenIdIsRedeemed( address nftContract, address allowedNftToken, uint256 allowedNftTokenId ) external view returns (bool) { return _tokenGatedRedeemed[nftContract][allowedNftToken][ allowedNftTokenId ]; } /** * @notice Emits an event to notify update of the drop URI. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param dropURI The new drop URI. */ function updateDropURI(string calldata dropURI) external onlyINonFungibleSeaDropToken { // Emit an event with the update. emit DropURIUpdated(msg.sender, dropURI); } /** * @notice Updates the public drop data for the nft contract * and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param publicDrop The public drop data. */ function updatePublicDrop(PublicDrop calldata publicDrop) external override onlyINonFungibleSeaDropToken { // Revert if the fee basis points is greater than 10_000. if (publicDrop.feeBps > 10_000) { revert InvalidFeeBps(publicDrop.feeBps); } // Set the public drop data. _publicDrops[msg.sender] = publicDrop; // Emit an event with the update. emit PublicDropUpdated(msg.sender, publicDrop); } /** * @notice Updates the allow list merkle root for the nft contract * and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param allowListData The allow list data. */ function updateAllowList(AllowListData calldata allowListData) external override onlyINonFungibleSeaDropToken { // Track the previous root. bytes32 prevRoot = _allowListMerkleRoots[msg.sender]; // Update the merkle root. _allowListMerkleRoots[msg.sender] = allowListData.merkleRoot; // Emit an event with the update. emit AllowListUpdated( msg.sender, prevRoot, allowListData.merkleRoot, allowListData.publicKeyURIs, allowListData.allowListURI ); } /** * @notice Updates the token gated drop stage for the nft contract * and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * Note: If two INonFungibleSeaDropToken tokens are doing * simultaneous token gated drop promotions for each other, * they can be minted by the same actor until * `maxTokenSupplyForStage` is reached. Please ensure the * `allowedNftToken` is not running an active drop during * the `dropStage` time period. * * @param allowedNftToken The token gated nft token. * @param dropStage The token gated drop stage data. */ function updateTokenGatedDrop( address allowedNftToken, TokenGatedDropStage calldata dropStage ) external override onlyINonFungibleSeaDropToken { // Ensure the allowedNftToken is not the zero address. if (allowedNftToken == address(0)) { revert TokenGatedDropAllowedNftTokenCannotBeZeroAddress(); } // Ensure the allowedNftToken cannot be the drop token itself. if (allowedNftToken == msg.sender) { revert TokenGatedDropAllowedNftTokenCannotBeDropToken(); } // Revert if the fee basis points is greater than 10_000. if (dropStage.feeBps > 10_000) { revert InvalidFeeBps(dropStage.feeBps); } // Use maxTotalMintableByWallet != 0 as a signal that this update should // add or update the drop stage, otherwise we will be removing. bool addOrUpdateDropStage = dropStage.maxTotalMintableByWallet != 0; // Get pointers to the token gated drop data and enumerated addresses. TokenGatedDropStage storage existingDropStageData = _tokenGatedDrops[ msg.sender ][allowedNftToken]; address[] storage enumeratedTokens = _enumeratedTokenGatedTokens[ msg.sender ]; // Stage struct packs to a single slot, so load it // as a uint256; if it is 0, it is empty. bool dropStageDoesNotExist; assembly { dropStageDoesNotExist := iszero(sload(existingDropStageData.slot)) } if (addOrUpdateDropStage) { _tokenGatedDrops[msg.sender][allowedNftToken] = dropStage; // Add to enumeration if it does not exist already. if (dropStageDoesNotExist) { enumeratedTokens.push(allowedNftToken); } } else { // Check we are not deleting a drop stage that does not exist. if (dropStageDoesNotExist) { revert TokenGatedDropStageNotPresent(); } // Clear storage slot and remove from enumeration. delete _tokenGatedDrops[msg.sender][allowedNftToken]; _removeFromEnumeration(allowedNftToken, enumeratedTokens); } // Emit an event with the update. emit TokenGatedDropStageUpdated(msg.sender, allowedNftToken, dropStage); } /** * @notice Updates the creator payout address and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param payoutAddress The creator payout address. */ function updateCreatorPayoutAddress(address payoutAddress) external onlyINonFungibleSeaDropToken { if (payoutAddress == address(0)) { revert CreatorPayoutAddressCannotBeZeroAddress(); } // Set the creator payout address. _creatorPayoutAddresses[msg.sender] = payoutAddress; // Emit an event with the update. emit CreatorPayoutAddressUpdated(msg.sender, payoutAddress); } /** * @notice Updates the allowed fee recipient and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param feeRecipient The fee recipient. * @param allowed If the fee recipient is allowed. */ function updateAllowedFeeRecipient(address feeRecipient, bool allowed) external onlyINonFungibleSeaDropToken { if (feeRecipient == address(0)) { revert FeeRecipientCannotBeZeroAddress(); } // Track the enumerated storage. address[] storage enumeratedStorage = _enumeratedFeeRecipients[ msg.sender ]; mapping(address => bool) storage feeRecipientsMap = _allowedFeeRecipients[msg.sender]; if (allowed) { if (feeRecipientsMap[feeRecipient]) { revert DuplicateFeeRecipient(); } feeRecipientsMap[feeRecipient] = true; enumeratedStorage.push(feeRecipient); } else { if (!feeRecipientsMap[feeRecipient]) { revert FeeRecipientNotPresent(); } delete _allowedFeeRecipients[msg.sender][feeRecipient]; _removeFromEnumeration(feeRecipient, enumeratedStorage); } // Emit an event with the update. emit AllowedFeeRecipientUpdated(msg.sender, feeRecipient, allowed); } /** * @notice Updates the allowed server-side signers and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param signer The signer to update. * @param signedMintValidationParams Minimum and maximum parameters * to enforce for signed mints. */ function updateSignedMintValidationParams( address signer, SignedMintValidationParams calldata signedMintValidationParams ) external onlyINonFungibleSeaDropToken { if (signer == address(0)) { revert SignerCannotBeZeroAddress(); } if (signedMintValidationParams.minFeeBps > 10_000) { revert InvalidFeeBps(signedMintValidationParams.minFeeBps); } if (signedMintValidationParams.maxFeeBps > 10_000) { revert InvalidFeeBps(signedMintValidationParams.maxFeeBps); } // Track the enumerated storage. address[] storage enumeratedStorage = _enumeratedSigners[msg.sender]; mapping(address => SignedMintValidationParams) storage signedMintValidationParamsMap = _signedMintValidationParams[ msg.sender ]; SignedMintValidationParams storage existingSignedMintValidationParams = signedMintValidationParamsMap[ signer ]; bool signedMintValidationParamsDoNotExist; assembly { signedMintValidationParamsDoNotExist := iszero( sload(existingSignedMintValidationParams.slot) ) } // Use maxMaxTotalMintableByWallet as sentry for add/update or delete. bool addOrUpdate = signedMintValidationParams .maxMaxTotalMintableByWallet > 0; if (addOrUpdate) { signedMintValidationParamsMap[signer] = signedMintValidationParams; if (signedMintValidationParamsDoNotExist) { enumeratedStorage.push(signer); } } else { if ( existingSignedMintValidationParams .maxMaxTotalMintableByWallet == 0 ) { revert SignerNotPresent(); } delete _signedMintValidationParams[msg.sender][signer]; _removeFromEnumeration(signer, enumeratedStorage); } // Emit an event with the update. emit SignedMintValidationParamsUpdated( msg.sender, signer, signedMintValidationParams ); } /** * @notice Updates the allowed payer and emits an event. * * This method assume msg.sender is an nft contract and its * ERC165 interface id matches INonFungibleSeaDropToken. * * Note: Be sure only authorized users can call this from * token contracts that implement INonFungibleSeaDropToken. * * @param payer The payer to add or remove. * @param allowed Whether to add or remove the payer. */ function updatePayer(address payer, bool allowed) external onlyINonFungibleSeaDropToken { if (payer == address(0)) { revert PayerCannotBeZeroAddress(); } // Track the enumerated storage. address[] storage enumeratedStorage = _enumeratedPayers[msg.sender]; mapping(address => bool) storage payersMap = _allowedPayers[msg.sender]; if (allowed) { if (payersMap[payer]) { revert DuplicatePayer(); } payersMap[payer] = true; enumeratedStorage.push(payer); } else { if (!payersMap[payer]) { revert PayerNotPresent(); } delete _allowedPayers[msg.sender][payer]; _removeFromEnumeration(payer, enumeratedStorage); } // Emit an event with the update. emit PayerUpdated(msg.sender, payer, allowed); } /** * @notice Remove an address from a supplied enumeration. * * @param toRemove The address to remove. * @param enumeration The enumerated addresses to parse. */ function _removeFromEnumeration( address toRemove, address[] storage enumeration ) internal { // Cache the length. uint256 enumerationLength = enumeration.length; for (uint256 i = 0; i < enumerationLength; ) { // Check if the enumerated element is the one we are deleting. if (enumeration[i] == toRemove) { // Swap with the last element. enumeration[i] = enumeration[enumerationLength - 1]; // Delete the (now duplicated) last element. enumeration.pop(); // Exit the loop. break; } unchecked { ++i; } } } /** * @notice Verify an EIP-712 signature by recreating the data structure * that we signed on the client side, and then using that to recover * the address that signed the signature for this data. * * @param nftContract The nft contract. * @param minter The mint recipient. * @param feeRecipient The fee recipient. * @param mintParams The mint params. * @param salt The salt for the signed mint. */ function _getDigest( address nftContract, address minter, address feeRecipient, MintParams memory mintParams, uint256 salt ) internal view returns (bytes32 digest) { bytes32 mintParamsHashStruct = keccak256( abi.encode( _MINT_PARAMS_TYPEHASH, mintParams.mintPrice, mintParams.maxTotalMintableByWallet, mintParams.startTime, mintParams.endTime, mintParams.dropStageIndex, mintParams.maxTokenSupplyForStage, mintParams.feeBps, mintParams.restrictFeeRecipients ) ); digest = keccak256( bytes.concat( bytes2(0x1901), _domainSeparator(), keccak256( abi.encode( _SIGNED_MINT_TYPEHASH, nftContract, minter, feeRecipient, mintParamsHashStruct, salt ) ) ) ); } /** * @dev Internal pure function to cast a `bool` value to a `uint256` value. * * @param b The `bool` value to cast. * * @return u The `uint256` value. */ function _cast(bool b) internal pure returns (uint256 u) { assembly { u := b } } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; import {ERC20} from "../tokens/ERC20.sol"; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer. /// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller. library SafeTransferLib { /*////////////////////////////////////////////////////////////// ETH OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferETH(address to, uint256 amount) internal { bool success; assembly { // Transfer the ETH and store if it succeeded or not. success := call(gas(), to, amount, 0, 0, 0, 0) } require(success, "ETH_TRANSFER_FAILED"); } /*////////////////////////////////////////////////////////////// ERC20 OPERATIONS //////////////////////////////////////////////////////////////*/ function safeTransferFrom( ERC20 token, address from, address to, uint256 amount ) internal { bool success; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument. mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 100, 0, 32) ) } require(success, "TRANSFER_FROM_FAILED"); } function safeTransfer( ERC20 token, address to, uint256 amount ) internal { bool success; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "TRANSFER_FAILED"); } function safeApprove( ERC20 token, address to, uint256 amount ) internal { bool success; assembly { // Get a pointer to some free memory. let freeMemoryPointer := mload(0x40) // Write the abi-encoded calldata into memory, beginning with the function selector. mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000) mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument. mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. success := and( // Set success to whether the call reverted, if not we check it either // returned exactly 1 (can't just be non-zero data), or had no return data. or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())), // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2. // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space. // Counterintuitively, this call must be positioned second to the or() call in the // surrounding and() call or else returndatasize() will be zero during the computation. call(gas(), token, 0, freeMemoryPointer, 68, 0, 32) ) } require(success, "APPROVE_FAILED"); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`, * consuming from one or the other at each step according to the instructions given by * `proofFlags`. * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof} * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { address recoveredAddress = ecrecover( keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256( abi.encode( keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ), owner, spender, value, nonces[owner]++, deadline ) ) ) ), v, r, s ); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { SeaDrop } from "../SeaDrop.sol"; contract MaliciousRecipient { bool public startAttack; address public token; SeaDrop public seaDrop; receive() external payable { if (startAttack) { startAttack = false; seaDrop.mintPublic{ value: 1 ether }({ nftContract: token, feeRecipient: address(this), minterIfNotPayer: address(this), quantity: 1 }); } } // Also receive some eth in the process function setStartAttack() public payable { startAttack = true; } function attack(SeaDrop _seaDrop, address _token) external payable { token = _token; seaDrop = _seaDrop; _seaDrop.mintPublic{ value: 1 ether }({ nftContract: _token, feeRecipient: address(this), minterIfNotPayer: address(this), quantity: 1 }); token = address(0); seaDrop = SeaDrop(address(0)); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; /** * @dev HardHat doesn't support multiple source folders; so import everything * extra that hardhat tests rely on so they get compiled. Allows for faster * feedback than running an extra yarn build. */ import { TestERC721 } from "../test/TestERC721.sol"; import { MaliciousRecipient } from "../test/MaliciousRecipient.sol";
// SPDX-License-Identifier: Unlicense pragma solidity 0.8.17; import { ERC721 } from "lib/solmate/src/tokens/ERC721.sol"; // Used for minting test ERC721s in our tests contract TestERC721 is ERC721("Test721", "TST721") { function mint(address to, uint256 tokenId) public returns (bool) { _mint(to, tokenId); return true; } function tokenURI(uint256) public pure override returns (string memory) { return "tokenURI"; } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Modern, minimalist, and gas efficient ERC-721 implementation. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol) abstract contract ERC721 { /*////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 indexed id); event Approval(address indexed owner, address indexed spender, uint256 indexed id); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /*////////////////////////////////////////////////////////////// METADATA STORAGE/LOGIC //////////////////////////////////////////////////////////////*/ string public name; string public symbol; function tokenURI(uint256 id) public view virtual returns (string memory); /*////////////////////////////////////////////////////////////// ERC721 BALANCE/OWNER STORAGE //////////////////////////////////////////////////////////////*/ mapping(uint256 => address) internal _ownerOf; mapping(address => uint256) internal _balanceOf; function ownerOf(uint256 id) public view virtual returns (address owner) { require((owner = _ownerOf[id]) != address(0), "NOT_MINTED"); } function balanceOf(address owner) public view virtual returns (uint256) { require(owner != address(0), "ZERO_ADDRESS"); return _balanceOf[owner]; } /*////////////////////////////////////////////////////////////// ERC721 APPROVAL STORAGE //////////////////////////////////////////////////////////////*/ mapping(uint256 => address) public getApproved; mapping(address => mapping(address => bool)) public isApprovedForAll; /*////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor(string memory _name, string memory _symbol) { name = _name; symbol = _symbol; } /*////////////////////////////////////////////////////////////// ERC721 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 id) public virtual { address owner = _ownerOf[id]; require(msg.sender == owner || isApprovedForAll[owner][msg.sender], "NOT_AUTHORIZED"); getApproved[id] = spender; emit Approval(owner, spender, id); } function setApprovalForAll(address operator, bool approved) public virtual { isApprovedForAll[msg.sender][operator] = approved; emit ApprovalForAll(msg.sender, operator, approved); } function transferFrom( address from, address to, uint256 id ) public virtual { require(from == _ownerOf[id], "WRONG_FROM"); require(to != address(0), "INVALID_RECIPIENT"); require( msg.sender == from || isApprovedForAll[from][msg.sender] || msg.sender == getApproved[id], "NOT_AUTHORIZED" ); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. unchecked { _balanceOf[from]--; _balanceOf[to]++; } _ownerOf[id] = to; delete getApproved[id]; emit Transfer(from, to, id); } function safeTransferFrom( address from, address to, uint256 id ) public virtual { transferFrom(from, to, id); require( to.code.length == 0 || ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, "") == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT" ); } function safeTransferFrom( address from, address to, uint256 id, bytes calldata data ) public virtual { transferFrom(from, to, id); require( to.code.length == 0 || ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, data) == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT" ); } /*////////////////////////////////////////////////////////////// ERC165 LOGIC //////////////////////////////////////////////////////////////*/ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165 interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721 interfaceId == 0x5b5e139f; // ERC165 Interface ID for ERC721Metadata } /*////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 id) internal virtual { require(to != address(0), "INVALID_RECIPIENT"); require(_ownerOf[id] == address(0), "ALREADY_MINTED"); // Counter overflow is incredibly unrealistic. unchecked { _balanceOf[to]++; } _ownerOf[id] = to; emit Transfer(address(0), to, id); } function _burn(uint256 id) internal virtual { address owner = _ownerOf[id]; require(owner != address(0), "NOT_MINTED"); // Ownership check above ensures no underflow. unchecked { _balanceOf[owner]--; } delete _ownerOf[id]; delete getApproved[id]; emit Transfer(owner, address(0), id); } /*////////////////////////////////////////////////////////////// INTERNAL SAFE MINT LOGIC //////////////////////////////////////////////////////////////*/ function _safeMint(address to, uint256 id) internal virtual { _mint(to, id); require( to.code.length == 0 || ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, "") == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT" ); } function _safeMint( address to, uint256 id, bytes memory data ) internal virtual { _mint(to, id); require( to.code.length == 0 || ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, data) == ERC721TokenReceiver.onERC721Received.selector, "UNSAFE_RECIPIENT" ); } } /// @notice A generic interface for a contract which properly accepts ERC721 tokens. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol) abstract contract ERC721TokenReceiver { function onERC721Received( address, address, uint256, bytes calldata ) external virtual returns (bytes4) { return ERC721TokenReceiver.onERC721Received.selector; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { ERC721SeaDrop } from "../ERC721SeaDrop.sol"; /** * @title ERC721SeaDropRandomOffset * @author James Wenzel (emo.eth) * @author Ryan Ghods (ralxz.eth) * @author Stephan Min (stephanm.eth) * @author Michael Cohen (notmichael.eth) * @notice ERC721SeaDropRandomOffset is a token contract that extends * ERC721SeaDrop to apply a randomOffset to the tokenURI, * to enable fair metadata reveals. */ contract ERC721SeaDropRandomOffset is ERC721SeaDrop { /// @notice The random offset, between 1 and the MAX_SUPPLY at the time of /// being set. uint256 public randomOffset; /// @notice If the collection has been revealed and the randomOffset has /// been set. 1=False, 2=True. uint256 public revealed = _REVEALED_FALSE; /// @dev For gas efficiency, uint is used instead of bool for revealed. uint256 private constant _REVEALED_FALSE = 1; uint256 private constant _REVEALED_TRUE = 2; /// @notice Revert when setting the randomOffset if already set. error AlreadyRevealed(); /// @notice Revert when setting the randomOffset if the collection is /// not yet fully minted. error NotFullyMinted(); /** * @notice Deploy the token contract with its name, symbol, * and allowed SeaDrop addresses. */ constructor( string memory name, string memory symbol, address[] memory allowedSeaDrop ) ERC721SeaDrop(name, symbol, allowedSeaDrop) {} /** * @notice Set the random offset, for a fair metadata reveal. Only callable * by the owner one time when the total number of minted tokens * equals the max supply. Should be called immediately before * reveal. */ // solhint-disable-next-line comprehensive-interface function setRandomOffset() external onlyOwner { // Revert setting the offset if already revealed. if (revealed == _REVEALED_TRUE) { revert AlreadyRevealed(); } // Put maxSupply on the stack, since reading a state variable // costs more gas than reading a local variable. uint256 maxSupply = _maxSupply; // Revert if the collection is not yet fully minted. if (_totalMinted() != maxSupply) { revert NotFullyMinted(); } // block.difficulty returns PREVRANDAO on Ethereum post-merge // NOTE: do not use this on other chains // randomOffset returns between 1 and MAX_SUPPLY randomOffset = (uint256(keccak256(abi.encode(block.difficulty))) % (maxSupply - 1)) + 1; // Set revealed to true. revealed = _REVEALED_TRUE; } /** * @notice The token URI, offset by randomOffset, to enable fair metadata * reveals. * * @param tokenId The token id */ function tokenURI(uint256 tokenId) public view override returns (string memory) { if (!_exists(tokenId)) { revert URIQueryForNonexistentToken(); } string memory base = _baseURI(); if (bytes(base).length == 0) { // If there is no baseURI set, return an empty string. return ""; } else if (revealed == _REVEALED_FALSE) { // If the baseURI is set but the collection is not revealed yet, // return just the baseURI. return base; } else { // If the baseURI is set and the collection is revealed, // return the tokenURI offset by the randomOffset. return string.concat( base, _toString( ((tokenId + randomOffset) % _maxSupply) + _startTokenId() ) ); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { ERC721SeaDrop } from "../ERC721SeaDrop.sol"; /** * @title ERC721SeaDropBurnable * @author James Wenzel (emo.eth) * @author Ryan Ghods (ralxz.eth) * @author Stephan Min (stephanm.eth) * @author Michael Cohen (notmichael.eth) * @notice ERC721SeaDropBurnable is a token contract that extends * ERC721SeaDrop to additionally provide a burn function. */ contract ERC721SeaDropBurnable is ERC721SeaDrop { /** * @notice Deploy the token contract with its name, symbol, * and allowed SeaDrop addresses. */ constructor( string memory name, string memory symbol, address[] memory allowedSeaDrop ) ERC721SeaDrop(name, symbol, allowedSeaDrop) {} /** * @notice Burns `tokenId`. The caller must own `tokenId` or be an * approved operator. * * @param tokenId The token id to burn. */ // solhint-disable-next-line comprehensive-interface function burn(uint256 tokenId) external { _burn(tokenId, true); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import "./ERC721SeaDrop.sol"; import { IERC721 } from "lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol"; import { IERC2981 } from "lib/openzeppelin-contracts/contracts/interfaces/IERC2981.sol"; import { MerkleProof } from "./lib/MerkleProof.sol"; interface IERC5639 { /** * @notice Returns true if the address is delegated to act on the entire vault * @param delegate The hotwallet to act on your behalf * @param vault The cold wallet who issued the delegation */ function checkDelegateForAll(address delegate, address vault) external view returns (bool); } contract TestingContract is ERC721SeaDrop { // ============================================================= // CONSTANTS // ============================================================= // The Genesis NFT Collection smart contract address address private constant _GENESIS_COLLECTION_ADDRESS = 0x748Dc6d68512d444dd9346A99f5f72f4788672F4; // The CandyRepublic address address private constant _CANDY = 0xa0e091347827eC3fFC0E85389b8f0014E2895f15; // The CandyRepublic secondary address address private constant _CANDY_2 = 0x4C90a5584aBfe69462b6Dec304A78a59FE18b2b4; // The Delegeate cash address address private constant _DELEGATE_CASH_ADDRESS = 0x00000000000076A84feF008CDAbe6409d2FE638B; // The OpenSea Registry smart contract address address private constant _PROXY_REGISTRY_ADDRESS = 0xa5409ec958C83C3f309868babACA7c86DCB077c1; // NFT total supply uint256 private constant _TOTAL_SUPPLY = 6250; // NFT sale window uint256 private constant _MINT_START = 1677099600; // Genesis + Derivative = OG_WINDOW uint256 private constant _OG_WINDOW_START = _MINT_START; uint256 private constant _OG_WINDOW_END = _OG_WINDOW_START + 45 minutes; // Prospects + Whitelist A = WHITELIST_WINDOW uint256 private constant _WHITELIST_WINDOW_START = _MINT_START + 15 minutes; uint256 private constant _WHITELIST_WINDOW_END = _WHITELIST_WINDOW_START + 30 minutes; // Whitelist B = FINAL_WINDOW uint256 private constant _FINAL_WINDOW_START = _WHITELIST_WINDOW_END; uint256 private constant _FINAL_WINDOW_END = _FINAL_WINDOW_START + 30 minutes; // Public mint uint256 private constant _PUBLIC_WINDOW_START = _FINAL_WINDOW_END; uint256 private constant _PUBLIC_WINDOW_END = _PUBLIC_WINDOW_START + 30 minutes; // The maxmimum mint/wallet uint256 private constant _MINT_PRICE = 0.0008 ether; uint256 private constant _MINT_PRICE_PROSPECT = 0.0007 ether; uint256 private constant _MINT_CAP = 20; uint256 private constant _DERIVATIVES_FREE_MINT_CAP = 1; uint256 private constant _PUBLIC_MINT_CAP = 1; uint256 private constant _GENESIS_BITMAP_LENGTH = 2; // ============================================================= // STORAGE // ============================================================= // The merkle tree root hash for the genesis addresses. bytes32 private _DERIVATIVES_WHITELIST_ROOT = 0x126095171d42ac1451766cfb60a5782db96c342ec125d1ddf9daaeeedfe0e090; // The merkle tree root hash for the prospects addresses. bytes32 private _WHITELIST_PROSPECT_ROOT = 0xc488b8656c7c3ee37169e932772c4b8660d18a09978030f7ffb9d1f52f31104c; // The merkle tree root hash for the whitelistA addresses. bytes32 private _WHITELIST_A_ROOT = 0xeb8bdf29ae8d9db4818f61e1e161a495743c573b0e20118d334a17751970422e; // The merkle tree root hash for the whitelistB addresses. bytes32 private _WHITELIST_B_ROOT = 0x2f4d7943c3b12b3eeda0428749a522d8e2fa153f54c4ce1971b20f45c46855a4; // Bitmap representing used genesis token ids uint256 private GenesisBitmap = 0; bool private didReserve = false; // Burning Mechanism bool public burnEnabled = false; uint256[5] public unburnable; // For public mint mapping(address => bool) public didMintPublic; constructor( string memory name_, string memory symbol_, string memory baseURI_, address[] memory seaDropAllowlist ) ERC721SeaDrop(name_, symbol_, seaDropAllowlist) { _tokenBaseURI = baseURI_; } function reserveTeam() external onlyOwner { // Ensure the sender can call it once. require(!didReserve); didReserve = true; _mint(_CANDY, 250); } function configureWhitelists( bytes32 derivatives, bytes32 prospects, bytes32 whitelistA, bytes32 whitelistB ) external onlyOwner { _DERIVATIVES_WHITELIST_ROOT = derivatives; _WHITELIST_PROSPECT_ROOT = prospects; _WHITELIST_A_ROOT = whitelistA; _WHITELIST_B_ROOT = whitelistB; } function isWhitelist( bytes32[] calldata proof, bytes32 leaf, bytes32 root ) internal pure returns (bool) { return MerkleProof.verifyCalldata(proof, root, leaf); } function inOGPeriod() internal view returns (bool) { return block.timestamp >= _OG_WINDOW_START && block.timestamp <= _OG_WINDOW_END; } function inWhitelistPeriod() internal view returns (bool) { return block.timestamp >= _WHITELIST_WINDOW_START && block.timestamp <= _WHITELIST_WINDOW_END; } function inFinalPeriod() internal view returns (bool) { return block.timestamp >= _FINAL_WINDOW_START && block.timestamp <= _FINAL_WINDOW_END; } function inPublicPeriod() internal view returns (bool) { return block.timestamp >= _PUBLIC_WINDOW_START && block.timestamp <= _PUBLIC_WINDOW_END; } function getGenesisBitmap() external view returns (uint256) { return GenesisBitmap; } function getPrice( address wallet, uint256 mintType, uint256 quantity ) public view returns (uint256) { // 1: Derivatives if (mintType == 1) { uint256 numberMinted = _numberMinted(wallet); if (quantity == 2 || numberMinted == 1) { return _MINT_PRICE; } return 0; } // 2: Prospects if (mintType == 2) { return quantity * _MINT_PRICE_PROSPECT; } // Other: WhitelistA/B return quantity * _MINT_PRICE; } function genesisMint(uint256[] calldata genesisTokenID, address vault) external { require(tx.origin == msg.sender, "Caller is Smart Contract"); require(inOGPeriod(), "Not in mint window!"); uint256[] memory genesisTokenIDMemory = genesisTokenID; uint256 genesisLength = genesisTokenIDMemory.length; uint256 currentSupply = totalSupply(); require( (2 * genesisLength) + currentSupply <= _TOTAL_SUPPLY, "Exceeding Limit!" ); uint256 mintQuantity; uint256 mintedFromThatNFT; uint256 finalOring; uint256 memoryGenesis = GenesisBitmap; uint256 shifting; IERC721 GenesisSmartContract = IERC721(_GENESIS_COLLECTION_ADDRESS); address requester = msg.sender; if (vault != address(0)) { IERC5639 DelegateRegistry = IERC5639(_DELEGATE_CASH_ADDRESS); require( DelegateRegistry.checkDelegateForAll(msg.sender, vault), "Not delegate!" ); requester = vault; } for (uint256 index; index < genesisLength; ) { require( GenesisSmartContract.ownerOf(genesisTokenIDMemory[index]) == requester, "Not owner of tokenID!" ); shifting = 2 * (genesisTokenIDMemory[index] - 1); mintedFromThatNFT = (memoryGenesis & (3 << shifting)) >> shifting; if (mintedFromThatNFT == 0) { mintQuantity += _GENESIS_BITMAP_LENGTH; finalOring = finalOring ^ (3 << shifting); } unchecked { ++index; } } require(mintQuantity > 0, "Can't mint anymore!"); // Set genesis bitmap GenesisBitmap = (memoryGenesis ^ finalOring); _mint(msg.sender, mintQuantity); } function derivativeMint( bytes32[] calldata derivativeProof, uint256 quantity ) external payable { require(tx.origin == msg.sender, "Caller is Smart Contract"); // Check for correct window period require(inWhitelistPeriod(), "Not in mint window!"); // Check total supply uint256 currentSupply = totalSupply(); require( currentSupply + quantity <= _TOTAL_SUPPLY, "Exceeding 6250 NFTs!" ); // Check mint cap uint256 numberMinted = _numberMinted(msg.sender); require( numberMinted + quantity <= _MINT_CAP, "Can't mint more than 2!" ); // Check if whitelisted require( isWhitelist( derivativeProof, keccak256(abi.encodePacked(msg.sender)), _DERIVATIVES_WHITELIST_ROOT ), "Not whitelisted!" ); // Check if paid the correct ammount of ETH require( msg.value == getPrice(msg.sender, 1, quantity), "Incorrect payment value!" ); _mint(msg.sender, quantity); } function whitelistProspectMint( bytes32[] calldata whitelistProof, uint256 quantity ) external payable { require(tx.origin == msg.sender, "Caller is Smart Contract"); // Check for correct window period require(inWhitelistPeriod(), "Not in mint window!"); // Check total supply uint256 currentSupply = totalSupply(); require( currentSupply + quantity <= _TOTAL_SUPPLY, "Exceeding 6250 NFTs!" ); // Check mint cap uint256 numberMinted = _numberMinted(msg.sender); require( numberMinted + quantity <= _MINT_CAP, "Can't mint more than 2!" ); // Check if whitelisted require( isWhitelist( whitelistProof, keccak256(abi.encodePacked(msg.sender)), _WHITELIST_PROSPECT_ROOT ), "Not whitelisted!" ); // Check if paid the correct ammount of ETH require( msg.value == getPrice(msg.sender, 2, quantity), "Incorrect Payment Value!" ); _mint(msg.sender, quantity); } function whitelistAMint(bytes32[] calldata whitelistProof, uint256 quantity) external payable { require(tx.origin == msg.sender, "Caller is Smart Contract"); // Check for correct window period require(inWhitelistPeriod(), "Not in mint window!"); // Check total supply uint256 currentSupply = totalSupply(); require( currentSupply + quantity <= _TOTAL_SUPPLY, "Exceeding 6250 NFTs!" ); // Check mint cap uint256 numberMinted = _numberMinted(msg.sender); require( numberMinted + quantity <= _MINT_CAP, "Can't mint more than 2!" ); // Check if whitelisted require( isWhitelist( whitelistProof, keccak256(abi.encodePacked(msg.sender)), _WHITELIST_A_ROOT ), "Not whitelisted!" ); // Check if paid the correct ammount of ETH require( msg.value == getPrice(msg.sender, 3, quantity), "Incorrect Payment Value!" ); _mint(msg.sender, quantity); } function whitelistBMint(bytes32[] calldata whitelistProof, uint256 quantity) external payable { require(tx.origin == msg.sender, "Caller is Smart Contract"); // Check for correct window period require(inFinalPeriod(), "Not in mint window!"); // Check total supply uint256 currentSupply = totalSupply(); require( currentSupply + quantity <= _TOTAL_SUPPLY, "Exceeding 6250 NFTs!" ); // Check mint cap uint256 numberMinted = _numberMinted(msg.sender); require( numberMinted + quantity <= _MINT_CAP, "Can't mint more than 2!" ); // Check if whitelisted require( isWhitelist( whitelistProof, keccak256(abi.encodePacked(msg.sender)), _WHITELIST_B_ROOT ), "Not whitelisted!" ); // Check if paid the correct ammount of ETH require( msg.value == getPrice(msg.sender, 3, quantity), "Incorrect Payment Value!" ); _mint(msg.sender, quantity); } function publicMint(uint256 quantity) external payable { require(tx.origin == msg.sender, "Caller is Smart Contract"); // Check for correct window period require(inPublicPeriod(), "Not in mint window!"); // Check total supply uint256 currentSupply = totalSupply(); require( currentSupply + quantity <= _TOTAL_SUPPLY, "Exceeding 6250 NFTs!" ); require(quantity == _PUBLIC_MINT_CAP, "Can't mint more than 1!"); // Mint once! require(!didMintPublic[msg.sender], "Already minted public mint!"); // Check if paid the correct ammount of ETH require( msg.value == getPrice(msg.sender, 3, quantity), "Incorrect Payment Value!" ); didMintPublic[msg.sender] = true; _mint(msg.sender, quantity); } // Withdraw ETH Funds function withdrawETHFunds() external onlyOwner { (bool success, ) = _CANDY.call{ value: address(this).balance }(""); require(success, "Transfer failed."); } function getNumberMinted(address _address) external view returns (uint256) { return _numberMinted(_address); } function enableBurn(uint256[5] calldata unburnables) external onlyOwner { unburnable = unburnables; burnEnabled = true; } function burn(uint256 tokenID) external { require(burnEnabled, "Burn not enabled!"); for (uint256 i; i < 5; ) { require(tokenID != unburnable[i], "Can't burn!"); unchecked { ++i; } } _burn(tokenID, true); } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId), ".json")) : ""; } /** * @notice Called with the sale price to determine how much royalty * is owed and to whom. * * @ param _tokenId The NFT asset queried for royalty information. * @param _salePrice The sale price of the NFT asset specified by * _tokenId. * * @return receiver Address of who should be sent the royalty payment. * @return royaltyAmount The royalty payment amount for _salePrice. */ function royaltyInfo( uint256, /* _tokenId */ uint256 _salePrice ) external pure override(ERC721ContractMetadata, IERC2981) returns (address receiver, uint256 royaltyAmount) { // Set the royalty amount to the sale price times the royalty basis // points divided by 10_000. royaltyAmount = (_salePrice * 300) / 10_000; // Set the receiver of the royalty. receiver = _CANDY_2; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import {TwoStepOwnable} from "./TwoStepOwnable.sol"; contract TwoStepAdministered is TwoStepOwnable { event AdministratorUpdated( address indexed previousAdministrator, address indexed newAdministrator ); event PotentialAdministratorUpdated(address newPotentialAdministrator); error OnlyAdministrator(); error OnlyOwnerOrAdministrator(); error NotNextAdministrator(); error NewAdministratorIsZeroAddress(); address public administrator; address public potentialAdministrator; modifier onlyAdministrator() virtual { if (msg.sender != administrator) { revert OnlyAdministrator(); } _; } modifier onlyOwnerOrAdministrator() virtual { if (msg.sender != owner()) { if (msg.sender != administrator) { revert OnlyOwnerOrAdministrator(); } } _; } constructor(address _administrator) { _initialize(_administrator); } function _initialize(address _administrator) private onlyConstructor { administrator = _administrator; emit AdministratorUpdated(address(0), _administrator); } function transferAdministration(address newAdministrator) public virtual onlyAdministrator { if (newAdministrator == address(0)) { revert NewAdministratorIsZeroAddress(); } potentialAdministrator = newAdministrator; emit PotentialAdministratorUpdated(newAdministrator); } function _transferAdministration(address newAdministrator) internal virtual { administrator = newAdministrator; emit AdministratorUpdated(msg.sender, newAdministrator); } ///@notice Acept administration of smart contract, after the current administrator has initiated the process with transferAdministration function acceptAdministration() public virtual { address _potentialAdministrator = potentialAdministrator; if (msg.sender != _potentialAdministrator) { revert NotNextAdministrator(); } _transferAdministration(_potentialAdministrator); delete potentialAdministrator; } ///@notice cancel administration transfer function cancelAdministrationTransfer() public virtual onlyAdministrator { delete potentialAdministrator; emit PotentialAdministratorUpdated(address(0)); } function renounceAdministration() public virtual onlyAdministrator { delete administrator; emit AdministratorUpdated(msg.sender, address(0)); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { ERC721SeaDrop } from "./ERC721SeaDrop.sol"; import { ISeaDrop } from "./interfaces/ISeaDrop.sol"; import { AllowListData, PublicDrop, TokenGatedDropStage, SignedMintValidationParams } from "./lib/SeaDropStructs.sol"; import { TwoStepAdministered } from "lib/utility-contracts/src/TwoStepAdministered.sol"; /** * @title ERC721PartnerSeaDrop * @author James Wenzel (emo.eth) * @author Ryan Ghods (ralxz.eth) * @author Stephan Min (stephanm.eth) * @notice ERC721PartnerSeaDrop is a token contract that contains methods * to properly interact with SeaDrop, with additional administrative * functionality tailored for business requirements around partnered * mints with off-chain agreements in place between two parties. * * The "Owner" should control mint specifics such as price and start. * The "Administrator" should control fee parameters. * * Otherwise, for ease of administration, either Owner or Administrator * should be able to configure mint parameters. They have the ability * to override each other's actions in many circumstances, which is * why the establishment of off-chain trust is important. * * Note: An Administrator is not required to interface with SeaDrop. */ contract ERC721PartnerSeaDrop is ERC721SeaDrop, TwoStepAdministered { /// @notice To prevent Owner from overriding fees, Administrator must /// first initialize with fee. error AdministratorMustInitializeWithFee(); /** * @notice Deploy the token contract with its name, symbol, * administrator, and allowed SeaDrop addresses. */ constructor( string memory name, string memory symbol, address administrator, address[] memory allowedSeaDrop ) ERC721SeaDrop(name, symbol, allowedSeaDrop) TwoStepAdministered(administrator) {} /** * @notice Mint tokens, restricted to the SeaDrop contract. * * @param minter The address to mint to. * @param quantity The number of tokens to mint. */ function mintSeaDrop(address minter, uint256 quantity) external virtual override { // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(msg.sender); // Extra safety check to ensure the max supply is not exceeded. if (_totalMinted() + quantity > maxSupply()) { revert MintQuantityExceedsMaxSupply( _totalMinted() + quantity, maxSupply() ); } // Mint the quantity of tokens to the minter. _mint(minter, quantity); } /** * @notice Update the allowed SeaDrop contracts. * Only the owner or administrator can use this function. * * @param allowedSeaDrop The allowed SeaDrop addresses. */ function updateAllowedSeaDrop(address[] calldata allowedSeaDrop) external override onlyOwnerOrAdministrator { _updateAllowedSeaDrop(allowedSeaDrop); } /** * @notice Update the public drop data for this nft contract on SeaDrop. * Only the owner or administrator can use this function. * * The administrator can only update `feeBps`. * * @param seaDropImpl The allowed SeaDrop contract. * @param publicDrop The public drop data. */ function updatePublicDrop( address seaDropImpl, PublicDrop calldata publicDrop ) external virtual override onlyOwnerOrAdministrator { // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Track the previous public drop data. PublicDrop memory retrieved = ISeaDrop(seaDropImpl).getPublicDrop( address(this) ); // Track the newly supplied drop data. PublicDrop memory supplied = publicDrop; // Only the administrator (OpenSea) can set feeBps. if (msg.sender != administrator) { // Administrator must first set fee. if (retrieved.maxTotalMintableByWallet == 0) { revert AdministratorMustInitializeWithFee(); } supplied.feeBps = retrieved.feeBps; supplied.restrictFeeRecipients = true; } else { // Administrator can only initialize // (maxTotalMintableByWallet > 0) and set // feeBps/restrictFeeRecipients. uint16 maxTotalMintableByWallet = retrieved .maxTotalMintableByWallet; retrieved.maxTotalMintableByWallet = maxTotalMintableByWallet > 0 ? maxTotalMintableByWallet : 1; retrieved.feeBps = supplied.feeBps; retrieved.restrictFeeRecipients = true; supplied = retrieved; } // Update the public drop data on SeaDrop. ISeaDrop(seaDropImpl).updatePublicDrop(supplied); } /** * @notice Update the allow list data for this nft contract on SeaDrop. * Only the owner or administrator can use this function. * * @param seaDropImpl The allowed SeaDrop contract. * @param allowListData The allow list data. */ function updateAllowList( address seaDropImpl, AllowListData calldata allowListData ) external virtual override onlyOwnerOrAdministrator { // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Update the allow list on SeaDrop. ISeaDrop(seaDropImpl).updateAllowList(allowListData); } /** * @notice Update the token gated drop stage data for this nft contract * on SeaDrop. * Only the owner or administrator can use this function. * * The administrator must first set `feeBps`. * * Note: If two INonFungibleSeaDropToken tokens are doing * simultaneous token gated drop promotions for each other, * they can be minted by the same actor until * `maxTokenSupplyForStage` is reached. Please ensure the * `allowedNftToken` is not running an active drop during the * `dropStage` time period. * * @param seaDropImpl The allowed SeaDrop contract. * @param allowedNftToken The allowed nft token. * @param dropStage The token gated drop stage data. */ function updateTokenGatedDrop( address seaDropImpl, address allowedNftToken, TokenGatedDropStage calldata dropStage ) external virtual override onlyOwnerOrAdministrator { // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Track the previous drop stage data. TokenGatedDropStage memory retrieved = ISeaDrop(seaDropImpl) .getTokenGatedDrop(address(this), allowedNftToken); // Track the newly supplied drop data. TokenGatedDropStage memory supplied = dropStage; // Only the administrator (OpenSea) can set feeBps on Partner // contracts. if (msg.sender != administrator) { // Administrator must first set fee. if (retrieved.maxTotalMintableByWallet == 0) { revert AdministratorMustInitializeWithFee(); } supplied.feeBps = retrieved.feeBps; supplied.restrictFeeRecipients = true; } else { // Administrator can only initialize // (maxTotalMintableByWallet > 0) and set // feeBps/restrictFeeRecipients. uint16 maxTotalMintableByWallet = retrieved .maxTotalMintableByWallet; retrieved.maxTotalMintableByWallet = maxTotalMintableByWallet > 0 ? maxTotalMintableByWallet : 1; retrieved.feeBps = supplied.feeBps; retrieved.restrictFeeRecipients = true; supplied = retrieved; } // Update the token gated drop stage. ISeaDrop(seaDropImpl).updateTokenGatedDrop(allowedNftToken, supplied); } /** * @notice Update the drop URI for this nft contract on SeaDrop. * Only the owner or administrator can use this function. * * @param seaDropImpl The allowed SeaDrop contract. * @param dropURI The new drop URI. */ function updateDropURI(address seaDropImpl, string calldata dropURI) external virtual override onlyOwnerOrAdministrator { // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Update the drop URI. ISeaDrop(seaDropImpl).updateDropURI(dropURI); } /** * @notice Update the allowed fee recipient for this nft contract * on SeaDrop. * Only the administrator can set the allowed fee recipient. * * @param seaDropImpl The allowed SeaDrop contract. * @param feeRecipient The new fee recipient. * @param allowed If the fee recipient is allowed. */ function updateAllowedFeeRecipient( address seaDropImpl, address feeRecipient, bool allowed ) external override onlyAdministrator { // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Update the allowed fee recipient. ISeaDrop(seaDropImpl).updateAllowedFeeRecipient(feeRecipient, allowed); } /** * @notice Update the server-side signers for this nft contract * on SeaDrop. * Only the owner or administrator can use this function. * * @param seaDropImpl The allowed SeaDrop contract. * @param signer The signer to update. * @param signedMintValidationParams Minimum and maximum parameters to * enforce for signed mints. */ function updateSignedMintValidationParams( address seaDropImpl, address signer, SignedMintValidationParams memory signedMintValidationParams ) external virtual override onlyOwnerOrAdministrator { // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Track the previous signed mint validation params. SignedMintValidationParams memory retrieved = ISeaDrop(seaDropImpl) .getSignedMintValidationParams(address(this), signer); // Track the newly supplied params. SignedMintValidationParams memory supplied = signedMintValidationParams; // Only the administrator (OpenSea) can set feeBps on Partner // contracts. if (msg.sender != administrator) { // Administrator must first set fee. if (retrieved.maxMaxTotalMintableByWallet == 0) { revert AdministratorMustInitializeWithFee(); } supplied.minFeeBps = retrieved.minFeeBps; supplied.maxFeeBps = retrieved.maxFeeBps; } else { // Administrator can only initialize // (maxTotalMintableByWallet > 0) and set // feeBps/restrictFeeRecipients. uint24 maxMaxTotalMintableByWallet = retrieved .maxMaxTotalMintableByWallet; retrieved .maxMaxTotalMintableByWallet = maxMaxTotalMintableByWallet > 0 ? maxMaxTotalMintableByWallet : 1; retrieved.minFeeBps = supplied.minFeeBps; retrieved.maxFeeBps = supplied.maxFeeBps; supplied = retrieved; } // Update the signed mint validation params. ISeaDrop(seaDropImpl).updateSignedMintValidationParams( signer, supplied ); } /** * @notice Update the allowed payers for this nft contract on SeaDrop. * Only the owner or administrator can use this function. * * @param seaDropImpl The allowed SeaDrop contract. * @param payer The payer to update. * @param allowed Whether the payer is allowed. */ function updatePayer( address seaDropImpl, address payer, bool allowed ) external virtual override onlyOwnerOrAdministrator { // Ensure the SeaDrop is allowed. _onlyAllowedSeaDrop(seaDropImpl); // Update the payer. ISeaDrop(seaDropImpl).updatePayer(payer, allowed); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { ERC721PartnerSeaDrop } from "../ERC721PartnerSeaDrop.sol"; /** * @title ERC721PartnerSeaDropRandomOffset * @author James Wenzel (emo.eth) * @author Ryan Ghods (ralxz.eth) * @author Stephan Min (stephanm.eth) * @notice ERC721PartnerSeaDropRandomOffset is a token contract that extends * ERC721PartnerSeaDrop to apply a randomOffset to the tokenURI, * to enable fair metadata reveals. */ contract ERC721PartnerSeaDropRandomOffset is ERC721PartnerSeaDrop { /// @notice The random offset, between 1 and the MAX_SUPPLY at the time of /// being set. uint256 public randomOffset; /// @notice If the collection has been revealed and the randomOffset has /// been set. 1=False, 2=True. uint256 public revealed = _REVEALED_FALSE; /// @dev For gas efficiency, uint is used instead of bool for revealed. uint256 private constant _REVEALED_FALSE = 1; uint256 private constant _REVEALED_TRUE = 2; /// @notice Revert when setting the randomOffset if already set. error AlreadyRevealed(); /// @notice Revert when setting the randomOffset if the collection is /// not yet fully minted. error NotFullyMinted(); /** * @notice Deploy the token contract with its name, symbol, * administrator, and allowed SeaDrop addresses. */ constructor( string memory name, string memory symbol, address administrator, address[] memory allowedSeaDrop ) ERC721PartnerSeaDrop(name, symbol, administrator, allowedSeaDrop) {} /** * @notice Set the random offset, for a fair metadata reveal. Only callable * by the owner one time when the total number of minted tokens * equals the max supply. Should be called immediately before * reveal. */ // solhint-disable-next-line comprehensive-interface function setRandomOffset() external onlyOwner { // Revert setting the offset if already revealed. if (revealed == _REVEALED_TRUE) { revert AlreadyRevealed(); } // Put maxSupply on the stack, since reading a state variable // costs more gas than reading a local variable. uint256 maxSupply = _maxSupply; // Revert if the collection is not yet fully minted. if (_totalMinted() != maxSupply) { revert NotFullyMinted(); } // block.difficulty returns PREVRANDAO on Ethereum post-merge // NOTE: do not use this on other chains // randomOffset returns between 1 and MAX_SUPPLY randomOffset = (uint256(keccak256(abi.encode(block.difficulty))) % (maxSupply - 1)) + 1; // Set revealed to true. revealed = _REVEALED_TRUE; } /** * @notice The token URI, offset by randomOffset, to enable fair metadata * reveals. * * @param tokenId The token id */ function tokenURI(uint256 tokenId) public view override returns (string memory) { if (!_exists(tokenId)) { revert URIQueryForNonexistentToken(); } string memory base = _baseURI(); if (bytes(base).length == 0) { // If there is no baseURI set, return an empty string. return ""; } else if (revealed == _REVEALED_FALSE) { // If the baseURI is set but the collection is not revealed yet, // return just the baseURI. return base; } else { // If the baseURI is set and the collection is revealed, // return the tokenURI offset by the randomOffset. return string.concat( base, _toString( ((tokenId + randomOffset) % _maxSupply) + _startTokenId() ) ); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import { ERC721PartnerSeaDrop } from "../ERC721PartnerSeaDrop.sol"; /** * @title ERC721PartnerSeaDropBurnable * @author James Wenzel (emo.eth) * @author Ryan Ghods (ralxz.eth) * @author Stephan Min (stephanm.eth) * @notice ERC721PartnerSeaDropBurnable is a token contract that extends * ERC721PartnerSeaDrop to additionally provide a burn function. */ contract ERC721PartnerSeaDropBurnable is ERC721PartnerSeaDrop { /** * @notice Deploy the token contract with its name, symbol, * administrator, and allowed SeaDrop addresses. */ constructor( string memory name, string memory symbol, address administrator, address[] memory allowedSeaDrop ) ERC721PartnerSeaDrop(name, symbol, administrator, allowedSeaDrop) {} /** * @notice Burns `tokenId`. The caller must own `tokenId` or be an * approved operator. * * @param tokenId The token id to burn. */ // solhint-disable-next-line comprehensive-interface function burn(uint256 tokenId) external { _burn(tokenId, true); } }
{ "viaIR": false, "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"string","name":"baseURI_","type":"string"},{"internalType":"address[]","name":"seaDropAllowlist","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"newMaxSupply","type":"uint256"}],"name":"CannotExceedMaxSupplyOfUint64","type":"error"},{"inputs":[{"internalType":"uint256","name":"basisPoints","type":"uint256"}],"name":"InvalidRoyaltyBasisPoints","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"name":"MintQuantityExceedsMaxSupply","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NotNextOwner","type":"error"},{"inputs":[],"name":"OnlyAllowedSeaDrop","type":"error"},{"inputs":[],"name":"OnlyOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"ProvenanceHashCannotBeSetAfterMintStarted","type":"error"},{"inputs":[],"name":"RoyaltyAddressCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"SignersMismatch","type":"error"},{"inputs":[],"name":"TokenGatedMismatch","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"allowedSeaDrop","type":"address[]"}],"name":"AllowedSeaDropUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newContractURI","type":"string"}],"name":"ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMaxSupply","type":"uint256"}],"name":"MaxSupplyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newPotentialAdministrator","type":"address"}],"name":"PotentialOwnerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"previousHash","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"newHash","type":"bytes32"}],"name":"ProvenanceHashUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"bps","type":"uint256"}],"name":"RoyaltyInfoUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"SeaDropTokenDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burnEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"derivatives","type":"bytes32"},{"internalType":"bytes32","name":"prospects","type":"bytes32"},{"internalType":"bytes32","name":"whitelistA","type":"bytes32"},{"internalType":"bytes32","name":"whitelistB","type":"bytes32"}],"name":"configureWhitelists","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"derivativeProof","type":"bytes32[]"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"derivativeMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"didMintPublic","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"internalType":"uint256","name":"toTokenId","type":"uint256"}],"name":"emitBatchMetadataUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[5]","name":"unburnables","type":"uint256[5]"}],"name":"enableBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"genesisTokenID","type":"uint256[]"},{"internalType":"address","name":"vault","type":"address"}],"name":"genesisMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGenesisBitmap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"getMintStats","outputs":[{"internalType":"uint256","name":"minterNumMinted","type":"uint256"},{"internalType":"uint256","name":"currentTotalSupply","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getNumberMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"mintType","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mintSeaDrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"string","name":"contractURI","type":"string"},{"internalType":"address","name":"seaDropImpl","type":"address"},{"components":[{"internalType":"uint80","name":"mintPrice","type":"uint80"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint16","name":"maxTotalMintableByWallet","type":"uint16"},{"internalType":"uint16","name":"feeBps","type":"uint16"},{"internalType":"bool","name":"restrictFeeRecipients","type":"bool"}],"internalType":"struct PublicDrop","name":"publicDrop","type":"tuple"},{"internalType":"string","name":"dropURI","type":"string"},{"components":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"string[]","name":"publicKeyURIs","type":"string[]"},{"internalType":"string","name":"allowListURI","type":"string"}],"internalType":"struct AllowListData","name":"allowListData","type":"tuple"},{"internalType":"address","name":"creatorPayoutAddress","type":"address"},{"internalType":"bytes32","name":"provenanceHash","type":"bytes32"},{"internalType":"address[]","name":"allowedFeeRecipients","type":"address[]"},{"internalType":"address[]","name":"disallowedFeeRecipients","type":"address[]"},{"internalType":"address[]","name":"allowedPayers","type":"address[]"},{"internalType":"address[]","name":"disallowedPayers","type":"address[]"},{"internalType":"address[]","name":"tokenGatedAllowedNftTokens","type":"address[]"},{"components":[{"internalType":"uint80","name":"mintPrice","type":"uint80"},{"internalType":"uint16","name":"maxTotalMintableByWallet","type":"uint16"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint8","name":"dropStageIndex","type":"uint8"},{"internalType":"uint32","name":"maxTokenSupplyForStage","type":"uint32"},{"internalType":"uint16","name":"feeBps","type":"uint16"},{"internalType":"bool","name":"restrictFeeRecipients","type":"bool"}],"internalType":"struct TokenGatedDropStage[]","name":"tokenGatedDropStages","type":"tuple[]"},{"internalType":"address[]","name":"disallowedTokenGatedAllowedNftTokens","type":"address[]"},{"internalType":"address[]","name":"signers","type":"address[]"},{"components":[{"internalType":"uint80","name":"minMintPrice","type":"uint80"},{"internalType":"uint24","name":"maxMaxTotalMintableByWallet","type":"uint24"},{"internalType":"uint40","name":"minStartTime","type":"uint40"},{"internalType":"uint40","name":"maxEndTime","type":"uint40"},{"internalType":"uint40","name":"maxMaxTokenSupplyForStage","type":"uint40"},{"internalType":"uint16","name":"minFeeBps","type":"uint16"},{"internalType":"uint16","name":"maxFeeBps","type":"uint16"}],"internalType":"struct SignedMintValidationParams[]","name":"signedMintValidationParams","type":"tuple[]"},{"internalType":"address[]","name":"disallowedSigners","type":"address[]"}],"internalType":"struct ERC721SeaDropStructsErrorsAndEvents.MultiConfigureStruct","name":"config","type":"tuple"}],"name":"multiConfigure","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provenanceHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"publicMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserveTeam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"royaltyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyBasisPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newContractURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxSupply","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newProvenanceHash","type":"bytes32"}],"name":"setProvenanceHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"royaltyAddress","type":"address"},{"internalType":"uint96","name":"royaltyBps","type":"uint96"}],"internalType":"struct ISeaDropTokenContractMetadata.RoyaltyInfo","name":"newInfo","type":"tuple"}],"name":"setRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newPotentialOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"unburnable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"seaDropImpl","type":"address"},{"components":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"string[]","name":"publicKeyURIs","type":"string[]"},{"internalType":"string","name":"allowListURI","type":"string"}],"internalType":"struct AllowListData","name":"allowListData","type":"tuple"}],"name":"updateAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"seaDropImpl","type":"address"},{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"updateAllowedFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"allowedSeaDrop","type":"address[]"}],"name":"updateAllowedSeaDrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"seaDropImpl","type":"address"},{"internalType":"address","name":"payoutAddress","type":"address"}],"name":"updateCreatorPayoutAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"seaDropImpl","type":"address"},{"internalType":"string","name":"dropURI","type":"string"}],"name":"updateDropURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"seaDropImpl","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"updatePayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"seaDropImpl","type":"address"},{"components":[{"internalType":"uint80","name":"mintPrice","type":"uint80"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint16","name":"maxTotalMintableByWallet","type":"uint16"},{"internalType":"uint16","name":"feeBps","type":"uint16"},{"internalType":"bool","name":"restrictFeeRecipients","type":"bool"}],"internalType":"struct PublicDrop","name":"publicDrop","type":"tuple"}],"name":"updatePublicDrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"seaDropImpl","type":"address"},{"internalType":"address","name":"signer","type":"address"},{"components":[{"internalType":"uint80","name":"minMintPrice","type":"uint80"},{"internalType":"uint24","name":"maxMaxTotalMintableByWallet","type":"uint24"},{"internalType":"uint40","name":"minStartTime","type":"uint40"},{"internalType":"uint40","name":"maxEndTime","type":"uint40"},{"internalType":"uint40","name":"maxMaxTokenSupplyForStage","type":"uint40"},{"internalType":"uint16","name":"minFeeBps","type":"uint16"},{"internalType":"uint16","name":"maxFeeBps","type":"uint16"}],"internalType":"struct SignedMintValidationParams","name":"signedMintValidationParams","type":"tuple"}],"name":"updateSignedMintValidationParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"seaDropImpl","type":"address"},{"internalType":"address","name":"allowedNftToken","type":"address"},{"components":[{"internalType":"uint80","name":"mintPrice","type":"uint80"},{"internalType":"uint16","name":"maxTotalMintableByWallet","type":"uint16"},{"internalType":"uint48","name":"startTime","type":"uint48"},{"internalType":"uint48","name":"endTime","type":"uint48"},{"internalType":"uint8","name":"dropStageIndex","type":"uint8"},{"internalType":"uint32","name":"maxTokenSupplyForStage","type":"uint32"},{"internalType":"uint16","name":"feeBps","type":"uint16"},{"internalType":"bool","name":"restrictFeeRecipients","type":"bool"}],"internalType":"struct TokenGatedDropStage","name":"dropStage","type":"tuple"}],"name":"updateTokenGatedDrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"whitelistProof","type":"bytes32[]"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"whitelistAMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"whitelistProof","type":"bytes32[]"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"whitelistBMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"whitelistProof","type":"bytes32[]"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"whitelistProspectMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdrawETHFunds","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040526001600f557f126095171d42ac1451766cfb60a5782db96c342ec125d1ddf9daaeeedfe0e0906012557fc488b8656c7c3ee37169e932772c4b8660d18a09978030f7ffb9d1f52f31104c6013557ee8e92031a3ebb515ac5cc188d169f561c00232a10c64c4101ea8dbcfaf67516014557faf7f27a81fe9f7e5a51250d23b12306d01061a9a833c24723e1988f0fbecd23e60155560006016556017805461ffff19169055348015620000b557600080fd5b50604051620057de380380620057de833981016040819052620000d89162000508565b838382733cc6cdda760b79bafa08df41ecfa224f810dceb66001848481816002620001048382620006d3565b506003620001138282620006d3565b50506001600055506200012562000332565b50506daaeb6d7670e522a718067333cd4e3b156200026c578015620001ba57604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b1580156200019b57600080fd5b505af1158015620001b0573d6000803e3d6000fd5b505050506200026c565b6001600160a01b038216156200020b5760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af29039060440162000180565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b1580156200025257600080fd5b505af115801562000267573d6000803e3d6000fd5b505050505b5050805160005b81811015620002d2576001601060008584815181106200029757620002976200079f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905560010162000273565b508151620002e8906011906020850190620003b1565b506040517fd7aca75208b9be5ffc04c6a01922020ffd62b55e68e502e317f5344960279af890600090a15050505081600b9081620003279190620006d3565b5050505050620007b5565b303b15620003525760405162dc149f60e41b815260040160405180910390fd5b6200035d336200035f565b565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b82805482825590600052602060002090810192821562000409579160200282015b828111156200040957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190620003d2565b50620004179291506200041b565b5090565b5b808211156200041757600081556001016200041c565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171562000473576200047362000432565b604052919050565b600082601f8301126200048d57600080fd5b81516001600160401b03811115620004a957620004a962000432565b6020620004bf601f8301601f1916820162000448565b8281528582848701011115620004d457600080fd5b60005b83811015620004f4578581018301518282018401528201620004d7565b506000928101909101919091529392505050565b600080600080608085870312156200051f57600080fd5b84516001600160401b03808211156200053757600080fd5b62000545888389016200047b565b95506020915081870151818111156200055d57600080fd5b6200056b89828a016200047b565b9550506040870151818111156200058157600080fd5b6200058f89828a016200047b565b945050606087015181811115620005a557600080fd5b8701601f81018913620005b757600080fd5b805182811115620005cc57620005cc62000432565b8060051b9250620005df84840162000448565b818152928201840192848101908b851115620005fa57600080fd5b928501925b848410156200063457835192506001600160a01b0383168314620006235760008081fd5b8282529285019290850190620005ff565b989b979a50959850505050505050565b600181811c908216806200065957607f821691505b6020821081036200067a57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620006ce57600081815260208120601f850160051c81016020861015620006a95750805b601f850160051c820191505b81811015620006ca57828155600101620006b5565b5050505b505050565b81516001600160401b03811115620006ef57620006ef62000432565b620007078162000700845462000644565b8462000680565b602080601f8311600181146200073f5760008415620007265750858301515b600019600386901b1c1916600185901b178555620006ca565b600085815260208120601f198616915b8281101562000770578886015182559484019460019091019084016200074f565b50858210156200078f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b61501980620007c56000396000f3fe6080604052600436106103ad5760003560e01c806366251b69116101e7578063a22cb4651161010d578063cb743ba8116100a0578063e985e9c51161006f578063e985e9c514610ab5578063f2fde38b14610ad5578063f6cd5a7b14610af5578063fea125d914610b2557600080fd5b8063cb743ba814610a4b578063cdb9765714610a6b578063d5abeb0114610a8b578063e8a3d48514610aa057600080fd5b8063b94ee947116100dc578063b94ee947146109e3578063c0e5b49c14610a03578063c6ab67a314610a16578063c87b56dd14610a2b57600080fd5b8063a22cb46514610965578063a483011414610985578063ad2f852a146109a5578063b88d4fde146109c357600080fd5b80637a05bc82116101855780638da5cb5b116101545780638da5cb5b146108f2578063911f456b14610910578063938e3d7b1461093057806395d89b411461095057600080fd5b80637a05bc82146108575780637bc2be7614610877578063840e15d4146108975780638a59a7fd146108d257600080fd5b806370a08231116101c157806370a08231146107ed578063715018a61461080d57806374ca590c1461082257806379ba50971461084257600080fd5b806366251b69146107985780636c0360eb146107b85780636f8b44b0146107cd57600080fd5b80633d8a6318116102d757806355f804b31161026a57806360c308b61161023957806360c308b614610723578063629f349d146107435780636352211e1461075857806364869dad1461077857600080fd5b806355f804b3146106b15780635728f798146106d15780635c69b9fb146106f15780635dc96d161461070457600080fd5b806342966c68116102a657806342966c681461063157806344dae42c1461065157806348a4c10114610671578063511aa6441461069157600080fd5b80633d8a6318146105b557806341f43434146105ca57806342260b5d146105ec57806342842e0e1461061157600080fd5b806318160ddd1161034f57806323b872dd1161031e57806323b872dd146105235780632a55205a146105435780632db11544146105825780633680620d1461059557600080fd5b806318160ddd146104c45780631b73593c146104d95780631d7b7176146104f957806323452b9c1461050e57600080fd5b8063095ea7b31161038b578063095ea7b314610441578063099b6bfa146104635780630bb057a514610483578063159c1a581461049657600080fd5b806301ffc9a7146103b257806306fdde03146103e7578063081812fc14610409575b600080fd5b3480156103be57600080fd5b506103d26103cd366004613bff565b610b38565b60405190151581526020015b60405180910390f35b3480156103f357600080fd5b506103fc610b7e565b6040516103de9190613c6c565b34801561041557600080fd5b50610429610424366004613c7f565b610c10565b6040516001600160a01b0390911681526020016103de565b34801561044d57600080fd5b5061046161045c366004613cad565b610c54565b005b34801561046f57600080fd5b5061046161047e366004613c7f565b610c6d565b610461610491366004613d24565b610ce0565b3480156104a257600080fd5b506104b66104b1366004613c7f565b610e55565b6040519081526020016103de565b3480156104d057600080fd5b506104b6610e6c565b3480156104e557600080fd5b506104616104f4366004613d6f565b610e7a565b34801561050557600080fd5b50610461610eed565b34801561051a57600080fd5b50610461610f33565b34801561052f57600080fd5b5061046161053e366004613db0565b610f81565b34801561054f57600080fd5b5061056361055e366004613df1565b610fac565b604080516001600160a01b0390931683526020830191909152016103de565b610461610590366004613c7f565b610fe7565b3480156105a157600080fd5b506104616105b0366004613e13565b61118e565b3480156105c157600080fd5b506016546104b6565b3480156105d657600080fd5b506104296daaeb6d7670e522a718067333cd4e81565b3480156105f857600080fd5b50600e54600160a01b90046001600160601b03166104b6565b34801561061d57600080fd5b5061046161062c366004613db0565b6111cb565b34801561063d57600080fd5b5061046161064c366004613c7f565b6111f0565b34801561065d57600080fd5b5061046161066c366004613e69565b6112af565b34801561067d57600080fd5b5061046161068c366004613e9f565b6113c0565b34801561069d57600080fd5b506104616106ac366004613fa9565b61143a565b3480156106bd57600080fd5b506104616106cc3660046140b9565b611479565b3480156106dd57600080fd5b506104b66106ec3660046140fa565b6114e8565b6104616106ff366004613d24565b61156a565b34801561071057600080fd5b506017546103d290610100900460ff1681565b34801561072f57600080fd5b5061046161073e36600461412f565b6116c0565b34801561074f57600080fd5b506104616116d2565b34801561076457600080fd5b50610429610773366004613c7f565b611779565b34801561078457600080fd5b50610461610793366004613cad565b611784565b3480156107a457600080fd5b506104616107b3366004614164565b611842565b3480156107c457600080fd5b506103fc611881565b3480156107d957600080fd5b506104616107e8366004613c7f565b611890565b3480156107f957600080fd5b506104b6610808366004614192565b6118f8565b34801561081957600080fd5b50610461611946565b34801561082e57600080fd5b5061046161083d3660046141af565b611958565b34801561084e57600080fd5b50610461611ce0565b34801561086357600080fd5b506104616108723660046141fa565b611d59565b34801561088357600080fd5b5061046161089236600461424e565b611d98565b3480156108a357600080fd5b506108b76108b2366004614192565b611dd7565b604080519384526020840192909252908201526060016103de565b3480156108de57600080fd5b506104b66108ed366004614192565b611e01565b3480156108fe57600080fd5b506008546001600160a01b0316610429565b34801561091c57600080fd5b5061046161092b3660046142a3565b611e0c565b34801561093c57600080fd5b5061046161094b3660046140b9565b612a29565b34801561095c57600080fd5b506103fc612a70565b34801561097157600080fd5b506104616109803660046142de565b612a7f565b34801561099157600080fd5b506104616109a0366004613df1565b612a93565b3480156109b157600080fd5b50600e546001600160a01b0316610429565b3480156109cf57600080fd5b506104616109de36600461430c565b612ad1565b3480156109ef57600080fd5b506104616109fe3660046143cf565b612af7565b610461610a11366004613d24565b612b13565b348015610a2257600080fd5b50600d546104b6565b348015610a3757600080fd5b506103fc610a46366004613c7f565b612c20565b348015610a5757600080fd5b50610461610a66366004613e9f565b612ca3565b348015610a7757600080fd5b50610461610a86366004614401565b612cea565b348015610a9757600080fd5b50600a546104b6565b348015610aac57600080fd5b506103fc612d12565b348015610ac157600080fd5b506103d2610ad0366004614164565b612d21565b348015610ae157600080fd5b50610461610af0366004614192565b612d4f565b348015610b0157600080fd5b506103d2610b10366004614192565b601d6020526000908152604090205460ff1681565b610461610b33366004613d24565b612dcc565b60006001600160e01b03198216630c487f4760e11b1480610b6957506001600160e01b03198216639c15441560e01b145b80610b785750610b7882612eb1565b92915050565b606060028054610b8d90614423565b80601f0160208091040260200160405190810160405280929190818152602001828054610bb990614423565b8015610c065780601f10610bdb57610100808354040283529160200191610c06565b820191906000526020600020905b815481529060010190602001808311610be957829003601f168201915b5050505050905090565b6000610c1b82612ef1565b610c38576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b81610c5e81612f26565b610c688383612fdf565b505050565b610c7561307f565b6000546000190115610c9a5760405163e03264af60e01b815260040160405180910390fd5b600d80549082905560408051828152602081018490527f7c22004198bf87da0f0dab623c72e66ca1200f4454aa3b9ca30f436275428b7c91015b60405180910390a15050565b323314610d085760405162461bcd60e51b8152600401610cff90614457565b60405180910390fd5b610d106130cf565b610d2c5760405162461bcd60e51b8152600401610cff9061448e565b6000610d36610e6c565b905061186a610d4583836144d1565b1115610d635760405162461bcd60e51b8152600401610cff906144e4565b6000610d6e3361310f565b90506002610d7c84836144d1565b1115610d9a5760405162461bcd60e51b8152600401610cff90614512565b610dce858533604051602001610db09190614549565b60405160208183030381529060405280519060200120601254613137565b610dea5760405162461bcd60e51b8152600401610cff90614566565b610df6336001856114e8565b3414610e445760405162461bcd60e51b815260206004820152601860248201527f496e636f7272656374207061796d656e742076616c75652100000000000000006044820152606401610cff565b610e4e3384613150565b5050505050565b60188160058110610e6557600080fd5b0154905081565b600154600054036000190190565b610e8261307f565b610e8b8261322a565b6040516301308e6560e01b81526001600160a01b038316906301308e6590610eb7908490600401614631565b600060405180830381600087803b158015610ed157600080fd5b505af1158015610ee5573d6000803e3d6000fd5b505050505050565b610ef5613268565b60175460ff1615610f0557600080fd5b6017805460ff19166001179055610f3173a0e091347827ec3ffc0e85389b8f0014e2895f1560fa613150565b565b610f3b613268565b600980546001600160a01b0319169055604051600081527f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974da9060200160405180910390a1565b826001600160a01b0381163314610f9b57610f9b33612f26565b610fa6848484613293565b50505050565b600080612710610fbe8461012c61463f565b610fc89190614656565b734c90a5584abfe69462b6dec304a78a59fe18b2b49590945092505050565b3233146110065760405162461bcd60e51b8152600401610cff90614457565b61100e613420565b61102a5760405162461bcd60e51b8152600401610cff9061448e565b6000611034610e6c565b905061186a61104383836144d1565b11156110615760405162461bcd60e51b8152600401610cff906144e4565b600182146110b15760405162461bcd60e51b815260206004820152601760248201527f43616e2774206d696e74206d6f7265207468616e2031210000000000000000006044820152606401610cff565b336000908152601d602052604090205460ff16156111115760405162461bcd60e51b815260206004820152601b60248201527f416c7265616479206d696e746564207075626c6963206d696e742100000000006044820152606401610cff565b61111d336003846114e8565b34146111665760405162461bcd60e51b8152602060048201526018602482015277496e636f7272656374205061796d656e742056616c75652160401b6044820152606401610cff565b336000818152601d60205260409020805460ff1916600117905561118a9083613150565b5050565b61119661307f565b61119f8261322a565b60405163ebb4a55f60e01b81526001600160a01b0383169063ebb4a55f90610eb79084906004016147b9565b826001600160a01b03811633146111e5576111e533612f26565b610fa6848484613470565b601754610100900460ff1661123b5760405162461bcd60e51b81526020600482015260116024820152704275726e206e6f7420656e61626c65642160781b6044820152606401610cff565b60005b60058110156112a0576018816005811061125a5761125a6147cc565b015482036112985760405162461bcd60e51b815260206004820152600b60248201526a43616e2774206275726e2160a81b6044820152606401610cff565b60010161123e565b506112ac81600161348b565b50565b6112b761307f565b60006112c66020830183614192565b6001600160a01b0316036112ed57604051631cc0baef60e01b815260040160405180910390fd5b61271061130060408301602084016147f7565b6001600160601b031611156113445761131f60408201602083016147f7565b604051633cadbafb60e01b81526001600160601b039091166004820152602401610cff565b80600e6113518282614814565b507ff21fccf4d64d86d532c4e4eb86c007b6ad57a460c27d724188625e755ec6cf6d90506113826020830183614192565b61139260408401602085016147f7565b604080516001600160a01b0390931683526001600160601b039091166020830152015b60405180910390a150565b6113c861307f565b6113d18361322a565b604051638e7d1e4360e01b81526001600160a01b0383811660048301528215156024830152841690638e7d1e43906044015b600060405180830381600087803b15801561141d57600080fd5b505af1158015611431573d6000803e3d6000fd5b50505050505050565b61144261307f565b61144b8361322a565b6040516309a7002f60e31b81526001600160a01b03841690634d3801789061140390859085906004016148c1565b61148161307f565b600b61148e828483614925565b50611497610e6c565b1561118a577f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c6001806114c960005490565b6114d391906149e4565b60408051928352602083019190915201610cd4565b60008260010361152e5760006114fd8561310f565b9050826002148061150e5750806001145b156115245767011c37937e080000915050611563565b6000915050611563565b8260020361154e5761154766f8b0a10e4700008361463f565b9050611563565b61156067011c37937e0800008361463f565b90505b9392505050565b3233146115895760405162461bcd60e51b8152600401610cff90614457565b6115916130cf565b6115ad5760405162461bcd60e51b8152600401610cff9061448e565b60006115b7610e6c565b905061186a6115c683836144d1565b11156115e45760405162461bcd60e51b8152600401610cff906144e4565b60006115ef3361310f565b905060026115fd84836144d1565b111561161b5760405162461bcd60e51b8152600401610cff90614512565b61164f8585336040516020016116319190614549565b60405160208183030381529060405280519060200120601454613137565b61166b5760405162461bcd60e51b8152600401610cff90614566565b611677336003856114e8565b3414610e445760405162461bcd60e51b8152602060048201526018602482015277496e636f7272656374205061796d656e742056616c75652160401b6044820152606401610cff565b6116c8613268565b61118a82826135c3565b6116da613268565b60405160009073a0e091347827ec3ffc0e85389b8f0014e2895f159047908381818185875af1925050503d8060008114611730576040519150601f19603f3d011682016040523d82523d6000602084013e611735565b606091505b50509050806112ac5760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610cff565b6000610b78826136dd565b600f546001146117c35760405162461bcd60e51b815260206004820152600a6024820152695245454e5452414e435960b01b6044820152606401610cff565b6002600f556117d13361322a565b600a54816117e26000546000190190565b6117ec91906144d1565b111561182f57806118006000546000190190565b61180a91906144d1565b600a5460405163384b48c560e21b815260048101929092526024820152604401610cff565b611839828261374c565b50506001600f55565b61184a61307f565b6118538261322a565b60405163024e71b760e31b81526001600160a01b0382811660048301528316906312738db890602401610eb7565b606061188b613766565b905090565b61189861307f565b6001600160401b038111156118c35760405163b43e913760e01b815260048101829052602401610cff565b600a8190556040518181527f7810bd47de260c3e9ee10061cf438099dd12256c79485f12f94dbccc981e806c906020016113b5565b60006001600160a01b038216611921576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b61194e613268565b610f316000613775565b3233146119775760405162461bcd60e51b8152600401610cff90614457565b61197f6137c7565b61199b5760405162461bcd60e51b8152600401610cff9061448e565b60008383808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250845194955092506119df9150610e6c9050565b905061186a816119f084600261463f565b6119fa91906144d1565b1115611a3b5760405162461bcd60e51b815260206004820152601060248201526f457863656564696e67204c696d69742160801b6044820152606401610cff565b6016546000908190819081731be6f6bac65573b68fefbdf89c5c1fa7f3a5805b336001600160a01b038b1615611b2a57604051634e1cade160e11b81523360048201526001600160a01b038c1660248201526d76a84fef008cdabe6409d2fe638b908190639c395bc290604401602060405180830381865afa158015611ac5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae991906149f7565b611b255760405162461bcd60e51b815260206004820152600d60248201526c4e6f742064656c65676174652160981b6044820152606401610cff565b8b9150505b60005b89811015611c7a57816001600160a01b0316836001600160a01b0316636352211e8d8481518110611b6057611b606147cc565b60200260200101516040518263ffffffff1660e01b8152600401611b8691815260200190565b602060405180830381865afa158015611ba3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc79190614a14565b6001600160a01b031614611c155760405162461bcd60e51b81526020600482015260156024820152744e6f74206f776e6572206f6620746f6b656e49442160581b6044820152606401610cff565b60018b8281518110611c2957611c296147cc565b6020026020010151611c3b91906149e4565b611c4690600261463f565b6003811b8616811c975093506000879003611c7257611c666002896144d1565b9750836003901b861895505b600101611b2d565b5060008711611cc15760405162461bcd60e51b815260206004820152601360248201527243616e2774206d696e7420616e796d6f72652160681b6044820152606401610cff565b838518601655611cd13388613150565b50505050505050505050505050565b6009546001600160a01b0316338114611d0c57604051636b7584e760e11b815260040160405180910390fd5b600980546001600160a01b0319169055604051600081527f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974da9060200160405180910390a16112ac81613775565b611d6161307f565b611d6a8361322a565b60405163b957d0cb60e01b81526001600160a01b0384169063b957d0cb906114039085908590600401614a31565b611da061307f565b611da98361322a565b604051637ecd591560e11b81526001600160a01b0384169063fd9ab22a906114039085908590600401614b13565b6000806000611de58461310f565b9250611df46000546000190190565b600a549395909450915050565b6000610b788261310f565b611e14613268565b803515611e6d576040516306f8b44b60e41b8152813560048201523090636f8b44b090602401600060405180830381600087803b158015611e5457600080fd5b505af1158015611e68573d6000803e3d6000fd5b505050505b611e7a6020820182614b31565b159050611ee457306355f804b3611e946020840184614b31565b6040518363ffffffff1660e01b8152600401611eb1929190614a31565b600060405180830381600087803b158015611ecb57600080fd5b505af1158015611edf573d6000803e3d6000fd5b505050505b611ef16040820182614b31565b159050611f5b573063938e3d7b611f0b6040840184614b31565b6040518363ffffffff1660e01b8152600401611f28929190614a31565b600060405180830381600087803b158015611f4257600080fd5b505af1158015611f56573d6000803e3d6000fd5b505050505b611f7b611f6e60e0830160c08401614b77565b65ffffffffffff16151590565b611f8e611f6e60c0840160a08501614b77565b176001036120005730631b73593c611fac6080840160608501614192565b836080016040518363ffffffff1660e01b8152600401611fcd929190614b92565b600060405180830381600087803b158015611fe757600080fd5b505af1158015611ffb573d6000803e3d6000fd5b505050505b61200e610140820182614b31565b15905061208a5730637a05bc8261202b6080840160608501614192565b612039610140850185614b31565b6040518463ffffffff1660e01b815260040161205793929190614baf565b600060405180830381600087803b15801561207157600080fd5b505af1158015612085573d6000803e3d6000fd5b505050505b600061209a610160830183614bd4565b35146121145730633680620d6120b66080840160608501614192565b6120c4610160850185614bd4565b6040518363ffffffff1660e01b81526004016120e1929190614bf4565b600060405180830381600087803b1580156120fb57600080fd5b505af115801561210f573d6000803e3d6000fd5b505050505b60006121286101a083016101808401614192565b6001600160a01b0316146121bf57306366251b6961214c6080840160608501614192565b61215e6101a085016101808601614192565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b1580156121a657600080fd5b505af11580156121ba573d6000803e3d6000fd5b505050505b6101a081013515612220576040516304cdb5fd60e11b81526101a08201356004820152309063099b6bfa90602401600060405180830381600087803b15801561220757600080fd5b505af115801561221b573d6000803e3d6000fd5b505050505b60006122306101c0830183614c18565b905011156122fa5760005b6122496101c0830183614c18565b90508110156122f857306348a4c1016122686080850160608601614192565b6122766101c0860186614c18565b85818110612286576122866147cc565b905060200201602081019061229b9190614192565b60016040518463ffffffff1660e01b81526004016122bb93929190614c61565b600060405180830381600087803b1580156122d557600080fd5b505af11580156122e9573d6000803e3d6000fd5b5050505080600101905061223b565b505b600061230a6101e0830183614c18565b905011156123d45760005b6123236101e0830183614c18565b90508110156123d257306348a4c1016123426080850160608601614192565b6123506101e0860186614c18565b85818110612360576123606147cc565b90506020020160208101906123759190614192565b60006040518463ffffffff1660e01b815260040161239593929190614c61565b600060405180830381600087803b1580156123af57600080fd5b505af11580156123c3573d6000803e3d6000fd5b50505050806001019050612315565b505b60006123e4610200830183614c18565b905011156124ae5760005b6123fd610200830183614c18565b90508110156124ac573063cb743ba861241c6080850160608601614192565b61242a610200860186614c18565b8581811061243a5761243a6147cc565b905060200201602081019061244f9190614192565b60016040518463ffffffff1660e01b815260040161246f93929190614c61565b600060405180830381600087803b15801561248957600080fd5b505af115801561249d573d6000803e3d6000fd5b505050508060010190506123ef565b505b60006124be610220830183614c18565b905011156125885760005b6124d7610220830183614c18565b9050811015612586573063cb743ba86124f66080850160608601614192565b612504610220860186614c18565b85818110612514576125146147cc565b90506020020160208101906125299190614192565b60006040518463ffffffff1660e01b815260040161254993929190614c61565b600060405180830381600087803b15801561256357600080fd5b505af1158015612577573d6000803e3d6000fd5b505050508060010190506124c9565b505b6000612598610260830183614c85565b905011156126c3576125ae610240820182614c18565b90506125be610260830183614c85565b9050146125de5760405163b81aa63960e01b815260040160405180910390fd5b60005b6125ef610260830183614c85565b90508110156126c15730637bc2be7661260e6080850160608601614192565b61261c610240860186614c18565b8581811061262c5761262c6147cc565b90506020020160208101906126419190614192565b61264f610260870187614c85565b8681811061265f5761265f6147cc565b905061010002016040518463ffffffff1660e01b815260040161268493929190614cce565b600060405180830381600087803b15801561269e57600080fd5b505af11580156126b2573d6000803e3d6000fd5b505050508060010190506125e1565b505b60006126d3610280830183614c18565b905011156127de5760005b6126ec610280830183614c18565b90508110156127dc576040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915230637bc2be7661274c6080860160608701614192565b61275a610280870187614c18565b8681811061276a5761276a6147cc565b905060200201602081019061277f9190614192565b846040518463ffffffff1660e01b815260040161279e93929190614cf4565b600060405180830381600087803b1580156127b857600080fd5b505af11580156127cc573d6000803e3d6000fd5b50505050816001019150506126de565b505b60006127ee6102c0830183614da6565b90501115612918576128046102a0820182614c18565b90506128146102c0830183614da6565b905014612834576040516374ef6df760e01b815260040160405180910390fd5b60005b6128456102c0830183614da6565b9050811015612916573063511aa6446128646080850160608601614192565b6128726102a0860186614c18565b85818110612882576128826147cc565b90506020020160208101906128979190614192565b6128a56102c0870187614da6565b868181106128b5576128b56147cc565b905060e002016040518463ffffffff1660e01b81526004016128d993929190614dee565b600060405180830381600087803b1580156128f357600080fd5b505af1158015612907573d6000803e3d6000fd5b50505050806001019050612837565b505b60006129286102e0830183614c18565b905011156112ac5760005b6129416102e0830183614c18565b905081101561118a576040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c08101919091523063511aa6446129996080860160608701614192565b6129a76102e0870187614c18565b868181106129b7576129b76147cc565b90506020020160208101906129cc9190614192565b846040518463ffffffff1660e01b81526004016129eb93929190614ea7565b600060405180830381600087803b158015612a0557600080fd5b505af1158015612a19573d6000803e3d6000fd5b5050505081600101915050612933565b612a3161307f565b600c612a3e828483614925565b507f905d981207a7d0b6c62cc46ab0be2a076d0298e4a86d0ab79882dbd01ac373788282604051610cd4929190614a31565b606060038054610b8d90614423565b81612a8981612f26565b610c6883836137e8565b612a9b61307f565b60408051838152602081018390527f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c9101610cd4565b836001600160a01b0381163314612aeb57612aeb33612f26565b610e4e85858585613854565b612aff613268565b601293909355601391909155601455601555565b323314612b325760405162461bcd60e51b8152600401610cff90614457565b612b3a6130cf565b612b565760405162461bcd60e51b8152600401610cff9061448e565b6000612b60610e6c565b905061186a612b6f83836144d1565b1115612b8d5760405162461bcd60e51b8152600401610cff906144e4565b6000612b983361310f565b90506002612ba684836144d1565b1115612bc45760405162461bcd60e51b8152600401610cff90614512565b612bf8858533604051602001612bda9190614549565b60405160208183030381529060405280519060200120601354613137565b612c145760405162461bcd60e51b8152600401610cff90614566565b611677336002856114e8565b6060612c2b82612ef1565b612c4857604051630a14c4b560e41b815260040160405180910390fd5b6000612c52613766565b90508051600003612c725760405180602001604052806000815250611563565b80612c7c84613898565b604051602001612c8d929190614ecd565b6040516020818303038152906040529392505050565b612cab61307f565b612cb48361322a565b604051633f952e6560e11b81526001600160a01b0383811660048301528215156024830152841690637f2a5cca90604401611403565b612cf2613268565b612cff6018826005613b43565b50506017805461ff001916610100179055565b6060600c8054610b8d90614423565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b612d57613268565b6001600160a01b038116612d7e57604051633a247dd760e11b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974da906020016113b5565b323314612deb5760405162461bcd60e51b8152600401610cff90614457565b612df36138dc565b612e0f5760405162461bcd60e51b8152600401610cff9061448e565b6000612e19610e6c565b905061186a612e2883836144d1565b1115612e465760405162461bcd60e51b8152600401610cff906144e4565b6000612e513361310f565b90506002612e5f84836144d1565b1115612e7d5760405162461bcd60e51b8152600401610cff90614512565b61164f858533604051602001612e939190614549565b60405160208183030381529060405280519060200120601554613137565b60006001600160e01b0319821663152a902d60e11b1480612ee25750632483248360e11b6001600160e01b03198316145b80610b785750610b7882613914565b600081600111158015612f05575060005482105b8015610b78575050600090815260046020526040902054600160e01b161590565b6daaeb6d7670e522a718067333cd4e3b156112ac57604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015612f93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fb791906149f7565b6112ac57604051633b79c77360e21b81526001600160a01b0382166004820152602401610cff565b6000612fea82611779565b9050336001600160a01b03821614613023576130068133612d21565b613023576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b3033146130ae6130976008546001600160a01b031690565b6001600160a01b0316336001600160a01b03161490565b17600003610f3157604051635fc483c560e01b815260040160405180910390fd5b60006130e16363f7a9a0611c206144d1565b421015801561188b57506130fb6363f7a9a0611c206144d1565b613107906138406144d1565b421115905090565b6001600160a01b03166000908152600560205260409081902054901c6001600160401b031690565b600061314585858486613962565b90505b949350505050565b60008054908290036131755760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b17831790558284019083908390600080516020614fc48339815191528180a4600183015b8181146132005780836000600080516020614fc4833981519152600080a46001016131da565b508160000361322157604051622e076360e81b815260040160405180910390fd5b60005550505050565b6001600160a01b03811660009081526010602052604090205460ff1615156001146112ac576040516315e26ff360e01b815260040160405180910390fd5b6008546001600160a01b03163314610f3157604051635fc483c560e01b815260040160405180910390fd5b600061329e826136dd565b9050836001600160a01b0316816001600160a01b0316146132d15760405162a1148160e81b815260040160405180910390fd5b600082815260066020526040902080546132fd8187335b6001600160a01b039081169116811491141790565b6133285761330b8633612d21565b61332857604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661334f57604051633a954ecd60e21b815260040160405180910390fd5b801561335a57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b841690036133ec576001840160008181526004602052604081205490036133ea5760005481146133ea5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b0316600080516020614fc483398151915260405160405180910390a4610ee5565b60006134326363f7a9a06154606144d1565b61343e90611c206144d1565b421015801561188b57506134586363f7a9a06154606144d1565b61346490611c206144d1565b61310790610e106144d1565b610c6883838360405180602001604052806000815250612ad1565b6000613496836136dd565b9050806000806134b486600090815260066020526040902080549091565b9150915084156134f4576134c98184336132e8565b6134f4576134d78333612d21565b6134f457604051632ce44b5f60e11b815260040160405180910390fd5b80156134ff57600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b8516900361358d5760018601600081815260046020526040812054900361358b57600054811461358b5760008181526004602052604090208590555b505b60405186906000906001600160a01b03861690600080516020614fc4833981519152908390a45050600180548101905550505050565b6011548160005b8281101561362757600060106000601184815481106135eb576135eb6147cc565b6000918252602080832091909101546001600160a01b031683528201929092526040019020805460ff19169115159190911790556001016135ca565b5060005b818110156136905760016010600087878581811061364b5761364b6147cc565b90506020020160208101906136609190614192565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905560010161362b565b5061369d60118585613b81565b507fbbd3b69c138de4d317d0bc4290282c4e1cbd1e58b579a5b4f114b598c237454d84846040516136cf929190614f0c565b60405180910390a150505050565b60008180600111613733576000548110156137335760008181526004602052604081205490600160e01b82169003613731575b80600003611563575060001901600081815260046020526040902054613710565b505b604051636f96cda160e11b815260040160405180910390fd5b61118a82826040518060200160405280600081525061397a565b6060600b8054610b8d90614423565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006363f7a9a0421015801561188b57506131076363f7a9a06154606144d1565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61385f848484610f81565b6001600160a01b0383163b15610fa65761387b848484846139e0565b610fa6576040516368d2bf6b60e11b815260040160405180910390fd5b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806138b25750819003601f19909101908152919050565b60006138ee6363f7a9a06154606144d1565b421015801561188b57506139086363f7a9a06154606144d1565b61310790611c206144d1565b60006301ffc9a760e01b6001600160e01b03198316148061394557506380ac58cd60e01b6001600160e01b03198316145b80610b785750506001600160e01b031916635b5e139f60e01b1490565b600082613970868685613ac8565b1495945050505050565b6139848383613150565b6001600160a01b0383163b15610c68576000548281035b6139ae60008683806001019450866139e0565b6139cb576040516368d2bf6b60e11b815260040160405180910390fd5b81811061399b578160005414610e4e57600080fd5b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613a15903390899088908890600401614f5a565b6020604051808303816000875af1925050508015613a50575060408051601f3d908101601f19168201909252613a4d91810190614f8d565b60015b613aae573d808015613a7e576040519150601f19603f3d011682016040523d82523d6000602084013e613a83565b606091505b508051600003613aa6576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613148565b60008183825b81811015613b0c57613af883888884818110613aec57613aec6147cc565b90506020020135613b17565b925080613b0481614faa565b915050613ace565b509095945050505050565b6000818310613b33576000828152602084905260409020611563565b5060009182526020526040902090565b8260058101928215613b71579160200282015b82811115613b71578235825591602001919060010190613b56565b50613b7d929150613bd4565b5090565b828054828255906000526020600020908101928215613b71579160200282015b82811115613b715781546001600160a01b0319166001600160a01b03843516178255602090920191600190910190613ba1565b5b80821115613b7d5760008155600101613bd5565b6001600160e01b0319811681146112ac57600080fd5b600060208284031215613c1157600080fd5b813561156381613be9565b60005b83811015613c37578181015183820152602001613c1f565b50506000910152565b60008151808452613c58816020860160208601613c1c565b601f01601f19169290920160200192915050565b6020815260006115636020830184613c40565b600060208284031215613c9157600080fd5b5035919050565b6001600160a01b03811681146112ac57600080fd5b60008060408385031215613cc057600080fd5b8235613ccb81613c98565b946020939093013593505050565b60008083601f840112613ceb57600080fd5b5081356001600160401b03811115613d0257600080fd5b6020830191508360208260051b8501011115613d1d57600080fd5b9250929050565b600080600060408486031215613d3957600080fd5b83356001600160401b03811115613d4f57600080fd5b613d5b86828701613cd9565b909790965060209590950135949350505050565b60008082840360e0811215613d8357600080fd5b8335613d8e81613c98565b925060c0601f1982011215613da257600080fd5b506020830190509250929050565b600080600060608486031215613dc557600080fd5b8335613dd081613c98565b92506020840135613de081613c98565b929592945050506040919091013590565b60008060408385031215613e0457600080fd5b50508035926020909101359150565b60008060408385031215613e2657600080fd5b8235613e3181613c98565b915060208301356001600160401b03811115613e4c57600080fd5b830160608186031215613e5e57600080fd5b809150509250929050565b600060408284031215613e7b57600080fd5b50919050565b80151581146112ac57600080fd5b8035613e9a81613e81565b919050565b600080600060608486031215613eb457600080fd5b8335613ebf81613c98565b92506020840135613ecf81613c98565b91506040840135613edf81613e81565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715613f2257613f22613eea565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613f5057613f50613eea565b604052919050565b80356001600160501b0381168114613e9a57600080fd5b803562ffffff81168114613e9a57600080fd5b803564ffffffffff81168114613e9a57600080fd5b803561ffff81168114613e9a57600080fd5b6000806000838503610120811215613fc057600080fd5b8435613fcb81613c98565b93506020850135613fdb81613c98565b925060e0603f1982011215613fef57600080fd5b50613ff8613f00565b61400460408601613f58565b815261401260608601613f6f565b602082015261402360808601613f82565b604082015261403460a08601613f82565b606082015261404560c08601613f82565b608082015261405660e08601613f97565b60a08201526140686101008601613f97565b60c0820152809150509250925092565b60008083601f84011261408a57600080fd5b5081356001600160401b038111156140a157600080fd5b602083019150836020828501011115613d1d57600080fd5b600080602083850312156140cc57600080fd5b82356001600160401b038111156140e257600080fd5b6140ee85828601614078565b90969095509350505050565b60008060006060848603121561410f57600080fd5b833561411a81613c98565b95602085013595506040909401359392505050565b6000806020838503121561414257600080fd5b82356001600160401b0381111561415857600080fd5b6140ee85828601613cd9565b6000806040838503121561417757600080fd5b823561418281613c98565b91506020830135613e5e81613c98565b6000602082840312156141a457600080fd5b813561156381613c98565b6000806000604084860312156141c457600080fd5b83356001600160401b038111156141da57600080fd5b6141e686828701613cd9565b9094509250506020840135613edf81613c98565b60008060006040848603121561420f57600080fd5b833561421a81613c98565b925060208401356001600160401b0381111561423557600080fd5b61424186828701614078565b9497909650939450505050565b600080600083850361014081121561426557600080fd5b843561427081613c98565b9350602085013561428081613c98565b9250610100603f198201121561429557600080fd5b506040840190509250925092565b6000602082840312156142b557600080fd5b81356001600160401b038111156142cb57600080fd5b8201610300818503121561156357600080fd5b600080604083850312156142f157600080fd5b82356142fc81613c98565b91506020830135613e5e81613e81565b6000806000806080858703121561432257600080fd5b843561432d81613c98565b935060208581013561433e81613c98565b93506040860135925060608601356001600160401b038082111561436157600080fd5b818801915088601f83011261437557600080fd5b81358181111561438757614387613eea565b614399601f8201601f19168501613f28565b915080825289848285010111156143af57600080fd5b808484018584013760008482840101525080935050505092959194509250565b600080600080608085870312156143e557600080fd5b5050823594602084013594506040840135936060013592509050565b600060a0828403121561441357600080fd5b8260a083011115613e7b57600080fd5b600181811c9082168061443757607f821691505b602082108103613e7b57634e487b7160e01b600052602260045260246000fd5b60208082526018908201527f43616c6c657220697320536d61727420436f6e74726163740000000000000000604082015260600190565b6020808252601390820152724e6f7420696e206d696e742077696e646f772160681b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610b7857610b786144bb565b602080825260149082015273457863656564696e672036323530204e4654732160601b604082015260600190565b60208082526017908201527f43616e2774206d696e74206d6f7265207468616e203221000000000000000000604082015260600190565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60208082526010908201526f4e6f742077686974656c69737465642160801b604082015260600190565b803565ffffffffffff81168114613e9a57600080fd5b6001600160501b036145b782613f58565b1682526145c660208201614590565b65ffffffffffff8082166020850152806145e260408501614590565b16604085015250506145f660608201613f97565b61ffff80821660608501528061460e60808501613f97565b166080850152505060a081013561462481613e81565b80151560a0840152505050565b60c08101610b7882846145a6565b8082028115828204841417610b7857610b786144bb565b60008261467357634e487b7160e01b600052601260045260246000fd5b500490565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000808335601e198436030181126146b857600080fd5b83016020810192503590506001600160401b038111156146d757600080fd5b803603821315613d1d57600080fd5b60006060830182358452602080840135601e1985360301811261470857600080fd5b840181810190356001600160401b0381111561472357600080fd5b8060051b80360383131561473657600080fd5b6060848901529381905260809387018401938290880160005b8381101561478957898703607f1901825261476a83866146a1565b614775898284614678565b98505050918501919085019060010161474f565b50505050505061479c60408401846146a1565b85830360408701526147af838284614678565b9695505050505050565b60208152600061156360208301846146e6565b634e487b7160e01b600052603260045260246000fd5b6001600160601b03811681146112ac57600080fd5b60006020828403121561480957600080fd5b8135611563816147e2565b813561481f81613c98565b81546001600160a01b03199081166001600160a01b03929092169182178355602084013561484c816147e2565b60a01b1617905550565b6001600160501b03815116825262ffffff6020820151166020830152604081015164ffffffffff8082166040850152806060840151166060850152806080840151166080850152505060a081015161ffff80821660a08501528060c08401511660c085015250505050565b6001600160a01b038316815261010081016115636020830184614856565b601f821115610c6857600081815260208120601f850160051c810160208610156149065750805b601f850160051c820191505b81811015610ee557828155600101614912565b6001600160401b0383111561493c5761493c613eea565b6149508361494a8354614423565b836148df565b6000601f841160018114614984576000851561496c5750838201355b600019600387901b1c1916600186901b178355610e4e565b600083815260209020601f19861690835b828110156149b55786850135825560209485019460019092019101614995565b50868210156149d25760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81810381811115610b7857610b786144bb565b600060208284031215614a0957600080fd5b815161156381613e81565b600060208284031215614a2657600080fd5b815161156381613c98565b602081526000611560602083018486614678565b803563ffffffff81168114613e9a57600080fd5b6001600160501b03614a6a82613f58565b16825261ffff614a7c60208301613f97565b166020830152614a8e60408201614590565b65ffffffffffff808216604085015280614aaa60608501614590565b1660608501525050608081013560ff81168114614ac657600080fd5b60ff166080830152614ada60a08201614a45565b63ffffffff1660a0830152614af160c08201613f97565b61ffff1660c0830152614b0660e08201613e8f565b80151560e0840152505050565b6001600160a01b038316815261012081016115636020830184614a59565b6000808335601e19843603018112614b4857600080fd5b8301803591506001600160401b03821115614b6257600080fd5b602001915036819003821315613d1d57600080fd5b600060208284031215614b8957600080fd5b61156382614590565b6001600160a01b038316815260e0810161156360208301846145a6565b6001600160a01b03841681526040602082018190526000906131459083018486614678565b60008235605e19833603018112614bea57600080fd5b9190910192915050565b6001600160a01b0383168152604060208201819052600090611560908301846146e6565b6000808335601e19843603018112614c2f57600080fd5b8301803591506001600160401b03821115614c4957600080fd5b6020019150600581901b3603821315613d1d57600080fd5b6001600160a01b039384168152919092166020820152901515604082015260600190565b6000808335601e19843603018112614c9c57600080fd5b8301803591506001600160401b03821115614cb657600080fd5b6020019150600881901b3603821315613d1d57600080fd5b6001600160a01b0384811682528316602082015261014081016131486040830184614a59565b60006101408201905060018060a01b0380861683528085166020840152506001600160501b03835116604083015261ffff602084015116606083015265ffffffffffff60408401511660808301526060830151614d5b60a084018265ffffffffffff169052565b50608083015160ff811660c08401525060a083015163ffffffff811660e08401525060c083015161ffff81166101008401525060e08301518015156101208401525b50949350505050565b6000808335601e19843603018112614dbd57600080fd5b8301803591506001600160401b03821115614dd757600080fd5b602001915060e081023603821315613d1d57600080fd5b6001600160a01b0384811682528316602082015261012081016001600160501b03614e1884613f58565b16604083015262ffffff614e2e60208501613f6f565b166060830152614e4060408401613f82565b64ffffffffff808216608085015280614e5b60608701613f82565b1660a085015280614e6e60808701613f82565b1660c08501525050614e8260a08401613f97565b61ffff1660e0830152614e9760c08401613f97565b61ffff8116610100840152614d9d565b6001600160a01b0384811682528316602082015261012081016131486040830184614856565b60008351614edf818460208801613c1c565b835190830190614ef3818360208801613c1c565b64173539b7b760d91b9101908152600501949350505050565b60208082528181018390526000908460408401835b86811015614f4f578235614f3481613c98565b6001600160a01b031682529183019190830190600101614f21565b509695505050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906147af90830184613c40565b600060208284031215614f9f57600080fd5b815161156381613be9565b600060018201614fbc57614fbc6144bb565b506001019056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212206083ef637a9100f4fb3b6e714e338973062505e3294a073fb7794c3ea2c1c21664736f6c63430008110033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000d43616e647952657075626c696300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000243520000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043697066733a2f2f6261667962656966696c7a73636333766562326e34786f787732353672646b787466707a62667679666e76346764323371357178696c77347968712f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000005ea00ac477b1030ce78506496e8c2de24bf5
Deployed Bytecode
0x6080604052600436106103ad5760003560e01c806366251b69116101e7578063a22cb4651161010d578063cb743ba8116100a0578063e985e9c51161006f578063e985e9c514610ab5578063f2fde38b14610ad5578063f6cd5a7b14610af5578063fea125d914610b2557600080fd5b8063cb743ba814610a4b578063cdb9765714610a6b578063d5abeb0114610a8b578063e8a3d48514610aa057600080fd5b8063b94ee947116100dc578063b94ee947146109e3578063c0e5b49c14610a03578063c6ab67a314610a16578063c87b56dd14610a2b57600080fd5b8063a22cb46514610965578063a483011414610985578063ad2f852a146109a5578063b88d4fde146109c357600080fd5b80637a05bc82116101855780638da5cb5b116101545780638da5cb5b146108f2578063911f456b14610910578063938e3d7b1461093057806395d89b411461095057600080fd5b80637a05bc82146108575780637bc2be7614610877578063840e15d4146108975780638a59a7fd146108d257600080fd5b806370a08231116101c157806370a08231146107ed578063715018a61461080d57806374ca590c1461082257806379ba50971461084257600080fd5b806366251b69146107985780636c0360eb146107b85780636f8b44b0146107cd57600080fd5b80633d8a6318116102d757806355f804b31161026a57806360c308b61161023957806360c308b614610723578063629f349d146107435780636352211e1461075857806364869dad1461077857600080fd5b806355f804b3146106b15780635728f798146106d15780635c69b9fb146106f15780635dc96d161461070457600080fd5b806342966c68116102a657806342966c681461063157806344dae42c1461065157806348a4c10114610671578063511aa6441461069157600080fd5b80633d8a6318146105b557806341f43434146105ca57806342260b5d146105ec57806342842e0e1461061157600080fd5b806318160ddd1161034f57806323b872dd1161031e57806323b872dd146105235780632a55205a146105435780632db11544146105825780633680620d1461059557600080fd5b806318160ddd146104c45780631b73593c146104d95780631d7b7176146104f957806323452b9c1461050e57600080fd5b8063095ea7b31161038b578063095ea7b314610441578063099b6bfa146104635780630bb057a514610483578063159c1a581461049657600080fd5b806301ffc9a7146103b257806306fdde03146103e7578063081812fc14610409575b600080fd5b3480156103be57600080fd5b506103d26103cd366004613bff565b610b38565b60405190151581526020015b60405180910390f35b3480156103f357600080fd5b506103fc610b7e565b6040516103de9190613c6c565b34801561041557600080fd5b50610429610424366004613c7f565b610c10565b6040516001600160a01b0390911681526020016103de565b34801561044d57600080fd5b5061046161045c366004613cad565b610c54565b005b34801561046f57600080fd5b5061046161047e366004613c7f565b610c6d565b610461610491366004613d24565b610ce0565b3480156104a257600080fd5b506104b66104b1366004613c7f565b610e55565b6040519081526020016103de565b3480156104d057600080fd5b506104b6610e6c565b3480156104e557600080fd5b506104616104f4366004613d6f565b610e7a565b34801561050557600080fd5b50610461610eed565b34801561051a57600080fd5b50610461610f33565b34801561052f57600080fd5b5061046161053e366004613db0565b610f81565b34801561054f57600080fd5b5061056361055e366004613df1565b610fac565b604080516001600160a01b0390931683526020830191909152016103de565b610461610590366004613c7f565b610fe7565b3480156105a157600080fd5b506104616105b0366004613e13565b61118e565b3480156105c157600080fd5b506016546104b6565b3480156105d657600080fd5b506104296daaeb6d7670e522a718067333cd4e81565b3480156105f857600080fd5b50600e54600160a01b90046001600160601b03166104b6565b34801561061d57600080fd5b5061046161062c366004613db0565b6111cb565b34801561063d57600080fd5b5061046161064c366004613c7f565b6111f0565b34801561065d57600080fd5b5061046161066c366004613e69565b6112af565b34801561067d57600080fd5b5061046161068c366004613e9f565b6113c0565b34801561069d57600080fd5b506104616106ac366004613fa9565b61143a565b3480156106bd57600080fd5b506104616106cc3660046140b9565b611479565b3480156106dd57600080fd5b506104b66106ec3660046140fa565b6114e8565b6104616106ff366004613d24565b61156a565b34801561071057600080fd5b506017546103d290610100900460ff1681565b34801561072f57600080fd5b5061046161073e36600461412f565b6116c0565b34801561074f57600080fd5b506104616116d2565b34801561076457600080fd5b50610429610773366004613c7f565b611779565b34801561078457600080fd5b50610461610793366004613cad565b611784565b3480156107a457600080fd5b506104616107b3366004614164565b611842565b3480156107c457600080fd5b506103fc611881565b3480156107d957600080fd5b506104616107e8366004613c7f565b611890565b3480156107f957600080fd5b506104b6610808366004614192565b6118f8565b34801561081957600080fd5b50610461611946565b34801561082e57600080fd5b5061046161083d3660046141af565b611958565b34801561084e57600080fd5b50610461611ce0565b34801561086357600080fd5b506104616108723660046141fa565b611d59565b34801561088357600080fd5b5061046161089236600461424e565b611d98565b3480156108a357600080fd5b506108b76108b2366004614192565b611dd7565b604080519384526020840192909252908201526060016103de565b3480156108de57600080fd5b506104b66108ed366004614192565b611e01565b3480156108fe57600080fd5b506008546001600160a01b0316610429565b34801561091c57600080fd5b5061046161092b3660046142a3565b611e0c565b34801561093c57600080fd5b5061046161094b3660046140b9565b612a29565b34801561095c57600080fd5b506103fc612a70565b34801561097157600080fd5b506104616109803660046142de565b612a7f565b34801561099157600080fd5b506104616109a0366004613df1565b612a93565b3480156109b157600080fd5b50600e546001600160a01b0316610429565b3480156109cf57600080fd5b506104616109de36600461430c565b612ad1565b3480156109ef57600080fd5b506104616109fe3660046143cf565b612af7565b610461610a11366004613d24565b612b13565b348015610a2257600080fd5b50600d546104b6565b348015610a3757600080fd5b506103fc610a46366004613c7f565b612c20565b348015610a5757600080fd5b50610461610a66366004613e9f565b612ca3565b348015610a7757600080fd5b50610461610a86366004614401565b612cea565b348015610a9757600080fd5b50600a546104b6565b348015610aac57600080fd5b506103fc612d12565b348015610ac157600080fd5b506103d2610ad0366004614164565b612d21565b348015610ae157600080fd5b50610461610af0366004614192565b612d4f565b348015610b0157600080fd5b506103d2610b10366004614192565b601d6020526000908152604090205460ff1681565b610461610b33366004613d24565b612dcc565b60006001600160e01b03198216630c487f4760e11b1480610b6957506001600160e01b03198216639c15441560e01b145b80610b785750610b7882612eb1565b92915050565b606060028054610b8d90614423565b80601f0160208091040260200160405190810160405280929190818152602001828054610bb990614423565b8015610c065780601f10610bdb57610100808354040283529160200191610c06565b820191906000526020600020905b815481529060010190602001808311610be957829003601f168201915b5050505050905090565b6000610c1b82612ef1565b610c38576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b81610c5e81612f26565b610c688383612fdf565b505050565b610c7561307f565b6000546000190115610c9a5760405163e03264af60e01b815260040160405180910390fd5b600d80549082905560408051828152602081018490527f7c22004198bf87da0f0dab623c72e66ca1200f4454aa3b9ca30f436275428b7c91015b60405180910390a15050565b323314610d085760405162461bcd60e51b8152600401610cff90614457565b60405180910390fd5b610d106130cf565b610d2c5760405162461bcd60e51b8152600401610cff9061448e565b6000610d36610e6c565b905061186a610d4583836144d1565b1115610d635760405162461bcd60e51b8152600401610cff906144e4565b6000610d6e3361310f565b90506002610d7c84836144d1565b1115610d9a5760405162461bcd60e51b8152600401610cff90614512565b610dce858533604051602001610db09190614549565b60405160208183030381529060405280519060200120601254613137565b610dea5760405162461bcd60e51b8152600401610cff90614566565b610df6336001856114e8565b3414610e445760405162461bcd60e51b815260206004820152601860248201527f496e636f7272656374207061796d656e742076616c75652100000000000000006044820152606401610cff565b610e4e3384613150565b5050505050565b60188160058110610e6557600080fd5b0154905081565b600154600054036000190190565b610e8261307f565b610e8b8261322a565b6040516301308e6560e01b81526001600160a01b038316906301308e6590610eb7908490600401614631565b600060405180830381600087803b158015610ed157600080fd5b505af1158015610ee5573d6000803e3d6000fd5b505050505050565b610ef5613268565b60175460ff1615610f0557600080fd5b6017805460ff19166001179055610f3173a0e091347827ec3ffc0e85389b8f0014e2895f1560fa613150565b565b610f3b613268565b600980546001600160a01b0319169055604051600081527f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974da9060200160405180910390a1565b826001600160a01b0381163314610f9b57610f9b33612f26565b610fa6848484613293565b50505050565b600080612710610fbe8461012c61463f565b610fc89190614656565b734c90a5584abfe69462b6dec304a78a59fe18b2b49590945092505050565b3233146110065760405162461bcd60e51b8152600401610cff90614457565b61100e613420565b61102a5760405162461bcd60e51b8152600401610cff9061448e565b6000611034610e6c565b905061186a61104383836144d1565b11156110615760405162461bcd60e51b8152600401610cff906144e4565b600182146110b15760405162461bcd60e51b815260206004820152601760248201527f43616e2774206d696e74206d6f7265207468616e2031210000000000000000006044820152606401610cff565b336000908152601d602052604090205460ff16156111115760405162461bcd60e51b815260206004820152601b60248201527f416c7265616479206d696e746564207075626c6963206d696e742100000000006044820152606401610cff565b61111d336003846114e8565b34146111665760405162461bcd60e51b8152602060048201526018602482015277496e636f7272656374205061796d656e742056616c75652160401b6044820152606401610cff565b336000818152601d60205260409020805460ff1916600117905561118a9083613150565b5050565b61119661307f565b61119f8261322a565b60405163ebb4a55f60e01b81526001600160a01b0383169063ebb4a55f90610eb79084906004016147b9565b826001600160a01b03811633146111e5576111e533612f26565b610fa6848484613470565b601754610100900460ff1661123b5760405162461bcd60e51b81526020600482015260116024820152704275726e206e6f7420656e61626c65642160781b6044820152606401610cff565b60005b60058110156112a0576018816005811061125a5761125a6147cc565b015482036112985760405162461bcd60e51b815260206004820152600b60248201526a43616e2774206275726e2160a81b6044820152606401610cff565b60010161123e565b506112ac81600161348b565b50565b6112b761307f565b60006112c66020830183614192565b6001600160a01b0316036112ed57604051631cc0baef60e01b815260040160405180910390fd5b61271061130060408301602084016147f7565b6001600160601b031611156113445761131f60408201602083016147f7565b604051633cadbafb60e01b81526001600160601b039091166004820152602401610cff565b80600e6113518282614814565b507ff21fccf4d64d86d532c4e4eb86c007b6ad57a460c27d724188625e755ec6cf6d90506113826020830183614192565b61139260408401602085016147f7565b604080516001600160a01b0390931683526001600160601b039091166020830152015b60405180910390a150565b6113c861307f565b6113d18361322a565b604051638e7d1e4360e01b81526001600160a01b0383811660048301528215156024830152841690638e7d1e43906044015b600060405180830381600087803b15801561141d57600080fd5b505af1158015611431573d6000803e3d6000fd5b50505050505050565b61144261307f565b61144b8361322a565b6040516309a7002f60e31b81526001600160a01b03841690634d3801789061140390859085906004016148c1565b61148161307f565b600b61148e828483614925565b50611497610e6c565b1561118a577f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c6001806114c960005490565b6114d391906149e4565b60408051928352602083019190915201610cd4565b60008260010361152e5760006114fd8561310f565b9050826002148061150e5750806001145b156115245767011c37937e080000915050611563565b6000915050611563565b8260020361154e5761154766f8b0a10e4700008361463f565b9050611563565b61156067011c37937e0800008361463f565b90505b9392505050565b3233146115895760405162461bcd60e51b8152600401610cff90614457565b6115916130cf565b6115ad5760405162461bcd60e51b8152600401610cff9061448e565b60006115b7610e6c565b905061186a6115c683836144d1565b11156115e45760405162461bcd60e51b8152600401610cff906144e4565b60006115ef3361310f565b905060026115fd84836144d1565b111561161b5760405162461bcd60e51b8152600401610cff90614512565b61164f8585336040516020016116319190614549565b60405160208183030381529060405280519060200120601454613137565b61166b5760405162461bcd60e51b8152600401610cff90614566565b611677336003856114e8565b3414610e445760405162461bcd60e51b8152602060048201526018602482015277496e636f7272656374205061796d656e742056616c75652160401b6044820152606401610cff565b6116c8613268565b61118a82826135c3565b6116da613268565b60405160009073a0e091347827ec3ffc0e85389b8f0014e2895f159047908381818185875af1925050503d8060008114611730576040519150601f19603f3d011682016040523d82523d6000602084013e611735565b606091505b50509050806112ac5760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610cff565b6000610b78826136dd565b600f546001146117c35760405162461bcd60e51b815260206004820152600a6024820152695245454e5452414e435960b01b6044820152606401610cff565b6002600f556117d13361322a565b600a54816117e26000546000190190565b6117ec91906144d1565b111561182f57806118006000546000190190565b61180a91906144d1565b600a5460405163384b48c560e21b815260048101929092526024820152604401610cff565b611839828261374c565b50506001600f55565b61184a61307f565b6118538261322a565b60405163024e71b760e31b81526001600160a01b0382811660048301528316906312738db890602401610eb7565b606061188b613766565b905090565b61189861307f565b6001600160401b038111156118c35760405163b43e913760e01b815260048101829052602401610cff565b600a8190556040518181527f7810bd47de260c3e9ee10061cf438099dd12256c79485f12f94dbccc981e806c906020016113b5565b60006001600160a01b038216611921576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b61194e613268565b610f316000613775565b3233146119775760405162461bcd60e51b8152600401610cff90614457565b61197f6137c7565b61199b5760405162461bcd60e51b8152600401610cff9061448e565b60008383808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250845194955092506119df9150610e6c9050565b905061186a816119f084600261463f565b6119fa91906144d1565b1115611a3b5760405162461bcd60e51b815260206004820152601060248201526f457863656564696e67204c696d69742160801b6044820152606401610cff565b6016546000908190819081731be6f6bac65573b68fefbdf89c5c1fa7f3a5805b336001600160a01b038b1615611b2a57604051634e1cade160e11b81523360048201526001600160a01b038c1660248201526d76a84fef008cdabe6409d2fe638b908190639c395bc290604401602060405180830381865afa158015611ac5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae991906149f7565b611b255760405162461bcd60e51b815260206004820152600d60248201526c4e6f742064656c65676174652160981b6044820152606401610cff565b8b9150505b60005b89811015611c7a57816001600160a01b0316836001600160a01b0316636352211e8d8481518110611b6057611b606147cc565b60200260200101516040518263ffffffff1660e01b8152600401611b8691815260200190565b602060405180830381865afa158015611ba3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc79190614a14565b6001600160a01b031614611c155760405162461bcd60e51b81526020600482015260156024820152744e6f74206f776e6572206f6620746f6b656e49442160581b6044820152606401610cff565b60018b8281518110611c2957611c296147cc565b6020026020010151611c3b91906149e4565b611c4690600261463f565b6003811b8616811c975093506000879003611c7257611c666002896144d1565b9750836003901b861895505b600101611b2d565b5060008711611cc15760405162461bcd60e51b815260206004820152601360248201527243616e2774206d696e7420616e796d6f72652160681b6044820152606401610cff565b838518601655611cd13388613150565b50505050505050505050505050565b6009546001600160a01b0316338114611d0c57604051636b7584e760e11b815260040160405180910390fd5b600980546001600160a01b0319169055604051600081527f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974da9060200160405180910390a16112ac81613775565b611d6161307f565b611d6a8361322a565b60405163b957d0cb60e01b81526001600160a01b0384169063b957d0cb906114039085908590600401614a31565b611da061307f565b611da98361322a565b604051637ecd591560e11b81526001600160a01b0384169063fd9ab22a906114039085908590600401614b13565b6000806000611de58461310f565b9250611df46000546000190190565b600a549395909450915050565b6000610b788261310f565b611e14613268565b803515611e6d576040516306f8b44b60e41b8152813560048201523090636f8b44b090602401600060405180830381600087803b158015611e5457600080fd5b505af1158015611e68573d6000803e3d6000fd5b505050505b611e7a6020820182614b31565b159050611ee457306355f804b3611e946020840184614b31565b6040518363ffffffff1660e01b8152600401611eb1929190614a31565b600060405180830381600087803b158015611ecb57600080fd5b505af1158015611edf573d6000803e3d6000fd5b505050505b611ef16040820182614b31565b159050611f5b573063938e3d7b611f0b6040840184614b31565b6040518363ffffffff1660e01b8152600401611f28929190614a31565b600060405180830381600087803b158015611f4257600080fd5b505af1158015611f56573d6000803e3d6000fd5b505050505b611f7b611f6e60e0830160c08401614b77565b65ffffffffffff16151590565b611f8e611f6e60c0840160a08501614b77565b176001036120005730631b73593c611fac6080840160608501614192565b836080016040518363ffffffff1660e01b8152600401611fcd929190614b92565b600060405180830381600087803b158015611fe757600080fd5b505af1158015611ffb573d6000803e3d6000fd5b505050505b61200e610140820182614b31565b15905061208a5730637a05bc8261202b6080840160608501614192565b612039610140850185614b31565b6040518463ffffffff1660e01b815260040161205793929190614baf565b600060405180830381600087803b15801561207157600080fd5b505af1158015612085573d6000803e3d6000fd5b505050505b600061209a610160830183614bd4565b35146121145730633680620d6120b66080840160608501614192565b6120c4610160850185614bd4565b6040518363ffffffff1660e01b81526004016120e1929190614bf4565b600060405180830381600087803b1580156120fb57600080fd5b505af115801561210f573d6000803e3d6000fd5b505050505b60006121286101a083016101808401614192565b6001600160a01b0316146121bf57306366251b6961214c6080840160608501614192565b61215e6101a085016101808601614192565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401600060405180830381600087803b1580156121a657600080fd5b505af11580156121ba573d6000803e3d6000fd5b505050505b6101a081013515612220576040516304cdb5fd60e11b81526101a08201356004820152309063099b6bfa90602401600060405180830381600087803b15801561220757600080fd5b505af115801561221b573d6000803e3d6000fd5b505050505b60006122306101c0830183614c18565b905011156122fa5760005b6122496101c0830183614c18565b90508110156122f857306348a4c1016122686080850160608601614192565b6122766101c0860186614c18565b85818110612286576122866147cc565b905060200201602081019061229b9190614192565b60016040518463ffffffff1660e01b81526004016122bb93929190614c61565b600060405180830381600087803b1580156122d557600080fd5b505af11580156122e9573d6000803e3d6000fd5b5050505080600101905061223b565b505b600061230a6101e0830183614c18565b905011156123d45760005b6123236101e0830183614c18565b90508110156123d257306348a4c1016123426080850160608601614192565b6123506101e0860186614c18565b85818110612360576123606147cc565b90506020020160208101906123759190614192565b60006040518463ffffffff1660e01b815260040161239593929190614c61565b600060405180830381600087803b1580156123af57600080fd5b505af11580156123c3573d6000803e3d6000fd5b50505050806001019050612315565b505b60006123e4610200830183614c18565b905011156124ae5760005b6123fd610200830183614c18565b90508110156124ac573063cb743ba861241c6080850160608601614192565b61242a610200860186614c18565b8581811061243a5761243a6147cc565b905060200201602081019061244f9190614192565b60016040518463ffffffff1660e01b815260040161246f93929190614c61565b600060405180830381600087803b15801561248957600080fd5b505af115801561249d573d6000803e3d6000fd5b505050508060010190506123ef565b505b60006124be610220830183614c18565b905011156125885760005b6124d7610220830183614c18565b9050811015612586573063cb743ba86124f66080850160608601614192565b612504610220860186614c18565b85818110612514576125146147cc565b90506020020160208101906125299190614192565b60006040518463ffffffff1660e01b815260040161254993929190614c61565b600060405180830381600087803b15801561256357600080fd5b505af1158015612577573d6000803e3d6000fd5b505050508060010190506124c9565b505b6000612598610260830183614c85565b905011156126c3576125ae610240820182614c18565b90506125be610260830183614c85565b9050146125de5760405163b81aa63960e01b815260040160405180910390fd5b60005b6125ef610260830183614c85565b90508110156126c15730637bc2be7661260e6080850160608601614192565b61261c610240860186614c18565b8581811061262c5761262c6147cc565b90506020020160208101906126419190614192565b61264f610260870187614c85565b8681811061265f5761265f6147cc565b905061010002016040518463ffffffff1660e01b815260040161268493929190614cce565b600060405180830381600087803b15801561269e57600080fd5b505af11580156126b2573d6000803e3d6000fd5b505050508060010190506125e1565b505b60006126d3610280830183614c18565b905011156127de5760005b6126ec610280830183614c18565b90508110156127dc576040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081019190915230637bc2be7661274c6080860160608701614192565b61275a610280870187614c18565b8681811061276a5761276a6147cc565b905060200201602081019061277f9190614192565b846040518463ffffffff1660e01b815260040161279e93929190614cf4565b600060405180830381600087803b1580156127b857600080fd5b505af11580156127cc573d6000803e3d6000fd5b50505050816001019150506126de565b505b60006127ee6102c0830183614da6565b90501115612918576128046102a0820182614c18565b90506128146102c0830183614da6565b905014612834576040516374ef6df760e01b815260040160405180910390fd5b60005b6128456102c0830183614da6565b9050811015612916573063511aa6446128646080850160608601614192565b6128726102a0860186614c18565b85818110612882576128826147cc565b90506020020160208101906128979190614192565b6128a56102c0870187614da6565b868181106128b5576128b56147cc565b905060e002016040518463ffffffff1660e01b81526004016128d993929190614dee565b600060405180830381600087803b1580156128f357600080fd5b505af1158015612907573d6000803e3d6000fd5b50505050806001019050612837565b505b60006129286102e0830183614c18565b905011156112ac5760005b6129416102e0830183614c18565b905081101561118a576040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c08101919091523063511aa6446129996080860160608701614192565b6129a76102e0870187614c18565b868181106129b7576129b76147cc565b90506020020160208101906129cc9190614192565b846040518463ffffffff1660e01b81526004016129eb93929190614ea7565b600060405180830381600087803b158015612a0557600080fd5b505af1158015612a19573d6000803e3d6000fd5b5050505081600101915050612933565b612a3161307f565b600c612a3e828483614925565b507f905d981207a7d0b6c62cc46ab0be2a076d0298e4a86d0ab79882dbd01ac373788282604051610cd4929190614a31565b606060038054610b8d90614423565b81612a8981612f26565b610c6883836137e8565b612a9b61307f565b60408051838152602081018390527f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c9101610cd4565b836001600160a01b0381163314612aeb57612aeb33612f26565b610e4e85858585613854565b612aff613268565b601293909355601391909155601455601555565b323314612b325760405162461bcd60e51b8152600401610cff90614457565b612b3a6130cf565b612b565760405162461bcd60e51b8152600401610cff9061448e565b6000612b60610e6c565b905061186a612b6f83836144d1565b1115612b8d5760405162461bcd60e51b8152600401610cff906144e4565b6000612b983361310f565b90506002612ba684836144d1565b1115612bc45760405162461bcd60e51b8152600401610cff90614512565b612bf8858533604051602001612bda9190614549565b60405160208183030381529060405280519060200120601354613137565b612c145760405162461bcd60e51b8152600401610cff90614566565b611677336002856114e8565b6060612c2b82612ef1565b612c4857604051630a14c4b560e41b815260040160405180910390fd5b6000612c52613766565b90508051600003612c725760405180602001604052806000815250611563565b80612c7c84613898565b604051602001612c8d929190614ecd565b6040516020818303038152906040529392505050565b612cab61307f565b612cb48361322a565b604051633f952e6560e11b81526001600160a01b0383811660048301528215156024830152841690637f2a5cca90604401611403565b612cf2613268565b612cff6018826005613b43565b50506017805461ff001916610100179055565b6060600c8054610b8d90614423565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b612d57613268565b6001600160a01b038116612d7e57604051633a247dd760e11b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974da906020016113b5565b323314612deb5760405162461bcd60e51b8152600401610cff90614457565b612df36138dc565b612e0f5760405162461bcd60e51b8152600401610cff9061448e565b6000612e19610e6c565b905061186a612e2883836144d1565b1115612e465760405162461bcd60e51b8152600401610cff906144e4565b6000612e513361310f565b90506002612e5f84836144d1565b1115612e7d5760405162461bcd60e51b8152600401610cff90614512565b61164f858533604051602001612e939190614549565b60405160208183030381529060405280519060200120601554613137565b60006001600160e01b0319821663152a902d60e11b1480612ee25750632483248360e11b6001600160e01b03198316145b80610b785750610b7882613914565b600081600111158015612f05575060005482105b8015610b78575050600090815260046020526040902054600160e01b161590565b6daaeb6d7670e522a718067333cd4e3b156112ac57604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015612f93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fb791906149f7565b6112ac57604051633b79c77360e21b81526001600160a01b0382166004820152602401610cff565b6000612fea82611779565b9050336001600160a01b03821614613023576130068133612d21565b613023576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b3033146130ae6130976008546001600160a01b031690565b6001600160a01b0316336001600160a01b03161490565b17600003610f3157604051635fc483c560e01b815260040160405180910390fd5b60006130e16363f7a9a0611c206144d1565b421015801561188b57506130fb6363f7a9a0611c206144d1565b613107906138406144d1565b421115905090565b6001600160a01b03166000908152600560205260409081902054901c6001600160401b031690565b600061314585858486613962565b90505b949350505050565b60008054908290036131755760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b17831790558284019083908390600080516020614fc48339815191528180a4600183015b8181146132005780836000600080516020614fc4833981519152600080a46001016131da565b508160000361322157604051622e076360e81b815260040160405180910390fd5b60005550505050565b6001600160a01b03811660009081526010602052604090205460ff1615156001146112ac576040516315e26ff360e01b815260040160405180910390fd5b6008546001600160a01b03163314610f3157604051635fc483c560e01b815260040160405180910390fd5b600061329e826136dd565b9050836001600160a01b0316816001600160a01b0316146132d15760405162a1148160e81b815260040160405180910390fd5b600082815260066020526040902080546132fd8187335b6001600160a01b039081169116811491141790565b6133285761330b8633612d21565b61332857604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661334f57604051633a954ecd60e21b815260040160405180910390fd5b801561335a57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b841690036133ec576001840160008181526004602052604081205490036133ea5760005481146133ea5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b0316600080516020614fc483398151915260405160405180910390a4610ee5565b60006134326363f7a9a06154606144d1565b61343e90611c206144d1565b421015801561188b57506134586363f7a9a06154606144d1565b61346490611c206144d1565b61310790610e106144d1565b610c6883838360405180602001604052806000815250612ad1565b6000613496836136dd565b9050806000806134b486600090815260066020526040902080549091565b9150915084156134f4576134c98184336132e8565b6134f4576134d78333612d21565b6134f457604051632ce44b5f60e11b815260040160405180910390fd5b80156134ff57600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b8516900361358d5760018601600081815260046020526040812054900361358b57600054811461358b5760008181526004602052604090208590555b505b60405186906000906001600160a01b03861690600080516020614fc4833981519152908390a45050600180548101905550505050565b6011548160005b8281101561362757600060106000601184815481106135eb576135eb6147cc565b6000918252602080832091909101546001600160a01b031683528201929092526040019020805460ff19169115159190911790556001016135ca565b5060005b818110156136905760016010600087878581811061364b5761364b6147cc565b90506020020160208101906136609190614192565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905560010161362b565b5061369d60118585613b81565b507fbbd3b69c138de4d317d0bc4290282c4e1cbd1e58b579a5b4f114b598c237454d84846040516136cf929190614f0c565b60405180910390a150505050565b60008180600111613733576000548110156137335760008181526004602052604081205490600160e01b82169003613731575b80600003611563575060001901600081815260046020526040902054613710565b505b604051636f96cda160e11b815260040160405180910390fd5b61118a82826040518060200160405280600081525061397a565b6060600b8054610b8d90614423565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006363f7a9a0421015801561188b57506131076363f7a9a06154606144d1565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61385f848484610f81565b6001600160a01b0383163b15610fa65761387b848484846139e0565b610fa6576040516368d2bf6b60e11b815260040160405180910390fd5b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806138b25750819003601f19909101908152919050565b60006138ee6363f7a9a06154606144d1565b421015801561188b57506139086363f7a9a06154606144d1565b61310790611c206144d1565b60006301ffc9a760e01b6001600160e01b03198316148061394557506380ac58cd60e01b6001600160e01b03198316145b80610b785750506001600160e01b031916635b5e139f60e01b1490565b600082613970868685613ac8565b1495945050505050565b6139848383613150565b6001600160a01b0383163b15610c68576000548281035b6139ae60008683806001019450866139e0565b6139cb576040516368d2bf6b60e11b815260040160405180910390fd5b81811061399b578160005414610e4e57600080fd5b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613a15903390899088908890600401614f5a565b6020604051808303816000875af1925050508015613a50575060408051601f3d908101601f19168201909252613a4d91810190614f8d565b60015b613aae573d808015613a7e576040519150601f19603f3d011682016040523d82523d6000602084013e613a83565b606091505b508051600003613aa6576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613148565b60008183825b81811015613b0c57613af883888884818110613aec57613aec6147cc565b90506020020135613b17565b925080613b0481614faa565b915050613ace565b509095945050505050565b6000818310613b33576000828152602084905260409020611563565b5060009182526020526040902090565b8260058101928215613b71579160200282015b82811115613b71578235825591602001919060010190613b56565b50613b7d929150613bd4565b5090565b828054828255906000526020600020908101928215613b71579160200282015b82811115613b715781546001600160a01b0319166001600160a01b03843516178255602090920191600190910190613ba1565b5b80821115613b7d5760008155600101613bd5565b6001600160e01b0319811681146112ac57600080fd5b600060208284031215613c1157600080fd5b813561156381613be9565b60005b83811015613c37578181015183820152602001613c1f565b50506000910152565b60008151808452613c58816020860160208601613c1c565b601f01601f19169290920160200192915050565b6020815260006115636020830184613c40565b600060208284031215613c9157600080fd5b5035919050565b6001600160a01b03811681146112ac57600080fd5b60008060408385031215613cc057600080fd5b8235613ccb81613c98565b946020939093013593505050565b60008083601f840112613ceb57600080fd5b5081356001600160401b03811115613d0257600080fd5b6020830191508360208260051b8501011115613d1d57600080fd5b9250929050565b600080600060408486031215613d3957600080fd5b83356001600160401b03811115613d4f57600080fd5b613d5b86828701613cd9565b909790965060209590950135949350505050565b60008082840360e0811215613d8357600080fd5b8335613d8e81613c98565b925060c0601f1982011215613da257600080fd5b506020830190509250929050565b600080600060608486031215613dc557600080fd5b8335613dd081613c98565b92506020840135613de081613c98565b929592945050506040919091013590565b60008060408385031215613e0457600080fd5b50508035926020909101359150565b60008060408385031215613e2657600080fd5b8235613e3181613c98565b915060208301356001600160401b03811115613e4c57600080fd5b830160608186031215613e5e57600080fd5b809150509250929050565b600060408284031215613e7b57600080fd5b50919050565b80151581146112ac57600080fd5b8035613e9a81613e81565b919050565b600080600060608486031215613eb457600080fd5b8335613ebf81613c98565b92506020840135613ecf81613c98565b91506040840135613edf81613e81565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715613f2257613f22613eea565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613f5057613f50613eea565b604052919050565b80356001600160501b0381168114613e9a57600080fd5b803562ffffff81168114613e9a57600080fd5b803564ffffffffff81168114613e9a57600080fd5b803561ffff81168114613e9a57600080fd5b6000806000838503610120811215613fc057600080fd5b8435613fcb81613c98565b93506020850135613fdb81613c98565b925060e0603f1982011215613fef57600080fd5b50613ff8613f00565b61400460408601613f58565b815261401260608601613f6f565b602082015261402360808601613f82565b604082015261403460a08601613f82565b606082015261404560c08601613f82565b608082015261405660e08601613f97565b60a08201526140686101008601613f97565b60c0820152809150509250925092565b60008083601f84011261408a57600080fd5b5081356001600160401b038111156140a157600080fd5b602083019150836020828501011115613d1d57600080fd5b600080602083850312156140cc57600080fd5b82356001600160401b038111156140e257600080fd5b6140ee85828601614078565b90969095509350505050565b60008060006060848603121561410f57600080fd5b833561411a81613c98565b95602085013595506040909401359392505050565b6000806020838503121561414257600080fd5b82356001600160401b0381111561415857600080fd5b6140ee85828601613cd9565b6000806040838503121561417757600080fd5b823561418281613c98565b91506020830135613e5e81613c98565b6000602082840312156141a457600080fd5b813561156381613c98565b6000806000604084860312156141c457600080fd5b83356001600160401b038111156141da57600080fd5b6141e686828701613cd9565b9094509250506020840135613edf81613c98565b60008060006040848603121561420f57600080fd5b833561421a81613c98565b925060208401356001600160401b0381111561423557600080fd5b61424186828701614078565b9497909650939450505050565b600080600083850361014081121561426557600080fd5b843561427081613c98565b9350602085013561428081613c98565b9250610100603f198201121561429557600080fd5b506040840190509250925092565b6000602082840312156142b557600080fd5b81356001600160401b038111156142cb57600080fd5b8201610300818503121561156357600080fd5b600080604083850312156142f157600080fd5b82356142fc81613c98565b91506020830135613e5e81613e81565b6000806000806080858703121561432257600080fd5b843561432d81613c98565b935060208581013561433e81613c98565b93506040860135925060608601356001600160401b038082111561436157600080fd5b818801915088601f83011261437557600080fd5b81358181111561438757614387613eea565b614399601f8201601f19168501613f28565b915080825289848285010111156143af57600080fd5b808484018584013760008482840101525080935050505092959194509250565b600080600080608085870312156143e557600080fd5b5050823594602084013594506040840135936060013592509050565b600060a0828403121561441357600080fd5b8260a083011115613e7b57600080fd5b600181811c9082168061443757607f821691505b602082108103613e7b57634e487b7160e01b600052602260045260246000fd5b60208082526018908201527f43616c6c657220697320536d61727420436f6e74726163740000000000000000604082015260600190565b6020808252601390820152724e6f7420696e206d696e742077696e646f772160681b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610b7857610b786144bb565b602080825260149082015273457863656564696e672036323530204e4654732160601b604082015260600190565b60208082526017908201527f43616e2774206d696e74206d6f7265207468616e203221000000000000000000604082015260600190565b60609190911b6bffffffffffffffffffffffff1916815260140190565b60208082526010908201526f4e6f742077686974656c69737465642160801b604082015260600190565b803565ffffffffffff81168114613e9a57600080fd5b6001600160501b036145b782613f58565b1682526145c660208201614590565b65ffffffffffff8082166020850152806145e260408501614590565b16604085015250506145f660608201613f97565b61ffff80821660608501528061460e60808501613f97565b166080850152505060a081013561462481613e81565b80151560a0840152505050565b60c08101610b7882846145a6565b8082028115828204841417610b7857610b786144bb565b60008261467357634e487b7160e01b600052601260045260246000fd5b500490565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000808335601e198436030181126146b857600080fd5b83016020810192503590506001600160401b038111156146d757600080fd5b803603821315613d1d57600080fd5b60006060830182358452602080840135601e1985360301811261470857600080fd5b840181810190356001600160401b0381111561472357600080fd5b8060051b80360383131561473657600080fd5b6060848901529381905260809387018401938290880160005b8381101561478957898703607f1901825261476a83866146a1565b614775898284614678565b98505050918501919085019060010161474f565b50505050505061479c60408401846146a1565b85830360408701526147af838284614678565b9695505050505050565b60208152600061156360208301846146e6565b634e487b7160e01b600052603260045260246000fd5b6001600160601b03811681146112ac57600080fd5b60006020828403121561480957600080fd5b8135611563816147e2565b813561481f81613c98565b81546001600160a01b03199081166001600160a01b03929092169182178355602084013561484c816147e2565b60a01b1617905550565b6001600160501b03815116825262ffffff6020820151166020830152604081015164ffffffffff8082166040850152806060840151166060850152806080840151166080850152505060a081015161ffff80821660a08501528060c08401511660c085015250505050565b6001600160a01b038316815261010081016115636020830184614856565b601f821115610c6857600081815260208120601f850160051c810160208610156149065750805b601f850160051c820191505b81811015610ee557828155600101614912565b6001600160401b0383111561493c5761493c613eea565b6149508361494a8354614423565b836148df565b6000601f841160018114614984576000851561496c5750838201355b600019600387901b1c1916600186901b178355610e4e565b600083815260209020601f19861690835b828110156149b55786850135825560209485019460019092019101614995565b50868210156149d25760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b81810381811115610b7857610b786144bb565b600060208284031215614a0957600080fd5b815161156381613e81565b600060208284031215614a2657600080fd5b815161156381613c98565b602081526000611560602083018486614678565b803563ffffffff81168114613e9a57600080fd5b6001600160501b03614a6a82613f58565b16825261ffff614a7c60208301613f97565b166020830152614a8e60408201614590565b65ffffffffffff808216604085015280614aaa60608501614590565b1660608501525050608081013560ff81168114614ac657600080fd5b60ff166080830152614ada60a08201614a45565b63ffffffff1660a0830152614af160c08201613f97565b61ffff1660c0830152614b0660e08201613e8f565b80151560e0840152505050565b6001600160a01b038316815261012081016115636020830184614a59565b6000808335601e19843603018112614b4857600080fd5b8301803591506001600160401b03821115614b6257600080fd5b602001915036819003821315613d1d57600080fd5b600060208284031215614b8957600080fd5b61156382614590565b6001600160a01b038316815260e0810161156360208301846145a6565b6001600160a01b03841681526040602082018190526000906131459083018486614678565b60008235605e19833603018112614bea57600080fd5b9190910192915050565b6001600160a01b0383168152604060208201819052600090611560908301846146e6565b6000808335601e19843603018112614c2f57600080fd5b8301803591506001600160401b03821115614c4957600080fd5b6020019150600581901b3603821315613d1d57600080fd5b6001600160a01b039384168152919092166020820152901515604082015260600190565b6000808335601e19843603018112614c9c57600080fd5b8301803591506001600160401b03821115614cb657600080fd5b6020019150600881901b3603821315613d1d57600080fd5b6001600160a01b0384811682528316602082015261014081016131486040830184614a59565b60006101408201905060018060a01b0380861683528085166020840152506001600160501b03835116604083015261ffff602084015116606083015265ffffffffffff60408401511660808301526060830151614d5b60a084018265ffffffffffff169052565b50608083015160ff811660c08401525060a083015163ffffffff811660e08401525060c083015161ffff81166101008401525060e08301518015156101208401525b50949350505050565b6000808335601e19843603018112614dbd57600080fd5b8301803591506001600160401b03821115614dd757600080fd5b602001915060e081023603821315613d1d57600080fd5b6001600160a01b0384811682528316602082015261012081016001600160501b03614e1884613f58565b16604083015262ffffff614e2e60208501613f6f565b166060830152614e4060408401613f82565b64ffffffffff808216608085015280614e5b60608701613f82565b1660a085015280614e6e60808701613f82565b1660c08501525050614e8260a08401613f97565b61ffff1660e0830152614e9760c08401613f97565b61ffff8116610100840152614d9d565b6001600160a01b0384811682528316602082015261012081016131486040830184614856565b60008351614edf818460208801613c1c565b835190830190614ef3818360208801613c1c565b64173539b7b760d91b9101908152600501949350505050565b60208082528181018390526000908460408401835b86811015614f4f578235614f3481613c98565b6001600160a01b031682529183019190830190600101614f21565b509695505050505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906147af90830184613c40565b600060208284031215614f9f57600080fd5b815161156381613be9565b600060018201614fbc57614fbc6144bb565b506001019056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212206083ef637a9100f4fb3b6e714e338973062505e3294a073fb7794c3ea2c1c21664736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000d43616e647952657075626c696300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000243520000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043697066733a2f2f6261667962656966696c7a73636333766562326e34786f787732353672646b787466707a62667679666e76346764323371357178696c77347968712f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000005ea00ac477b1030ce78506496e8c2de24bf5
-----Decoded View---------------
Arg [0] : name_ (string): CandyRepublic
Arg [1] : symbol_ (string): CR
Arg [2] : baseURI_ (string): ipfs://bafybeifilzscc3veb2n4xoxw256rdkxtfpzbfvyfnv4gd23q5qxilw4yhq/
Arg [3] : seaDropAllowlist (address[]): 0x00005EA00Ac477B1030CE78506496e8C2dE24bf5
-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [4] : 000000000000000000000000000000000000000000000000000000000000000d
Arg [5] : 43616e647952657075626c696300000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [7] : 4352000000000000000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000043
Arg [9] : 697066733a2f2f6261667962656966696c7a73636333766562326e34786f7877
Arg [10] : 32353672646b787466707a62667679666e76346764323371357178696c773479
Arg [11] : 68712f0000000000000000000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [13] : 00000000000000000000000000005ea00ac477b1030ce78506496e8c2de24bf5
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.