Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
Overview
Max Total Supply
10,000 RUGBIRD
Holders
3,303
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
3 RUGBIRDLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
RugBirds
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 600 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.10 <0.9.0; import "@divergencetech/ethier/contracts/crypto/SignatureChecker.sol"; import "@divergencetech/ethier/contracts/crypto/SignerManager.sol"; import "@divergencetech/ethier/contracts/erc721/BaseTokenURI.sol"; import "@divergencetech/ethier/contracts/erc721/ERC721ACommon.sol"; import "@divergencetech/ethier/contracts/erc721/ERC721Redeemer.sol"; import "@divergencetech/ethier/contracts/sales/FixedPriceSeller.sol"; import "@divergencetech/ethier/contracts/utils/Monotonic.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; interface ITokenURIGenerator { function tokenURI(uint256 tokenId) external view returns (string memory); } contract RugBirds is AccessControlEnumerable, BaseTokenURI, FixedPriceSeller, SignerManager, ERC2981, ERC721ACommon { using EnumerableSet for EnumerableSet.AddressSet; using ERC721Redeemer for ERC721Redeemer.Claims; using Monotonic for Monotonic.Increaser; using SignatureChecker for EnumerableSet.AddressSet; /** @notice Role of administrative users allowed to expel a Moonbird from the nest. @dev See expelFromNest(). */ bytes32 public constant EXPULSION_ROLE = keccak256("EXPULSION_ROLE"); string public storefrontURI; constructor( string memory name, string memory symbol, string memory tknURI, string memory _storefrontURI, uint supplyCap, uint maxPer, address payable beneficiary, address payable royaltyReceiver ) BaseTokenURI(tknURI) FixedPriceSeller( 0, // price of 0 wei Seller.SellerConfig({ totalInventory: supplyCap, maxPerAddress: maxPer, maxPerTx: maxPer, freeQuota: 0, reserveFreeQuota: false, lockFreeQuota: false, lockTotalInventory: true }), beneficiary ) ERC721ACommon( name, // token name symbol, // token symbol beneficiary, // royalty receiver 500 // royalties, bps ) { setStorefrontURI(_storefrontURI); _setDefaultRoyalty(royaltyReceiver, 500); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(EXPULSION_ROLE, msg.sender); } function setStorefrontURI(string memory uri) onlyOwner public { storefrontURI = uri; } function contractURI() public view returns(string memory) { return storefrontURI; } /** @dev Mint tokens purchased via the Seller. */ function _handlePurchase( address to, uint256 n, bool ) internal override { _safeMint(to, n); // We're using two separate pools (one from Seller, and one for PROOF // minting), so add an extra layer of checks for this invariant. This // should never fail as each pool has its own restriction, and is in // place purely for tests (hence assert). assert(totalSupply() <= 10_000); } /** @dev Record of already-used signatures. */ mapping(bytes32 => bool) public usedMessages; /** @notice Mint as a non-holder of PROOF tokens. */ function mintPublic( address to, uint amt ) external payable { _purchase(to, amt); } /** @notice Flag indicating whether holders of PROOF passes can mint. */ bool public proofMintingOpen = false; /** @notice Sets whether holders of PROOF passes can mint. */ function setPROOFMintingOpen(bool open) external onlyOwner { proofMintingOpen = open; } /** @notice Mint unclaimed tokens from the PROOF-holder pool. */ function mintUnclaimed(address to, uint256 n) external onlyOwner { _handlePurchase(to, n, true); } /** @dev tokenId to nesting start time (0 = not nesting). */ mapping(uint256 => uint256) private nestingStarted; /** @dev Cumulative per-token nesting, excluding the current period. */ mapping(uint256 => uint256) private nestingTotal; /** @notice Returns the length of time, in seconds, that the Moonbird has nested. @dev Nesting is tied to a specific Moonbird, not to the owner, so it doesn't reset upon sale. @return nesting Whether the Moonbird is currently nesting. MAY be true with zero current nesting if in the same block as nesting began. @return current Zero if not currently nesting, otherwise the length of time since the most recent nesting began. @return total Total period of time for which the Moonbird has nested across its life, including the current period. */ function nestingPeriod(uint256 tokenId) external view returns ( bool nesting, uint256 current, uint256 total ) { uint256 start = nestingStarted[tokenId]; if (start != 0) { nesting = true; current = block.timestamp - start; } total = current + nestingTotal[tokenId]; } /** @dev MUST only be modified by safeTransferWhileNesting(); if set to 2 then the _beforeTokenTransfer() block while nesting is disabled. */ uint256 private nestingTransfer = 1; /** @notice Transfer a token between addresses while the Moonbird is minting, thus not resetting the nesting period. */ function safeTransferWhileNesting( address from, address to, uint256 tokenId ) external { require(ownerOf(tokenId) == _msgSender(), "Moonbirds: Only owner"); nestingTransfer = 2; safeTransferFrom(from, to, tokenId); nestingTransfer = 1; } /** @dev Block transfers while nesting. */ function _beforeTokenTransfers( address, address, uint256 startTokenId, uint256 quantity ) internal view override { uint256 tokenId = startTokenId; for (uint256 end = tokenId + quantity; tokenId < end; ++tokenId) { require( nestingStarted[tokenId] == 0 || nestingTransfer == 2, "Moonbirds: nesting" ); } } /** @dev Emitted when a Moonbird begins nesting. */ event Nested(uint256 indexed tokenId); /** @dev Emitted when a Moonbird stops nesting; either through standard means or by expulsion. */ event Unnested(uint256 indexed tokenId); /** @dev Emitted when a Moonbird is expelled from the nest. */ event Expelled(uint256 indexed tokenId); /** @notice Whether nesting is currently allowed. @dev If false then nesting is blocked, but unnesting is always allowed. */ bool public nestingOpen = false; /** @notice Toggles the `nestingOpen` flag. */ function setNestingOpen(bool open) external onlyOwner { nestingOpen = open; } /** @notice Changes the Moonbird's nesting status. */ function toggleNesting(uint256 tokenId) internal onlyApprovedOrOwner(tokenId) { uint256 start = nestingStarted[tokenId]; if (start == 0) { require(nestingOpen, "Moonbirds: nesting closed"); nestingStarted[tokenId] = block.timestamp; emit Nested(tokenId); } else { nestingTotal[tokenId] += block.timestamp - start; nestingStarted[tokenId] = 0; emit Unnested(tokenId); } } /** @notice Changes the Moonbirds' nesting statuss (what's the plural of status? statii? statuses? status? The plural of sheep is sheep; maybe it's also the plural of status). @dev Changes the Moonbirds' nesting sheep (see @notice). */ function toggleNesting(uint256[] calldata tokenIds) external { uint256 n = tokenIds.length; for (uint256 i = 0; i < n; ++i) { toggleNesting(tokenIds[i]); } } /** @notice Admin-only ability to expel a Moonbird from the nest. @dev As most sales listings use off-chain signatures it's impossible to detect someone who has nested and then deliberately undercuts the floor price in the knowledge that the sale can't proceed. This function allows for monitoring of such practices and expulsion if abuse is detected, allowing the undercutting bird to be sold on the open market. Since OpenSea uses isApprovedForAll() in its pre-listing checks, we can't block by that means because nesting would then be all-or-nothing for all of a particular owner's Moonbirds. */ function expelFromNest(uint256 tokenId) external onlyRole(EXPULSION_ROLE) { require(nestingStarted[tokenId] != 0, "Moonbirds: not nested"); nestingTotal[tokenId] += block.timestamp - nestingStarted[tokenId]; nestingStarted[tokenId] = 0; emit Unnested(tokenId); emit Expelled(tokenId); } /** @dev Required override to select the correct baseTokenURI. */ function _baseURI() internal view override(BaseTokenURI, ERC721A) returns (string memory) { return BaseTokenURI._baseURI(); } /** @notice If set, contract to which tokenURI() calls are proxied. */ ITokenURIGenerator public renderingContract; /** @notice Sets the optional tokenURI override contract. */ function setRenderingContract(ITokenURIGenerator _contract) external onlyOwner { renderingContract = _contract; } /** @notice If renderingContract is set then returns its tokenURI(tokenId) return value, otherwise returns the standard baseTokenURI + tokenId. */ function tokenURI(uint256 tokenId) public view override returns (string memory) { if (address(renderingContract) != address(0)) { return renderingContract.tokenURI(tokenId); } return super.tokenURI(tokenId); } /** @notice Sets the contract-wide royalty info. */ function setRoyaltyInfo(address receiver, uint96 feeBasisPoints) external onlyOwner { _setDefaultRoyalty(receiver, feeBasisPoints); } function supportsInterface(bytes4 interfaceId) public view override(ERC721ACommon, ERC2981, AccessControlEnumerable) returns (bool) { return super.supportsInterface(interfaceId); } function updateWalletMax(uint cnt) onlyOwner public { sellerConfig.maxPerAddress = cnt; sellerConfig.maxPerTx = cnt; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.2 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * 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 // ERC721A Contracts v4.2.2 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // 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 // OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/BitMaps.sol) pragma solidity ^0.8.0; /** * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential. * Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor]. */ library BitMaps { struct BitMap { mapping(uint256 => uint256) _data; } /** * @dev Returns whether the bit at `index` is set. */ function get(BitMap storage bitmap, uint256 index) internal view returns (bool) { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); return bitmap._data[bucket] & mask != 0; } /** * @dev Sets the bit at `index` to the boolean `value`. */ function setTo( BitMap storage bitmap, uint256 index, bool value ) internal { if (value) { set(bitmap, index); } else { unset(bitmap, index); } } /** * @dev Sets the bit at `index`. */ function set(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); bitmap._data[bucket] |= mask; } /** * @dev Unsets the bit at `index`. */ function unset(BitMap storage bitmap, uint256 index) internal { uint256 bucket = index >> 8; uint256 mask = 1 << (index & 0xff); bitmap._data[bucket] &= ~mask; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`. // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`. // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a // good first aproximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1; uint256 x = a; if (x >> 128 > 0) { x >>= 128; result <<= 64; } if (x >> 64 > 0) { x >>= 64; result <<= 32; } if (x >> 32 > 0) { x >>= 32; result <<= 16; } if (x >> 16 > 0) { x >>= 16; result <<= 8; } if (x >> 8 > 0) { x >>= 8; result <<= 4; } if (x >> 4 > 0) { x >>= 4; result <<= 2; } if (x >> 2 > 0) { result <<= 1; } // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { uint256 result = sqrt(a); if (rounding == Rounding.Up && result * result < a) { result += 1; } return result; } }
// 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 // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// 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 // 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: 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/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// 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 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol) pragma solidity ^0.8.0; import "../token/ERC721/IERC721.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (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 v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; /// @notice A Pausable contract that can only be toggled by the Owner. contract OwnerPausable is Ownable, Pausable { /// @notice Pauses the contract. function pause() public onlyOwner { Pausable._pause(); } /// @notice Unpauses the contract. function unpause() public onlyOwner { Pausable._unpause(); } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; /** @notice Provides monotonic increasing and decreasing values, similar to OpenZeppelin's Counter but (a) limited in direction, and (b) allowing for steps > 1. */ library Monotonic { /** @notice Holds a value that can only increase. @dev The internal value MUST NOT be accessed directly. Instead use current() and add(). */ struct Increaser { uint256 value; } /// @notice Returns the current value of the Increaser. function current(Increaser storage incr) internal view returns (uint256) { return incr.value; } /// @notice Adds x to the Increaser's value. function add(Increaser storage incr, uint256 x) internal { incr.value += x; } /** @notice Holds a value that can only decrease. @dev The internal value MUST NOT be accessed directly. Instead use current() and subtract(). */ struct Decreaser { uint256 value; } /// @notice Returns the current value of the Decreaser. function current(Decreaser storage decr) internal view returns (uint256) { return decr.value; } /// @notice Subtracts x from the Decreaser's value. function subtract(Decreaser storage decr, uint256 x) internal { decr.value -= x; } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "../utils/Monotonic.sol"; import "../utils/OwnerPausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; /** @notice An abstract contract providing the _purchase() function to: - Enforce per-wallet / per-transaction limits - Calculate required cost, forwarding to a beneficiary, and refunding extra */ abstract contract Seller is OwnerPausable, ReentrancyGuard { using Address for address payable; using Monotonic for Monotonic.Increaser; using Strings for uint256; /** @dev Note that the address limits are vulnerable to wallet farming. @param maxPerAddress Unlimited if zero. @param maxPerTex Unlimited if zero. @param freeQuota Maximum number that can be purchased free of charge by the contract owner. @param reserveFreeQuota Whether to excplitly reserve the freeQuota amount and not let it be eroded by regular purchases. @param lockFreeQuota If true, calls to setSellerConfig() will ignore changes to freeQuota. Can be locked after initial setting, but not unlocked. This allows a contract owner to commit to a maximum number of reserved items. @param lockTotalInventory Similar to lockFreeQuota but applied to totalInventory. */ struct SellerConfig { uint256 totalInventory; uint256 maxPerAddress; uint256 maxPerTx; uint248 freeQuota; bool reserveFreeQuota; bool lockFreeQuota; bool lockTotalInventory; } constructor(SellerConfig memory config, address payable _beneficiary) { setSellerConfig(config); setBeneficiary(_beneficiary); } /// @notice Configuration of purchase limits. SellerConfig public sellerConfig; /// @notice Sets the seller config. function setSellerConfig(SellerConfig memory config) public onlyOwner { require( config.totalInventory >= config.freeQuota, "Seller: excessive free quota" ); require( config.totalInventory >= _totalSold.current(), "Seller: inventory < already sold" ); require( config.freeQuota >= purchasedFreeOfCharge.current(), "Seller: free quota < already used" ); // Overriding the in-memory fields before copying the whole struct, as // against writing individual fields, gives a greater guarantee of // correctness as the code is simpler to read. if (sellerConfig.lockTotalInventory) { config.lockTotalInventory = true; config.totalInventory = sellerConfig.totalInventory; } if (sellerConfig.lockFreeQuota) { config.lockFreeQuota = true; config.freeQuota = sellerConfig.freeQuota; } sellerConfig = config; } /// @notice Recipient of revenues. address payable public beneficiary; /// @notice Sets the recipient of revenues. function setBeneficiary(address payable _beneficiary) public onlyOwner { beneficiary = _beneficiary; } /** @dev Must return the current cost of a batch of items. This may be constant or, for example, decreasing for a Dutch auction or increasing for a bonding curve. @param n The number of items being purchased. @param metadata Arbitrary data, propagated by the call to _purchase() that can be used to charge different prices. This value is a uint256 instead of bytes as this allows simple passing of a set cost (see ArbitraryPriceSeller). */ function cost(uint256 n, uint256 metadata) public view virtual returns (uint256); /** @dev Called by both _purchase() and purchaseFreeOfCharge() after all limits have been put in place; must perform all contract-specific sale logic, e.g. ERC721 minting. When _handlePurchase() is called, the value returned by Seller.totalSold() will be the POST-purchase amount to allow for the checks-effects-interactions (ECI) pattern as _handlePurchase() may include an interaction. _handlePurchase() MUST itself implement the CEI pattern. @param to The recipient of the item(s). @param n The number of items allowed to be purchased, which MAY be less than to the number passed to _purchase() but SHALL be greater than zero. @param freeOfCharge Indicates that the call originated from purchaseFreeOfCharge() and not _purchase(). */ function _handlePurchase( address to, uint256 n, bool freeOfCharge ) internal virtual; /** @notice Tracks total number of items sold by this contract, including those purchased free of charge by the contract owner. */ Monotonic.Increaser private _totalSold; /// @notice Returns the total number of items sold by this contract. function totalSold() public view returns (uint256) { return _totalSold.current(); } /** @notice Tracks the number of items already bought by an address, regardless of transferring out (in the case of ERC721). @dev This isn't public as it may be skewed due to differences in msg.sender and tx.origin, which it treats in the same way such that sum(_bought)>=totalSold(). */ mapping(address => uint256) private _bought; /** @notice Returns min(n, max(extra items addr can purchase)) and reverts if 0. @param zeroMsg The message with which to revert on 0 extra. */ function _capExtra( uint256 n, address addr, string memory zeroMsg ) internal view returns (uint256) { uint256 extra = sellerConfig.maxPerAddress - _bought[addr]; if (extra == 0) { revert(string(abi.encodePacked("Seller: ", zeroMsg))); } return Math.min(n, extra); } /// @notice Emitted when a buyer is refunded. event Refund(address indexed buyer, uint256 amount); /// @notice Emitted on all purchases of non-zero amount. event Revenue( address indexed beneficiary, uint256 numPurchased, uint256 amount ); /// @notice Tracks number of items purchased free of charge. Monotonic.Increaser private purchasedFreeOfCharge; /** @notice Allows the contract owner to purchase without payment, within the quota enforced by the SellerConfig. */ function purchaseFreeOfCharge(address to, uint256 n) public onlyOwner whenNotPaused { /** * ##### CHECKS */ uint256 freeQuota = sellerConfig.freeQuota; n = Math.min(n, freeQuota - purchasedFreeOfCharge.current()); require(n > 0, "Seller: Free quota exceeded"); uint256 totalInventory = sellerConfig.totalInventory; n = Math.min(n, totalInventory - _totalSold.current()); require(n > 0, "Seller: Sold out"); /** * ##### EFFECTS */ _totalSold.add(n); purchasedFreeOfCharge.add(n); /** * ##### INTERACTIONS */ _handlePurchase(to, n, true); assert(_totalSold.current() <= totalInventory); assert(purchasedFreeOfCharge.current() <= freeQuota); } /** @notice Convenience function for calling _purchase() with empty costMetadata when unneeded. */ function _purchase(address to, uint256 requested) internal virtual { _purchase(to, requested, 0); } /** @notice Enforces all purchase limits (counts and costs) before calling _handlePurchase(), after which the received funds are disbursed to the beneficiary, less any required refunds. @param to The final recipient of the item(s). @param requested The number of items requested for purchase, which MAY be reduced when passed to _handlePurchase(). @param costMetadata Arbitrary data, propagated in the call to cost(), to be optionally used in determining the price. */ function _purchase( address to, uint256 requested, uint256 costMetadata ) internal nonReentrant whenNotPaused { /** * ##### CHECKS */ SellerConfig memory config = sellerConfig; uint256 n = config.maxPerTx == 0 ? requested : Math.min(requested, config.maxPerTx); uint256 maxAvailable; uint256 sold; if (config.reserveFreeQuota) { maxAvailable = config.totalInventory - config.freeQuota; sold = _totalSold.current() - purchasedFreeOfCharge.current(); } else { maxAvailable = config.totalInventory; sold = _totalSold.current(); } n = Math.min(n, maxAvailable - sold); require(n > 0, "Seller: Sold out"); if (config.maxPerAddress > 0) { bool alsoLimitSender = _msgSender() != to; // solhint-disable-next-line avoid-tx-origin bool alsoLimitOrigin = tx.origin != _msgSender() && tx.origin != to; n = _capExtra(n, to, "Buyer limit"); if (alsoLimitSender) { n = _capExtra(n, _msgSender(), "Sender limit"); } if (alsoLimitOrigin) { // solhint-disable-next-line avoid-tx-origin n = _capExtra(n, tx.origin, "Origin limit"); } _bought[to] += n; if (alsoLimitSender) { _bought[_msgSender()] += n; } if (alsoLimitOrigin) { // solhint-disable-next-line avoid-tx-origin _bought[tx.origin] += n; } } uint256 _cost = cost(n, costMetadata); if (msg.value < _cost) { revert( string( abi.encodePacked( "Seller: Costs ", (_cost / 1e9).toString(), " GWei" ) ) ); } /** * ##### EFFECTS */ _totalSold.add(n); assert(_totalSold.current() <= config.totalInventory); /** * ##### INTERACTIONS */ // As _handlePurchase() is often an ERC721 safeMint(), it constitutes an // interaction. _handlePurchase(to, n, false); // Ideally we'd be using a PullPayment here, but the user experience is // poor when there's a variable cost or the number of items purchased // has been capped. We've addressed reentrancy with both a nonReentrant // modifier and the checks, effects, interactions pattern. if (_cost > 0) { beneficiary.sendValue(_cost); emit Revenue(beneficiary, n, _cost); } if (msg.value > _cost) { address payable reimburse = payable(_msgSender()); uint256 refund = msg.value - _cost; // Using Address.sendValue() here would mask the revertMsg upon // reentrancy, but we want to expose it to allow for more precise // testing. This otherwise uses the exact same pattern as // Address.sendValue(). // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returnData) = reimburse.call{ value: refund }(""); // Although `returnData` will have a spurious prefix, all we really // care about is that it contains the ReentrancyGuard reversion // message so we can check in the tests. require(success, string(returnData)); emit Refund(reimburse, refund); } } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "./Seller.sol"; /// @notice A Seller with fixed per-item price. abstract contract FixedPriceSeller is Seller { constructor( uint256 _price, Seller.SellerConfig memory sellerConfig, address payable _beneficiary ) Seller(sellerConfig, _beneficiary) { setPrice(_price); } /** @notice The fixed per-item price. @dev Fixed as in not changing with time nor number of items, but not a constant. */ uint256 public price; /// @notice Sets the per-item price. function setPrice(uint256 _price) public onlyOwner { price = _price; } /** @notice Override of Seller.cost() with fixed price. @dev The second parameter, metadata propagated from the call to _purchase(), is ignored. */ function cost(uint256 n, uint256) public view override returns (uint256) { return n * price; } }
// SPDX-License-Identifier: MIT // Copyright (c) 2022 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/interfaces/IERC721.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/structs/BitMaps.sol"; /** @notice Allows holders of ERC721 tokens to redeem rights to some claim; for example, the right to mint a token of some other collection. */ library ERC721Redeemer { using BitMaps for BitMaps.BitMap; using Strings for uint256; /** @notice Storage value to track already-claimed redemptions for a specific token collection. */ struct Claims { /** @dev This field MUST NOT be considered part of the public API. Instead, prefer `using ERC721Redeemer for ERC721Redeemer.Claims` and utilise the provided functions. */ mapping(uint256 => uint256) _total; } /** @notice Storage value to track already-claimed redemptions for a specific token collection, given that there is only a single claim allowed per tokenId. */ struct SingleClaims { /** @dev This field MUST NOT be considered part of the public API. Instead, prefer `using ERC721Redeemer for ERC721Redeemer.SingleClaims` and utilise the provided functions. */ BitMaps.BitMap _claimed; } /** @notice Emitted when a token's claim is redeemed. */ event Redemption( IERC721 indexed token, address indexed redeemer, uint256 tokenId, uint256 n ); /** @notice Checks that the redeemer is allowed to redeem the claims for the tokenIds by being either the owner or approved address for all tokenIds, and updates the Claims to reflect this. @dev For more efficient gas usage, recurring values in tokenIds SHOULD be adjacent to one another as this will batch expensive operations. The simplest way to achieve this is by sorting tokenIds. @param tokenIds The token IDs for which the claims are being redeemed. If maxAllowance > 1 then identical tokenIds can be passed more than once; see dev comments. @return The number of redeemed claims; either 0 or tokenIds.length; */ function redeem( Claims storage claims, uint256 maxAllowance, address redeemer, IERC721 token, uint256[] calldata tokenIds ) internal returns (uint256) { if (maxAllowance == 0 || tokenIds.length == 0) { return 0; } // See comment for `endSameId`. bool multi = maxAllowance > 1; for ( uint256 i = 0; i < tokenIds.length; /* note increment at end */ ) { uint256 tokenId = tokenIds[i]; requireOwnerOrApproved(token, tokenId, redeemer); uint256 n = 1; if (multi) { // If allowed > 1 we can save on expensive operations like // checking ownership / remaining allowance by batching equal // tokenIds. The algorithm assumes that equal IDs are adjacent // in the array. uint256 endSameId; for ( endSameId = i + 1; endSameId < tokenIds.length && tokenIds[endSameId] == tokenId; endSameId++ ) {} // solhint-disable-line no-empty-blocks n = endSameId - i; } claims._total[tokenId] += n; if (claims._total[tokenId] > maxAllowance) { revertWithTokenId( "ERC721Redeemer: over allowance for", tokenId ); } i += n; emit Redemption(token, redeemer, tokenId, n); } return tokenIds.length; } /** @notice Checks that the redeemer is allowed to redeem the single claim for each of the tokenIds by being either the owner or approved address for all tokenIds, and updates the SingleClaims to reflect this. @param tokenIds The token IDs for which the claims are being redeemed. Only a single claim can be made against a tokenId. @return The number of redeemed claims; either 0 or tokenIds.length; */ function redeem( SingleClaims storage claims, address redeemer, IERC721 token, uint256[] calldata tokenIds ) internal returns (uint256) { if (tokenIds.length == 0) { return 0; } for (uint256 i = 0; i < tokenIds.length; i++) { uint256 tokenId = tokenIds[i]; requireOwnerOrApproved(token, tokenId, redeemer); if (claims._claimed.get(tokenId)) { revertWithTokenId( "ERC721Redeemer: over allowance for", tokenId ); } claims._claimed.set(tokenId); emit Redemption(token, redeemer, tokenId, 1); } return tokenIds.length; } /** @dev Reverts if neither the owner nor approved for the tokenId. */ function requireOwnerOrApproved( IERC721 token, uint256 tokenId, address redeemer ) private view { if ( token.ownerOf(tokenId) != redeemer && token.getApproved(tokenId) != redeemer ) { revertWithTokenId( "ERC721Redeemer: not approved nor owner of", tokenId ); } } /** @notice Reverts with the concatenation of revertMsg and tokenId.toString(). @dev Used to save gas by constructing the revert message only as required, instead of passing it to require(). */ function revertWithTokenId(string memory revertMsg, uint256 tokenId) private pure { revert(string(abi.encodePacked(revertMsg, " ", tokenId.toString()))); } /** @notice Returns the number of claimed redemptions for the token. */ function claimed(Claims storage claims, uint256 tokenId) internal view returns (uint256) { return claims._total[tokenId]; } /** @notice Returns whether the token has had a claim made against it. */ function claimed(SingleClaims storage claims, uint256 tokenId) internal view returns (bool) { return claims._claimed.get(tokenId); } }
// SPDX-License-Identifier: MIT // Copyright (c) 2022 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "erc721a/contracts/ERC721A.sol"; import "../utils/OwnerPausable.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; /** @notice An ERC721A contract with common functionality: - Pausable with toggling functions exposed to Owner only - ERC2981 royalties */ contract ERC721ACommon is ERC721A, OwnerPausable, ERC2981 { constructor( string memory name, string memory symbol, address payable royaltyReciever, uint96 royaltyBasisPoints ) ERC721A(name, symbol) { _setDefaultRoyalty(royaltyReciever, royaltyBasisPoints); } /// @notice Requires that the token exists. modifier tokenExists(uint256 tokenId) { require(ERC721A._exists(tokenId), "ERC721ACommon: Token doesn't exist"); _; } /// @notice Requires that msg.sender owns or is approved for the token. modifier onlyApprovedOrOwner(uint256 tokenId) { require( _ownershipOf(tokenId).addr == _msgSender() || getApproved(tokenId) == _msgSender(), "ERC721ACommon: Not approved nor owner" ); _; } function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual override { require(!paused(), "ERC721ACommon: paused"); super._beforeTokenTransfers(from, to, startTokenId, quantity); } /// @notice Overrides supportsInterface as required by inheritance. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721A, ERC2981) returns (bool) { return ERC721A.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId); } /// @notice Sets the royalty receiver and percentage (in units of basis /// points = 0.01%). function setDefaultRoyalty(address receiver, uint96 basisPoints) public virtual onlyOwner { _setDefaultRoyalty(receiver, basisPoints); } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; /** @notice ERC721 extension that overrides the OpenZeppelin _baseURI() function to return a prefix that can be set by the contract owner. */ contract BaseTokenURI is Ownable { /// @notice Base token URI used as a prefix by tokenURI(). string public baseTokenURI; constructor(string memory _baseTokenURI) { setBaseTokenURI(_baseTokenURI); } /// @notice Sets the base token URI prefix. function setBaseTokenURI(string memory _baseTokenURI) public onlyOwner { baseTokenURI = _baseTokenURI; } /** @notice Concatenates and returns the base token URI and the token ID without any additional characters (e.g. a slash). @dev This requires that an inheriting contract that also inherits from OZ's ERC721 will have to override both contracts; although we could simply require that users implement their own _baseURI() as here, this can easily be forgotten and the current approach guides them with compiler errors. This favours the latter half of "APIs should be easy to use and hard to misuse" from https://www.infoq.com/articles/API-Design-Joshua-Bloch/. */ function _baseURI() internal view virtual returns (string memory) { return baseTokenURI; } }
// SPDX-License-Identifier: MIT // Copyright (c) 2022 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; /** @title SignerManager @notice Manges addition and removal of a core set of addresses from which valid ECDSA signatures can be accepted; see SignatureChecker. */ contract SignerManager is Ownable { using EnumerableSet for EnumerableSet.AddressSet; /** @dev Addresses from which signatures can be accepted. */ EnumerableSet.AddressSet internal signers; /** @notice Add an address to the set of accepted signers. */ function addSigner(address signer) external onlyOwner { signers.add(signer); } /** @notice Remove an address previously added with addSigner(). */ function removeSigner(address signer) external onlyOwner { signers.remove(signer); } }
// SPDX-License-Identifier: MIT // Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier) pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; /** @title SignatureChecker @notice Additional functions for EnumerableSet.Addresset that require a valid ECDSA signature of a standardized message, signed by any member of the set. */ library SignatureChecker { using EnumerableSet for EnumerableSet.AddressSet; /** @notice Requires that the message has not been used previously and that the recovered signer is contained in the signers AddressSet. @dev Convenience wrapper for message generation + signature verification + marking message as used @param signers Set of addresses from which signatures are accepted. @param usedMessages Set of already-used messages. @param signature ECDSA signature of message. */ function requireValidSignature( EnumerableSet.AddressSet storage signers, bytes memory data, bytes calldata signature, mapping(bytes32 => bool) storage usedMessages ) internal { bytes32 message = generateMessage(data); require( !usedMessages[message], "SignatureChecker: Message already used" ); usedMessages[message] = true; requireValidSignature(signers, message, signature); } /** @notice Requires that the message has not been used previously and that the recovered signer is contained in the signers AddressSet. @dev Convenience wrapper for message generation + signature verification. */ function requireValidSignature( EnumerableSet.AddressSet storage signers, bytes memory data, bytes calldata signature ) internal view { bytes32 message = generateMessage(data); requireValidSignature(signers, message, signature); } /** @notice Requires that the message has not been used previously and that the recovered signer is contained in the signers AddressSet. @dev Convenience wrapper for message generation from address + signature verification. */ function requireValidSignature( EnumerableSet.AddressSet storage signers, address a, bytes calldata signature ) internal view { bytes32 message = generateMessage(abi.encodePacked(a)); requireValidSignature(signers, message, signature); } /** @notice Common validator logic, checking if the recovered signer is contained in the signers AddressSet. */ function validSignature( EnumerableSet.AddressSet storage signers, bytes32 message, bytes calldata signature ) internal view returns (bool) { return signers.contains(ECDSA.recover(message, signature)); } /** @notice Requires that the recovered signer is contained in the signers AddressSet. @dev Convenience wrapper that reverts if the signature validation fails. */ function requireValidSignature( EnumerableSet.AddressSet storage signers, bytes32 message, bytes calldata signature ) internal view { require( validSignature(signers, message, signature), "SignatureChecker: Invalid signature" ); } /** @notice Generates a message for a given data input that will be signed off-chain using ECDSA. @dev For multiple data fields, a standard concatenation using `abi.encodePacked` is commonly used to build data. */ function generateMessage(bytes memory data) internal pure returns (bytes32) { return ECDSA.toEthSignedMessageHash(data); } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 600 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"tknURI","type":"string"},{"internalType":"string","name":"_storefrontURI","type":"string"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"maxPer","type":"uint256"},{"internalType":"address payable","name":"beneficiary","type":"address"},{"internalType":"address payable","name":"royaltyReceiver","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","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":"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":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":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Expelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Nested","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":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Refund","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"numPurchased","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Revenue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Unnested","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXPULSION_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"addSigner","outputs":[],"stateMutability":"nonpayable","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":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beneficiary","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"n","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"expelFromNest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amt","type":"uint256"}],"name":"mintPublic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"n","type":"uint256"}],"name":"mintUnclaimed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nestingOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"nestingPeriod","outputs":[{"internalType":"bool","name":"nesting","type":"bool"},{"internalType":"uint256","name":"current","type":"uint256"},{"internalType":"uint256","name":"total","type":"uint256"}],"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":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proofMintingOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"n","type":"uint256"}],"name":"purchaseFreeOfCharge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"removeSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renderingContract","outputs":[{"internalType":"contract ITokenURIGenerator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"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":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferWhileNesting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sellerConfig","outputs":[{"internalType":"uint256","name":"totalInventory","type":"uint256"},{"internalType":"uint256","name":"maxPerAddress","type":"uint256"},{"internalType":"uint256","name":"maxPerTx","type":"uint256"},{"internalType":"uint248","name":"freeQuota","type":"uint248"},{"internalType":"bool","name":"reserveFreeQuota","type":"bool"},{"internalType":"bool","name":"lockFreeQuota","type":"bool"},{"internalType":"bool","name":"lockTotalInventory","type":"bool"}],"stateMutability":"view","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":"_baseTokenURI","type":"string"}],"name":"setBaseTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_beneficiary","type":"address"}],"name":"setBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"basisPoints","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"open","type":"bool"}],"name":"setNestingOpen","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"open","type":"bool"}],"name":"setPROOFMintingOpen","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ITokenURIGenerator","name":"_contract","type":"address"}],"name":"setRenderingContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeBasisPoints","type":"uint96"}],"name":"setRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"totalInventory","type":"uint256"},{"internalType":"uint256","name":"maxPerAddress","type":"uint256"},{"internalType":"uint256","name":"maxPerTx","type":"uint256"},{"internalType":"uint248","name":"freeQuota","type":"uint248"},{"internalType":"bool","name":"reserveFreeQuota","type":"bool"},{"internalType":"bool","name":"lockFreeQuota","type":"bool"},{"internalType":"bool","name":"lockTotalInventory","type":"bool"}],"internalType":"struct Seller.SellerConfig","name":"config","type":"tuple"}],"name":"setSellerConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setStorefrontURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"storefrontURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","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":"tokenIds","type":"uint256[]"}],"name":"toggleNesting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cnt","type":"uint256"}],"name":"updateWalletMax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"usedMessages","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6080604052601d805460ff1990811690915560016020556021805490911690553480156200002c57600080fd5b5060405162004580380380620045808339810160408190526200004f91620008c1565b8787836101f460006040518060e001604052808a815260200189815260200189815260200160006001600160f81b03168152602001600015158152602001600015158152602001600115158152508781818e89898160029080519060200190620000bb92919062000731565b508051620000d190600390602084019062000731565b50506000805550620000e333620001a4565b6008805460ff60a01b19169055620000fb81620001f6565b506001600c556200010c8262000219565b62000117816200041b565b506200012590508362000447565b5050506200013a82826200045660201b60201c565b505050506200014f856200055760201b60201c565b6200015d816101f462000456565b6200016a60003362000576565b620001967f7904e9328f622335e3d715af4f9d4b4147d279485bd5be001b80efa4da608a293362000576565b5050505050505050620009f0565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b62000200620005b9565b80516200021590600b90602084019062000731565b5050565b62000223620005b9565b80606001516001600160f81b0316816000015110156200028a5760405162461bcd60e51b815260206004820152601c60248201527f53656c6c65723a2065786365737369766520667265652071756f74610000000060448201526064015b60405180910390fd5b620002a160136200061760201b62001b051760201c565b81511015620002f35760405162461bcd60e51b815260206004820181905260248201527f53656c6c65723a20696e76656e746f7279203c20616c726561647920736f6c64604482015260640162000281565b6200030a60156200061760201b62001b051760201c565b81606001516001600160f81b03161015620003725760405162461bcd60e51b815260206004820152602160248201527f53656c6c65723a20667265652071756f7461203c20616c7265616479207573656044820152601960fa1b606482015260840162000281565b601154610100900460ff16156200039057600160c0820152600d5481525b60115460ff1615620003b557600160a08201526010546001600160f81b031660608201525b8051600d556020810151600e556040810151600f55606081015160808201511515600160f81b026001600160f81b039091161760105560a08101516011805460c09093015115156101000261ff00199215159290921661ffff1990931692909217179055565b62000425620005b9565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b62000451620005b9565b601655565b6127106001600160601b0382161115620004c65760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840162000281565b6001600160a01b0382166200051e5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640162000281565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601955565b62000561620005b9565b80516200021590601b90602084019062000731565b6200058d82826200061b60201b62001b091760201c565b6000828152600a60209081526040909120620005b491839062001bab620006bf821b17901c565b505050565b6008546001600160a01b03163314620006155760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000281565b565b5490565b60008281526009602090815260408083206001600160a01b038516845290915290205460ff16620002155760008281526009602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200067b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000620006d6836001600160a01b038416620006df565b90505b92915050565b60008181526001830160205260408120546200072857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620006d9565b506000620006d9565b8280546200073f90620009b3565b90600052602060002090601f016020900481019282620007635760008555620007ae565b82601f106200077e57805160ff1916838001178555620007ae565b82800160010185558215620007ae579182015b82811115620007ae57825182559160200191906001019062000791565b50620007bc929150620007c0565b5090565b5b80821115620007bc5760008155600101620007c1565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620007ff57600080fd5b81516001600160401b03808211156200081c576200081c620007d7565b604051601f8301601f19908116603f01168101908282118183101715620008475762000847620007d7565b816040528381526020925086838588010111156200086457600080fd5b600091505b8382101562000888578582018301518183018401529082019062000869565b838211156200089a5760008385830101525b9695505050505050565b80516001600160a01b0381168114620008bc57600080fd5b919050565b600080600080600080600080610100898b031215620008df57600080fd5b88516001600160401b0380821115620008f757600080fd5b620009058c838d01620007ed565b995060208b01519150808211156200091c57600080fd5b6200092a8c838d01620007ed565b985060408b01519150808211156200094157600080fd5b6200094f8c838d01620007ed565b975060608b01519150808211156200096657600080fd5b50620009758b828c01620007ed565b9550506080890151935060a089015192506200099460c08a01620008a4565b9150620009a460e08a01620008a4565b90509295985092959890939650565b600181811c90821680620009c857607f821691505b60208210811415620009ea57634e487b7160e01b600052602260045260246000fd5b50919050565b613b808062000a006000396000f3fe6080604052600436106103ad5760003560e01c8063715018a6116101e7578063afab28721161010d578063d547741f116100a0578063e985e9c51161006f578063e985e9c514610b89578063eb12d61e14610bd2578063f2031c6714610bf2578063f2fde38b14610c0c57600080fd5b8063d547741f14610b1f578063d547cfb714610b3f578063dc9ff3ed14610b54578063e8a3d48514610b7457600080fd5b8063bf62e21d116100dc578063bf62e21d14610a9a578063c7fecbcc14610aba578063c87b56dd14610adf578063ca15c87314610aff57600080fd5b8063afab2872146109af578063b7f1d072146109cf578063b88d4fde146109ef578063bb69b7ef14610a0f57600080fd5b806391d1485411610185578063a035b1fe11610154578063a035b1fe14610944578063a217fddf1461095a578063a22cb4651461096f578063aa9678781461098f57600080fd5b806391d14854146108b657806395d89b41146108fc5780639e705140146109115780639f93f7791461093157600080fd5b80639010d07c116101c15780639010d07c1461084157806391053d94146108615780639106d7ba1461088157806391b7f5ed1461089657600080fd5b8063715018a6146107f95780638456cb591461080e5780638da5cb5b1461082357600080fd5b80632f2ff15d116102d7578063421745ab1161026a5780635a028400116102395780635a0284001461076a5780635c975abb1461079a5780636352211e146107b957806370a08231146107d957600080fd5b8063421745ab146106cd57806342842e0e146106ed578063469b29cd1461070d5780634ca4fdf51461072d57600080fd5b806339154b9e116102a657806339154b9e146106445780633ec02e14146106645780633f4ba83a1461068457806340b625c01461069957600080fd5b80632f2ff15d146105c457806330176e13146105e457806336568abe1461060457806338af3eed1461062457600080fd5b806318160ddd1161034f578063247045191161031e5780632470451914610520578063248a9ca3146105355780632a55205a146105655780632f274bd4146105a457600080fd5b806318160ddd146104a35780631c31f710146104c65780632015c291146104e657806323b872dd1461050057600080fd5b806306fdde031161038b57806306fdde0314610409578063081812fc1461042b578063095ea7b3146104635780630e316ab71461048357600080fd5b806301ffc9a7146103b257806302fa7c47146103e757806304634d8d146103e7575b600080fd5b3480156103be57600080fd5b506103d26103cd3660046132fb565b610c2c565b60405190151581526020015b60405180910390f35b3480156103f357600080fd5b5061040761040236600461332d565b610c3d565b005b34801561041557600080fd5b5061041e610c53565b6040516103de91906133cf565b34801561043757600080fd5b5061044b6104463660046133e2565b610ce5565b6040516001600160a01b0390911681526020016103de565b34801561046f57600080fd5b5061040761047e3660046133fb565b610d29565b34801561048f57600080fd5b5061040761049e366004613427565b610dc9565b3480156104af57600080fd5b50600154600054035b6040519081526020016103de565b3480156104d257600080fd5b506104076104e1366004613427565b610ddc565b3480156104f257600080fd5b506021546103d29060ff1681565b34801561050c57600080fd5b5061040761051b366004613444565b610e06565b34801561052c57600080fd5b5061041e610fa5565b34801561054157600080fd5b506104b86105503660046133e2565b60009081526009602052604090206001015490565b34801561057157600080fd5b50610585610580366004613485565b611033565b604080516001600160a01b0390931683526020830191909152016103de565b3480156105b057600080fd5b506104076105bf36600461352c565b6110ee565b3480156105d057600080fd5b506104076105df3660046135b7565b6112bf565b3480156105f057600080fd5b506104076105ff366004613642565b6112e9565b34801561061057600080fd5b5061040761061f3660046135b7565b611304565b34801561063057600080fd5b5060125461044b906001600160a01b031681565b34801561065057600080fd5b5061040761065f3660046133e2565b61138c565b34801561067057600080fd5b506104b861067f366004613485565b6114b4565b34801561069057600080fd5b506104076114cb565b3480156106a557600080fd5b506104b87f7904e9328f622335e3d715af4f9d4b4147d279485bd5be001b80efa4da608a2981565b3480156106d957600080fd5b506104076106e836600461368b565b6114dd565b3480156106f957600080fd5b50610407610708366004613444565b6114f8565b34801561071957600080fd5b506104076107283660046136a6565b611513565b34801561073957600080fd5b5061074d6107483660046133e2565b611556565b6040805193151584526020840192909252908201526060016103de565b34801561077657600080fd5b506103d26107853660046133e2565b601c6020526000908152604090205460ff1681565b3480156107a657600080fd5b50600854600160a01b900460ff166103d2565b3480156107c557600080fd5b5061044b6107d43660046133e2565b6115a2565b3480156107e557600080fd5b506104b86107f4366004613427565b6115ad565b34801561080557600080fd5b506104076115fc565b34801561081a57600080fd5b5061040761160e565b34801561082f57600080fd5b506008546001600160a01b031661044b565b34801561084d57600080fd5b5061044b61085c366004613485565b61161e565b34801561086d57600080fd5b5061040761087c3660046133e2565b611636565b34801561088d57600080fd5b506104b8611648565b3480156108a257600080fd5b506104076108b13660046133e2565b611658565b3480156108c257600080fd5b506103d26108d13660046135b7565b60009182526009602090815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561090857600080fd5b5061041e611665565b34801561091d57600080fd5b5061040761092c3660046133fb565b611674565b61040761093f3660046133fb565b611688565b34801561095057600080fd5b506104b860165481565b34801561096657600080fd5b506104b8600081565b34801561097b57600080fd5b5061040761098a36600461371b565b611692565b34801561099b57600080fd5b506104076109aa366004613444565b611728565b3480156109bb57600080fd5b506104076109ca366004613642565b6117a2565b3480156109db57600080fd5b506104076109ea366004613427565b6117bd565b3480156109fb57600080fd5b50610407610a0a366004613750565b6117fa565b348015610a1b57600080fd5b50600d54600e54600f54601054601154610a57949392916001600160f81b0381169160ff600160f81b9092048216918181169161010090041687565b604080519788526020880196909652948601939093526001600160f81b03909116606085015215156080840152151560a0830152151560c082015260e0016103de565b348015610aa657600080fd5b50610407610ab53660046133fb565b61183e565b348015610ac657600080fd5b5060215461044b9061010090046001600160a01b031681565b348015610aeb57600080fd5b5061041e610afa3660046133e2565b61196f565b348015610b0b57600080fd5b506104b8610b1a3660046133e2565b611a06565b348015610b2b57600080fd5b50610407610b3a3660046135b7565b611a1d565b348015610b4b57600080fd5b5061041e611a42565b348015610b6057600080fd5b50610407610b6f36600461368b565b611a4f565b348015610b8057600080fd5b5061041e611a6a565b348015610b9557600080fd5b506103d2610ba43660046137d0565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610bde57600080fd5b50610407610bed366004613427565b611a79565b348015610bfe57600080fd5b50601d546103d29060ff1681565b348015610c1857600080fd5b50610407610c27366004613427565b611a8c565b6000610c3782611bc0565b92915050565b610c45611bda565b610c4f8282611c34565b5050565b606060028054610c62906137fe565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8e906137fe565b8015610cdb5780601f10610cb057610100808354040283529160200191610cdb565b820191906000526020600020905b815481529060010190602001808311610cbe57829003601f168201915b5050505050905090565b6000610cf082611d3b565b610d0d576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610d34826115a2565b9050336001600160a01b03821614610d6d57610d508133610ba4565b610d6d576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b610dd1611bda565b610c4f601782611d62565b610de4611bda565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e1182611d77565b9050836001600160a01b0316816001600160a01b031614610e445760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610e9157610e748633610ba4565b610e9157604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610eb857604051633a954ecd60e21b815260040160405180910390fd5b610ec58686866001611dd8565b8015610ed057600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040902055600160e11b8316610f5b5760018401600081815260046020526040902054610f59576000548114610f595760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b601b8054610fb2906137fe565b80601f0160208091040260200160405190810160405280929190818152602001828054610fde906137fe565b801561102b5780601f106110005761010080835404028352916020019161102b565b820191906000526020600020905b81548152906001019060200180831161100e57829003601f168201915b505050505081565b6000828152601a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046bffffffffffffffffffffffff169282019290925282916110b25750604080518082019091526019546001600160a01b0381168252600160a01b90046bffffffffffffffffffffffff1660208201525b6020810151600090612710906110d6906bffffffffffffffffffffffff168761384f565b6110e09190613884565b915196919550909350505050565b6110f6611bda565b80606001516001600160f81b03168160000151101561115c5760405162461bcd60e51b815260206004820152601c60248201527f53656c6c65723a2065786365737369766520667265652071756f74610000000060448201526064015b60405180910390fd5b601354815110156111af5760405162461bcd60e51b815260206004820181905260248201527f53656c6c65723a20696e76656e746f7279203c20616c726561647920736f6c646044820152606401611153565b60155481606001516001600160f81b031610156112185760405162461bcd60e51b815260206004820152602160248201527f53656c6c65723a20667265652071756f7461203c20616c7265616479207573656044820152601960fa1b6064820152608401611153565b601154610100900460ff161561123557600160c0820152600d5481525b60115460ff161561125957600160a08201526010546001600160f81b031660608201525b8051600d556020810151600e556040810151600f55606081015160808201511515600160f81b026001600160f81b039091161760105560a08101516011805460c09093015115156101000261ff00199215159290921661ffff1990931692909217179055565b6000828152600960205260409020600101546112da81611e69565b6112e48383611e73565b505050565b6112f1611bda565b8051610c4f90600b90602084019061324c565b6001600160a01b03811633146113825760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401611153565b610c4f8282611e95565b7f7904e9328f622335e3d715af4f9d4b4147d279485bd5be001b80efa4da608a296113b681611e69565b6000828152601e60205260409020546114115760405162461bcd60e51b815260206004820152601560248201527f4d6f6f6e62697264733a206e6f74206e657374656400000000000000000000006044820152606401611153565b6000828152601e602052604090205461142a9042613898565b6000838152601f6020526040812080549091906114489084906138af565b90915550506000828152601e60205260408082208290555183917f657500793744fd287ed8e476832a3cb4b7aa5b931cda10bdc773a301e0e9a83191a260405182907f3ebee94e74ea24f711b5876dca724062e18b7b37b6883e686a92f093248a4fcf90600090a25050565b6000601654836114c4919061384f565b9392505050565b6114d3611bda565b6114db611eb7565b565b6114e5611bda565b6021805460ff1916911515919091179055565b6112e4838383604051806020016040528060008152506117fa565b8060005b8181101561155057611540848483818110611534576115346138c7565b90506020020135611f0c565b611549816138dd565b9050611517565b50505050565b6000818152601e6020526040812054819081908015611580576001935061157d8142613898565b92505b6000858152601f602052604090205461159990846138af565b93959294505050565b6000610c3782611d77565b60006001600160a01b0382166115d6576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b611604611bda565b6114db60006120a4565b611616611bda565b6114db6120f6565b6000828152600a602052604081206114c49083612139565b61163e611bda565b600e819055600f55565b600061165360135490565b905090565b611660611bda565b601655565b606060038054610c62906137fe565b61167c611bda565b610c4f82826001612145565b610c4f828261216d565b6001600160a01b0382163314156116bc5760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b33611732826115a2565b6001600160a01b0316146117885760405162461bcd60e51b815260206004820152601560248201527f4d6f6f6e62697264733a204f6e6c79206f776e657200000000000000000000006044820152606401611153565b60026020556117988383836114f8565b5050600160205550565b6117aa611bda565b8051610c4f90601b90602084019061324c565b6117c5611bda565b602180546001600160a01b039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b611805848484610e06565b6001600160a01b0383163b156115505761182184848484612179565b611550576040516368d2bf6b60e11b815260040160405180910390fd5b611846611bda565b61184e612262565b6010546001600160f81b03166118768261186760155490565b6118719084613898565b6122bc565b9150600082116118c85760405162461bcd60e51b815260206004820152601b60248201527f53656c6c65723a20467265652071756f746120657863656564656400000000006044820152606401611153565b600d546118d88361186760135490565b92506000831161191d5760405162461bcd60e51b815260206004820152601060248201526f14d95b1b195c8e8814dbdb19081bdd5d60821b6044820152606401611153565b6119286013846122d2565b6119336015846122d2565b61193f84846001612145565b8061194960135490565b1115611957576119576138f8565b8161196160155490565b1115611550576115506138f8565b60215460609061010090046001600160a01b0316156119fd5760215460405163c87b56dd60e01b8152600481018490526101009091046001600160a01b03169063c87b56dd90602401600060405180830381865afa1580156119d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c37919081019061390e565b610c37826122ef565b6000818152600a60205260408120610c3790612373565b600082815260096020526040902060010154611a3881611e69565b6112e48383611e95565b600b8054610fb2906137fe565b611a57611bda565b601d805460ff1916911515919091179055565b6060601b8054610c62906137fe565b611a81611bda565b610c4f601782611bab565b611a94611bda565b6001600160a01b038116611af95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611153565b611b02816120a4565b50565b5490565b60008281526009602090815260408083206001600160a01b038516845290915290205460ff16610c4f5760008281526009602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611b673390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006114c4836001600160a01b03841661237d565b6000611bcb826123cc565b80610c375750610c378261241a565b6008546001600160a01b031633146114db5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611153565b6127106bffffffffffffffffffffffff82161115611ca75760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401611153565b6001600160a01b038216611cfd5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401611153565b604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff9091166020909201829052600160a01b90910217601955565b6000805482108015610c37575050600090815260046020526040902054600160e01b161590565b60006114c4836001600160a01b03841661243f565b600081600054811015611dbf57600081815260046020526040902054600160e01b8116611dbd575b806114c4575060001901600081815260046020526040902054611d9f565b505b604051636f96cda160e11b815260040160405180910390fd5b816000611de583836138af565b90505b80821015610f9d576000828152601e60205260409020541580611e0d57506020546002145b611e595760405162461bcd60e51b815260206004820152601260248201527f4d6f6f6e62697264733a206e657374696e6700000000000000000000000000006044820152606401611153565b611e62826138dd565b9150611de8565b611b028133612532565b611e7d8282611b09565b6000828152600a602052604090206112e49082611bab565b611e9f82826125b2565b6000828152600a602052604090206112e49082611d62565b611ebf612635565b6008805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b8033611f178261268e565b516001600160a01b03161480611f3d575033611f3282610ce5565b6001600160a01b0316145b611f975760405162461bcd60e51b815260206004820152602560248201527f45524337323141436f6d6d6f6e3a204e6f7420617070726f766564206e6f722060448201526437bbb732b960d91b6064820152608401611153565b6000828152601e60205260409020548061203a5760215460ff16611ffd5760405162461bcd60e51b815260206004820152601960248201527f4d6f6f6e62697264733a206e657374696e6720636c6f736564000000000000006044820152606401611153565b6000838152601e60205260408082204290555184917f84bccedf5fbad5c802864c2d64e4562a610a468ba28173bd7528588e4429eaf791a2505050565b6120448142613898565b6000848152601f6020526040812080549091906120629084906138af565b90915550506000838152601e60205260408082208290555184917f657500793744fd287ed8e476832a3cb4b7aa5b931cda10bdc773a301e0e9a83191a2505050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6120fe612262565b6008805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611eef3390565b60006114c48383612706565b61214f8383612730565b61271061215f6001546000540390565b11156112e4576112e46138f8565b610c4f8282600061274a565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906121ae90339089908890889060040161397c565b6020604051808303816000875af19250505080156121e9575060408051601f3d908101601f191682019092526121e6918101906139b8565b60015b612244573d808015612217576040519150601f19603f3d011682016040523d82523d6000602084013e61221c565b606091505b50805161223c576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b600854600160a01b900460ff16156114db5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401611153565b60008183106122cb57816114c4565b5090919050565b808260000160008282546122e691906138af565b90915550505050565b60606122fa82611d3b565b61231757604051630a14c4b560e41b815260040160405180910390fd5b6000612321612c14565b905080516000141561234257604051806020016040528060008152506114c4565b8061234c84612c1e565b60405160200161235d9291906139d5565b6040516020818303038152906040529392505050565b6000610c37825490565b60008181526001830160205260408120546123c457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c37565b506000610c37565b60006301ffc9a760e01b6001600160e01b0319831614806123fd57506380ac58cd60e01b6001600160e01b03198316145b80610c375750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b0319821663152a902d60e11b1480610c375750610c3782612c60565b60008181526001830160205260408120548015612528576000612463600183613898565b855490915060009061247790600190613898565b90508181146124dc576000866000018281548110612497576124976138c7565b90600052602060002001549050808760000184815481106124ba576124ba6138c7565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806124ed576124ed613a04565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610c37565b6000915050610c37565b60008281526009602090815260408083206001600160a01b038516845290915290205460ff16610c4f57612570816001600160a01b03166014612c85565b61257b836020612c85565b60405160200161258c929190613a1a565b60408051601f198184030181529082905262461bcd60e51b8252611153916004016133cf565b60008281526009602090815260408083206001600160a01b038516845290915290205460ff1615610c4f5760008281526009602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600854600160a01b900460ff166114db5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401611153565b604080516080810182526000808252602082018190529181018290526060810191909152610c376126be83611d77565b604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b600082600001828154811061271d5761271d6138c7565b9060005260206000200154905092915050565b610c4f828260405180602001604052806000815250612e2e565b6002600c54141561279d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611153565b6002600c556127aa612262565b6040805160e081018252600d548152600e546020820152600f549181018290526010546001600160f81b038116606083015260ff600160f81b909104811615156080830152601154808216151560a0840152610100900416151560c08201529060009015612825576128208483604001516122bc565b612827565b835b905060008083608001511561286f5760608401518451612850916001600160f81b031690613898565b915061285b60155490565b6013546128689190613898565b905061287f565b8351915061287c60135490565b90505b61288d836118718385613898565b9250600083116128d25760405162461bcd60e51b815260206004820152601060248201526f14d95b1b195c8e8814dbdb19081bdd5d60821b6044820152606401611153565b602084015115612a6257336001600160a01b0388168114159060009032148015906129065750326001600160a01b038a1614155b9050612948858a6040518060400160405280600b81526020017f4275796572206c696d6974000000000000000000000000000000000000000000815250612e9b565b945081156129935761299085336040518060400160405280600c81526020017f53656e646572206c696d69740000000000000000000000000000000000000000815250612e9b565b94505b80156129dc576129d985326040518060400160405280600c81526020017f4f726967696e206c696d69740000000000000000000000000000000000000000815250612e9b565b94505b6001600160a01b03891660009081526014602052604081208054879290612a049084906138af565b90915550508115612a34573360009081526014602052604081208054879290612a2e9084906138af565b90915550505b8015612a5f573260009081526014602052604081208054879290612a599084906138af565b90915550505b50505b6000612a6e84876114b4565b905080341015612a9e57612a8e612a89633b9aca0083613884565b612eed565b60405160200161258c9190613a9b565b612aa96013856122d2565b84516013541115612abc57612abc6138f8565b612ac888856000612145565b8015612b2d57601254612ae4906001600160a01b031682612feb565b60125460408051868152602081018490526001600160a01b03909216917f01f51b99bd1c3cca301836178e5dee13aadfe44eff06dc3ddcbf3c9d058454f8910160405180910390a25b80341115612c0557336000612b428334613898565b9050600080836001600160a01b03168360405160006040518083038185875af1925050503d8060008114612b92576040519150601f19603f3d011682016040523d82523d6000602084013e612b97565b606091505b5091509150818190612bbc5760405162461bcd60e51b815260040161115391906133cf565b50836001600160a01b03167fbb28353e4598c3b9199101a66e0989549b659a59a54d2c27fbb183f1932c8e6d84604051612bf891815260200190565b60405180910390a2505050505b50506001600c55505050505050565b6060611653613104565b604080516080019081905280825b600183039250600a81066030018353600a900480612c4957612c4e565b612c2c565b50819003601f19909101908152919050565b60006001600160e01b03198216635a05180f60e01b1480610c375750610c3782613113565b60606000612c9483600261384f565b612c9f9060026138af565b67ffffffffffffffff811115612cb757612cb76134a7565b6040519080825280601f01601f191660200182016040528015612ce1576020820181803683370190505b509050600360fc1b81600081518110612cfc57612cfc6138c7565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612d2b57612d2b6138c7565b60200101906001600160f81b031916908160001a9053506000612d4f84600261384f565b612d5a9060016138af565b90505b6001811115612ddf577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612d9b57612d9b6138c7565b1a60f81b828281518110612db157612db16138c7565b60200101906001600160f81b031916908160001a90535060049490941c93612dd881613aef565b9050612d5d565b5083156114c45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401611153565b612e388383613148565b6001600160a01b0383163b156112e4576000548281035b612e626000868380600101945086612179565b612e7f576040516368d2bf6b60e11b815260040160405180910390fd5b818110612e4f578160005414612e9457600080fd5b5050505050565b6001600160a01b038216600090815260146020526040812054600e548291612ec291613898565b905080612eda578260405160200161258c9190613b06565b612ee485826122bc565b95945050505050565b606081612f115750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612f3b5780612f25816138dd565b9150612f349050600a83613884565b9150612f15565b60008167ffffffffffffffff811115612f5657612f566134a7565b6040519080825280601f01601f191660200182016040528015612f80576020820181803683370190505b5090505b841561225a57612f95600183613898565b9150612fa2600a86613b36565b612fad9060306138af565b60f81b818381518110612fc257612fc26138c7565b60200101906001600160f81b031916908160001a905350612fe4600a86613884565b9450612f84565b8047101561303b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401611153565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613088576040519150601f19603f3d011682016040523d82523d6000602084013e61308d565b606091505b50509050806112e45760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401611153565b6060600b8054610c62906137fe565b60006001600160e01b03198216637965db0b60e01b1480610c3757506301ffc9a760e01b6001600160e01b0319831614610c37565b600054816131695760405163b562e8dd60e01b815260040160405180910390fd5b6131766000848385611dd8565b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461322557808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a46001016131ed565b508161324357604051622e076360e81b815260040160405180910390fd5b60005550505050565b828054613258906137fe565b90600052602060002090601f01602090048101928261327a57600085556132c0565b82601f1061329357805160ff19168380011785556132c0565b828001600101855582156132c0579182015b828111156132c05782518255916020019190600101906132a5565b506132cc9291506132d0565b5090565b5b808211156132cc57600081556001016132d1565b6001600160e01b031981168114611b0257600080fd5b60006020828403121561330d57600080fd5b81356114c4816132e5565b6001600160a01b0381168114611b0257600080fd5b6000806040838503121561334057600080fd5b823561334b81613318565b915060208301356bffffffffffffffffffffffff8116811461336c57600080fd5b809150509250929050565b60005b8381101561339257818101518382015260200161337a565b838111156115505750506000910152565b600081518084526133bb816020860160208601613377565b601f01601f19169290920160200192915050565b6020815260006114c460208301846133a3565b6000602082840312156133f457600080fd5b5035919050565b6000806040838503121561340e57600080fd5b823561341981613318565b946020939093013593505050565b60006020828403121561343957600080fd5b81356114c481613318565b60008060006060848603121561345957600080fd5b833561346481613318565b9250602084013561347481613318565b929592945050506040919091013590565b6000806040838503121561349857600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60405160e0810167ffffffffffffffff811182821017156134e0576134e06134a7565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561350f5761350f6134a7565b604052919050565b8035801515811461352757600080fd5b919050565b600060e0828403121561353e57600080fd5b6135466134bd565b82358152602083013560208201526040830135604082015260608301356001600160f81b038116811461357857600080fd5b606082015261358960808401613517565b608082015261359a60a08401613517565b60a08201526135ab60c08401613517565b60c08201529392505050565b600080604083850312156135ca57600080fd5b82359150602083013561336c81613318565b600067ffffffffffffffff8211156135f6576135f66134a7565b50601f01601f191660200190565b6000613617613612846135dc565b6134e6565b905082815283838301111561362b57600080fd5b828260208301376000602084830101529392505050565b60006020828403121561365457600080fd5b813567ffffffffffffffff81111561366b57600080fd5b8201601f8101841361367c57600080fd5b61225a84823560208401613604565b60006020828403121561369d57600080fd5b6114c482613517565b600080602083850312156136b957600080fd5b823567ffffffffffffffff808211156136d157600080fd5b818501915085601f8301126136e557600080fd5b8135818111156136f457600080fd5b8660208260051b850101111561370957600080fd5b60209290920196919550909350505050565b6000806040838503121561372e57600080fd5b823561373981613318565b915061374760208401613517565b90509250929050565b6000806000806080858703121561376657600080fd5b843561377181613318565b9350602085013561378181613318565b925060408501359150606085013567ffffffffffffffff8111156137a457600080fd5b8501601f810187136137b557600080fd5b6137c487823560208401613604565b91505092959194509250565b600080604083850312156137e357600080fd5b82356137ee81613318565b9150602083013561336c81613318565b600181811c9082168061381257607f821691505b6020821081141561383357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561386957613869613839565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826138935761389361386e565b500490565b6000828210156138aa576138aa613839565b500390565b600082198211156138c2576138c2613839565b500190565b634e487b7160e01b600052603260045260246000fd5b60006000198214156138f1576138f1613839565b5060010190565b634e487b7160e01b600052600160045260246000fd5b60006020828403121561392057600080fd5b815167ffffffffffffffff81111561393757600080fd5b8201601f8101841361394857600080fd5b8051613956613612826135dc565b81815285602083850101111561396b57600080fd5b612ee4826020830160208601613377565b60006001600160a01b038087168352808616602084015250836040830152608060608301526139ae60808301846133a3565b9695505050505050565b6000602082840312156139ca57600080fd5b81516114c4816132e5565b600083516139e7818460208801613377565b8351908301906139fb818360208801613377565b01949350505050565b634e487b7160e01b600052603160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613a52816017850160208801613377565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613a8f816028840160208801613377565b01602801949350505050565b7f53656c6c65723a20436f73747320000000000000000000000000000000000000815260008251613ad381600e850160208701613377565b64204757656960d81b600e939091019283015250601301919050565b600081613afe57613afe613839565b506000190190565b67029b2b63632b91d160c51b815260008251613b29816008850160208701613377565b9190910160080192915050565b600082613b4557613b4561386e565b50069056fea2646970667358221220e792fe86cd80c04ae0077cb8605ef0b91930c82ba10ae5eb4d5cedb6591c190664736f6c634300080b003300000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000030000000000000000000000003f91b4ac2d3456bb8fbbf1458bd7ac07b63c2ad10000000000000000000000003f91b4ac2d3456bb8fbbf1458bd7ac07b63c2ad10000000000000000000000000000000000000000000000000000000000000009527567204269726473000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000075255474249524400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002268747470733a2f2f6e66742e72756762697264732e636f6d2f6d657461646174612f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002168747470733a2f2f72756762697264732e636f6d2f6f70656e7365612e6a736f6e00000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106103ad5760003560e01c8063715018a6116101e7578063afab28721161010d578063d547741f116100a0578063e985e9c51161006f578063e985e9c514610b89578063eb12d61e14610bd2578063f2031c6714610bf2578063f2fde38b14610c0c57600080fd5b8063d547741f14610b1f578063d547cfb714610b3f578063dc9ff3ed14610b54578063e8a3d48514610b7457600080fd5b8063bf62e21d116100dc578063bf62e21d14610a9a578063c7fecbcc14610aba578063c87b56dd14610adf578063ca15c87314610aff57600080fd5b8063afab2872146109af578063b7f1d072146109cf578063b88d4fde146109ef578063bb69b7ef14610a0f57600080fd5b806391d1485411610185578063a035b1fe11610154578063a035b1fe14610944578063a217fddf1461095a578063a22cb4651461096f578063aa9678781461098f57600080fd5b806391d14854146108b657806395d89b41146108fc5780639e705140146109115780639f93f7791461093157600080fd5b80639010d07c116101c15780639010d07c1461084157806391053d94146108615780639106d7ba1461088157806391b7f5ed1461089657600080fd5b8063715018a6146107f95780638456cb591461080e5780638da5cb5b1461082357600080fd5b80632f2ff15d116102d7578063421745ab1161026a5780635a028400116102395780635a0284001461076a5780635c975abb1461079a5780636352211e146107b957806370a08231146107d957600080fd5b8063421745ab146106cd57806342842e0e146106ed578063469b29cd1461070d5780634ca4fdf51461072d57600080fd5b806339154b9e116102a657806339154b9e146106445780633ec02e14146106645780633f4ba83a1461068457806340b625c01461069957600080fd5b80632f2ff15d146105c457806330176e13146105e457806336568abe1461060457806338af3eed1461062457600080fd5b806318160ddd1161034f578063247045191161031e5780632470451914610520578063248a9ca3146105355780632a55205a146105655780632f274bd4146105a457600080fd5b806318160ddd146104a35780631c31f710146104c65780632015c291146104e657806323b872dd1461050057600080fd5b806306fdde031161038b57806306fdde0314610409578063081812fc1461042b578063095ea7b3146104635780630e316ab71461048357600080fd5b806301ffc9a7146103b257806302fa7c47146103e757806304634d8d146103e7575b600080fd5b3480156103be57600080fd5b506103d26103cd3660046132fb565b610c2c565b60405190151581526020015b60405180910390f35b3480156103f357600080fd5b5061040761040236600461332d565b610c3d565b005b34801561041557600080fd5b5061041e610c53565b6040516103de91906133cf565b34801561043757600080fd5b5061044b6104463660046133e2565b610ce5565b6040516001600160a01b0390911681526020016103de565b34801561046f57600080fd5b5061040761047e3660046133fb565b610d29565b34801561048f57600080fd5b5061040761049e366004613427565b610dc9565b3480156104af57600080fd5b50600154600054035b6040519081526020016103de565b3480156104d257600080fd5b506104076104e1366004613427565b610ddc565b3480156104f257600080fd5b506021546103d29060ff1681565b34801561050c57600080fd5b5061040761051b366004613444565b610e06565b34801561052c57600080fd5b5061041e610fa5565b34801561054157600080fd5b506104b86105503660046133e2565b60009081526009602052604090206001015490565b34801561057157600080fd5b50610585610580366004613485565b611033565b604080516001600160a01b0390931683526020830191909152016103de565b3480156105b057600080fd5b506104076105bf36600461352c565b6110ee565b3480156105d057600080fd5b506104076105df3660046135b7565b6112bf565b3480156105f057600080fd5b506104076105ff366004613642565b6112e9565b34801561061057600080fd5b5061040761061f3660046135b7565b611304565b34801561063057600080fd5b5060125461044b906001600160a01b031681565b34801561065057600080fd5b5061040761065f3660046133e2565b61138c565b34801561067057600080fd5b506104b861067f366004613485565b6114b4565b34801561069057600080fd5b506104076114cb565b3480156106a557600080fd5b506104b87f7904e9328f622335e3d715af4f9d4b4147d279485bd5be001b80efa4da608a2981565b3480156106d957600080fd5b506104076106e836600461368b565b6114dd565b3480156106f957600080fd5b50610407610708366004613444565b6114f8565b34801561071957600080fd5b506104076107283660046136a6565b611513565b34801561073957600080fd5b5061074d6107483660046133e2565b611556565b6040805193151584526020840192909252908201526060016103de565b34801561077657600080fd5b506103d26107853660046133e2565b601c6020526000908152604090205460ff1681565b3480156107a657600080fd5b50600854600160a01b900460ff166103d2565b3480156107c557600080fd5b5061044b6107d43660046133e2565b6115a2565b3480156107e557600080fd5b506104b86107f4366004613427565b6115ad565b34801561080557600080fd5b506104076115fc565b34801561081a57600080fd5b5061040761160e565b34801561082f57600080fd5b506008546001600160a01b031661044b565b34801561084d57600080fd5b5061044b61085c366004613485565b61161e565b34801561086d57600080fd5b5061040761087c3660046133e2565b611636565b34801561088d57600080fd5b506104b8611648565b3480156108a257600080fd5b506104076108b13660046133e2565b611658565b3480156108c257600080fd5b506103d26108d13660046135b7565b60009182526009602090815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561090857600080fd5b5061041e611665565b34801561091d57600080fd5b5061040761092c3660046133fb565b611674565b61040761093f3660046133fb565b611688565b34801561095057600080fd5b506104b860165481565b34801561096657600080fd5b506104b8600081565b34801561097b57600080fd5b5061040761098a36600461371b565b611692565b34801561099b57600080fd5b506104076109aa366004613444565b611728565b3480156109bb57600080fd5b506104076109ca366004613642565b6117a2565b3480156109db57600080fd5b506104076109ea366004613427565b6117bd565b3480156109fb57600080fd5b50610407610a0a366004613750565b6117fa565b348015610a1b57600080fd5b50600d54600e54600f54601054601154610a57949392916001600160f81b0381169160ff600160f81b9092048216918181169161010090041687565b604080519788526020880196909652948601939093526001600160f81b03909116606085015215156080840152151560a0830152151560c082015260e0016103de565b348015610aa657600080fd5b50610407610ab53660046133fb565b61183e565b348015610ac657600080fd5b5060215461044b9061010090046001600160a01b031681565b348015610aeb57600080fd5b5061041e610afa3660046133e2565b61196f565b348015610b0b57600080fd5b506104b8610b1a3660046133e2565b611a06565b348015610b2b57600080fd5b50610407610b3a3660046135b7565b611a1d565b348015610b4b57600080fd5b5061041e611a42565b348015610b6057600080fd5b50610407610b6f36600461368b565b611a4f565b348015610b8057600080fd5b5061041e611a6a565b348015610b9557600080fd5b506103d2610ba43660046137d0565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610bde57600080fd5b50610407610bed366004613427565b611a79565b348015610bfe57600080fd5b50601d546103d29060ff1681565b348015610c1857600080fd5b50610407610c27366004613427565b611a8c565b6000610c3782611bc0565b92915050565b610c45611bda565b610c4f8282611c34565b5050565b606060028054610c62906137fe565b80601f0160208091040260200160405190810160405280929190818152602001828054610c8e906137fe565b8015610cdb5780601f10610cb057610100808354040283529160200191610cdb565b820191906000526020600020905b815481529060010190602001808311610cbe57829003601f168201915b5050505050905090565b6000610cf082611d3b565b610d0d576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610d34826115a2565b9050336001600160a01b03821614610d6d57610d508133610ba4565b610d6d576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b610dd1611bda565b610c4f601782611d62565b610de4611bda565b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e1182611d77565b9050836001600160a01b0316816001600160a01b031614610e445760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417610e9157610e748633610ba4565b610e9157604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610eb857604051633a954ecd60e21b815260040160405180910390fd5b610ec58686866001611dd8565b8015610ed057600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040902055600160e11b8316610f5b5760018401600081815260046020526040902054610f59576000548114610f595760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b601b8054610fb2906137fe565b80601f0160208091040260200160405190810160405280929190818152602001828054610fde906137fe565b801561102b5780601f106110005761010080835404028352916020019161102b565b820191906000526020600020905b81548152906001019060200180831161100e57829003601f168201915b505050505081565b6000828152601a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046bffffffffffffffffffffffff169282019290925282916110b25750604080518082019091526019546001600160a01b0381168252600160a01b90046bffffffffffffffffffffffff1660208201525b6020810151600090612710906110d6906bffffffffffffffffffffffff168761384f565b6110e09190613884565b915196919550909350505050565b6110f6611bda565b80606001516001600160f81b03168160000151101561115c5760405162461bcd60e51b815260206004820152601c60248201527f53656c6c65723a2065786365737369766520667265652071756f74610000000060448201526064015b60405180910390fd5b601354815110156111af5760405162461bcd60e51b815260206004820181905260248201527f53656c6c65723a20696e76656e746f7279203c20616c726561647920736f6c646044820152606401611153565b60155481606001516001600160f81b031610156112185760405162461bcd60e51b815260206004820152602160248201527f53656c6c65723a20667265652071756f7461203c20616c7265616479207573656044820152601960fa1b6064820152608401611153565b601154610100900460ff161561123557600160c0820152600d5481525b60115460ff161561125957600160a08201526010546001600160f81b031660608201525b8051600d556020810151600e556040810151600f55606081015160808201511515600160f81b026001600160f81b039091161760105560a08101516011805460c09093015115156101000261ff00199215159290921661ffff1990931692909217179055565b6000828152600960205260409020600101546112da81611e69565b6112e48383611e73565b505050565b6112f1611bda565b8051610c4f90600b90602084019061324c565b6001600160a01b03811633146113825760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401611153565b610c4f8282611e95565b7f7904e9328f622335e3d715af4f9d4b4147d279485bd5be001b80efa4da608a296113b681611e69565b6000828152601e60205260409020546114115760405162461bcd60e51b815260206004820152601560248201527f4d6f6f6e62697264733a206e6f74206e657374656400000000000000000000006044820152606401611153565b6000828152601e602052604090205461142a9042613898565b6000838152601f6020526040812080549091906114489084906138af565b90915550506000828152601e60205260408082208290555183917f657500793744fd287ed8e476832a3cb4b7aa5b931cda10bdc773a301e0e9a83191a260405182907f3ebee94e74ea24f711b5876dca724062e18b7b37b6883e686a92f093248a4fcf90600090a25050565b6000601654836114c4919061384f565b9392505050565b6114d3611bda565b6114db611eb7565b565b6114e5611bda565b6021805460ff1916911515919091179055565b6112e4838383604051806020016040528060008152506117fa565b8060005b8181101561155057611540848483818110611534576115346138c7565b90506020020135611f0c565b611549816138dd565b9050611517565b50505050565b6000818152601e6020526040812054819081908015611580576001935061157d8142613898565b92505b6000858152601f602052604090205461159990846138af565b93959294505050565b6000610c3782611d77565b60006001600160a01b0382166115d6576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b611604611bda565b6114db60006120a4565b611616611bda565b6114db6120f6565b6000828152600a602052604081206114c49083612139565b61163e611bda565b600e819055600f55565b600061165360135490565b905090565b611660611bda565b601655565b606060038054610c62906137fe565b61167c611bda565b610c4f82826001612145565b610c4f828261216d565b6001600160a01b0382163314156116bc5760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b33611732826115a2565b6001600160a01b0316146117885760405162461bcd60e51b815260206004820152601560248201527f4d6f6f6e62697264733a204f6e6c79206f776e657200000000000000000000006044820152606401611153565b60026020556117988383836114f8565b5050600160205550565b6117aa611bda565b8051610c4f90601b90602084019061324c565b6117c5611bda565b602180546001600160a01b039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b611805848484610e06565b6001600160a01b0383163b156115505761182184848484612179565b611550576040516368d2bf6b60e11b815260040160405180910390fd5b611846611bda565b61184e612262565b6010546001600160f81b03166118768261186760155490565b6118719084613898565b6122bc565b9150600082116118c85760405162461bcd60e51b815260206004820152601b60248201527f53656c6c65723a20467265652071756f746120657863656564656400000000006044820152606401611153565b600d546118d88361186760135490565b92506000831161191d5760405162461bcd60e51b815260206004820152601060248201526f14d95b1b195c8e8814dbdb19081bdd5d60821b6044820152606401611153565b6119286013846122d2565b6119336015846122d2565b61193f84846001612145565b8061194960135490565b1115611957576119576138f8565b8161196160155490565b1115611550576115506138f8565b60215460609061010090046001600160a01b0316156119fd5760215460405163c87b56dd60e01b8152600481018490526101009091046001600160a01b03169063c87b56dd90602401600060405180830381865afa1580156119d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c37919081019061390e565b610c37826122ef565b6000818152600a60205260408120610c3790612373565b600082815260096020526040902060010154611a3881611e69565b6112e48383611e95565b600b8054610fb2906137fe565b611a57611bda565b601d805460ff1916911515919091179055565b6060601b8054610c62906137fe565b611a81611bda565b610c4f601782611bab565b611a94611bda565b6001600160a01b038116611af95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611153565b611b02816120a4565b50565b5490565b60008281526009602090815260408083206001600160a01b038516845290915290205460ff16610c4f5760008281526009602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611b673390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006114c4836001600160a01b03841661237d565b6000611bcb826123cc565b80610c375750610c378261241a565b6008546001600160a01b031633146114db5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611153565b6127106bffffffffffffffffffffffff82161115611ca75760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401611153565b6001600160a01b038216611cfd5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401611153565b604080518082019091526001600160a01b039092168083526bffffffffffffffffffffffff9091166020909201829052600160a01b90910217601955565b6000805482108015610c37575050600090815260046020526040902054600160e01b161590565b60006114c4836001600160a01b03841661243f565b600081600054811015611dbf57600081815260046020526040902054600160e01b8116611dbd575b806114c4575060001901600081815260046020526040902054611d9f565b505b604051636f96cda160e11b815260040160405180910390fd5b816000611de583836138af565b90505b80821015610f9d576000828152601e60205260409020541580611e0d57506020546002145b611e595760405162461bcd60e51b815260206004820152601260248201527f4d6f6f6e62697264733a206e657374696e6700000000000000000000000000006044820152606401611153565b611e62826138dd565b9150611de8565b611b028133612532565b611e7d8282611b09565b6000828152600a602052604090206112e49082611bab565b611e9f82826125b2565b6000828152600a602052604090206112e49082611d62565b611ebf612635565b6008805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b8033611f178261268e565b516001600160a01b03161480611f3d575033611f3282610ce5565b6001600160a01b0316145b611f975760405162461bcd60e51b815260206004820152602560248201527f45524337323141436f6d6d6f6e3a204e6f7420617070726f766564206e6f722060448201526437bbb732b960d91b6064820152608401611153565b6000828152601e60205260409020548061203a5760215460ff16611ffd5760405162461bcd60e51b815260206004820152601960248201527f4d6f6f6e62697264733a206e657374696e6720636c6f736564000000000000006044820152606401611153565b6000838152601e60205260408082204290555184917f84bccedf5fbad5c802864c2d64e4562a610a468ba28173bd7528588e4429eaf791a2505050565b6120448142613898565b6000848152601f6020526040812080549091906120629084906138af565b90915550506000838152601e60205260408082208290555184917f657500793744fd287ed8e476832a3cb4b7aa5b931cda10bdc773a301e0e9a83191a2505050565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6120fe612262565b6008805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611eef3390565b60006114c48383612706565b61214f8383612730565b61271061215f6001546000540390565b11156112e4576112e46138f8565b610c4f8282600061274a565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906121ae90339089908890889060040161397c565b6020604051808303816000875af19250505080156121e9575060408051601f3d908101601f191682019092526121e6918101906139b8565b60015b612244573d808015612217576040519150601f19603f3d011682016040523d82523d6000602084013e61221c565b606091505b50805161223c576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b600854600160a01b900460ff16156114db5760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401611153565b60008183106122cb57816114c4565b5090919050565b808260000160008282546122e691906138af565b90915550505050565b60606122fa82611d3b565b61231757604051630a14c4b560e41b815260040160405180910390fd5b6000612321612c14565b905080516000141561234257604051806020016040528060008152506114c4565b8061234c84612c1e565b60405160200161235d9291906139d5565b6040516020818303038152906040529392505050565b6000610c37825490565b60008181526001830160205260408120546123c457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c37565b506000610c37565b60006301ffc9a760e01b6001600160e01b0319831614806123fd57506380ac58cd60e01b6001600160e01b03198316145b80610c375750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b0319821663152a902d60e11b1480610c375750610c3782612c60565b60008181526001830160205260408120548015612528576000612463600183613898565b855490915060009061247790600190613898565b90508181146124dc576000866000018281548110612497576124976138c7565b90600052602060002001549050808760000184815481106124ba576124ba6138c7565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806124ed576124ed613a04565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610c37565b6000915050610c37565b60008281526009602090815260408083206001600160a01b038516845290915290205460ff16610c4f57612570816001600160a01b03166014612c85565b61257b836020612c85565b60405160200161258c929190613a1a565b60408051601f198184030181529082905262461bcd60e51b8252611153916004016133cf565b60008281526009602090815260408083206001600160a01b038516845290915290205460ff1615610c4f5760008281526009602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600854600160a01b900460ff166114db5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401611153565b604080516080810182526000808252602082018190529181018290526060810191909152610c376126be83611d77565b604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b600082600001828154811061271d5761271d6138c7565b9060005260206000200154905092915050565b610c4f828260405180602001604052806000815250612e2e565b6002600c54141561279d5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611153565b6002600c556127aa612262565b6040805160e081018252600d548152600e546020820152600f549181018290526010546001600160f81b038116606083015260ff600160f81b909104811615156080830152601154808216151560a0840152610100900416151560c08201529060009015612825576128208483604001516122bc565b612827565b835b905060008083608001511561286f5760608401518451612850916001600160f81b031690613898565b915061285b60155490565b6013546128689190613898565b905061287f565b8351915061287c60135490565b90505b61288d836118718385613898565b9250600083116128d25760405162461bcd60e51b815260206004820152601060248201526f14d95b1b195c8e8814dbdb19081bdd5d60821b6044820152606401611153565b602084015115612a6257336001600160a01b0388168114159060009032148015906129065750326001600160a01b038a1614155b9050612948858a6040518060400160405280600b81526020017f4275796572206c696d6974000000000000000000000000000000000000000000815250612e9b565b945081156129935761299085336040518060400160405280600c81526020017f53656e646572206c696d69740000000000000000000000000000000000000000815250612e9b565b94505b80156129dc576129d985326040518060400160405280600c81526020017f4f726967696e206c696d69740000000000000000000000000000000000000000815250612e9b565b94505b6001600160a01b03891660009081526014602052604081208054879290612a049084906138af565b90915550508115612a34573360009081526014602052604081208054879290612a2e9084906138af565b90915550505b8015612a5f573260009081526014602052604081208054879290612a599084906138af565b90915550505b50505b6000612a6e84876114b4565b905080341015612a9e57612a8e612a89633b9aca0083613884565b612eed565b60405160200161258c9190613a9b565b612aa96013856122d2565b84516013541115612abc57612abc6138f8565b612ac888856000612145565b8015612b2d57601254612ae4906001600160a01b031682612feb565b60125460408051868152602081018490526001600160a01b03909216917f01f51b99bd1c3cca301836178e5dee13aadfe44eff06dc3ddcbf3c9d058454f8910160405180910390a25b80341115612c0557336000612b428334613898565b9050600080836001600160a01b03168360405160006040518083038185875af1925050503d8060008114612b92576040519150601f19603f3d011682016040523d82523d6000602084013e612b97565b606091505b5091509150818190612bbc5760405162461bcd60e51b815260040161115391906133cf565b50836001600160a01b03167fbb28353e4598c3b9199101a66e0989549b659a59a54d2c27fbb183f1932c8e6d84604051612bf891815260200190565b60405180910390a2505050505b50506001600c55505050505050565b6060611653613104565b604080516080019081905280825b600183039250600a81066030018353600a900480612c4957612c4e565b612c2c565b50819003601f19909101908152919050565b60006001600160e01b03198216635a05180f60e01b1480610c375750610c3782613113565b60606000612c9483600261384f565b612c9f9060026138af565b67ffffffffffffffff811115612cb757612cb76134a7565b6040519080825280601f01601f191660200182016040528015612ce1576020820181803683370190505b509050600360fc1b81600081518110612cfc57612cfc6138c7565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612d2b57612d2b6138c7565b60200101906001600160f81b031916908160001a9053506000612d4f84600261384f565b612d5a9060016138af565b90505b6001811115612ddf577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110612d9b57612d9b6138c7565b1a60f81b828281518110612db157612db16138c7565b60200101906001600160f81b031916908160001a90535060049490941c93612dd881613aef565b9050612d5d565b5083156114c45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401611153565b612e388383613148565b6001600160a01b0383163b156112e4576000548281035b612e626000868380600101945086612179565b612e7f576040516368d2bf6b60e11b815260040160405180910390fd5b818110612e4f578160005414612e9457600080fd5b5050505050565b6001600160a01b038216600090815260146020526040812054600e548291612ec291613898565b905080612eda578260405160200161258c9190613b06565b612ee485826122bc565b95945050505050565b606081612f115750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612f3b5780612f25816138dd565b9150612f349050600a83613884565b9150612f15565b60008167ffffffffffffffff811115612f5657612f566134a7565b6040519080825280601f01601f191660200182016040528015612f80576020820181803683370190505b5090505b841561225a57612f95600183613898565b9150612fa2600a86613b36565b612fad9060306138af565b60f81b818381518110612fc257612fc26138c7565b60200101906001600160f81b031916908160001a905350612fe4600a86613884565b9450612f84565b8047101561303b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401611153565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613088576040519150601f19603f3d011682016040523d82523d6000602084013e61308d565b606091505b50509050806112e45760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401611153565b6060600b8054610c62906137fe565b60006001600160e01b03198216637965db0b60e01b1480610c3757506301ffc9a760e01b6001600160e01b0319831614610c37565b600054816131695760405163b562e8dd60e01b815260040160405180910390fd5b6131766000848385611dd8565b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461322557808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a46001016131ed565b508161324357604051622e076360e81b815260040160405180910390fd5b60005550505050565b828054613258906137fe565b90600052602060002090601f01602090048101928261327a57600085556132c0565b82601f1061329357805160ff19168380011785556132c0565b828001600101855582156132c0579182015b828111156132c05782518255916020019190600101906132a5565b506132cc9291506132d0565b5090565b5b808211156132cc57600081556001016132d1565b6001600160e01b031981168114611b0257600080fd5b60006020828403121561330d57600080fd5b81356114c4816132e5565b6001600160a01b0381168114611b0257600080fd5b6000806040838503121561334057600080fd5b823561334b81613318565b915060208301356bffffffffffffffffffffffff8116811461336c57600080fd5b809150509250929050565b60005b8381101561339257818101518382015260200161337a565b838111156115505750506000910152565b600081518084526133bb816020860160208601613377565b601f01601f19169290920160200192915050565b6020815260006114c460208301846133a3565b6000602082840312156133f457600080fd5b5035919050565b6000806040838503121561340e57600080fd5b823561341981613318565b946020939093013593505050565b60006020828403121561343957600080fd5b81356114c481613318565b60008060006060848603121561345957600080fd5b833561346481613318565b9250602084013561347481613318565b929592945050506040919091013590565b6000806040838503121561349857600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60405160e0810167ffffffffffffffff811182821017156134e0576134e06134a7565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561350f5761350f6134a7565b604052919050565b8035801515811461352757600080fd5b919050565b600060e0828403121561353e57600080fd5b6135466134bd565b82358152602083013560208201526040830135604082015260608301356001600160f81b038116811461357857600080fd5b606082015261358960808401613517565b608082015261359a60a08401613517565b60a08201526135ab60c08401613517565b60c08201529392505050565b600080604083850312156135ca57600080fd5b82359150602083013561336c81613318565b600067ffffffffffffffff8211156135f6576135f66134a7565b50601f01601f191660200190565b6000613617613612846135dc565b6134e6565b905082815283838301111561362b57600080fd5b828260208301376000602084830101529392505050565b60006020828403121561365457600080fd5b813567ffffffffffffffff81111561366b57600080fd5b8201601f8101841361367c57600080fd5b61225a84823560208401613604565b60006020828403121561369d57600080fd5b6114c482613517565b600080602083850312156136b957600080fd5b823567ffffffffffffffff808211156136d157600080fd5b818501915085601f8301126136e557600080fd5b8135818111156136f457600080fd5b8660208260051b850101111561370957600080fd5b60209290920196919550909350505050565b6000806040838503121561372e57600080fd5b823561373981613318565b915061374760208401613517565b90509250929050565b6000806000806080858703121561376657600080fd5b843561377181613318565b9350602085013561378181613318565b925060408501359150606085013567ffffffffffffffff8111156137a457600080fd5b8501601f810187136137b557600080fd5b6137c487823560208401613604565b91505092959194509250565b600080604083850312156137e357600080fd5b82356137ee81613318565b9150602083013561336c81613318565b600181811c9082168061381257607f821691505b6020821081141561383357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561386957613869613839565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826138935761389361386e565b500490565b6000828210156138aa576138aa613839565b500390565b600082198211156138c2576138c2613839565b500190565b634e487b7160e01b600052603260045260246000fd5b60006000198214156138f1576138f1613839565b5060010190565b634e487b7160e01b600052600160045260246000fd5b60006020828403121561392057600080fd5b815167ffffffffffffffff81111561393757600080fd5b8201601f8101841361394857600080fd5b8051613956613612826135dc565b81815285602083850101111561396b57600080fd5b612ee4826020830160208601613377565b60006001600160a01b038087168352808616602084015250836040830152608060608301526139ae60808301846133a3565b9695505050505050565b6000602082840312156139ca57600080fd5b81516114c4816132e5565b600083516139e7818460208801613377565b8351908301906139fb818360208801613377565b01949350505050565b634e487b7160e01b600052603160045260246000fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613a52816017850160208801613377565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613a8f816028840160208801613377565b01602801949350505050565b7f53656c6c65723a20436f73747320000000000000000000000000000000000000815260008251613ad381600e850160208701613377565b64204757656960d81b600e939091019283015250601301919050565b600081613afe57613afe613839565b506000190190565b67029b2b63632b91d160c51b815260008251613b29816008850160208701613377565b9190910160080192915050565b600082613b4557613b4561386e565b50069056fea2646970667358221220e792fe86cd80c04ae0077cb8605ef0b91930c82ba10ae5eb4d5cedb6591c190664736f6c634300080b0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000030000000000000000000000003f91b4ac2d3456bb8fbbf1458bd7ac07b63c2ad10000000000000000000000003f91b4ac2d3456bb8fbbf1458bd7ac07b63c2ad10000000000000000000000000000000000000000000000000000000000000009527567204269726473000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000075255474249524400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002268747470733a2f2f6e66742e72756762697264732e636f6d2f6d657461646174612f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002168747470733a2f2f72756762697264732e636f6d2f6f70656e7365612e6a736f6e00000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : name (string): Rug Birds
Arg [1] : symbol (string): RUGBIRD
Arg [2] : tknURI (string): https://nft.rugbirds.com/metadata/
Arg [3] : _storefrontURI (string): https://rugbirds.com/opensea.json
Arg [4] : supplyCap (uint256): 10000
Arg [5] : maxPer (uint256): 3
Arg [6] : beneficiary (address): 0x3F91B4aC2d3456Bb8FBbF1458BD7ac07B63c2Ad1
Arg [7] : royaltyReceiver (address): 0x3F91B4aC2d3456Bb8FBbF1458BD7ac07B63c2Ad1
-----Encoded View---------------
18 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [3] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [4] : 0000000000000000000000000000000000000000000000000000000000002710
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [6] : 0000000000000000000000003f91b4ac2d3456bb8fbbf1458bd7ac07b63c2ad1
Arg [7] : 0000000000000000000000003f91b4ac2d3456bb8fbbf1458bd7ac07b63c2ad1
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [9] : 5275672042697264730000000000000000000000000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [11] : 5255474249524400000000000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000022
Arg [13] : 68747470733a2f2f6e66742e72756762697264732e636f6d2f6d657461646174
Arg [14] : 612f000000000000000000000000000000000000000000000000000000000000
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000021
Arg [16] : 68747470733a2f2f72756762697264732e636f6d2f6f70656e7365612e6a736f
Arg [17] : 6e00000000000000000000000000000000000000000000000000000000000000
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.