ERC-721
Overview
Max Total Supply
100 CCTest
Holders
86
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
2 CCTestLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
ERC721SeaDrop
Compiler Version
v0.8.15+commit.e14f2714
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.11; import { IERC721SeaDrop, IERC721ContractMetadata } from "./interfaces/IERC721SeaDrop.sol"; import { ERC721ContractMetadata, IERC721ContractMetadata } from "./ERC721ContractMetadata.sol"; import { ERC721A } from "ERC721A/ERC721A.sol"; import { TwoStepAdministered } from "utility-contracts/TwoStepAdministered.sol"; import { IERC721 } from "openzeppelin-contracts/contracts/token/ERC721/IERC721.sol"; import { IERC165 } from "openzeppelin-contracts/contracts/utils/introspection/IERC165.sol"; import { SeaDrop } from "./SeaDrop.sol"; import { ISeaDrop } from "./interfaces/ISeaDrop.sol"; import { SeaDropErrorsAndEvents } from "./lib/SeaDropErrorsAndEvents.sol"; import { AllowListData, PublicDrop, TokenGatedDropStage } from "./lib/SeaDropStructs.sol"; /** * @title ERC721SeaDrop * @author jameswenzel, ryanio, stephankmin * @notice ERC721SeaDrop is a token contract that contains methods * to properly interact with SeaDrop. */ contract ERC721SeaDrop is ERC721ContractMetadata, IERC721SeaDrop, SeaDropErrorsAndEvents { // Track the allowed SeaDrop addresses. mapping(address => bool) private _allowedSeaDrop; // Track the enumrated allowed SeaDrop addresses. address[] internal _enumeratedAllowedSeaDrop; /** * @notice Modifier to restrict sender exclusively to * allowed SeaDrop contracts. */ modifier onlySeaDrop() { if (_allowedSeaDrop[msg.sender] != true) { revert OnlySeaDrop(); } _; } /** * @notice Modifier to restrict access exclusively to * allowed SeaDrop contracts. */ modifier onlyAllowedSeaDrop(address seaDrop) { if (_allowedSeaDrop[seaDrop] != true) { revert OnlySeaDrop(); } _; } /** * @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 ) ERC721ContractMetadata(name, symbol, administrator) { // Set the mapping for allowed SeaDrop contracts. for (uint256 i = 0; i < allowedSeaDrop.length; ) { _allowedSeaDrop[allowedSeaDrop[i]] = true; unchecked { ++i; } } // Set the enumeration. _enumeratedAllowedSeaDrop = allowedSeaDrop; } /** * @notice Update the allowed SeaDrop contracts. * * @param allowedSeaDrop The allowed SeaDrop addresses. */ function updateAllowedSeaDrop(address[] calldata allowedSeaDrop) external override onlyOwnerOrAdministrator { // Reset the old mapping. for (uint256 i = 0; i < _enumeratedAllowedSeaDrop.length; ) { _allowedSeaDrop[_enumeratedAllowedSeaDrop[i]] = false; unchecked { ++i; } } // Set the new mapping for allowed SeaDrop contracts. for (uint256 i = 0; i < allowedSeaDrop.length; ) { _allowedSeaDrop[allowedSeaDrop[i]] = true; unchecked { ++i; } } // Set the enumeration. _enumeratedAllowedSeaDrop = allowedSeaDrop; // Emit an event for the update. emit AllowedSeaDropUpdated(allowedSeaDrop); } /** * @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 payable override onlySeaDrop { // Mint the quantity of tokens to the minter. _mint(minter, quantity); } /** * @notice Update public drop data for this nft contract on SeaDrop. * Use `updatePublicDropFee` to update the fee recipient or feeBps. * * @param publicDrop The public drop data. */ function updatePublicDrop( address seaDropImpl, PublicDrop calldata publicDrop ) external virtual override onlyOwner 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) should be able to set feeBps. supplied.feeBps = retrieved.feeBps; retrieved.restrictFeeRecipients = true; // Update the public drop data on SeaDrop. ISeaDrop(seaDropImpl).updatePublicDrop(supplied); } /** * @notice Update public drop fee for this nft contract on SeaDrop. * * @param feeBps The public drop fee basis points. */ function updatePublicDropFee(address seaDropImpl, uint16 feeBps) external virtual onlyAdministrator onlyAllowedSeaDrop(seaDropImpl) { // Track the previous public drop data. PublicDrop memory retrieved = ISeaDrop(seaDropImpl).getPublicDrop( address(this) ); // Only the administrator (OpenSea) should be able to set feeBps. retrieved.feeBps = feeBps; retrieved.restrictFeeRecipients = true; // Update the public drop data on SeaDrop. ISeaDrop(seaDropImpl).updatePublicDrop(retrieved); } /** * @notice Update allow list data for this nft contract on SeaDrop. * * @param allowListData The allow list data. */ function updateAllowList( address seaDropImpl, AllowListData calldata allowListData ) external virtual override onlyOwnerOrAdministrator onlyAllowedSeaDrop(seaDropImpl) { // Update the allow list on SeaDrop. ISeaDrop(seaDropImpl).updateAllowList(allowListData); } /** * @notice Update token gated drop stage data for this nft contract * on SeaDrop. * * @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 onlyAllowedSeaDrop(seaDropImpl) { // Update the token gated drop stage. ISeaDrop(seaDropImpl).updateTokenGatedDrop( address(this), allowedNftToken, dropStage ); } /** * @notice Update the drop URI for this nft contract on SeaDrop. * * @param dropURI The new drop URI. */ function updateDropURI(address seaDropImpl, string calldata dropURI) external virtual override onlyOwnerOrAdministrator 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 payoutAddress The new payout address. */ function updateCreatorPayoutAddress( address seaDropImpl, address payoutAddress ) external onlyOwner 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 administrator can set the allowed fee recipient. * * @param feeRecipient The new fee recipient. * @param allowed If the fee recipient is allowed. */ function updateAllowedFeeRecipient( address seaDropImpl, address feeRecipient, bool allowed ) external onlyAdministrator 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 update the signers. * * @param newSigners The new signers. */ function updateSigners(address seaDropImpl, address[] calldata newSigners) external virtual override onlyOwnerOrAdministrator onlyAllowedSeaDrop(seaDropImpl) { // Update the signers. ISeaDrop(seaDropImpl).updateSigners(newSigners); } /** * @notice Returns a set of mint stats for the address. * This assists SeaDrop in enforcing maxSupply, * maxMintsPerWallet, and maxTokenSupplyForStage checks. * * @param minter The minter address. */ function getMintStats(address minter) external view returns ( uint256 minterNumMinted, uint256 currentTotalSupply, uint256 maxSupply ) { minterNumMinted = _numberMinted(minter); currentTotalSupply = totalSupply(); maxSupply = _maxSupply; } /** * @notice Returns the total token supply. */ function totalSupply() public view virtual override(IERC721ContractMetadata, ERC721ContractMetadata) returns (uint256) { return ERC721A.totalSupply(); } /** * @notice Returns if 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 == this.supportsInterface.selector || // ERC165 interfaceId == type(IERC721).interfaceId || // IERC721 interfaceId == type(IERC721ContractMetadata).interfaceId || // IERC721ContractMetadata interfaceId == type(IERC721SeaDrop).interfaceId; // IERC721SeaDrop } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import { IERC721ContractMetadata } from "../interfaces/IERC721ContractMetadata.sol"; import { AllowListData, PublicDrop, TokenGatedDropStage } from "../lib/SeaDropStructs.sol"; import { IERC165 } from "openzeppelin-contracts/contracts/utils/introspection/IERC165.sol"; interface IERC721SeaDrop is IERC721ContractMetadata, IERC165 { /** * @dev Revert with an error if a contract other than an allowed * SeaDrop address calls an update function. */ error OnlySeaDrop(); /** * @dev Emit an event when allowed SeaDrop contracts are updated. */ event AllowedSeaDropUpdated(address[] allowedSeaDrop); /** * @notice Update the allowed SeaDrop contracts. * * @param allowedSeaDrop The allowed SeaDrop addresses. */ function updateAllowedSeaDrop(address[] calldata allowedSeaDrop) external; /** * @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 payable; /** * @notice Returns a set of mint stats for the address. * This assists SeaDrop in enforcing maxSupply, * maxMintsPerWallet, and maxTokenSupplyForStage checks. * * @param minter The minter address. */ function getMintStats(address minter) external view returns ( uint256 minterNumMinted, uint256 currentTotalSupply, uint256 maxSupply ); /** * @notice Update public drop data for this nft contract on SeaDrop. * Use `updatePublicDropFee` to update the fee recipient or feeBps. * * @param seaDropImpl The allowed SeaDrop contract. * @param publicDrop The public drop data. */ function updatePublicDrop( address seaDropImpl, PublicDrop calldata publicDrop ) external; /** * @notice Update allow list data for this nft contract on SeaDrop. * * @param seaDropImpl The allowed SeaDrop contract. * @param allowListData The allow list data. */ function updateAllowList( address seaDropImpl, AllowListData calldata allowListData ) external; /** * @notice Update token gated drop stage data for this nft contract * on SeaDrop. * * @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. * * @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 update the signers. * * @param seaDropImpl The allowed SeaDrop contract. * @param newSigners The new signers. */ function updateSigners(address seaDropImpl, address[] calldata newSigners) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import { ERC721A } from "ERC721A/ERC721A.sol"; import { MaxMintable } from "utility-contracts/MaxMintable.sol"; import { TwoStepAdministered, TwoStepOwnable } from "utility-contracts/TwoStepAdministered.sol"; import { AllowList } from "utility-contracts/AllowList.sol"; import { Ownable } from "openzeppelin-contracts/contracts/access/Ownable.sol"; import { ECDSA } from "openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol"; import { ConstructorInitializable } from "utility-contracts/ConstructorInitializable.sol"; import { IERC721ContractMetadata } from "./interfaces/IERC721ContractMetadata.sol"; /** * @title ERC721ContractMetadata * @author jameswenzel, ryanio, stephankmin * @notice ERC721ContractMetadata is a token contract that extends ERC721A * with additional metadata capabilities. */ contract ERC721ContractMetadata is ERC721A, TwoStepAdministered, IERC721ContractMetadata { // Track the max supply. uint256 _maxSupply; // Track the base URI for token metadata. string _theBaseURI; // Track the contract URI for contract metadata. string _contractURI; // Track the provenance hash for guaranteeing metadata order // for random reveals. bytes32 _provenanceHash; /** * @notice Deploy the token contract with its name, symbol, * and an administrator. */ constructor( string memory name, string memory symbol, address administrator ) ERC721A(name, symbol) TwoStepAdministered(administrator) {} /** * @notice Returns the base URI for token metadata. */ function baseURI() external view override returns (string memory) { return _theBaseURI; } /** * @notice Returns the contract URI for contract metadata. */ function contractURI() external view override returns (string memory) { return _contractURI; } /** * @notice Sets the contract URI for contract metadata. * * @param newContractURI The new contract URI. */ function setContractURI(string calldata newContractURI) external override onlyOwner { // 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. * * @param startTokenId The start token id. * @param endTokenId The end token id. */ function setBatchTokenURIs( uint256 startTokenId, uint256 endTokenId, string calldata ) external onlyOwner { // Emit an event with the update. emit TokenURIUpdated(startTokenId, endTokenId); } /** * @notice Returns the max token supply. */ function maxSupply() public view returns (uint256) { return _maxSupply; } /** * @notice Returns the total token supply. */ function totalSupply() public view virtual override(ERC721A, IERC721ContractMetadata) returns (uint256) { return ERC721A.totalSupply(); } /** * @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 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 is unmodified * after mint has 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 onlyOwner { // Revert if any items have been minted. if (totalSupply() > 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 max token supply and emits an event. * * @param newMaxSupply The new max supply to set. */ function setMaxSupply(uint256 newMaxSupply) external onlyOwner { // Set the new max supply. _maxSupply = newMaxSupply; // Emit an event with the update. emit MaxSupplyUpdated(newMaxSupply); } /** * @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 onlyOwner { // Set the new base URI. _theBaseURI = newBaseURI; // Emit an event with the update. emit BaseURIUpdated(newBaseURI); } /** * @notice Returns the base URI for the contract, which ERC721A uses * to return tokenURI. */ function _baseURI() internal view virtual override returns (string memory) { return _theBaseURI; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.0 // 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 { // Reference type for token approval. 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 { if (operator == _msgSenderERC721A()) revert ApproveToCaller(); _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]`. 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. 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`. ) 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 0x80 bytes to keep the free memory pointer 32-byte word aliged. // We will need 1 32-byte word to store the length, // and 3 32-byte words to store a maximum of 78 digits. Total: 0x20 + 3 * 0x20 = 0x80. str := add(mload(0x40), 0x80) // Update the free memory pointer to allocate. mstore(0x40, str) // 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.0; import {TwoStepOwnable} from "utility-contracts/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 // 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: 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); }
// 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.11; import { ISeaDrop } from "./interfaces/ISeaDrop.sol"; import { AllowListData, MintParams, PublicDrop, TokenGatedDropStage, TokenGatedMintParams } from "./lib/SeaDropStructs.sol"; import { IERC721SeaDrop } from "./interfaces/IERC721SeaDrop.sol"; import { ERC20, SafeTransferLib } from "solmate/utils/SafeTransferLib.sol"; import { MerkleProofLib } from "solady/utils/MerkleProofLib.sol"; import { IERC721 } from "openzeppelin-contracts/contracts/token/ERC721/IERC721.sol"; import { IERC165 } from "openzeppelin-contracts/contracts/utils/introspection/IERC165.sol"; import { ECDSA } from "openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol"; /** * @title SeaDrop * @author jameswenzel, ryanio, stephankmin * @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 { using ECDSA for bytes32; // Track the public drops. mapping(address => PublicDrop) private _publicDrops; // Track the drop URIs. mapping(address => string) private _dropURIs; // Track the creator payout addresses. mapping(address => address) private _creatorPayoutAddresses; // Track the allow list merkle roots. mapping(address => bytes32) private _allowListMerkleRoots; // Track the allowed fee recipients. mapping(address => mapping(address => bool)) private _allowedFeeRecipients; // Track the allowed signers for server side drops. mapping(address => mapping(address => bool)) private _signers; // Track the signers for each server side drop. mapping(address => address[]) private _enumeratedSigners; // Track token gated drop stages. mapping(address => mapping(address => TokenGatedDropStage)) private _tokenGatedDrops; // Track the tokens for token gated drops. mapping(address => address[]) private _enumeratedTokenGatedTokens; // Track redeemed token IDs for token gated drop stages. mapping(address => mapping(address => mapping(uint256 => bool))) private _tokenGatedRedeemed; // EIP-712: Typed structured data hashing and signing bytes32 public immutable DOMAIN_SEPARATOR; bytes32 public immutable MINT_DATA_TYPEHASH; /** * @notice Ensure only tokens implementing IERC721SeaDrop can * call the update methods. */ modifier onlyIERC721SeaDrop() virtual { if ( !IERC165(msg.sender).supportsInterface( type(IERC721SeaDrop).interfaceId ) ) { revert OnlyIERC721SeaDrop(msg.sender); } _; } /** * @notice Constructor for the contract deployment. */ constructor() { DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ), keccak256(bytes("SeaDrop")), keccak256(bytes("1")), block.chainid, address(this) ) ); MINT_DATA_TYPEHASH = keccak256( "MintParams(address minter, uint256 mintPrice, uint256 maxTotalMintableByWallet, uint256 startTime, uint256 endTime, uint256 dropStageIndex, uint256 feeBps, bool restrictFeeRecipients)" ); } /** * @notice Mint a public drop. * * @param nftContract The nft contract to mint. * @param feeRecipient The fee recipient. * @param minter The mint recipient. * @param quantity The number of tokens to mint. */ function mintPublic( address nftContract, address feeRecipient, address minter, uint256 quantity ) external payable override { // Get the public drop data. PublicDrop memory publicDrop = _publicDrops[nftContract]; // Ensure that the drop has started. if (block.timestamp < publicDrop.startTime) { revert NotActive( block.timestamp, publicDrop.startTime, type(uint64).max ); } // Validate payment is correct for number minted. _checkCorrectPayment(quantity, publicDrop.mintPrice); // Check that the minter is allowed to mint the desired quantity. _checkMintQuantity( nftContract, minter, quantity, publicDrop.maxMintsPerWallet, 0 ); // Check that the fee recipient is allowed if restricted. _checkFeeRecipientIsAllowed( nftContract, feeRecipient, publicDrop.restrictFeeRecipients ); // Split the payout, mint the token, emit an event. _payAndMint( nftContract, minter, quantity, publicDrop.mintPrice, 0, publicDrop.feeBps, feeRecipient ); } /** * @notice Mint from an allow list. * * @param nftContract The nft contract to mint. * @param feeRecipient The fee recipient. * @param minter The mint recipient. * @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 minter, uint256 quantity, MintParams calldata mintParams, bytes32[] calldata proof ) 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); // 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 ( !MerkleProofLib.verify( proof, _allowListMerkleRoots[nftContract], keccak256(abi.encode(minter, mintParams)) ) ) { revert InvalidProof(); } // Split the payout, mint the token, emit an event. _payAndMint( nftContract, minter, quantity, mintParams.mintPrice, mintParams.dropStageIndex, mintParams.feeBps, feeRecipient ); } /** * @notice Mint with a server side signature. * * @param nftContract The nft contract to mint. * @param feeRecipient The fee recipient. * @param minter The mint recipient. * @param quantity The number of tokens to mint. * @param mintParams The mint parameters. * @param signature The server side signature, must be an allowed * signer. */ function mintSigned( address nftContract, address feeRecipient, address minter, uint256 quantity, MintParams calldata mintParams, 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); // 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 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. bytes32 digest = keccak256( abi.encodePacked( bytes2(0x1901), DOMAIN_SEPARATOR, keccak256(abi.encode(MINT_DATA_TYPEHASH, minter, mintParams)) ) ); // 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); if (!_signers[nftContract][recoveredAddress]) { revert InvalidSignature(recoveredAddress); } // Split the payout, mint the token, emit an event. _payAndMint( nftContract, minter, quantity, mintParams.mintPrice, mintParams.dropStageIndex, mintParams.feeBps, feeRecipient ); } /** * @notice Mint as an allowed token holder. * This will mark the token id as reedemed 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 minter The mint recipient. * @param tokenGatedMintParams The token gated mint params. */ function mintAllowedTokenHolder( address nftContract, address feeRecipient, address minter, TokenGatedMintParams[] calldata tokenGatedMintParams ) external payable override { // Track the total mint cost to compare against value sent with tx. uint256 totalCost; // Iterate through each allowedNftToken. for (uint256 i = 0; i < tokenGatedMintParams.length; ) { // Set the mintParams to a variable. TokenGatedMintParams calldata mintParams = tokenGatedMintParams[i]; // Set the dropStage to a variable. TokenGatedDropStage storage dropStage = _tokenGatedDrops[ nftContract ][mintParams.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; // Add to total cost. totalCost += 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 reedemed. for (uint256 j = 0; j < mintQuantity; ) { // Put the tokenId on the stack. uint256 tokenId = mintParams.allowedNftTokenIds[j]; // Check that the sender is the owner of the allowedNftTokenId. if ( IERC721(mintParams.allowedNftToken).ownerOf(tokenId) != minter ) { revert TokenGatedNotTokenOwner( nftContract, mintParams.allowedNftToken, tokenId ); } // Check that the token id has not already been redeemed. bool redeemed = _tokenGatedRedeemed[nftContract][ mintParams.allowedNftToken ][tokenId]; if (redeemed == true) { revert TokenGatedTokenIdAlreadyRedeemed( nftContract, mintParams.allowedNftToken, tokenId ); } // Mark the token id as reedemed. redeemed = true; unchecked { ++j; } } // Split the payout, mint the token, emit an event. _payAndMint( nftContract, minter, mintQuantity, dropStage.mintPrice, dropStage.dropStageIndex, dropStage.feeBps, feeRecipient ); unchecked { ++i; } } // Validate correct payment. if (msg.value != totalCost) { revert IncorrectPayment(msg.value, totalCost); } } /** * @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 (block.timestamp < startTime || block.timestamp > endTime) { // 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 == true && _allowedFeeRecipients[nftContract][feeRecipient] == false ) { 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 maxMintsPerWallet The allowed max mints per wallet. * @param nftContract The nft contract. */ function _checkMintQuantity( address nftContract, address minter, uint256 quantity, uint256 maxMintsPerWallet, uint256 maxTokenSupplyForStage ) internal view { // Get the mint stats. ( uint256 minterNumMinted, uint256 currentTotalSupply, uint256 maxSupply ) = IERC721SeaDrop(nftContract).getMintStats(minter); // Ensure mint quantity doesn't exceed maxMintsPerWallet. if (quantity + minterNumMinted > maxMintsPerWallet) { revert MintQuantityExceedsMaxMintedPerWallet( quantity + minterNumMinted, maxMintsPerWallet ); } // Ensure mint quantity doesn't exceed maxSupply. if (quantity + currentTotalSupply > maxSupply) { revert MintQuantityExceedsMaxSupply( quantity + currentTotalSupply, maxSupply ); } // Ensure mint quantity doesn't exceed maxTokenSupplyForStage // when provided. if (maxTokenSupplyForStage != 0) { 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 { // 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(); } // Get the fee amount. uint256 feeAmount = (msg.value * feeBps) / 10_000; // Get the creator payout amount. uint256 payoutAmount = msg.value - feeAmount; // Transfer to the fee recipient. SafeTransferLib.safeTransferETH(feeRecipient, feeAmount); // Transfer to the creator. SafeTransferLib.safeTransferETH(creatorPayoutAddress, payoutAmount); } /** * @notice Splits the payment, mints a number of tokens, * 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 _payAndMint( address nftContract, address minter, uint256 quantity, uint256 mintPrice, uint256 dropStageIndex, uint256 feeBps, address feeRecipient ) internal { // Split the payment between the creator and fee recipient. _splitPayout(nftContract, feeRecipient, feeBps); // Mint the token(s). IERC721SeaDrop(nftContract).mintSeaDrop(minter, quantity); // Emit an event for the mint. emit SeaDropMint( nftContract, minter, feeRecipient, msg.sender, quantity, mintPrice, feeBps, dropStageIndex ); } /** * @notice Returns the drop URI for the nft contract. * * @param nftContract The nft contract. */ function getDropURI(address nftContract) external view returns (string memory) { return _dropURIs[nftContract]; } /** * @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 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 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 Updates the drop URI and emits an event. * * @param newDropURI The new drop URI. */ function updateDropURI(string calldata newDropURI) external onlyIERC721SeaDrop { // Set the new drop URI. _dropURIs[msg.sender] = newDropURI; // Emit an event with the update. emit DropURIUpdated(msg.sender, newDropURI); } /** * @notice Updates the public drop for the nft contract and emits an event. * * @param publicDrop The public drop data. */ function updatePublicDrop(PublicDrop calldata publicDrop) external override onlyIERC721SeaDrop { // 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. * * @param allowListData The allow list data. */ function updateAllowList(AllowListData calldata allowListData) external override onlyIERC721SeaDrop { // 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. * * @param nftContract The nft contract. * @param allowedNftToken The token gated nft token. * @param dropStage The token gated drop stage data. */ function updateTokenGatedDrop( address nftContract, address allowedNftToken, TokenGatedDropStage calldata dropStage ) external override onlyIERC721SeaDrop { // Set the drop stage. _tokenGatedDrops[nftContract][allowedNftToken] = dropStage; // If the maxTotalMintableByWallet is greater than zero // then we are setting an active drop stage. if (dropStage.maxTotalMintableByWallet > 0) { // Add allowedNftToken to enumerated list if not present. bool allowedNftTokenExistsInEnumeration = false; // Iterate through enumerated token gated tokens for nft contract. for ( uint256 i = 0; i < _enumeratedTokenGatedTokens[nftContract].length; ) { if ( _enumeratedTokenGatedTokens[nftContract][i] == allowedNftToken ) { // Set the bool to true if found. allowedNftTokenExistsInEnumeration = true; } unchecked { ++i; } } // Add allowedNftToken to enumerated list if not present. if (allowedNftTokenExistsInEnumeration == false) { _enumeratedTokenGatedTokens[nftContract].push(allowedNftToken); } } // Emit an event with the update. emit TokenGatedDropStageUpdated( nftContract, allowedNftToken, dropStage ); } /** * @notice Updates the creator payout address and emits an event. * * @param _payoutAddress The creator payout address. */ function updateCreatorPayoutAddress(address _payoutAddress) external onlyIERC721SeaDrop { // 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. * * @param feeRecipient The fee recipient. * @param allowed If the fee recipient is allowed. */ function updateAllowedFeeRecipient(address feeRecipient, bool allowed) external onlyIERC721SeaDrop { // Set the allowed fee recipient. _allowedFeeRecipients[msg.sender][feeRecipient] = allowed; // Emit an event with the update. emit AllowedFeeRecipientUpdated(msg.sender, feeRecipient, allowed); } /** * @notice Updates the allowed server side signers and emits an event. * * @param newSigners The new list of signers. */ function updateSigners(address[] calldata newSigners) external onlyIERC721SeaDrop { // Track the enumerated storage. address[] storage enumeratedStorage = _enumeratedSigners[msg.sender]; // Track the old signers. address[] memory oldSigners = enumeratedStorage; // Delete old enumeration. delete _enumeratedSigners[msg.sender]; // Add new enumeration. for (uint256 i = 0; i < newSigners.length; ) { enumeratedStorage.push(newSigners[i]); unchecked { ++i; } } // Create a mapping of the signers. mapping(address => bool) storage signersMap = _signers[msg.sender]; // Delete old signers. for (uint256 i = 0; i < oldSigners.length; ) { signersMap[oldSigners[i]] = false; unchecked { ++i; } } // Add new signers. for (uint256 i = 0; i < newSigners.length; ) { signersMap[newSigners[i]] = true; unchecked { ++i; } } // Emit an event with the update. emit SignersUpdated(msg.sender, oldSigners, newSigners); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import { AllowListData, MintParams, PublicDrop, TokenGatedDropStage, TokenGatedMintParams } 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 minter The mint recipient. * @param quantity The number of tokens to mint. */ function mintPublic( address nftContract, address feeRecipient, address minter, uint256 quantity ) external payable; /** * @notice Mint from an allow list. * * @param nftContract The nft contract to mint. * @param feeRecipient The fee recipient. * @param minter The mint recipient. * @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 minter, uint256 quantity, MintParams calldata mintParams, bytes32[] calldata proof ) external payable; /** * @notice Mint with a server side signature. * * @param nftContract The nft contract to mint. * @param feeRecipient The fee recipient. * @param minter The mint recipient. * @param quantity The number of tokens to mint. * @param mintParams The mint parameters. * @param signature The server side signature, must be an allowed signer. */ function mintSigned( address nftContract, address feeRecipient, address minter, uint256 quantity, MintParams calldata mintParams, bytes calldata signature ) external payable; /** * @notice Mint as an allowed token holder. * This will mark the token id as reedemed 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 minter The mint recipient. * @param tokenGatedMintParams The token gated mint params. */ function mintAllowedTokenHolder( address nftContract, address feeRecipient, address minter, TokenGatedMintParams[] calldata tokenGatedMintParams ) external payable; /** * @notice Returns the drop URI for the nft contract. * * @param nftContract The nft contract. */ function getDropURI(address nftContract) external view returns (string memory); /** * @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. */ function getFeeRecipientIsAllowed(address nftContract, address feeRecipient) external view returns (bool); /** * @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 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); /** * The following methods assume msg.sender is an nft contract * and its ERC165 interface id matches IERC721SeaDrop. */ /** * @notice Updates the drop URI and emits an event. * * @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. * * @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. * * @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. * * @param nftContract The nft contract. * @param allowedNftToken The token gated nft token. * @param dropStage The token gated drop stage data. */ function updateTokenGatedDrop( address nftContract, address allowedNftToken, TokenGatedDropStage calldata dropStage ) external; /** * @notice Updates the creator payout address and emits an event. * * @param payoutAddress The creator payout address. */ function updateCreatorPayoutAddress(address payoutAddress) external; /** * @notice Updates the allowed fee recipient and emits an event. * * @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. * * @param newSigners The new list of signers. */ function updateSigners(address[] calldata newSigners) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import { PublicDrop, TokenGatedDropStage } 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 exceeds the max allowed * per transaction. */ error MintQuantityExceedsMaxPerTransaction(uint256 quantity, uint256 allowed); /** * @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. */ 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 restricted and not allowe. */ error FeeRecipientNotAllowed(); /** * @dev Revert if the creator payout address is the zero address. */ error CreatorPayoutAddressCannotBeZeroAddress(); /** * @dev Revert with an error if the allow list is already redeemed. * TODO should you only be able to redeem from an allow list once? * would otherwise be capped by maxTotalMintableByWallet */ error AllowListRedeemed(address minter); /** * @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 with an error if signer's signatuer is invalid. */ error InvalidSignature(address recoveredSigner); /** * @dev Revert with an error if the sender does not * match the IERC721SeaDrop interface. */ error OnlyIERC721SeaDrop(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 allowedNftContract, uint256 tokenId); /** * @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 allowedNftContract, uint256 tokenId); /** * @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 server side signers for an nft contract. */ event SignersUpdated( address indexed nftContract, address[] oldSigners, address[] newSigners ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /** * @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 maxMintsPerWallet Maximum total number of mints a user is * allowed. * @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 uint64 startTime; // 144/256 bits uint40 maxMintsPerWallet; // 184/256 bits uint16 feeBps; // 200/256 bits bool restrictFeeRecipients; // 208/256 bits } /** * @notice Stages from dropURI are strictly for front-end consumption, * and are trusted to match information in the * PublicDrop, AllowLists or TokenGatedDropStage * (we may want to surface discrepancies on the front-end) */ /** * @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 The limit of items this wallet can mint. * @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 TokenGatedDropStage { uint80 mintPrice; // 80/256 bits uint16 maxTotalMintableByWallet; uint48 startTime; uint48 endTime; uint8 dropStageIndex; // non-zero uint40 maxTokenSupplyForStage; uint16 feeBps; bool restrictFeeRecipients; } /** * @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 The limit of items this wallet can mint. * @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; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; interface IERC721ContractMetadata { /** * @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 URI for the collection-level metadata * is updated. */ event ContractURIUpdated(string newContractURI); /** * @dev Emit an event for partial reveals/updates. * Batch update implementation should be left to contract. * * @param startTokenId The start token id. * @param endTokenId The end token id. */ event TokenURIUpdated( uint256 indexed startTokenId, uint256 indexed endTokenId ); /** * @dev Emit an event for full token metadata reveals/updates. * * @param baseURI The base URI. */ event BaseURIUpdated(string baseURI); /** * @notice Returns the contract URI. */ function contractURI() external view returns (string memory); /** * @notice Sets the contract URI for contract metadata. * * @param newContractURI The new contract URI. */ function setContractURI(string calldata newContractURI) external; /** * @notice Returns the base URI for token metadata. */ function baseURI() external view returns (string memory); /** * @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 Returns the max token supply. */ function maxSupply() external view returns (uint256); /** * @notice Sets the max supply and emits an event. * * @param newMaxSupply The new max supply to set. */ function setMaxSupply(uint256 newMaxSupply) external; /** * @notice Returns the total token supply. */ function totalSupply() 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 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 is unmodified * after mint has 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; /** * @dev Revert with an error when attempting to set the provenance * hash after the mint has started. */ error ProvenanceHashCannotBeSetAfterMintStarted(); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import {TwoStepOwnable} from "./TwoStepOwnable.sol"; ///@notice Ownable contract with restrictions on how many times an address can mint abstract contract MaxMintable is TwoStepOwnable { uint256 public maxMintsPerWallet; error MaxMintedForWallet(); constructor(uint256 _maxMintsPerWallet) { maxMintsPerWallet = _maxMintsPerWallet; } modifier checkMaxMintedForWallet(uint256 quantity) { uint256 numMinted = _numberMinted(msg.sender); if (numMinted + quantity > maxMintsPerWallet) { revert MaxMintedForWallet(); } _; } ///@notice set maxMintsPerWallet. OnlyOwner function setMaxMintsPerWallet(uint256 maxMints) public onlyOwner { maxMintsPerWallet = maxMints; } function _numberMinted(address minter) internal virtual returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import {TwoStepOwnable} from "./TwoStepOwnable.sol"; /** * @notice Smart contract that verifies and tracks allow list redemptions against a configurable Merkle root, up to a * max number configured at deploy */ contract AllowList is TwoStepOwnable { bytes32 public merkleRoot; error NotAllowListed(); ///@notice Checks if msg.sender is included in AllowList, revert otherwise ///@param proof Merkle proof modifier onlyAllowListed(bytes32[] calldata proof) { if (!isAllowListed(proof, msg.sender)) { revert NotAllowListed(); } _; } constructor(bytes32 _merkleRoot) { merkleRoot = _merkleRoot; } ///@notice set the Merkle root in the contract. OnlyOwner. ///@param _merkleRoot the new Merkle root function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner { merkleRoot = _merkleRoot; } ///@notice Given a Merkle proof, check if an address is AllowListed against the root ///@param proof Merkle proof ///@param data abi-encoded data to be checked against the root ///@return boolean isAllowListed function isAllowListed(bytes32[] calldata proof, bytes memory data) public view returns (bool) { return verifyCalldata(proof, merkleRoot, keccak256(data)); } ///@notice Given a Merkle proof, check if an address is AllowListed against the root ///@param proof Merkle proof ///@param addr address to check against allow list ///@return boolean isAllowListed function isAllowListed(bytes32[] calldata proof, address addr) public view returns (bool) { return verifyCalldata( proof, merkleRoot, keccak256(abi.encodePacked(addr)) ); } /** * @dev Calldata version of {verify} * Copied from OpenZeppelin's MerkleProof.sol */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Calldata version of {processProof} * Copied from OpenZeppelin's MerkleProof.sol */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; ) { computedHash = _hashPair(computedHash, proof[i]); unchecked { ++i; } } return computedHash; } /// @dev Copied from OpenZeppelin's MerkleProof.sol function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } /// @dev Copied from OpenZeppelin's MerkleProof.sol 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) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @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`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @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 // 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 } 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"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' 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) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ 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 if (signature.length == 64) { bytes32 r; bytes32 vs; // 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)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } 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 (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // 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: 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 // ERC721A Contracts v4.2.0 // 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(); /** * The caller cannot approve to their own address. */ error ApproveToCaller(); /** * 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; 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 public 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)); } /** * @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: 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 pragma solidity ^0.8.4; /// @notice Gas optimized verification of proof of inclusion for a leaf in a Merkle tree. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol) library MerkleProofLib { function verify( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool isValid) { assembly { if proof.length { // Left shift by 5 is equivalent to multiplying by 0x20. let end := add(proof.offset, shl(5, proof.length)) // Initialize `offset` to the offset of `proof` in the calldata. let offset := proof.offset // Iterate over proof elements to compute root hash. // prettier-ignore for {} 1 {} { // Slot of `leaf` in scratch space. // If the condition is true: 0x20, otherwise: 0x00. let scratch := shl(5, gt(leaf, calldataload(offset))) // Store elements to hash contiguously in scratch space. // Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes. mstore(scratch, leaf) mstore(xor(scratch, 0x20), calldataload(offset)) // Reuse `leaf` to store the hash to reduce stack operations. leaf := keccak256(0x00, 0x40) offset := add(offset, 0x20) // prettier-ignore if iszero(lt(offset, end)) { break } } } isValid := eq(leaf, root) } } function verifyMultiProof( bytes32[] calldata proof, bytes32 root, bytes32[] calldata leafs, bool[] calldata flags ) internal pure returns (bool isValid) { // Rebuilds the root by consuming and producing values on a queue. // The queue starts with the `leafs` array, and goes into a `hashes` array. // After the process, the last element on the queue is verified // to be equal to the `root`. // // The `flags` array denotes whether the sibling // should be popped from the queue (`flag == true`), or // should be popped from the `proof` (`flag == false`). assembly { // If the number of flags is correct. // prettier-ignore for {} eq(add(leafs.length, proof.length), add(flags.length, 1)) {} { // Left shift by 5 is equivalent to multiplying by 0x20. // Compute the end calldata offset of `leafs`. let leafsEnd := add(leafs.offset, shl(5, leafs.length)) // These are the calldata offsets. let leafsOffset := leafs.offset let flagsOffset := flags.offset let proofOffset := proof.offset // We can use the free memory space for the queue. // We don't need to allocate, since the queue is temporary. let hashesFront := mload(0x40) let hashesBack := hashesFront // This is the end of the memory for the queue. let end := add(hashesBack, shl(5, flags.length)) // For the case where `proof.length + leafs.length == 1`. if iszero(flags.length) { // If `proof.length` is zero, `leafs.length` is 1. if iszero(proof.length) { isValid := eq(calldataload(leafsOffset), root) break } // If `leafs.length` is zero, `proof.length` is 1. if iszero(leafs.length) { isValid := eq(calldataload(proofOffset), root) break } } // prettier-ignore for {} 1 {} { let a := 0 // Pops a value from the queue into `a`. switch lt(leafsOffset, leafsEnd) case 0 { // Pop from `hashes` if there are no more leafs. a := mload(hashesFront) hashesFront := add(hashesFront, 0x20) } default { // Otherwise, pop from `leafs`. a := calldataload(leafsOffset) leafsOffset := add(leafsOffset, 0x20) } let b := 0 // If the flag is false, load the next proof, // else, pops from the queue. switch calldataload(flagsOffset) case 0 { // Loads the next proof. b := calldataload(proofOffset) proofOffset := add(proofOffset, 0x20) } default { // Pops a value from the queue into `a`. switch lt(leafsOffset, leafsEnd) case 0 { // Pop from `hashes` if there are no more leafs. b := mload(hashesFront) hashesFront := add(hashesFront, 0x20) } default { // Otherwise, pop from `leafs`. b := calldataload(leafsOffset) leafsOffset := add(leafsOffset, 0x20) } } // Advance to the next flag offset. flagsOffset := add(flagsOffset, 0x20) // Slot of `a` in scratch space. // If the condition is true: 0x20, otherwise: 0x00. let scratch := shl(5, gt(a, b)) // Hash the scratch space and push the result onto the queue. mstore(scratch, a) mstore(xor(scratch, 0x20), b) mstore(hashesBack, keccak256(0x00, 0x40)) hashesBack := add(hashesBack, 0x20) // prettier-ignore if iszero(lt(hashesBack, end)) { break } } // Checks if the last value in the queue is same as the root. isValid := eq(mload(sub(hashesBack, 0x20)), root) break } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_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) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @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] = _HEX_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: 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); } }
{ "remappings": [ "ERC721A/=lib/ERC721A/contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "murky/=lib/murky/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "seadrop/=src/", "solady/=lib/solady/src/", "solmate/=lib/solmate/src/", "utility-contracts/=lib/utility-contracts/src/", "src/=src/", "test/=test/", "script/=script/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "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":"address","name":"administrator","type":"address"},{"internalType":"address[]","name":"allowedSeaDrop","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"AllowListRedeemed","type":"error"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"CreatorPayoutAddressCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"FeeRecipientCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"FeeRecipientNotAllowed","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"want","type":"uint256"}],"name":"IncorrectPayment","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[{"internalType":"address","name":"recoveredSigner","type":"address"}],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"allowed","type":"uint256"}],"name":"MintQuantityExceedsMaxMintedPerWallet","type":"error"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"allowed","type":"uint256"}],"name":"MintQuantityExceedsMaxPerTransaction","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"name":"MintQuantityExceedsMaxSupply","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"maxTokenSupplyForStage","type":"uint256"}],"name":"MintQuantityExceedsMaxTokenSupplyForStage","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NewAdministratorIsZeroAddress","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentTimestamp","type":"uint256"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"endTimestamp","type":"uint256"}],"name":"NotActive","type":"error"},{"inputs":[],"name":"NotNextAdministrator","type":"error"},{"inputs":[],"name":"NotNextOwner","type":"error"},{"inputs":[],"name":"OnlyAdministrator","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"OnlyIERC721SeaDrop","type":"error"},{"inputs":[],"name":"OnlyOwner","type":"error"},{"inputs":[],"name":"OnlyOwnerOrAdministrator","type":"error"},{"inputs":[],"name":"OnlySeaDrop","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"ProvenanceHashCannotBeSetAfterMintStarted","type":"error"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"address","name":"allowedNftContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenGatedNotTokenOwner","type":"error"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"address","name":"allowedNftContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenGatedTokenIdAlreadyRedeemed","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":true,"internalType":"address","name":"previousAdministrator","type":"address"},{"indexed":true,"internalType":"address","name":"newAdministrator","type":"address"}],"name":"AdministratorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":true,"internalType":"bytes32","name":"previousMerkleRoot","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"},{"indexed":false,"internalType":"string[]","name":"publicKeyURI","type":"string[]"},{"indexed":false,"internalType":"string","name":"allowListURI","type":"string"}],"name":"AllowListUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":true,"internalType":"address","name":"feeRecipient","type":"address"},{"indexed":true,"internalType":"bool","name":"allowed","type":"bool"}],"name":"AllowedFeeRecipientUpdated","type":"event"},{"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":"string","name":"baseURI","type":"string"}],"name":"BaseURIUpdated","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":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":true,"internalType":"address","name":"newPayoutAddress","type":"address"}],"name":"CreatorPayoutAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":false,"internalType":"string","name":"newDropURI","type":"string"}],"name":"DropURIUpdated","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":"PotentialAdministratorUpdated","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":true,"internalType":"address","name":"nftContract","type":"address"},{"components":[{"internalType":"uint80","name":"mintPrice","type":"uint80"},{"internalType":"uint64","name":"startTime","type":"uint64"},{"internalType":"uint40","name":"maxMintsPerWallet","type":"uint40"},{"internalType":"uint16","name":"feeBps","type":"uint16"},{"internalType":"bool","name":"restrictFeeRecipients","type":"bool"}],"indexed":false,"internalType":"struct PublicDrop","name":"publicDrop","type":"tuple"}],"name":"PublicDropUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":true,"internalType":"address","name":"minter","type":"address"},{"indexed":true,"internalType":"address","name":"feeRecipient","type":"address"},{"indexed":false,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantityMinted","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"unitMintPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeBps","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dropStageIndex","type":"uint256"}],"name":"SeaDropMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":false,"internalType":"address[]","name":"oldSigners","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"newSigners","type":"address[]"}],"name":"SignersUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":true,"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":"uint40","name":"maxTokenSupplyForStage","type":"uint40"},{"internalType":"uint16","name":"feeBps","type":"uint16"},{"internalType":"bool","name":"restrictFeeRecipients","type":"bool"}],"indexed":false,"internalType":"struct TokenGatedDropStage","name":"dropStage","type":"tuple"}],"name":"TokenGatedDropStageUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"startTokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"endTokenId","type":"uint256"}],"name":"TokenURIUpdated","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":"acceptAdministration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"administrator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","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":[],"name":"cancelAdministrationTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelOwnershipTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"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":"payable","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":"potentialAdministrator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provenanceHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceAdministration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","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":"uint256","name":"startTokenId","type":"uint256"},{"internalType":"uint256","name":"endTokenId","type":"uint256"},{"internalType":"string","name":"","type":"string"}],"name":"setBatchTokenURIs","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":[{"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":"newAdministrator","type":"address"}],"name":"transferAdministration","outputs":[],"stateMutability":"nonpayable","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":"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"},{"components":[{"internalType":"uint80","name":"mintPrice","type":"uint80"},{"internalType":"uint64","name":"startTime","type":"uint64"},{"internalType":"uint40","name":"maxMintsPerWallet","type":"uint40"},{"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":"uint16","name":"feeBps","type":"uint16"}],"name":"updatePublicDropFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"seaDropImpl","type":"address"},{"internalType":"address[]","name":"newSigners","type":"address[]"}],"name":"updateSigners","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":"uint40","name":"maxTokenSupplyForStage","type":"uint40"},{"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"}]
Contract Creation Code
60806040523480156200001157600080fd5b506040516200312838038062003128833981016040819052620000349162000362565b838383808383600262000048838262000508565b50600362000057828262000508565b5050600080555062000068620000fb565b620000738162000128565b5050505060005b8151811015620000da576001601060008484815181106200009f576200009f620005d4565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790556001016200007a565b508051620000f0906011906020840190620001e6565b5050505050620005ea565b303b156200011b5760405162dc149f60e41b815260040160405180910390fd5b620001263362000194565b565b303b15620001485760405162dc149f60e41b815260040160405180910390fd5b600a80546001600160a01b0319166001600160a01b0383169081179091556040516000907f222c8e95a03c7aa95fc5d110485e0d38e767f07ab1ec878a6eac644ef1d83122908290a350565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8280548282559060005260206000209081019282156200023e579160200282015b828111156200023e57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000207565b506200024c92915062000250565b5090565b5b808211156200024c576000815560010162000251565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620002a857620002a862000267565b604052919050565b600082601f830112620002c257600080fd5b81516001600160401b03811115620002de57620002de62000267565b6020620002f4601f8301601f191682016200027d565b82815285828487010111156200030957600080fd5b60005b83811015620003295785810183015182820184015282016200030c565b838111156200033b5760008385840101525b5095945050505050565b80516001600160a01b03811681146200035d57600080fd5b919050565b600080600080608085870312156200037957600080fd5b84516001600160401b03808211156200039157600080fd5b6200039f88838901620002b0565b9550602091508187015181811115620003b757600080fd5b620003c589828a01620002b0565b955050620003d66040880162000345565b9350606087015181811115620003eb57600080fd5b8701601f81018913620003fd57600080fd5b80518281111562000412576200041262000267565b8060051b9250620004258484016200027d565b818152928201840192848101908b8511156200044057600080fd5b928501925b848410156200046957620004598462000345565b8252928501929085019062000445565b989b979a50959850505050505050565b600181811c908216806200048e57607f821691505b602082108103620004af57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200050357600081815260208120601f850160051c81016020861015620004de5750805b601f850160051c820191505b81811015620004ff57828155600101620004ea565b5050505b505050565b81516001600160401b0381111562000524576200052462000267565b6200053c8162000535845462000479565b84620004b5565b602080601f8311600181146200057457600084156200055b5750858301515b600019600386901b1c1916600185901b178555620004ff565b600085815260208120601f198616915b82811015620005a55788860151825594840194600190910190840162000584565b5085821015620005c45787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b612b2e80620005fa6000396000f3fe6080604052600436106102725760003560e01c806379ba50971161014f578063b88d4fde116100c1578063d5e7feb81161007a578063d5e7feb814610736578063e8a3d48514610756578063e985e9c51461076b578063f0025d96146107b4578063f2fde38b146107c9578063f53d0a8e146107e957600080fd5b8063b88d4fde14610697578063bbf1ab0c146106b7578063c6ab67a3146106d7578063c780b63d146106ec578063c87b56dd14610701578063d5abeb011461072157600080fd5b8063938e3d7b11610113578063938e3d7b146105ed57806395d89b411461060d5780639794ed4014610622578063998c05d814610637578063a22cb46514610657578063b0c1361a1461067757600080fd5b806379ba50971461053d5780637a05bc8214610552578063840e15d4146105725780638da5cb5b146105ad578063913ee93d146105cd57600080fd5b806348a4c101116101e857806364869dad116101ac57806364869dad146104a057806366251b69146104b35780636c0360eb146104d35780636f8b44b0146104e857806370a0823114610508578063715018a61461052857600080fd5b806348a4c1011461040057806355f804b31461042057806360c308b6146104405780636352211e146104605780636407ab101461048057600080fd5b806318160ddd1161023a57806318160ddd1461034857806323452b9c1461036b57806323b872dd1461038057806329e31c1b146103a05780633680620d146103c057806342842e0e146103e057600080fd5b806301ffc9a71461027757806306fdde03146102ac578063081812fc146102ce578063095ea7b314610306578063099b6bfa14610328575b600080fd5b34801561028357600080fd5b50610297610292366004611ea3565b610809565b60405190151581526020015b60405180910390f35b3480156102b857600080fd5b506102c1610876565b6040516102a39190611f18565b3480156102da57600080fd5b506102ee6102e9366004611f2b565b610908565b6040516001600160a01b0390911681526020016102a3565b34801561031257600080fd5b50610326610321366004611f60565b61094c565b005b34801561033457600080fd5b50610326610343366004611f2b565b6109ec565b34801561035457600080fd5b5061035d610a63565b6040519081526020016102a3565b34801561037757600080fd5b50610326610a77565b34801561038c57600080fd5b5061032661039b366004611f8a565b610ac6565b3480156103ac57600080fd5b506103266103bb36600461200e565b610c5f565b3480156103cc57600080fd5b506103266103db366004612060565b610c9a565b3480156103ec57600080fd5b506103266103fb366004611f8a565b610d7a565b34801561040c57600080fd5b5061032661041b3660046120cd565b610d9a565b34801561042c57600080fd5b5061032661043b366004612114565b610e72565b34801561044c57600080fd5b5061032661045b366004612199565b610eb9565b34801561046c57600080fd5b506102ee61047b366004611f2b565b611000565b34801561048c57600080fd5b5061032661049b3660046121ce565b61100b565b6103266104ae366004611f60565b6110b6565b3480156104bf57600080fd5b506103266104ce366004612220565b6110f9565b3480156104df57600080fd5b506102c161116f565b3480156104f457600080fd5b50610326610503366004611f2b565b61117e565b34801561051457600080fd5b5061035d610523366004612253565b6111c2565b34801561053457600080fd5b50610326611210565b34801561054957600080fd5b50610326611224565b34801561055e57600080fd5b5061032661056d36600461226e565b6112a0565b34801561057e57600080fd5b5061059261058d366004612253565b61134b565b604080519384526020840192909252908201526060016102a3565b3480156105b957600080fd5b506008546102ee906001600160a01b031681565b3480156105d957600080fd5b506103266105e8366004612253565b611387565b3480156105f957600080fd5b50610326610608366004612114565b61142a565b34801561061957600080fd5b506102c1611471565b34801561062e57600080fd5b50610326611480565b34801561064357600080fd5b506103266106523660046122b3565b6114ef565b34801561066357600080fd5b506103266106723660046122f2565b611632565b34801561068357600080fd5b50610326610692366004612339565b6116c7565b3480156106a357600080fd5b506103266106b23660046123d3565b6117e0565b3480156106c357600080fd5b506103266106d2366004612492565b61182a565b3480156106e357600080fd5b50600f5461035d565b3480156106f857600080fd5b506103266118d7565b34801561070d57600080fd5b506102c161071c366004611f2b565b611944565b34801561072d57600080fd5b50600c5461035d565b34801561074257600080fd5b50600b546102ee906001600160a01b031681565b34801561076257600080fd5b506102c16119c8565b34801561077757600080fd5b50610297610786366004612220565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b3480156107c057600080fd5b506103266119d7565b3480156107d557600080fd5b506103266107e4366004612253565b611a1f565b3480156107f557600080fd5b50600a546102ee906001600160a01b031681565b60006001600160e01b031982166301ffc9a760e01b148061083a57506001600160e01b031982166380ac58cd60e01b145b8061085557506001600160e01b03198216632fd0239360e01b145b8061087057506001600160e01b0319821663290d607b60e21b145b92915050565b606060028054610885906124e3565b80601f01602080910402602001604051908101604052809291908181526020018280546108b1906124e3565b80156108fe5780601f106108d3576101008083540402835291602001916108fe565b820191906000526020600020905b8154815290600101906020018083116108e157829003601f168201915b5050505050905090565b600061091382611a9c565b610930576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061095782611000565b9050336001600160a01b03821614610990576109738133610786565b610990576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6109f4611ac3565b60006109fe610a63565b1115610a1d5760405163e03264af60e01b815260040160405180910390fd5b600f80549082905560408051828152602081018490527f7c22004198bf87da0f0dab623c72e66ca1200f4454aa3b9ca30f436275428b7c91015b60405180910390a15050565b6000610a726001546000540390565b905090565b610a7f611ac3565b600980546001600160a01b0319169055604051600081527f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974da906020015b60405180910390a1565b6000610ad182611aee565b9050836001600160a01b0316816001600160a01b031614610b045760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610b5157610b348633610786565b610b5157604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610b7857604051633a954ecd60e21b815260040160405180910390fd5b8015610b8357600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003610c1557600184016000818152600460205260408120549003610c13576000548114610c135760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b610c67611ac3565b604051839085907fa367e77d52123b7db91661964f869e6d260e9050507402788a87ca8ad38687e790600090a350505050565b6008546001600160a01b03163314610cd757600a546001600160a01b03163314610cd7576040516359d9793760e01b815260040160405180910390fd5b6001600160a01b038216600090815260106020526040902054829060ff161515600114610d1757604051635136618d60e11b815260040160405180910390fd5b60405163ebb4a55f60e01b81526001600160a01b0384169063ebb4a55f90610d4390859060040161258b565b600060405180830381600087803b158015610d5d57600080fd5b505af1158015610d71573d6000803e3d6000fd5b50505050505050565b610d95838383604051806020016040528060008152506117e0565b505050565b600a546001600160a01b03163314610dc8576040516001620aed3360e41b0319815260040160405180910390fd5b6001600160a01b038316600090815260106020526040902054839060ff161515600114610e0857604051635136618d60e11b815260040160405180910390fd5b604051638e7d1e4360e01b81526001600160a01b0384811660048301528315156024830152851690638e7d1e43906044015b600060405180830381600087803b158015610e5457600080fd5b505af1158015610e68573d6000803e3d6000fd5b5050505050505050565b610e7a611ac3565b600d610e878284836126af565b507f6741b2fc379fad678116fe3d4d4b9a1a184ab53ba36b86ad0fa66340b1ab41ad8282604051610a5792919061276f565b6008546001600160a01b03163314610ef657600a546001600160a01b03163314610ef6576040516359d9793760e01b815260040160405180910390fd5b60005b601154811015610f585760006010600060118481548110610f1c57610f1c612783565b6000918252602080832091909101546001600160a01b031683528201929092526040019020805460ff1916911515919091179055600101610ef9565b5060005b81811015610fc157600160106000858585818110610f7c57610f7c612783565b9050602002016020810190610f919190612253565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055600101610f5c565b50610fce60118383611e15565b507fbbd3b69c138de4d317d0bc4290282c4e1cbd1e58b579a5b4f114b598c237454d8282604051610a57929190612799565b600061087082611aee565b6008546001600160a01b0316331461104857600a546001600160a01b03163314611048576040516359d9793760e01b815260040160405180910390fd5b6001600160a01b038316600090815260106020526040902054839060ff16151560011461108857604051635136618d60e11b815260040160405180910390fd5b6040516396751ae960e01b81526001600160a01b038516906396751ae990610e3a9086908690600401612799565b3360009081526010602052604090205460ff1615156001146110eb57604051635136618d60e11b815260040160405180910390fd5b6110f58282611b55565b5050565b611101611ac3565b6001600160a01b038216600090815260106020526040902054829060ff16151560011461114157604051635136618d60e11b815260040160405180910390fd5b60405163024e71b760e31b81526001600160a01b0383811660048301528416906312738db890602401610d43565b6060600d8054610885906124e3565b611186611ac3565b600c8190556040518181527f7810bd47de260c3e9ee10061cf438099dd12256c79485f12f94dbccc981e806c906020015b60405180910390a150565b60006001600160a01b0382166111eb576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b611218611ac3565b6112226000611c53565b565b6009546001600160a01b031633811461125057604051636b7584e760e11b815260040160405180910390fd5b600980546001600160a01b0319169055604051600081527f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974da9060200160405180910390a161129d81611c53565b50565b6008546001600160a01b031633146112dd57600a546001600160a01b031633146112dd576040516359d9793760e01b815260040160405180910390fd5b6001600160a01b038316600090815260106020526040902054839060ff16151560011461131d57604051635136618d60e11b815260040160405180910390fd5b60405163b957d0cb60e01b81526001600160a01b0385169063b957d0cb90610e3a908690869060040161276f565b6001600160a01b03811660009081526005602052604080822054901c6001600160401b0316908061137a610a63565b600c549395909450915050565b600a546001600160a01b031633146113b5576040516001620aed3360e41b0319815260040160405180910390fd5b6001600160a01b0381166113dc57604051633536be7f60e21b815260040160405180910390fd5b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527fffa60f32d5278b35b1a3350ca92518fb5fe53e54ad07ac6355a17f54c5296b1f906020016111b7565b611432611ac3565b600e61143f8284836126af565b507f905d981207a7d0b6c62cc46ab0be2a076d0298e4a86d0ab79882dbd01ac373788282604051610a5792919061276f565b606060038054610885906124e3565b600a546001600160a01b031633146114ae576040516001620aed3360e41b0319815260040160405180910390fd5b600b80546001600160a01b0319169055604051600081527fffa60f32d5278b35b1a3350ca92518fb5fe53e54ad07ac6355a17f54c5296b1f90602001610abc565b6114f7611ac3565b6001600160a01b038216600090815260106020526040902054829060ff16151560011461153757604051635136618d60e11b815260040160405180910390fd5b604051632f1a98a760e21b81523060048201526000906001600160a01b0385169063bc6a629c9060240160a060405180830381865afa15801561157e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a29190612825565b905060006115b5368590038501856128aa565b60608084015161ffff1690820152600160808401526040516336ccc91360e11b81529091506001600160a01b03861690636d999226906115f9908490600401612918565b600060405180830381600087803b15801561161357600080fd5b505af1158015611627573d6000803e3d6000fd5b505050505050505050565b336001600160a01b0383160361165b5760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600a546001600160a01b031633146116f5576040516001620aed3360e41b0319815260040160405180910390fd5b6001600160a01b038216600090815260106020526040902054829060ff16151560011461173557604051635136618d60e11b815260040160405180910390fd5b604051632f1a98a760e21b81523060048201526000906001600160a01b0385169063bc6a629c9060240160a060405180830381865afa15801561177c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a09190612825565b61ffff84166060820152600160808201526040516336ccc91360e11b81529091506001600160a01b03851690636d99922690610e3a908490600401612918565b6117eb848484610ac6565b6001600160a01b0383163b156118245761180784848484611ca5565b611824576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6008546001600160a01b0316331461186757600a546001600160a01b03163314611867576040516359d9793760e01b815260040160405180910390fd5b6001600160a01b038316600090815260106020526040902054839060ff1615156001146118a757604051635136618d60e11b815260040160405180910390fd5b604051632efc6ac360e21b81526001600160a01b0385169063bbf1ab0c90610e3a9030908790879060040161299b565b600a546001600160a01b03163314611905576040516001620aed3360e41b0319815260040160405180910390fd5b600a80546001600160a01b031916905560405160009033907f222c8e95a03c7aa95fc5d110485e0d38e767f07ab1ec878a6eac644ef1d83122908390a3565b606061194f82611a9c565b61196c57604051630a14c4b560e41b815260040160405180910390fd5b600061197661116f565b9050805160000361199657604051806020016040528060008152506119c1565b806119a084611d91565b6040516020016119b1929190612a79565b6040516020818303038152906040525b9392505050565b6060600e8054610885906124e3565b600b546001600160a01b0316338114611a03576040516353bb059b60e01b815260040160405180910390fd5b611a0c81611dc9565b50600b80546001600160a01b0319169055565b611a27611ac3565b6001600160a01b038116611a4e57604051633a247dd760e11b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974da906020016111b7565b6000805482108015610870575050600090815260046020526040902054600160e01b161590565b6008546001600160a01b0316331461122257604051635fc483c560e01b815260040160405180910390fd5b600081600054811015611b3c5760008181526004602052604081205490600160e01b82169003611b3a575b806000036119c1575060001901600081815260046020526040902054611b19565b505b604051636f96cda160e11b815260040160405180910390fd5b6000805490829003611b7a5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b818114611c2957808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101611bf1565b5081600003611c4a57604051622e076360e81b815260040160405180910390fd5b60005550505050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611cda903390899088908890600401612aa8565b6020604051808303816000875af1925050508015611d15575060408051601f3d908101601f19168201909252611d1291810190612adb565b60015b611d73573d808015611d43576040519150601f19603f3d011682016040523d82523d6000602084013e611d48565b606091505b508051600003611d6b576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b604080516080019081905280825b600183039250600a81066030018353600a900480611d9f5750819003601f19909101908152919050565b600a80546001600160a01b0319166001600160a01b03831690811790915560405133907f222c8e95a03c7aa95fc5d110485e0d38e767f07ab1ec878a6eac644ef1d8312290600090a350565b828054828255906000526020600020908101928215611e68579160200282015b82811115611e685781546001600160a01b0319166001600160a01b03843516178255602090920191600190910190611e35565b50611e74929150611e78565b5090565b5b80821115611e745760008155600101611e79565b6001600160e01b03198116811461129d57600080fd5b600060208284031215611eb557600080fd5b81356119c181611e8d565b60005b83811015611edb578181015183820152602001611ec3565b838111156118245750506000910152565b60008151808452611f04816020860160208601611ec0565b601f01601f19169290920160200192915050565b6020815260006119c16020830184611eec565b600060208284031215611f3d57600080fd5b5035919050565b80356001600160a01b0381168114611f5b57600080fd5b919050565b60008060408385031215611f7357600080fd5b611f7c83611f44565b946020939093013593505050565b600080600060608486031215611f9f57600080fd5b611fa884611f44565b9250611fb660208501611f44565b9150604084013590509250925092565b60008083601f840112611fd857600080fd5b5081356001600160401b03811115611fef57600080fd5b60208301915083602082850101111561200757600080fd5b9250929050565b6000806000806060858703121561202457600080fd5b843593506020850135925060408501356001600160401b0381111561204857600080fd5b61205487828801611fc6565b95989497509550505050565b6000806040838503121561207357600080fd5b61207c83611f44565b915060208301356001600160401b0381111561209757600080fd5b8301606081860312156120a957600080fd5b809150509250929050565b801515811461129d57600080fd5b8035611f5b816120b4565b6000806000606084860312156120e257600080fd5b6120eb84611f44565b92506120f960208501611f44565b91506040840135612109816120b4565b809150509250925092565b6000806020838503121561212757600080fd5b82356001600160401b0381111561213d57600080fd5b61214985828601611fc6565b90969095509350505050565b60008083601f84011261216757600080fd5b5081356001600160401b0381111561217e57600080fd5b6020830191508360208260051b850101111561200757600080fd5b600080602083850312156121ac57600080fd5b82356001600160401b038111156121c257600080fd5b61214985828601612155565b6000806000604084860312156121e357600080fd5b6121ec84611f44565b925060208401356001600160401b0381111561220757600080fd5b61221386828701612155565b9497909650939450505050565b6000806040838503121561223357600080fd5b61223c83611f44565b915061224a60208401611f44565b90509250929050565b60006020828403121561226557600080fd5b6119c182611f44565b60008060006040848603121561228357600080fd5b61228c84611f44565b925060208401356001600160401b038111156122a757600080fd5b61221386828701611fc6565b60008082840360c08112156122c757600080fd5b6122d084611f44565b925060a0601f19820112156122e457600080fd5b506020830190509250929050565b6000806040838503121561230557600080fd5b61230e83611f44565b915060208301356120a9816120b4565b61ffff8116811461129d57600080fd5b8035611f5b8161231e565b6000806040838503121561234c57600080fd5b61235583611f44565b915060208301356120a98161231e565b634e487b7160e01b600052604160045260246000fd5b60405160a081016001600160401b038111828210171561239d5761239d612365565b60405290565b604051601f8201601f191681016001600160401b03811182821017156123cb576123cb612365565b604052919050565b600080600080608085870312156123e957600080fd5b6123f285611f44565b93506020612401818701611f44565b93506040860135925060608601356001600160401b038082111561242457600080fd5b818801915088601f83011261243857600080fd5b81358181111561244a5761244a612365565b61245c601f8201601f191685016123a3565b9150808252898482850101111561247257600080fd5b808484018584013760008482840101525080935050505092959194509250565b60008060008385036101408112156124a957600080fd5b6124b285611f44565b93506124c060208601611f44565b9250610100603f19820112156124d557600080fd5b506040840190509250925092565b600181811c908216806124f757607f821691505b60208210810361251757634e487b7160e01b600052602260045260246000fd5b50919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000808335601e1984360301811261255d57600080fd5b83016020810192503590506001600160401b0381111561257c57600080fd5b80360382131561200757600080fd5b600060208083526080830184358285015281850135601e198636030181126125b257600080fd5b850182810190356001600160401b038111156125cd57600080fd5b8060051b8036038313156125e057600080fd5b606060408801529281905260a09286018301928290870160005b8381101561263457888603609f190182526126158386612546565b61262088828461251d565b9750505091860191908601906001016125fa565b50505050506126466040860186612546565b858303601f19016060870152925061265f82848361251d565b9695505050505050565b601f821115610d9557600081815260208120601f850160051c810160208610156126905750805b601f850160051c820191505b81811015610c575782815560010161269c565b6001600160401b038311156126c6576126c6612365565b6126da836126d483546124e3565b83612669565b6000601f84116001811461270e57600085156126f65750838201355b600019600387901b1c1916600186901b178355612768565b600083815260209020601f19861690835b8281101561273f578685013582556020948501946001909201910161271f565b508682101561275c5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b602081526000611d8960208301848661251d565b634e487b7160e01b600052603260045260246000fd5b60208082528181018390526000908460408401835b868110156127da576001600160a01b036127c784611f44565b16825291830191908301906001016127ae565b509695505050505050565b69ffffffffffffffffffff8116811461129d57600080fd5b6001600160401b038116811461129d57600080fd5b64ffffffffff8116811461129d57600080fd5b600060a0828403121561283757600080fd5b61283f61237b565b825161284a816127e5565b8152602083015161285a816127fd565b6020820152604083015161286d81612812565b604082015260608301516128808161231e565b60608201526080830151612893816120b4565b60808201529392505050565b8035611f5b81612812565b600060a082840312156128bc57600080fd5b6128c461237b565b82356128cf816127e5565b815260208301356128df816127fd565b602082015260408301356128f281612812565b604082015260608301356129058161231e565b60608201526080830135612893816120b4565b600060a08201905069ffffffffffffffffffff83511682526001600160401b03602084015116602083015264ffffffffff604084015116604083015261ffff606084015116606083015260808301511515608083015292915050565b803565ffffffffffff81168114611f5b57600080fd5b803560ff81168114611f5b57600080fd5b6001600160a01b03848116825283166020820152610140810182356129bf816127e5565b69ffffffffffffffffffff16604083015260208301356129de8161231e565b61ffff1660608301526129f360408401612974565b65ffffffffffff166080830152612a0c60608401612974565b65ffffffffffff1660a0830152612a256080840161298a565b60ff1660c0830152612a3960a0840161289f565b64ffffffffff1660e0830152612a5160c0840161232e565b61ffff16610100830152612a6760e084016120c2565b80151561012084015250949350505050565b60008351612a8b818460208801611ec0565b835190830190612a9f818360208801611ec0565b01949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061265f90830184611eec565b600060208284031215612aed57600080fd5b81516119c181611e8d56fea2646970667358221220a8b69222abbfc85cfd8758ac91aed58c8e61ed93e8772d134b48c7b8ff3de57964736f6c634300080f0033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000fba662e1a8e91a350702cf3b87d0c2d2fb4ba57f00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000016436f6f6c20436f6c6f7273205465737420546f6b656e000000000000000000000000000000000000000000000000000000000000000000000000000000000006434354657374000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002fb6feb663c481e9854a251002c772fead3974d6
Deployed Bytecode
0x6080604052600436106102725760003560e01c806379ba50971161014f578063b88d4fde116100c1578063d5e7feb81161007a578063d5e7feb814610736578063e8a3d48514610756578063e985e9c51461076b578063f0025d96146107b4578063f2fde38b146107c9578063f53d0a8e146107e957600080fd5b8063b88d4fde14610697578063bbf1ab0c146106b7578063c6ab67a3146106d7578063c780b63d146106ec578063c87b56dd14610701578063d5abeb011461072157600080fd5b8063938e3d7b11610113578063938e3d7b146105ed57806395d89b411461060d5780639794ed4014610622578063998c05d814610637578063a22cb46514610657578063b0c1361a1461067757600080fd5b806379ba50971461053d5780637a05bc8214610552578063840e15d4146105725780638da5cb5b146105ad578063913ee93d146105cd57600080fd5b806348a4c101116101e857806364869dad116101ac57806364869dad146104a057806366251b69146104b35780636c0360eb146104d35780636f8b44b0146104e857806370a0823114610508578063715018a61461052857600080fd5b806348a4c1011461040057806355f804b31461042057806360c308b6146104405780636352211e146104605780636407ab101461048057600080fd5b806318160ddd1161023a57806318160ddd1461034857806323452b9c1461036b57806323b872dd1461038057806329e31c1b146103a05780633680620d146103c057806342842e0e146103e057600080fd5b806301ffc9a71461027757806306fdde03146102ac578063081812fc146102ce578063095ea7b314610306578063099b6bfa14610328575b600080fd5b34801561028357600080fd5b50610297610292366004611ea3565b610809565b60405190151581526020015b60405180910390f35b3480156102b857600080fd5b506102c1610876565b6040516102a39190611f18565b3480156102da57600080fd5b506102ee6102e9366004611f2b565b610908565b6040516001600160a01b0390911681526020016102a3565b34801561031257600080fd5b50610326610321366004611f60565b61094c565b005b34801561033457600080fd5b50610326610343366004611f2b565b6109ec565b34801561035457600080fd5b5061035d610a63565b6040519081526020016102a3565b34801561037757600080fd5b50610326610a77565b34801561038c57600080fd5b5061032661039b366004611f8a565b610ac6565b3480156103ac57600080fd5b506103266103bb36600461200e565b610c5f565b3480156103cc57600080fd5b506103266103db366004612060565b610c9a565b3480156103ec57600080fd5b506103266103fb366004611f8a565b610d7a565b34801561040c57600080fd5b5061032661041b3660046120cd565b610d9a565b34801561042c57600080fd5b5061032661043b366004612114565b610e72565b34801561044c57600080fd5b5061032661045b366004612199565b610eb9565b34801561046c57600080fd5b506102ee61047b366004611f2b565b611000565b34801561048c57600080fd5b5061032661049b3660046121ce565b61100b565b6103266104ae366004611f60565b6110b6565b3480156104bf57600080fd5b506103266104ce366004612220565b6110f9565b3480156104df57600080fd5b506102c161116f565b3480156104f457600080fd5b50610326610503366004611f2b565b61117e565b34801561051457600080fd5b5061035d610523366004612253565b6111c2565b34801561053457600080fd5b50610326611210565b34801561054957600080fd5b50610326611224565b34801561055e57600080fd5b5061032661056d36600461226e565b6112a0565b34801561057e57600080fd5b5061059261058d366004612253565b61134b565b604080519384526020840192909252908201526060016102a3565b3480156105b957600080fd5b506008546102ee906001600160a01b031681565b3480156105d957600080fd5b506103266105e8366004612253565b611387565b3480156105f957600080fd5b50610326610608366004612114565b61142a565b34801561061957600080fd5b506102c1611471565b34801561062e57600080fd5b50610326611480565b34801561064357600080fd5b506103266106523660046122b3565b6114ef565b34801561066357600080fd5b506103266106723660046122f2565b611632565b34801561068357600080fd5b50610326610692366004612339565b6116c7565b3480156106a357600080fd5b506103266106b23660046123d3565b6117e0565b3480156106c357600080fd5b506103266106d2366004612492565b61182a565b3480156106e357600080fd5b50600f5461035d565b3480156106f857600080fd5b506103266118d7565b34801561070d57600080fd5b506102c161071c366004611f2b565b611944565b34801561072d57600080fd5b50600c5461035d565b34801561074257600080fd5b50600b546102ee906001600160a01b031681565b34801561076257600080fd5b506102c16119c8565b34801561077757600080fd5b50610297610786366004612220565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b3480156107c057600080fd5b506103266119d7565b3480156107d557600080fd5b506103266107e4366004612253565b611a1f565b3480156107f557600080fd5b50600a546102ee906001600160a01b031681565b60006001600160e01b031982166301ffc9a760e01b148061083a57506001600160e01b031982166380ac58cd60e01b145b8061085557506001600160e01b03198216632fd0239360e01b145b8061087057506001600160e01b0319821663290d607b60e21b145b92915050565b606060028054610885906124e3565b80601f01602080910402602001604051908101604052809291908181526020018280546108b1906124e3565b80156108fe5780601f106108d3576101008083540402835291602001916108fe565b820191906000526020600020905b8154815290600101906020018083116108e157829003601f168201915b5050505050905090565b600061091382611a9c565b610930576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061095782611000565b9050336001600160a01b03821614610990576109738133610786565b610990576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6109f4611ac3565b60006109fe610a63565b1115610a1d5760405163e03264af60e01b815260040160405180910390fd5b600f80549082905560408051828152602081018490527f7c22004198bf87da0f0dab623c72e66ca1200f4454aa3b9ca30f436275428b7c91015b60405180910390a15050565b6000610a726001546000540390565b905090565b610a7f611ac3565b600980546001600160a01b0319169055604051600081527f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974da906020015b60405180910390a1565b6000610ad182611aee565b9050836001600160a01b0316816001600160a01b031614610b045760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610b5157610b348633610786565b610b5157604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610b7857604051633a954ecd60e21b815260040160405180910390fd5b8015610b8357600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003610c1557600184016000818152600460205260408120549003610c13576000548114610c135760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b610c67611ac3565b604051839085907fa367e77d52123b7db91661964f869e6d260e9050507402788a87ca8ad38687e790600090a350505050565b6008546001600160a01b03163314610cd757600a546001600160a01b03163314610cd7576040516359d9793760e01b815260040160405180910390fd5b6001600160a01b038216600090815260106020526040902054829060ff161515600114610d1757604051635136618d60e11b815260040160405180910390fd5b60405163ebb4a55f60e01b81526001600160a01b0384169063ebb4a55f90610d4390859060040161258b565b600060405180830381600087803b158015610d5d57600080fd5b505af1158015610d71573d6000803e3d6000fd5b50505050505050565b610d95838383604051806020016040528060008152506117e0565b505050565b600a546001600160a01b03163314610dc8576040516001620aed3360e41b0319815260040160405180910390fd5b6001600160a01b038316600090815260106020526040902054839060ff161515600114610e0857604051635136618d60e11b815260040160405180910390fd5b604051638e7d1e4360e01b81526001600160a01b0384811660048301528315156024830152851690638e7d1e43906044015b600060405180830381600087803b158015610e5457600080fd5b505af1158015610e68573d6000803e3d6000fd5b5050505050505050565b610e7a611ac3565b600d610e878284836126af565b507f6741b2fc379fad678116fe3d4d4b9a1a184ab53ba36b86ad0fa66340b1ab41ad8282604051610a5792919061276f565b6008546001600160a01b03163314610ef657600a546001600160a01b03163314610ef6576040516359d9793760e01b815260040160405180910390fd5b60005b601154811015610f585760006010600060118481548110610f1c57610f1c612783565b6000918252602080832091909101546001600160a01b031683528201929092526040019020805460ff1916911515919091179055600101610ef9565b5060005b81811015610fc157600160106000858585818110610f7c57610f7c612783565b9050602002016020810190610f919190612253565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055600101610f5c565b50610fce60118383611e15565b507fbbd3b69c138de4d317d0bc4290282c4e1cbd1e58b579a5b4f114b598c237454d8282604051610a57929190612799565b600061087082611aee565b6008546001600160a01b0316331461104857600a546001600160a01b03163314611048576040516359d9793760e01b815260040160405180910390fd5b6001600160a01b038316600090815260106020526040902054839060ff16151560011461108857604051635136618d60e11b815260040160405180910390fd5b6040516396751ae960e01b81526001600160a01b038516906396751ae990610e3a9086908690600401612799565b3360009081526010602052604090205460ff1615156001146110eb57604051635136618d60e11b815260040160405180910390fd5b6110f58282611b55565b5050565b611101611ac3565b6001600160a01b038216600090815260106020526040902054829060ff16151560011461114157604051635136618d60e11b815260040160405180910390fd5b60405163024e71b760e31b81526001600160a01b0383811660048301528416906312738db890602401610d43565b6060600d8054610885906124e3565b611186611ac3565b600c8190556040518181527f7810bd47de260c3e9ee10061cf438099dd12256c79485f12f94dbccc981e806c906020015b60405180910390a150565b60006001600160a01b0382166111eb576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b611218611ac3565b6112226000611c53565b565b6009546001600160a01b031633811461125057604051636b7584e760e11b815260040160405180910390fd5b600980546001600160a01b0319169055604051600081527f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974da9060200160405180910390a161129d81611c53565b50565b6008546001600160a01b031633146112dd57600a546001600160a01b031633146112dd576040516359d9793760e01b815260040160405180910390fd5b6001600160a01b038316600090815260106020526040902054839060ff16151560011461131d57604051635136618d60e11b815260040160405180910390fd5b60405163b957d0cb60e01b81526001600160a01b0385169063b957d0cb90610e3a908690869060040161276f565b6001600160a01b03811660009081526005602052604080822054901c6001600160401b0316908061137a610a63565b600c549395909450915050565b600a546001600160a01b031633146113b5576040516001620aed3360e41b0319815260040160405180910390fd5b6001600160a01b0381166113dc57604051633536be7f60e21b815260040160405180910390fd5b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527fffa60f32d5278b35b1a3350ca92518fb5fe53e54ad07ac6355a17f54c5296b1f906020016111b7565b611432611ac3565b600e61143f8284836126af565b507f905d981207a7d0b6c62cc46ab0be2a076d0298e4a86d0ab79882dbd01ac373788282604051610a5792919061276f565b606060038054610885906124e3565b600a546001600160a01b031633146114ae576040516001620aed3360e41b0319815260040160405180910390fd5b600b80546001600160a01b0319169055604051600081527fffa60f32d5278b35b1a3350ca92518fb5fe53e54ad07ac6355a17f54c5296b1f90602001610abc565b6114f7611ac3565b6001600160a01b038216600090815260106020526040902054829060ff16151560011461153757604051635136618d60e11b815260040160405180910390fd5b604051632f1a98a760e21b81523060048201526000906001600160a01b0385169063bc6a629c9060240160a060405180830381865afa15801561157e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a29190612825565b905060006115b5368590038501856128aa565b60608084015161ffff1690820152600160808401526040516336ccc91360e11b81529091506001600160a01b03861690636d999226906115f9908490600401612918565b600060405180830381600087803b15801561161357600080fd5b505af1158015611627573d6000803e3d6000fd5b505050505050505050565b336001600160a01b0383160361165b5760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600a546001600160a01b031633146116f5576040516001620aed3360e41b0319815260040160405180910390fd5b6001600160a01b038216600090815260106020526040902054829060ff16151560011461173557604051635136618d60e11b815260040160405180910390fd5b604051632f1a98a760e21b81523060048201526000906001600160a01b0385169063bc6a629c9060240160a060405180830381865afa15801561177c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a09190612825565b61ffff84166060820152600160808201526040516336ccc91360e11b81529091506001600160a01b03851690636d99922690610e3a908490600401612918565b6117eb848484610ac6565b6001600160a01b0383163b156118245761180784848484611ca5565b611824576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6008546001600160a01b0316331461186757600a546001600160a01b03163314611867576040516359d9793760e01b815260040160405180910390fd5b6001600160a01b038316600090815260106020526040902054839060ff1615156001146118a757604051635136618d60e11b815260040160405180910390fd5b604051632efc6ac360e21b81526001600160a01b0385169063bbf1ab0c90610e3a9030908790879060040161299b565b600a546001600160a01b03163314611905576040516001620aed3360e41b0319815260040160405180910390fd5b600a80546001600160a01b031916905560405160009033907f222c8e95a03c7aa95fc5d110485e0d38e767f07ab1ec878a6eac644ef1d83122908390a3565b606061194f82611a9c565b61196c57604051630a14c4b560e41b815260040160405180910390fd5b600061197661116f565b9050805160000361199657604051806020016040528060008152506119c1565b806119a084611d91565b6040516020016119b1929190612a79565b6040516020818303038152906040525b9392505050565b6060600e8054610885906124e3565b600b546001600160a01b0316338114611a03576040516353bb059b60e01b815260040160405180910390fd5b611a0c81611dc9565b50600b80546001600160a01b0319169055565b611a27611ac3565b6001600160a01b038116611a4e57604051633a247dd760e11b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f11a3cf439fb225bfe74225716b6774765670ec1060e3796802e62139d69974da906020016111b7565b6000805482108015610870575050600090815260046020526040902054600160e01b161590565b6008546001600160a01b0316331461122257604051635fc483c560e01b815260040160405180910390fd5b600081600054811015611b3c5760008181526004602052604081205490600160e01b82169003611b3a575b806000036119c1575060001901600081815260046020526040902054611b19565b505b604051636f96cda160e11b815260040160405180910390fd5b6000805490829003611b7a5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b818114611c2957808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a4600101611bf1565b5081600003611c4a57604051622e076360e81b815260040160405180910390fd5b60005550505050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611cda903390899088908890600401612aa8565b6020604051808303816000875af1925050508015611d15575060408051601f3d908101601f19168201909252611d1291810190612adb565b60015b611d73573d808015611d43576040519150601f19603f3d011682016040523d82523d6000602084013e611d48565b606091505b508051600003611d6b576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b604080516080019081905280825b600183039250600a81066030018353600a900480611d9f5750819003601f19909101908152919050565b600a80546001600160a01b0319166001600160a01b03831690811790915560405133907f222c8e95a03c7aa95fc5d110485e0d38e767f07ab1ec878a6eac644ef1d8312290600090a350565b828054828255906000526020600020908101928215611e68579160200282015b82811115611e685781546001600160a01b0319166001600160a01b03843516178255602090920191600190910190611e35565b50611e74929150611e78565b5090565b5b80821115611e745760008155600101611e79565b6001600160e01b03198116811461129d57600080fd5b600060208284031215611eb557600080fd5b81356119c181611e8d565b60005b83811015611edb578181015183820152602001611ec3565b838111156118245750506000910152565b60008151808452611f04816020860160208601611ec0565b601f01601f19169290920160200192915050565b6020815260006119c16020830184611eec565b600060208284031215611f3d57600080fd5b5035919050565b80356001600160a01b0381168114611f5b57600080fd5b919050565b60008060408385031215611f7357600080fd5b611f7c83611f44565b946020939093013593505050565b600080600060608486031215611f9f57600080fd5b611fa884611f44565b9250611fb660208501611f44565b9150604084013590509250925092565b60008083601f840112611fd857600080fd5b5081356001600160401b03811115611fef57600080fd5b60208301915083602082850101111561200757600080fd5b9250929050565b6000806000806060858703121561202457600080fd5b843593506020850135925060408501356001600160401b0381111561204857600080fd5b61205487828801611fc6565b95989497509550505050565b6000806040838503121561207357600080fd5b61207c83611f44565b915060208301356001600160401b0381111561209757600080fd5b8301606081860312156120a957600080fd5b809150509250929050565b801515811461129d57600080fd5b8035611f5b816120b4565b6000806000606084860312156120e257600080fd5b6120eb84611f44565b92506120f960208501611f44565b91506040840135612109816120b4565b809150509250925092565b6000806020838503121561212757600080fd5b82356001600160401b0381111561213d57600080fd5b61214985828601611fc6565b90969095509350505050565b60008083601f84011261216757600080fd5b5081356001600160401b0381111561217e57600080fd5b6020830191508360208260051b850101111561200757600080fd5b600080602083850312156121ac57600080fd5b82356001600160401b038111156121c257600080fd5b61214985828601612155565b6000806000604084860312156121e357600080fd5b6121ec84611f44565b925060208401356001600160401b0381111561220757600080fd5b61221386828701612155565b9497909650939450505050565b6000806040838503121561223357600080fd5b61223c83611f44565b915061224a60208401611f44565b90509250929050565b60006020828403121561226557600080fd5b6119c182611f44565b60008060006040848603121561228357600080fd5b61228c84611f44565b925060208401356001600160401b038111156122a757600080fd5b61221386828701611fc6565b60008082840360c08112156122c757600080fd5b6122d084611f44565b925060a0601f19820112156122e457600080fd5b506020830190509250929050565b6000806040838503121561230557600080fd5b61230e83611f44565b915060208301356120a9816120b4565b61ffff8116811461129d57600080fd5b8035611f5b8161231e565b6000806040838503121561234c57600080fd5b61235583611f44565b915060208301356120a98161231e565b634e487b7160e01b600052604160045260246000fd5b60405160a081016001600160401b038111828210171561239d5761239d612365565b60405290565b604051601f8201601f191681016001600160401b03811182821017156123cb576123cb612365565b604052919050565b600080600080608085870312156123e957600080fd5b6123f285611f44565b93506020612401818701611f44565b93506040860135925060608601356001600160401b038082111561242457600080fd5b818801915088601f83011261243857600080fd5b81358181111561244a5761244a612365565b61245c601f8201601f191685016123a3565b9150808252898482850101111561247257600080fd5b808484018584013760008482840101525080935050505092959194509250565b60008060008385036101408112156124a957600080fd5b6124b285611f44565b93506124c060208601611f44565b9250610100603f19820112156124d557600080fd5b506040840190509250925092565b600181811c908216806124f757607f821691505b60208210810361251757634e487b7160e01b600052602260045260246000fd5b50919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000808335601e1984360301811261255d57600080fd5b83016020810192503590506001600160401b0381111561257c57600080fd5b80360382131561200757600080fd5b600060208083526080830184358285015281850135601e198636030181126125b257600080fd5b850182810190356001600160401b038111156125cd57600080fd5b8060051b8036038313156125e057600080fd5b606060408801529281905260a09286018301928290870160005b8381101561263457888603609f190182526126158386612546565b61262088828461251d565b9750505091860191908601906001016125fa565b50505050506126466040860186612546565b858303601f19016060870152925061265f82848361251d565b9695505050505050565b601f821115610d9557600081815260208120601f850160051c810160208610156126905750805b601f850160051c820191505b81811015610c575782815560010161269c565b6001600160401b038311156126c6576126c6612365565b6126da836126d483546124e3565b83612669565b6000601f84116001811461270e57600085156126f65750838201355b600019600387901b1c1916600186901b178355612768565b600083815260209020601f19861690835b8281101561273f578685013582556020948501946001909201910161271f565b508682101561275c5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b602081526000611d8960208301848661251d565b634e487b7160e01b600052603260045260246000fd5b60208082528181018390526000908460408401835b868110156127da576001600160a01b036127c784611f44565b16825291830191908301906001016127ae565b509695505050505050565b69ffffffffffffffffffff8116811461129d57600080fd5b6001600160401b038116811461129d57600080fd5b64ffffffffff8116811461129d57600080fd5b600060a0828403121561283757600080fd5b61283f61237b565b825161284a816127e5565b8152602083015161285a816127fd565b6020820152604083015161286d81612812565b604082015260608301516128808161231e565b60608201526080830151612893816120b4565b60808201529392505050565b8035611f5b81612812565b600060a082840312156128bc57600080fd5b6128c461237b565b82356128cf816127e5565b815260208301356128df816127fd565b602082015260408301356128f281612812565b604082015260608301356129058161231e565b60608201526080830135612893816120b4565b600060a08201905069ffffffffffffffffffff83511682526001600160401b03602084015116602083015264ffffffffff604084015116604083015261ffff606084015116606083015260808301511515608083015292915050565b803565ffffffffffff81168114611f5b57600080fd5b803560ff81168114611f5b57600080fd5b6001600160a01b03848116825283166020820152610140810182356129bf816127e5565b69ffffffffffffffffffff16604083015260208301356129de8161231e565b61ffff1660608301526129f360408401612974565b65ffffffffffff166080830152612a0c60608401612974565b65ffffffffffff1660a0830152612a256080840161298a565b60ff1660c0830152612a3960a0840161289f565b64ffffffffff1660e0830152612a5160c0840161232e565b61ffff16610100830152612a6760e084016120c2565b80151561012084015250949350505050565b60008351612a8b818460208801611ec0565b835190830190612a9f818360208801611ec0565b01949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061265f90830184611eec565b600060208284031215612aed57600080fd5b81516119c181611e8d56fea2646970667358221220a8b69222abbfc85cfd8758ac91aed58c8e61ed93e8772d134b48c7b8ff3de57964736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000fba662e1a8e91a350702cf3b87d0c2d2fb4ba57f00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000016436f6f6c20436f6c6f7273205465737420546f6b656e000000000000000000000000000000000000000000000000000000000000000000000000000000000006434354657374000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000002fb6feb663c481e9854a251002c772fead3974d6
-----Decoded View---------------
Arg [0] : name (string): Cool Colors Test Token
Arg [1] : symbol (string): CCTest
Arg [2] : administrator (address): 0xfBa662e1a8e91a350702cF3b87D0C2d2Fb4BA57F
Arg [3] : allowedSeaDrop (address[]): 0x2fb6FEB663c481E9854a251002C772FEad3974d6
-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 000000000000000000000000fba662e1a8e91a350702cf3b87d0c2d2fb4ba57f
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000016
Arg [5] : 436f6f6c20436f6c6f7273205465737420546f6b656e00000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [7] : 4343546573740000000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [9] : 0000000000000000000000002fb6feb663c481e9854a251002c772fead3974d6
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.