Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
17838259 | 459 days ago | Contract Creation | 0 ETH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
OpenEditionERC721
Compiler Version
v0.8.12+commit.f00d7308
Optimization Enabled:
Yes with 20 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; /// @author thirdweb // $$\ $$\ $$\ $$\ $$\ // $$ | $$ | \__| $$ | $$ | // $$$$$$\ $$$$$$$\ $$\ $$$$$$\ $$$$$$$ |$$\ $$\ $$\ $$$$$$\ $$$$$$$\ // \_$$ _| $$ __$$\ $$ |$$ __$$\ $$ __$$ |$$ | $$ | $$ |$$ __$$\ $$ __$$\ // $$ | $$ | $$ |$$ |$$ | \__|$$ / $$ |$$ | $$ | $$ |$$$$$$$$ |$$ | $$ | // $$ |$$\ $$ | $$ |$$ |$$ | $$ | $$ |$$ | $$ | $$ |$$ ____|$$ | $$ | // \$$$$ |$$ | $$ |$$ |$$ | \$$$$$$$ |\$$$$$\$$$$ |\$$$$$$$\ $$$$$$$ | // \____/ \__| \__|\__|\__| \_______| \_____\____/ \_______|\_______/ // ========== External imports ========== import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol"; import "./eip/queryable/ERC721AQueryableUpgradeable.sol"; // ========== Internal imports ========== import "./openzeppelin-presets/metatx/ERC2771ContextUpgradeable.sol"; import "./lib/CurrencyTransferLib.sol"; // ========== Features ========== import "./extension/Multicall.sol"; import "./extension/ContractMetadata.sol"; import "./extension/Royalty.sol"; import "./extension/PrimarySale.sol"; import "./extension/Ownable.sol"; import "./extension/SharedMetadata.sol"; import "./extension/PermissionsEnumerable.sol"; import "./extension/Drop.sol"; // OpenSea operator filter import "./extension/DefaultOperatorFiltererUpgradeable.sol"; contract OpenEditionERC721 is Initializable, ContractMetadata, Royalty, PrimarySale, Ownable, SharedMetadata, PermissionsEnumerable, Drop, ERC2771ContextUpgradeable, Multicall, DefaultOperatorFiltererUpgradeable, ERC721AQueryableUpgradeable { using StringsUpgradeable for uint256; /*/////////////////////////////////////////////////////////////// State variables //////////////////////////////////////////////////////////////*/ /// @dev Only transfers to or from TRANSFER_ROLE holders are valid, when transfers are restricted. bytes32 private transferRole; /// @dev Only MINTER_ROLE holders can update the shared metadata of tokens. bytes32 private minterRole; /// @dev Max bps in the thirdweb system. uint256 private constant MAX_BPS = 10_000; /*/////////////////////////////////////////////////////////////// Constructor + initializer logic //////////////////////////////////////////////////////////////*/ constructor() initializer {} /// @dev Initiliazes the contract, like a constructor. function initialize( address _defaultAdmin, string memory _name, string memory _symbol, string memory _contractURI, address[] memory _trustedForwarders, address _saleRecipient, address _royaltyRecipient, uint128 _royaltyBps ) external initializerERC721A initializer { bytes32 _transferRole = keccak256("TRANSFER_ROLE"); bytes32 _minterRole = keccak256("MINTER_ROLE"); // Initialize inherited contracts, most base-like -> most derived. __ERC2771Context_init(_trustedForwarders); __ERC721A_init(_name, _symbol); __DefaultOperatorFilterer_init(); _setupContractURI(_contractURI); _setupOwner(_defaultAdmin); _setOperatorRestriction(true); _setupRole(DEFAULT_ADMIN_ROLE, _defaultAdmin); _setupRole(_minterRole, _defaultAdmin); _setupRole(_transferRole, _defaultAdmin); _setupRole(_transferRole, address(0)); _setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps); _setupPrimarySaleRecipient(_saleRecipient); transferRole = _transferRole; minterRole = _minterRole; } /*/////////////////////////////////////////////////////////////// ERC 165 / 721 / 2981 logic //////////////////////////////////////////////////////////////*/ /// @dev Returns the URI for a given tokenId. function tokenURI(uint256 _tokenId) public view virtual override(ERC721AUpgradeable, IERC721AUpgradeable) returns (string memory) { if (!_exists(_tokenId)) { revert("!ID"); } return _getURIFromSharedMetadata(_tokenId); } /// @dev See ERC 165 function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721AUpgradeable, IERC165, IERC721AUpgradeable) returns (bool) { return super.supportsInterface(interfaceId) || type(IERC2981Upgradeable).interfaceId == interfaceId; } /// @dev The start token ID for the contract. function _startTokenId() internal pure override returns (uint256) { return 1; } function startTokenId() public pure returns (uint256) { return _startTokenId(); } /*/////////////////////////////////////////////////////////////// Internal functions //////////////////////////////////////////////////////////////*/ /// @dev Collects and distributes the primary sale value of NFTs being claimed. function _collectPriceOnClaim( address _primarySaleRecipient, uint256 _quantityToClaim, address _currency, uint256 _pricePerToken ) internal override { if (_pricePerToken == 0) { return; } uint256 totalPrice = _quantityToClaim * _pricePerToken; bool validMsgValue; if (_currency == CurrencyTransferLib.NATIVE_TOKEN) { validMsgValue = msg.value == totalPrice; } else { validMsgValue = msg.value == 0; } require(validMsgValue, "!V"); address saleRecipient = _primarySaleRecipient == address(0) ? primarySaleRecipient() : _primarySaleRecipient; CurrencyTransferLib.transferCurrency(_currency, _msgSender(), saleRecipient, totalPrice); } /// @dev Transfers the NFTs being claimed. function _transferTokensOnClaim(address _to, uint256 _quantityBeingClaimed) internal override returns (uint256 startTokenId_) { startTokenId_ = _nextTokenId(); _safeMint(_to, _quantityBeingClaimed); } /// @dev Checks whether primary sale recipient can be set in the given execution context. function _canSetPrimarySaleRecipient() internal view override returns (bool) { return hasRole(DEFAULT_ADMIN_ROLE, _msgSender()); } /// @dev Checks whether owner can be set in the given execution context. function _canSetOwner() internal view override returns (bool) { return hasRole(DEFAULT_ADMIN_ROLE, _msgSender()); } /// @dev Checks whether royalty info can be set in the given execution context. function _canSetRoyaltyInfo() internal view override returns (bool) { return hasRole(DEFAULT_ADMIN_ROLE, _msgSender()); } /// @dev Checks whether contract metadata can be set in the given execution context. function _canSetContractURI() internal view override returns (bool) { return hasRole(DEFAULT_ADMIN_ROLE, _msgSender()); } /// @dev Checks whether platform fee info can be set in the given execution context. function _canSetClaimConditions() internal view override returns (bool) { return hasRole(DEFAULT_ADMIN_ROLE, _msgSender()); } /// @dev Returns whether the shared metadata of tokens can be set in the given execution context. function _canSetSharedMetadata() internal view virtual override returns (bool) { return hasRole(minterRole, _msgSender()); } /// @dev Returns whether operator restriction can be set in the given execution context. function _canSetOperatorRestriction() internal virtual override returns (bool) { return hasRole(DEFAULT_ADMIN_ROLE, _msgSender()); } /*/////////////////////////////////////////////////////////////// Miscellaneous //////////////////////////////////////////////////////////////*/ /** * Returns the total amount of tokens minted in the contract. */ function totalMinted() external view returns (uint256) { unchecked { return _nextTokenId() - _startTokenId(); } } /// @dev The tokenId of the next NFT that will be minted / lazy minted. function nextTokenIdToMint() external view returns (uint256) { return _nextTokenId(); } /// @dev The next token ID of the NFT that can be claimed. function nextTokenIdToClaim() external view returns (uint256) { return _nextTokenId(); } /// @dev Burns `tokenId`. See {ERC721-_burn}. function burn(uint256 tokenId) external virtual { // note: ERC721AUpgradeable's `_burn(uint256,bool)` internally checks for token approvals. _burn(tokenId, true); } /// @dev See {ERC721-_beforeTokenTransfer}. function _beforeTokenTransfers( address from, address to, uint256 startTokenId_, uint256 quantity ) internal virtual override { super._beforeTokenTransfers(from, to, startTokenId_, quantity); // if transfer is restricted on the contract, we still want to allow burning and minting if (!hasRole(transferRole, address(0)) && from != address(0) && to != address(0)) { if (!hasRole(transferRole, from) && !hasRole(transferRole, to)) { revert("!T"); } } } /// @dev See {ERC721-setApprovalForAll}. function setApprovalForAll(address operator, bool approved) public override(IERC721AUpgradeable, ERC721AUpgradeable) onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); } /// @dev See {ERC721-approve}. function approve(address operator, uint256 tokenId) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) onlyAllowedOperatorApproval(operator) { super.approve(operator, tokenId); } /// @dev See {ERC721-_transferFrom}. function transferFrom( address from, address to, uint256 tokenId ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } /// @dev See {ERC721-_safeTransferFrom}. function safeTransferFrom( address from, address to, uint256 tokenId ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } /// @dev See {ERC721-_safeTransferFrom}. function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public payable override(ERC721AUpgradeable, IERC721AUpgradeable) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } function _dropMsgSender() internal view virtual override returns (address) { return _msgSender(); } function _msgSenderERC721A() internal view virtual override returns (address) { return _msgSender(); } function _msgSender() internal view virtual override(ERC2771ContextUpgradeable) returns (address sender) { return ERC2771ContextUpgradeable._msgSender(); } function _msgData() internal view virtual override(ERC2771ContextUpgradeable) returns (bytes calldata) { return ERC2771ContextUpgradeable._msgData(); } }
// 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 * [EIP](https://eips.ethereum.org/EIPS/eip-165). * * 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 * [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 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address who) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 value ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.0; import "./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 payed in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.11; import "./IERC165.sol"; import "./IERC721.sol"; interface IERC4906 is IERC165 { /// @dev This event emits when the metadata of a token is changed. /// So that the third-party platforms such as NFT market could /// timely update the images and related attributes of the NFT. event MetadataUpdate(uint256 _tokenId); /// @dev This event emits when the metadata of a range of tokens is changed. /// So that the third-party platforms such as NFT market could /// timely update the images and related attributes of the NFTs. event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface 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); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address); /** * @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 ) 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 Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address); /** * @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 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); /** * @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; }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import "./IERC721AQueryableUpgradeable.sol"; import "./ERC721AUpgradeable.sol"; import "./ERC721A__Initializable.sol"; /** * @title ERC721AQueryable. * * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryableUpgradeable is ERC721A__Initializable, ERC721AUpgradeable, IERC721AQueryableUpgradeable { function __ERC721AQueryable_init() internal onlyInitializingERC721A { __ERC721AQueryable_init_unchained(); } function __ERC721AQueryable_init_unchained() internal onlyInitializingERC721A {} /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory ownership) { unchecked { if (tokenId >= _startTokenId()) { if (tokenId < _nextTokenId()) { // If the `tokenId` is within bounds, // scan backwards for the initialized ownership slot. while (!_ownershipIsInitialized(tokenId)) --tokenId; return _ownershipAt(tokenId); } } } } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view virtual override returns (uint256[] memory) { return _tokensOfOwnerIn(owner, start, stop); } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) { uint256 start = _startTokenId(); uint256 stop = _nextTokenId(); uint256[] memory tokenIds; if (start != stop) tokenIds = _tokensOfOwnerIn(owner, start, stop); return tokenIds; } /** * @dev Helper function for returning an array of token IDs owned by `owner`. * * Note that this function is optimized for smaller bytecode size over runtime gas, * since it is meant to be called off-chain. */ function _tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) private view returns (uint256[] memory) { unchecked { if (start >= stop) _revert(InvalidQueryRange.selector); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } uint256 stopLimit = _nextTokenId(); // Set `stop = min(stop, stopLimit)`. if (stop >= stopLimit) { stop = stopLimit; } uint256[] memory tokenIds; uint256 tokenIdsMaxLength = balanceOf(owner); bool startLtStop = start < stop; assembly { // Set `tokenIdsMaxLength` to zero if `start` is less than `stop`. tokenIdsMaxLength := mul(tokenIdsMaxLength, startLtStop) } if (tokenIdsMaxLength != 0) { // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`, // to cater for cases where `balanceOf(owner)` is too big. if (stop - start <= tokenIdsMaxLength) { tokenIdsMaxLength = stop - start; } assembly { // Grab the free memory pointer. tokenIds := mload(0x40) // Allocate one word for the length, and `tokenIdsMaxLength` words // for the data. `shl(5, x)` is equivalent to `mul(32, x)`. mstore(0x40, add(tokenIds, shl(5, add(tokenIdsMaxLength, 1)))) } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), // initialize `currOwnershipAddr`. // `ownership.address` will not be zero, // as `start` is clamped to the valid token ID range. if (!ownership.burned) { currOwnershipAddr = ownership.addr; } uint256 tokenIdsIdx; // Use a do-while, which is slightly more efficient for this case, // as the array will at least contain one element. do { ownership = _ownershipAt(start); assembly { switch mload(add(ownership, 0x40)) // if `ownership.burned == false`. case 0 { // if `ownership.addr != address(0)`. // The `addr` already has it's upper 96 bits clearned, // since it is written to memory with regular Solidity. if mload(ownership) { currOwnershipAddr := mload(ownership) } // if `currOwnershipAddr == owner`. // The `shl(96, x)` is to make the comparison agnostic to any // dirty upper 96 bits in `owner`. if iszero(shl(96, xor(currOwnershipAddr, owner))) { tokenIdsIdx := add(tokenIdsIdx, 1) mstore(add(tokenIds, shl(5, tokenIdsIdx)), start) } } // Otherwise, reset `currOwnershipAddr`. // This handles the case of batch burned tokens // (burned bit of first slot set, remaining slots left uninitialized). default { currOwnershipAddr := 0 } start := add(start, 1) } } while (!(start == stop || tokenIdsIdx == tokenIdsMaxLength)); // Store the length of the array. assembly { mstore(tokenIds, tokenIdsIdx) } } return tokenIds; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library ERC721AStorage { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } struct Layout { // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 _currentIndex; // The number of tokens burned. uint256 _burnCounter; // Token name string _name; // Token symbol string _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) _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => ERC721AStorage.TokenApprovalRef) _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) _operatorApprovals; } bytes32 internal constant STORAGE_SLOT = keccak256("ERC721A.contracts.storage.ERC721A"); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import "./IERC721AUpgradeable.sol"; import { ERC721AStorage } from "./ERC721AStorage.sol"; import "./ERC721A__Initializable.sol"; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721ReceiverUpgradeable { 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 ERC721AUpgradeable is ERC721A__Initializable, IERC721AUpgradeable { using ERC721AStorage for ERC721AStorage.Layout; // ============================================================= // 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; // ============================================================= // CONSTRUCTOR // ============================================================= function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializingERC721A { __ERC721A_init_unchained(name_, symbol_); } function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializingERC721A { ERC721AStorage.layout()._name = name_; ERC721AStorage.layout()._symbol = symbol_; ERC721AStorage.layout()._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 ERC721AStorage.layout()._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 ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._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 ERC721AStorage.layout()._currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return ERC721AStorage.layout()._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.selector); return ERC721AStorage.layout()._packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (ERC721AStorage.layout()._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 (ERC721AStorage.layout()._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(ERC721AStorage.layout()._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 = ERC721AStorage.layout()._packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); ERC721AStorage.layout()._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 ERC721AStorage.layout()._name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return ERC721AStorage.layout()._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.selector); 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(ERC721AStorage.layout()._packedOwnerships[index]); } /** * @dev Returns whether the ownership slot at `index` is initialized. * An uninitialized slot does not necessarily mean that the slot has no owner. */ function _ownershipIsInitialized(uint256 index) internal view virtual returns (bool) { return ERC721AStorage.layout()._packedOwnerships[index] != 0; } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (ERC721AStorage.layout()._packedOwnerships[index] == 0) { ERC721AStorage.layout()._packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) { if (_startTokenId() <= tokenId) { packed = ERC721AStorage.layout()._packedOwnerships[tokenId]; // If the data at the starting slot does not exist, start the scan. if (packed == 0) { if (tokenId >= ERC721AStorage.layout()._currentIndex) _revert(OwnerQueryForNonexistentToken.selector); // 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, `tokenId` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. for (;;) { unchecked { packed = ERC721AStorage.layout()._packedOwnerships[--tokenId]; } if (packed == 0) continue; if (packed & _BITMASK_BURNED == 0) return packed; // Otherwise, the token is burned, and we must revert. // This handles the case of batch burned tokens, where only the burned bit // of the starting slot is set, and remaining slots are left uninitialized. _revert(OwnerQueryForNonexistentToken.selector); } } // Otherwise, the data exists and we can skip the scan. // This is possible because we have already achieved the target condition. // This saves 2143 gas on transfers of initialized tokens. // If the token is not burned, return `packed`. Otherwise, revert. if (packed & _BITMASK_BURNED == 0) return packed; } _revert(OwnerQueryForNonexistentToken.selector); } /** * @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. See {ERC721A-_approve}. * * Requirements: * * - The caller must own the token or be an approved operator. */ function approve(address to, uint256 tokenId) public payable virtual override { _approve(to, tokenId, true); } /** * @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.selector); return ERC721AStorage.layout()._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 { ERC721AStorage.layout()._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 ERC721AStorage.layout()._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 result) { if (_startTokenId() <= tokenId) { if (tokenId < ERC721AStorage.layout()._currentIndex) { uint256 packed; while ((packed = ERC721AStorage.layout()._packedOwnerships[tokenId]) == 0) --tokenId; result = packed & _BITMASK_BURNED == 0; } } } /** * @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) { ERC721AStorage.TokenApprovalRef storage tokenApproval = ERC721AStorage.layout()._tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean. from = address(uint160(uint256(uint160(from)) & _BITMASK_ADDRESS)); if (address(uint160(prevOwnershipPacked)) != from) _revert(TransferFromIncorrectOwner.selector); (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.selector); _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. --ERC721AStorage.layout()._packedAddressData[from]; // Updates: `balance -= 1`. ++ERC721AStorage.layout()._packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. ERC721AStorage.layout()._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 (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != ERC721AStorage.layout()._currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; assembly { // 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. from, // `from`. toMasked, // `to`. tokenId // `tokenId`. ) } if (toMasked == 0) _revert(TransferToZeroAddress.selector); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable 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 payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } } /** * @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__IERC721ReceiverUpgradeable(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (bytes4 retval) { return retval == ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { _revert(TransferToNonERC721ReceiverImplementer.selector); } 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 = ERC721AStorage.layout()._currentIndex; if (quantity == 0) _revert(MintZeroQuantity.selector); _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: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. uint256 toMasked = uint256(uint160(to)) & _BITMASK_ADDRESS; if (toMasked == 0) _revert(MintToZeroAddress.selector); uint256 end = startTokenId + quantity; uint256 tokenId = startTokenId; do { assembly { // 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`. tokenId // `tokenId`. ) } // The `!=` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. } while (++tokenId != end); ERC721AStorage.layout()._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 = ERC721AStorage.layout()._currentIndex; if (to == address(0)) _revert(MintToZeroAddress.selector); if (quantity == 0) _revert(MintZeroQuantity.selector); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) _revert(MintERC2309QuantityExceedsLimit.selector); _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`. ERC721AStorage.layout()._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`. ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); ERC721AStorage.layout()._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 = ERC721AStorage.layout()._currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { _revert(TransferToNonERC721ReceiverImplementer.selector); } } while (index < end); // Reentrancy protection. if (ERC721AStorage.layout()._currentIndex != end) _revert(bytes4(0)); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ""); } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Equivalent to `_approve(to, tokenId, false)`. */ function _approve(address to, uint256 tokenId) internal virtual { _approve(to, tokenId, false); } /** * @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: * * - `tokenId` must exist. * * Emits an {Approval} event. */ function _approve( address to, uint256 tokenId, bool approvalCheck ) internal virtual { address owner = ownerOf(tokenId); if (approvalCheck && _msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { _revert(ApprovalCallerNotOwnerNorApproved.selector); } ERC721AStorage.layout()._tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } // ============================================================= // 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.selector); } _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;`. ERC721AStorage.layout()._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`. ERC721AStorage.layout()._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 (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != ERC721AStorage.layout()._currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. ERC721AStorage.layout()._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 { ERC721AStorage.layout()._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 = ERC721AStorage.layout()._packedOwnerships[index]; if (packed == 0) _revert(OwnershipNotInitializedForExtraData.selector); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); ERC721AStorage.layout()._packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } /** * @dev For more efficient reverts. */ function _revert(bytes4 errorSelector) internal pure { assembly { mstore(0x00, errorSelector) revert(0x00, 0x04) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable diamond facet contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ import { ERC721A__InitializableStorage } from "./ERC721A__InitializableStorage.sol"; abstract contract ERC721A__Initializable { using ERC721A__InitializableStorage for ERC721A__InitializableStorage.Layout; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializerERC721A() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require( ERC721A__InitializableStorage.layout()._initializing ? _isConstructor() : !ERC721A__InitializableStorage.layout()._initialized, "ERC721A__Initializable: contract is already initialized" ); bool isTopLevelCall = !ERC721A__InitializableStorage.layout()._initializing; if (isTopLevelCall) { ERC721A__InitializableStorage.layout()._initializing = true; ERC721A__InitializableStorage.layout()._initialized = true; } _; if (isTopLevelCall) { ERC721A__InitializableStorage.layout()._initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializingERC721A() { require( ERC721A__InitializableStorage.layout()._initializing, "ERC721A__Initializable: contract is not initializing" ); _; } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; assembly { cs := extcodesize(self) } return cs == 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base storage for the initialization function for upgradeable diamond facet contracts **/ library ERC721A__InitializableStorage { struct Layout { /* * Indicates that the contract has been initialized. */ bool _initialized; /* * Indicates that the contract is in the process of being initialized. */ bool _initializing; } bytes32 internal constant STORAGE_SLOT = keccak256("ERC721A.contracts.storage.initializable.facet"); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import "./IERC721AUpgradeable.sol"; /** * @dev Interface of ERC721AQueryable. */ interface IERC721AQueryableUpgradeable is IERC721AUpgradeable { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory); /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view returns (uint256[] memory); /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721AUpgradeable { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @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 payable; /** * @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 payable; /** * @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: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./interface/IContractMetadata.sol"; /** * @title Contract Metadata * @notice Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI * for you contract. * Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea. */ abstract contract ContractMetadata is IContractMetadata { /// @notice Returns the contract metadata URI. string public override contractURI; /** * @notice Lets a contract admin set the URI for contract-level metadata. * @dev Caller should be authorized to setup contractURI, e.g. contract admin. * See {_canSetContractURI}. * Emits {ContractURIUpdated Event}. * * @param _uri keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") */ function setContractURI(string memory _uri) external override { if (!_canSetContractURI()) { revert("Not authorized"); } _setupContractURI(_uri); } /// @dev Lets a contract admin set the URI for contract-level metadata. function _setupContractURI(string memory _uri) internal { string memory prevURI = contractURI; contractURI = _uri; emit ContractURIUpdated(prevURI, _uri); } /// @dev Returns whether contract metadata can be set in the given execution context. function _canSetContractURI() internal view virtual returns (bool); }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.0; /// @author thirdweb import { OperatorFiltererUpgradeable } from "./OperatorFiltererUpgradeable.sol"; abstract contract DefaultOperatorFiltererUpgradeable is OperatorFiltererUpgradeable { address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6); function __DefaultOperatorFilterer_init() internal { OperatorFiltererUpgradeable.__OperatorFilterer_init(DEFAULT_SUBSCRIPTION, true); } function subscribeToRegistry(address _subscription) external { require(_canSetOperatorRestriction(), "Not authorized to subscribe to registry."); _register(_subscription, true); } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./interface/IDrop.sol"; import "../lib/MerkleProof.sol"; abstract contract Drop is IDrop { /*/////////////////////////////////////////////////////////////// State variables //////////////////////////////////////////////////////////////*/ /// @dev The active conditions for claiming tokens. ClaimConditionList public claimCondition; /*/////////////////////////////////////////////////////////////// Drop logic //////////////////////////////////////////////////////////////*/ /// @dev Lets an account claim tokens. function claim( address _receiver, uint256 _quantity, address _currency, uint256 _pricePerToken, AllowlistProof calldata _allowlistProof, bytes memory _data ) public payable virtual override { _beforeClaim(_receiver, _quantity, _currency, _pricePerToken, _allowlistProof, _data); uint256 activeConditionId = getActiveClaimConditionId(); verifyClaim(activeConditionId, _dropMsgSender(), _quantity, _currency, _pricePerToken, _allowlistProof); // Update contract state. claimCondition.conditions[activeConditionId].supplyClaimed += _quantity; claimCondition.supplyClaimedByWallet[activeConditionId][_dropMsgSender()] += _quantity; // If there's a price, collect price. _collectPriceOnClaim(address(0), _quantity, _currency, _pricePerToken); // Mint the relevant tokens to claimer. uint256 startTokenId = _transferTokensOnClaim(_receiver, _quantity); emit TokensClaimed(activeConditionId, _dropMsgSender(), _receiver, startTokenId, _quantity); _afterClaim(_receiver, _quantity, _currency, _pricePerToken, _allowlistProof, _data); } /// @dev Lets a contract admin set claim conditions. function setClaimConditions(ClaimCondition[] calldata _conditions, bool _resetClaimEligibility) external virtual override { if (!_canSetClaimConditions()) { revert("Not authorized"); } uint256 existingStartIndex = claimCondition.currentStartId; uint256 existingPhaseCount = claimCondition.count; /** * The mapping `supplyClaimedByWallet` uses a claim condition's UID as a key. * * If `_resetClaimEligibility == true`, we assign completely new UIDs to the claim * conditions in `_conditions`, effectively resetting the restrictions on claims expressed * by `supplyClaimedByWallet`. */ uint256 newStartIndex = existingStartIndex; if (_resetClaimEligibility) { newStartIndex = existingStartIndex + existingPhaseCount; } claimCondition.count = _conditions.length; claimCondition.currentStartId = newStartIndex; uint256 lastConditionStartTimestamp; for (uint256 i = 0; i < _conditions.length; i++) { require(i == 0 || lastConditionStartTimestamp < _conditions[i].startTimestamp, "ST"); uint256 supplyClaimedAlready = claimCondition.conditions[newStartIndex + i].supplyClaimed; if (supplyClaimedAlready > _conditions[i].maxClaimableSupply) { revert("max supply claimed"); } claimCondition.conditions[newStartIndex + i] = _conditions[i]; claimCondition.conditions[newStartIndex + i].supplyClaimed = supplyClaimedAlready; lastConditionStartTimestamp = _conditions[i].startTimestamp; } /** * Gas refunds (as much as possible) * * If `_resetClaimEligibility == true`, we assign completely new UIDs to the claim * conditions in `_conditions`. So, we delete claim conditions with UID < `newStartIndex`. * * If `_resetClaimEligibility == false`, and there are more existing claim conditions * than in `_conditions`, we delete the existing claim conditions that don't get replaced * by the conditions in `_conditions`. */ if (_resetClaimEligibility) { for (uint256 i = existingStartIndex; i < newStartIndex; i++) { delete claimCondition.conditions[i]; } } else { if (existingPhaseCount > _conditions.length) { for (uint256 i = _conditions.length; i < existingPhaseCount; i++) { delete claimCondition.conditions[newStartIndex + i]; } } } emit ClaimConditionsUpdated(_conditions, _resetClaimEligibility); } /// @dev Checks a request to claim NFTs against the active claim condition's criteria. function verifyClaim( uint256 _conditionId, address _claimer, uint256 _quantity, address _currency, uint256 _pricePerToken, AllowlistProof calldata _allowlistProof ) public view returns (bool isOverride) { ClaimCondition memory currentClaimPhase = claimCondition.conditions[_conditionId]; uint256 claimLimit = currentClaimPhase.quantityLimitPerWallet; uint256 claimPrice = currentClaimPhase.pricePerToken; address claimCurrency = currentClaimPhase.currency; if (currentClaimPhase.merkleRoot != bytes32(0)) { (isOverride, ) = MerkleProof.verify( _allowlistProof.proof, currentClaimPhase.merkleRoot, keccak256( abi.encodePacked( _claimer, _allowlistProof.quantityLimitPerWallet, _allowlistProof.pricePerToken, _allowlistProof.currency ) ) ); } if (isOverride) { claimLimit = _allowlistProof.quantityLimitPerWallet != 0 ? _allowlistProof.quantityLimitPerWallet : claimLimit; claimPrice = _allowlistProof.pricePerToken != type(uint256).max ? _allowlistProof.pricePerToken : claimPrice; claimCurrency = _allowlistProof.pricePerToken != type(uint256).max && _allowlistProof.currency != address(0) ? _allowlistProof.currency : claimCurrency; } uint256 supplyClaimedByWallet = claimCondition.supplyClaimedByWallet[_conditionId][_claimer]; if (_currency != claimCurrency || _pricePerToken != claimPrice) { revert("!PriceOrCurrency"); } if (_quantity == 0 || (_quantity + supplyClaimedByWallet > claimLimit)) { revert("!Qty"); } if (currentClaimPhase.supplyClaimed + _quantity > currentClaimPhase.maxClaimableSupply) { revert("!MaxSupply"); } if (currentClaimPhase.startTimestamp > block.timestamp) { revert("cant claim yet"); } } /// @dev At any given moment, returns the uid for the active claim condition. function getActiveClaimConditionId() public view returns (uint256) { for (uint256 i = claimCondition.currentStartId + claimCondition.count; i > claimCondition.currentStartId; i--) { if (block.timestamp >= claimCondition.conditions[i - 1].startTimestamp) { return i - 1; } } revert("!CONDITION."); } /// @dev Returns the claim condition at the given uid. function getClaimConditionById(uint256 _conditionId) external view returns (ClaimCondition memory condition) { condition = claimCondition.conditions[_conditionId]; } /// @dev Returns the supply claimed by claimer for a given conditionId. function getSupplyClaimedByWallet(uint256 _conditionId, address _claimer) public view returns (uint256 supplyClaimedByWallet) { supplyClaimedByWallet = claimCondition.supplyClaimedByWallet[_conditionId][_claimer]; } /*//////////////////////////////////////////////////////////////////// Optional hooks that can be implemented in the derived contract ///////////////////////////////////////////////////////////////////*/ /// @dev Exposes the ability to override the msg sender. function _dropMsgSender() internal virtual returns (address) { return msg.sender; } /// @dev Runs before every `claim` function call. function _beforeClaim( address _receiver, uint256 _quantity, address _currency, uint256 _pricePerToken, AllowlistProof calldata _allowlistProof, bytes memory _data ) internal virtual {} /// @dev Runs after every `claim` function call. function _afterClaim( address _receiver, uint256 _quantity, address _currency, uint256 _pricePerToken, AllowlistProof calldata _allowlistProof, bytes memory _data ) internal virtual {} /*/////////////////////////////////////////////////////////////// Virtual functions: to be implemented in derived contract //////////////////////////////////////////////////////////////*/ /// @dev Collects and distributes the primary sale value of NFTs being claimed. function _collectPriceOnClaim( address _primarySaleRecipient, uint256 _quantityToClaim, address _currency, uint256 _pricePerToken ) internal virtual; /// @dev Transfers the NFTs being claimed. function _transferTokensOnClaim(address _to, uint256 _quantityBeingClaimed) internal virtual returns (uint256 startTokenId); /// @dev Determine what wallet can update claim conditions function _canSetClaimConditions() internal view virtual returns (bool); }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.0; /// @author thirdweb import "../lib/TWAddress.sol"; import "./interface/IMulticall.sol"; /** * @dev Provides a function to batch together multiple calls in a single external call. * * _Available since v4.1._ */ contract Multicall is IMulticall { /** * @notice Receives and executes a batch of function calls on this contract. * @dev Receives and executes a batch of function calls on this contract. * * @param data The bytes data that makes up the batch of function calls to execute. * @return results The bytes data that makes up the result of the batch of function calls executed. */ function multicall(bytes[] calldata data) external virtual override returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { results[i] = TWAddress.functionDelegateCall(address(this), data[i]); } return results; } }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./interface/IOperatorFilterToggle.sol"; abstract contract OperatorFilterToggle is IOperatorFilterToggle { bool public operatorRestriction; function setOperatorRestriction(bool _restriction) external { require(_canSetOperatorRestriction(), "Not authorized to set operator restriction."); _setOperatorRestriction(_restriction); } function _setOperatorRestriction(bool _restriction) internal { operatorRestriction = _restriction; emit OperatorRestriction(_restriction); } function _canSetOperatorRestriction() internal virtual returns (bool); }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./interface/IOperatorFilterRegistry.sol"; import "./OperatorFilterToggle.sol"; abstract contract OperatorFiltererUpgradeable is OperatorFilterToggle { error OperatorNotAllowed(address operator); IOperatorFilterRegistry constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. _register(subscriptionOrRegistrantToCopy, subscribe); } modifier onlyAllowedOperator(address from) virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (operatorRestriction) { if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from == msg.sender) { _; return; } if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), msg.sender)) { revert OperatorNotAllowed(msg.sender); } } } _; } modifier onlyAllowedOperatorApproval(address operator) virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (operatorRestriction) { if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } _; } function _register(address subscriptionOrRegistrantToCopy, bool subscribe) internal { // Is the registry deployed? if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { // Is the subscription contract deployed? if (address(subscriptionOrRegistrantToCopy).code.length > 0) { // Do we want to subscribe? if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } } else { OPERATOR_FILTER_REGISTRY.register(address(this)); } } } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./interface/IOwnable.sol"; /** * @title Ownable * @notice Thirdweb's `Ownable` is a contract extension to be used with any base contract. It exposes functions for setting and reading * who the 'owner' of the inheriting smart contract is, and lets the inheriting contract perform conditional logic that uses * information about who the contract's owner is. */ abstract contract Ownable is IOwnable { /// @dev Owner of the contract (purpose: OpenSea compatibility) address private _owner; /// @dev Reverts if caller is not the owner. modifier onlyOwner() { if (msg.sender != _owner) { revert("Not authorized"); } _; } /** * @notice Returns the owner of the contract. */ function owner() public view override returns (address) { return _owner; } /** * @notice Lets an authorized wallet set a new owner for the contract. * @param _newOwner The address to set as the new owner of the contract. */ function setOwner(address _newOwner) external override { if (!_canSetOwner()) { revert("Not authorized"); } _setupOwner(_newOwner); } /// @dev Lets a contract admin set a new owner for the contract. The new owner must be a contract admin. function _setupOwner(address _newOwner) internal { address _prevOwner = _owner; _owner = _newOwner; emit OwnerUpdated(_prevOwner, _newOwner); } /// @dev Returns whether owner can be set in the given execution context. function _canSetOwner() internal view virtual returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./interface/IPermissions.sol"; import "../lib/TWStrings.sol"; /** * @title Permissions * @dev This contracts provides extending-contracts with role-based access control mechanisms */ contract Permissions is IPermissions { /// @dev Map from keccak256 hash of a role => a map from address => whether address has role. mapping(bytes32 => mapping(address => bool)) private _hasRole; /// @dev Map from keccak256 hash of a role to role admin. See {getRoleAdmin}. mapping(bytes32 => bytes32) private _getRoleAdmin; /// @dev Default admin role for all roles. Only accounts with this role can grant/revoke other roles. bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @dev Modifier that checks if an account has the specified role; reverts otherwise. modifier onlyRole(bytes32 role) { _checkRole(role, msg.sender); _; } /** * @notice Checks whether an account has a particular role. * @dev Returns `true` if `account` has been granted `role`. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param account Address of the account for which the role is being checked. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _hasRole[role][account]; } /** * @notice Checks whether an account has a particular role; * role restrictions can be swtiched on and off. * * @dev Returns `true` if `account` has been granted `role`. * Role restrictions can be swtiched on and off: * - If address(0) has ROLE, then the ROLE restrictions * don't apply. * - If address(0) does not have ROLE, then the ROLE * restrictions will apply. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param account Address of the account for which the role is being checked. */ function hasRoleWithSwitch(bytes32 role, address account) public view returns (bool) { if (!_hasRole[role][address(0)]) { return _hasRole[role][account]; } return true; } /** * @notice Returns the admin role that controls the specified role. * @dev See {grantRole} and {revokeRole}. * To change a role's admin, use {_setRoleAdmin}. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") */ function getRoleAdmin(bytes32 role) external view override returns (bytes32) { return _getRoleAdmin[role]; } /** * @notice Grants a role to an account, if not previously granted. * @dev Caller must have admin role for the `role`. * Emits {RoleGranted Event}. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param account Address of the account to which the role is being granted. */ function grantRole(bytes32 role, address account) public virtual override { _checkRole(_getRoleAdmin[role], msg.sender); if (_hasRole[role][account]) { revert("Can only grant to non holders"); } _setupRole(role, account); } /** * @notice Revokes role from an account. * @dev Caller must have admin role for the `role`. * Emits {RoleRevoked Event}. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param account Address of the account from which the role is being revoked. */ function revokeRole(bytes32 role, address account) public virtual override { _checkRole(_getRoleAdmin[role], msg.sender); _revokeRole(role, account); } /** * @notice Revokes role from the account. * @dev Caller must have the `role`, with caller being the same as `account`. * Emits {RoleRevoked Event}. * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param account Address of the account from which the role is being revoked. */ function renounceRole(bytes32 role, address account) public virtual override { if (msg.sender != account) { revert("Can only renounce for self"); } _revokeRole(role, account); } /// @dev Sets `adminRole` as `role`'s admin role. function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = _getRoleAdmin[role]; _getRoleAdmin[role] = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /// @dev Sets up `role` for `account` function _setupRole(bytes32 role, address account) internal virtual { _hasRole[role][account] = true; emit RoleGranted(role, account, msg.sender); } /// @dev Revokes `role` from `account` function _revokeRole(bytes32 role, address account) internal virtual { _checkRole(role, account); delete _hasRole[role][account]; emit RoleRevoked(role, account, msg.sender); } /// @dev Checks `role` for `account`. Reverts with a message including the required role. function _checkRole(bytes32 role, address account) internal view virtual { if (!_hasRole[role][account]) { revert( string( abi.encodePacked( "Permissions: account ", TWStrings.toHexString(uint160(account), 20), " is missing role ", TWStrings.toHexString(uint256(role), 32) ) ) ); } } /// @dev Checks `role` for `account`. Reverts with a message including the required role. function _checkRoleWithSwitch(bytes32 role, address account) internal view virtual { if (!hasRoleWithSwitch(role, account)) { revert( string( abi.encodePacked( "Permissions: account ", TWStrings.toHexString(uint160(account), 20), " is missing role ", TWStrings.toHexString(uint256(role), 32) ) ) ); } } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./interface/IPermissionsEnumerable.sol"; import "./Permissions.sol"; /** * @title PermissionsEnumerable * @dev This contracts provides extending-contracts with role-based access control mechanisms. * Also provides interfaces to view all members with a given role, and total count of members. */ contract PermissionsEnumerable is IPermissionsEnumerable, Permissions { /** * @notice A data structure to store data of members for a given role. * * @param index Current index in the list of accounts that have a role. * @param members map from index => address of account that has a role * @param indexOf map from address => index which the account has. */ struct RoleMembers { uint256 index; mapping(uint256 => address) members; mapping(address => uint256) indexOf; } /// @dev map from keccak256 hash of a role to its members' data. See {RoleMembers}. mapping(bytes32 => RoleMembers) private roleMembers; /** * @notice Returns the role-member from a list of members for a role, * at a given index. * @dev Returns `member` who has `role`, at `index` of role-members list. * See struct {RoleMembers}, and mapping {roleMembers} * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * @param index Index in list of current members for the role. * * @return member Address of account that has `role` */ function getRoleMember(bytes32 role, uint256 index) external view override returns (address member) { uint256 currentIndex = roleMembers[role].index; uint256 check; for (uint256 i = 0; i < currentIndex; i += 1) { if (roleMembers[role].members[i] != address(0)) { if (check == index) { member = roleMembers[role].members[i]; return member; } check += 1; } else if (hasRole(role, address(0)) && i == roleMembers[role].indexOf[address(0)]) { check += 1; } } } /** * @notice Returns total number of accounts that have a role. * @dev Returns `count` of accounts that have `role`. * See struct {RoleMembers}, and mapping {roleMembers} * * @param role keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE") * * @return count Total number of accounts that have `role` */ function getRoleMemberCount(bytes32 role) external view override returns (uint256 count) { uint256 currentIndex = roleMembers[role].index; for (uint256 i = 0; i < currentIndex; i += 1) { if (roleMembers[role].members[i] != address(0)) { count += 1; } } if (hasRole(role, address(0))) { count += 1; } } /// @dev Revokes `role` from `account`, and removes `account` from {roleMembers} /// See {_removeMember} function _revokeRole(bytes32 role, address account) internal override { super._revokeRole(role, account); _removeMember(role, account); } /// @dev Grants `role` to `account`, and adds `account` to {roleMembers} /// See {_addMember} function _setupRole(bytes32 role, address account) internal override { super._setupRole(role, account); _addMember(role, account); } /// @dev adds `account` to {roleMembers}, for `role` function _addMember(bytes32 role, address account) internal { uint256 idx = roleMembers[role].index; roleMembers[role].index += 1; roleMembers[role].members[idx] = account; roleMembers[role].indexOf[account] = idx; } /// @dev removes `account` from {roleMembers}, for `role` function _removeMember(bytes32 role, address account) internal { uint256 idx = roleMembers[role].indexOf[account]; delete roleMembers[role].members[idx]; delete roleMembers[role].indexOf[account]; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./interface/IPrimarySale.sol"; /** * @title Primary Sale * @notice Thirdweb's `PrimarySale` is a contract extension to be used with any base contract. It exposes functions for setting and reading * the recipient of primary sales, and lets the inheriting contract perform conditional logic that uses information about * primary sales, if desired. */ abstract contract PrimarySale is IPrimarySale { /// @dev The address that receives all primary sales value. address private recipient; /// @dev Returns primary sale recipient address. function primarySaleRecipient() public view override returns (address) { return recipient; } /** * @notice Updates primary sale recipient. * @dev Caller should be authorized to set primary sales info. * See {_canSetPrimarySaleRecipient}. * Emits {PrimarySaleRecipientUpdated Event}; See {_setupPrimarySaleRecipient}. * * @param _saleRecipient Address to be set as new recipient of primary sales. */ function setPrimarySaleRecipient(address _saleRecipient) external override { if (!_canSetPrimarySaleRecipient()) { revert("Not authorized"); } _setupPrimarySaleRecipient(_saleRecipient); } /// @dev Lets a contract admin set the recipient for all primary sales. function _setupPrimarySaleRecipient(address _saleRecipient) internal { recipient = _saleRecipient; emit PrimarySaleRecipientUpdated(_saleRecipient); } /// @dev Returns whether primary sale recipient can be set in the given execution context. function _canSetPrimarySaleRecipient() internal view virtual returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./interface/IRoyalty.sol"; /** * @title Royalty * @notice Thirdweb's `Royalty` is a contract extension to be used with any base contract. It exposes functions for setting and reading * the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic * that uses information about royalty fees, if desired. * * @dev The `Royalty` contract is ERC2981 compliant. */ abstract contract Royalty is IRoyalty { /// @dev The (default) address that receives all royalty value. address private royaltyRecipient; /// @dev The (default) % of a sale to take as royalty (in basis points). uint16 private royaltyBps; /// @dev Token ID => royalty recipient and bps for token mapping(uint256 => RoyaltyInfo) private royaltyInfoForToken; /** * @notice View royalty info for a given token and sale price. * @dev Returns royalty amount and recipient for `tokenId` and `salePrice`. * @param tokenId The tokenID of the NFT for which to query royalty info. * @param salePrice Sale price of the token. * * @return receiver Address of royalty recipient account. * @return royaltyAmount Royalty amount calculated at current royaltyBps value. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view virtual override returns (address receiver, uint256 royaltyAmount) { (address recipient, uint256 bps) = getRoyaltyInfoForToken(tokenId); receiver = recipient; royaltyAmount = (salePrice * bps) / 10_000; } /** * @notice View royalty info for a given token. * @dev Returns royalty recipient and bps for `_tokenId`. * @param _tokenId The tokenID of the NFT for which to query royalty info. */ function getRoyaltyInfoForToken(uint256 _tokenId) public view override returns (address, uint16) { RoyaltyInfo memory royaltyForToken = royaltyInfoForToken[_tokenId]; return royaltyForToken.recipient == address(0) ? (royaltyRecipient, uint16(royaltyBps)) : (royaltyForToken.recipient, uint16(royaltyForToken.bps)); } /** * @notice Returns the defualt royalty recipient and BPS for this contract's NFTs. */ function getDefaultRoyaltyInfo() external view override returns (address, uint16) { return (royaltyRecipient, uint16(royaltyBps)); } /** * @notice Updates default royalty recipient and bps. * @dev Caller should be authorized to set royalty info. * See {_canSetRoyaltyInfo}. * Emits {DefaultRoyalty Event}; See {_setupDefaultRoyaltyInfo}. * * @param _royaltyRecipient Address to be set as default royalty recipient. * @param _royaltyBps Updated royalty bps. */ function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external override { if (!_canSetRoyaltyInfo()) { revert("Not authorized"); } _setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps); } /// @dev Lets a contract admin update the default royalty recipient and bps. function _setupDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) internal { if (_royaltyBps > 10_000) { revert("Exceeds max bps"); } royaltyRecipient = _royaltyRecipient; royaltyBps = uint16(_royaltyBps); emit DefaultRoyalty(_royaltyRecipient, _royaltyBps); } /** * @notice Updates default royalty recipient and bps for a particular token. * @dev Sets royalty info for `_tokenId`. Caller should be authorized to set royalty info. * See {_canSetRoyaltyInfo}. * Emits {RoyaltyForToken Event}; See {_setupRoyaltyInfoForToken}. * * @param _recipient Address to be set as royalty recipient for given token Id. * @param _bps Updated royalty bps for the token Id. */ function setRoyaltyInfoForToken( uint256 _tokenId, address _recipient, uint256 _bps ) external override { if (!_canSetRoyaltyInfo()) { revert("Not authorized"); } _setupRoyaltyInfoForToken(_tokenId, _recipient, _bps); } /// @dev Lets a contract admin set the royalty recipient and bps for a particular token Id. function _setupRoyaltyInfoForToken( uint256 _tokenId, address _recipient, uint256 _bps ) internal { if (_bps > 10_000) { revert("Exceeds max bps"); } royaltyInfoForToken[_tokenId] = RoyaltyInfo({ recipient: _recipient, bps: _bps }); emit RoyaltyForToken(_tokenId, _recipient, _bps); } /// @dev Returns whether royalty info can be set in the given execution context. function _canSetRoyaltyInfo() internal view virtual returns (bool); }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.10; /// @author thirdweb import "../lib/NFTMetadataRendererLib.sol"; import "./interface/ISharedMetadata.sol"; import "../eip/interface/IERC4906.sol"; abstract contract SharedMetadata is ISharedMetadata, IERC4906 { /// @notice Token metadata information SharedMetadataInfo public sharedMetadata; /// @notice Set shared metadata for NFTs function setSharedMetadata(SharedMetadataInfo calldata _metadata) external virtual { if (!_canSetSharedMetadata()) { revert("Not authorized"); } _setSharedMetadata(_metadata); } /** * @dev Sets shared metadata for NFTs. * @param _metadata common metadata for all tokens */ function _setSharedMetadata(SharedMetadataInfo calldata _metadata) internal { sharedMetadata = SharedMetadataInfo({ name: _metadata.name, description: _metadata.description, imageURI: _metadata.imageURI, animationURI: _metadata.animationURI }); emit BatchMetadataUpdate(0, type(uint256).max); emit SharedMetadataUpdated({ name: _metadata.name, description: _metadata.description, imageURI: _metadata.imageURI, animationURI: _metadata.animationURI }); } /** * @dev Token URI information getter * @param tokenId Token ID to get URI for */ function _getURIFromSharedMetadata(uint256 tokenId) internal view returns (string memory) { SharedMetadataInfo memory info = sharedMetadata; return NFTMetadataRenderer.createMetadataEdition({ name: info.name, description: info.description, imageURI: info.imageURI, animationURI: info.animationURI, tokenOfEdition: tokenId }); } /// @dev Returns whether shared metadata can be set in the given execution context. function _canSetSharedMetadata() internal view virtual returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb /** * The interface `IClaimCondition` is written for thirdweb's 'Drop' contracts, which are distribution mechanisms for tokens. * * A claim condition defines criteria under which accounts can mint tokens. Claim conditions can be overwritten * or added to by the contract admin. At any moment, there is only one active claim condition. */ interface IClaimCondition { /** * @notice The criteria that make up a claim condition. * * @param startTimestamp The unix timestamp after which the claim condition applies. * The same claim condition applies until the `startTimestamp` * of the next claim condition. * * @param maxClaimableSupply The maximum total number of tokens that can be claimed under * the claim condition. * * @param supplyClaimed At any given point, the number of tokens that have been claimed * under the claim condition. * * @param quantityLimitPerWallet The maximum number of tokens that can be claimed by a wallet. * * @param merkleRoot The allowlist of addresses that can claim tokens under the claim * condition. * * @param pricePerToken The price required to pay per token claimed. * * @param currency The currency in which the `pricePerToken` must be paid. * * @param metadata Claim condition metadata. */ struct ClaimCondition { uint256 startTimestamp; uint256 maxClaimableSupply; uint256 supplyClaimed; uint256 quantityLimitPerWallet; bytes32 merkleRoot; uint256 pricePerToken; address currency; string metadata; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./IClaimCondition.sol"; /** * The interface `IClaimConditionMultiPhase` is written for thirdweb's 'Drop' contracts, which are distribution mechanisms for tokens. * * An authorized wallet can set a series of claim conditions, ordered by their respective `startTimestamp`. * A claim condition defines criteria under which accounts can mint tokens. Claim conditions can be overwritten * or added to by the contract admin. At any moment, there is only one active claim condition. */ interface IClaimConditionMultiPhase is IClaimCondition { /** * @notice The set of all claim conditions, at any given moment. * Claim Phase ID = [currentStartId, currentStartId + length - 1]; * * @param currentStartId The uid for the first claim condition amongst the current set of * claim conditions. The uid for each next claim condition is one * more than the previous claim condition's uid. * * @param count The total number of phases / claim conditions in the list * of claim conditions. * * @param conditions The claim conditions at a given uid. Claim conditions * are ordered in an ascending order by their `startTimestamp`. * * @param supplyClaimedByWallet Map from a claim condition uid and account to supply claimed by account. */ struct ClaimConditionList { uint256 currentStartId; uint256 count; mapping(uint256 => ClaimCondition) conditions; mapping(uint256 => mapping(address => uint256)) supplyClaimedByWallet; } }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb /** * Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI * for you contract. * * Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea. */ interface IContractMetadata { /// @dev Returns the metadata URI of the contract. function contractURI() external view returns (string memory); /** * @dev Sets contract URI for the storefront-level metadata of the contract. * Only module admin can call this function. */ function setContractURI(string calldata _uri) external; /// @dev Emitted when the contract URI is updated. event ContractURIUpdated(string prevURI, string newURI); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./IClaimConditionMultiPhase.sol"; /** * The interface `IDrop` is written for thirdweb's 'Drop' contracts, which are distribution mechanisms for tokens. * * An authorized wallet can set a series of claim conditions, ordered by their respective `startTimestamp`. * A claim condition defines criteria under which accounts can mint tokens. Claim conditions can be overwritten * or added to by the contract admin. At any moment, there is only one active claim condition. */ interface IDrop is IClaimConditionMultiPhase { /** * @param proof Prood of concerned wallet's inclusion in an allowlist. * @param quantityLimitPerWallet The total quantity of tokens the allowlisted wallet is eligible to claim over time. * @param pricePerToken The price per token the allowlisted wallet must pay to claim tokens. * @param currency The currency in which the allowlisted wallet must pay the price for claiming tokens. */ struct AllowlistProof { bytes32[] proof; uint256 quantityLimitPerWallet; uint256 pricePerToken; address currency; } /// @notice Emitted when tokens are claimed via `claim`. event TokensClaimed( uint256 indexed claimConditionIndex, address indexed claimer, address indexed receiver, uint256 startTokenId, uint256 quantityClaimed ); /// @notice Emitted when the contract's claim conditions are updated. event ClaimConditionsUpdated(ClaimCondition[] claimConditions, bool resetEligibility); /** * @notice Lets an account claim a given quantity of NFTs. * * @param receiver The receiver of the NFTs to claim. * @param quantity The quantity of NFTs to claim. * @param currency The currency in which to pay for the claim. * @param pricePerToken The price per token to pay for the claim. * @param allowlistProof The proof of the claimer's inclusion in the merkle root allowlist * of the claim conditions that apply. * @param data Arbitrary bytes data that can be leveraged in the implementation of this interface. */ function claim( address receiver, uint256 quantity, address currency, uint256 pricePerToken, AllowlistProof calldata allowlistProof, bytes memory data ) external payable; /** * @notice Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions. * * @param phases Claim conditions in ascending order by `startTimestamp`. * * @param resetClaimEligibility Whether to honor the restrictions applied to wallets who have claimed tokens in the current conditions, * in the new claim conditions being set. * */ function setClaimConditions(ClaimCondition[] calldata phases, bool resetClaimEligibility) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author thirdweb /** * @dev Provides a function to batch together multiple calls in a single external call. * * _Available since v4.1._ */ interface IMulticall { /** * @dev Receives and executes a batch of function calls on this contract. */ function multicall(bytes[] calldata data) external returns (bytes[] memory results); }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.0; /// @author thirdweb interface IOperatorFilterRegistry { function isOperatorAllowed(address registrant, address operator) external view returns (bool); function register(address registrant) external; function registerAndSubscribe(address registrant, address subscription) external; function registerAndCopyEntries(address registrant, address registrantToCopy) external; function unregister(address addr) external; function updateOperator( address registrant, address operator, bool filtered ) external; function updateOperators( address registrant, address[] calldata operators, bool filtered ) external; function updateCodeHash( address registrant, bytes32 codehash, bool filtered ) external; function updateCodeHashes( address registrant, bytes32[] calldata codeHashes, bool filtered ) external; function subscribe(address registrant, address registrantToSubscribe) external; function unsubscribe(address registrant, bool copyExistingEntries) external; function subscriptionOf(address addr) external returns (address registrant); function subscribers(address registrant) external returns (address[] memory); function subscriberAt(address registrant, uint256 index) external returns (address); function copyEntriesOf(address registrant, address registrantToCopy) external; function isOperatorFiltered(address registrant, address operator) external returns (bool); function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); function filteredOperators(address addr) external returns (address[] memory); function filteredCodeHashes(address addr) external returns (bytes32[] memory); function filteredOperatorAt(address registrant, uint256 index) external returns (address); function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); function isRegistered(address addr) external returns (bool); function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.0; /// @author thirdweb interface IOperatorFilterToggle { event OperatorRestriction(bool restriction); function operatorRestriction() external view returns (bool); function setOperatorRestriction(bool restriction) external; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb /** * Thirdweb's `Ownable` is a contract extension to be used with any base contract. It exposes functions for setting and reading * who the 'owner' of the inheriting smart contract is, and lets the inheriting contract perform conditional logic that uses * information about who the contract's owner is. */ interface IOwnable { /// @dev Returns the owner of the contract. function owner() external view returns (address); /// @dev Lets a module admin set a new owner for the contract. The new owner must be a module admin. function setOwner(address _newOwner) external; /// @dev Emitted when a new Owner is set. event OwnerUpdated(address indexed prevOwner, address indexed newOwner); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IPermissions { /** * @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: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "./IPermissions.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IPermissionsEnumerable is IPermissions { /** * @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 * [forum post](https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296) * 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: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb /** * Thirdweb's `Primary` is a contract extension to be used with any base contract. It exposes functions for setting and reading * the recipient of primary sales, and lets the inheriting contract perform conditional logic that uses information about * primary sales, if desired. */ interface IPrimarySale { /// @dev The adress that receives all primary sales value. function primarySaleRecipient() external view returns (address); /// @dev Lets a module admin set the default recipient of all primary sales. function setPrimarySaleRecipient(address _saleRecipient) external; /// @dev Emitted when a new sale recipient is set. event PrimarySaleRecipientUpdated(address indexed recipient); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb import "../../eip/interface/IERC2981.sol"; /** * Thirdweb's `Royalty` is a contract extension to be used with any base contract. It exposes functions for setting and reading * the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic * that uses information about royalty fees, if desired. * * The `Royalty` contract is ERC2981 compliant. */ interface IRoyalty is IERC2981 { struct RoyaltyInfo { address recipient; uint256 bps; } /// @dev Returns the royalty recipient and fee bps. function getDefaultRoyaltyInfo() external view returns (address, uint16); /// @dev Lets a module admin update the royalty bps and recipient. function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external; /// @dev Lets a module admin set the royalty recipient for a particular token Id. function setRoyaltyInfoForToken( uint256 tokenId, address recipient, uint256 bps ) external; /// @dev Returns the royalty recipient for a particular token Id. function getRoyaltyInfoForToken(uint256 tokenId) external view returns (address, uint16); /// @dev Emitted when royalty info is updated. event DefaultRoyalty(address indexed newRoyaltyRecipient, uint256 newRoyaltyBps); /// @dev Emitted when royalty recipient for tokenId is set event RoyaltyForToken(uint256 indexed tokenId, address indexed royaltyRecipient, uint256 royaltyBps); }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.10; /// @author thirdweb interface ISharedMetadata { /// @notice Emitted when shared metadata is lazy minted. event SharedMetadataUpdated(string name, string description, string imageURI, string animationURI); /** * @notice Structure for metadata shared across all tokens * * @param name Shared name of NFT in metadata * @param description Shared description of NFT in metadata * @param imageURI Shared URI of image to render for NFTs * @param animationURI Shared URI of animation to render for NFTs */ struct SharedMetadataInfo { string name; string description; string imageURI; string animationURI; } /** * @notice Set shared metadata for NFTs * @param _metadata common metadata for all tokens */ function setSharedMetadata(SharedMetadataInfo calldata _metadata) external; }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; interface IWETH { function deposit() external payable; function withdraw(uint256 amount) external; function transfer(address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; /// @author thirdweb // Helper interfaces import { IWETH } from "../interfaces/IWETH.sol"; import "../openzeppelin-presets/token/ERC20/utils/SafeERC20.sol"; library CurrencyTransferLib { using SafeERC20 for IERC20; /// @dev The address interpreted as native token of the chain. address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; /// @dev Transfers a given amount of currency. function transferCurrency( address _currency, address _from, address _to, uint256 _amount ) internal { if (_amount == 0) { return; } if (_currency == NATIVE_TOKEN) { safeTransferNativeToken(_to, _amount); } else { safeTransferERC20(_currency, _from, _to, _amount); } } /// @dev Transfers a given amount of currency. (With native token wrapping) function transferCurrencyWithWrapper( address _currency, address _from, address _to, uint256 _amount, address _nativeTokenWrapper ) internal { if (_amount == 0) { return; } if (_currency == NATIVE_TOKEN) { if (_from == address(this)) { // withdraw from weth then transfer withdrawn native token to recipient IWETH(_nativeTokenWrapper).withdraw(_amount); safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper); } else if (_to == address(this)) { // store native currency in weth require(_amount == msg.value, "msg.value != amount"); IWETH(_nativeTokenWrapper).deposit{ value: _amount }(); } else { safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper); } } else { safeTransferERC20(_currency, _from, _to, _amount); } } /// @dev Transfer `amount` of ERC20 token from `from` to `to`. function safeTransferERC20( address _currency, address _from, address _to, uint256 _amount ) internal { if (_from == _to) { return; } if (_from == address(this)) { IERC20(_currency).safeTransfer(_to, _amount); } else { IERC20(_currency).safeTransferFrom(_from, _to, _amount); } } /// @dev Transfers `amount` of native token to `to`. function safeTransferNativeToken(address to, uint256 value) internal { // solhint-disable avoid-low-level-calls // slither-disable-next-line low-level-calls (bool success, ) = to.call{ value: value }(""); require(success, "native token transfer failed"); } /// @dev Transfers `amount` of native token to `to`. (With native token wrapping) function safeTransferNativeTokenWithWrapper( address to, uint256 value, address _nativeTokenWrapper ) internal { // solhint-disable avoid-low-level-calls // slither-disable-next-line low-level-calls (bool success, ) = to.call{ value: value }(""); if (!success) { IWETH(_nativeTokenWrapper).deposit{ value: value }(); IERC20(_nativeTokenWrapper).safeTransfer(to, value); } } }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.0; /// @author thirdweb /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. * * Source: https://github.com/ensdomains/governance/blob/master/contracts/MerkleProof.sol */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool, uint256) { bytes32 computedHash = leaf; uint256 index = 0; for (uint256 i = 0; i < proof.length; i++) { index *= 2; bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); index += 1; } } // Check if the computed hash (root) is equal to the provided root return (computedHash == root, index); } }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.10; /* solhint-disable quotes */ /// @author thirdweb /// credits: Zora import "./TWStrings.sol"; import "../openzeppelin-presets/utils/Base64.sol"; /// NFT metadata library for rendering metadata associated with editions library NFTMetadataRenderer { /** * @notice Generate edition metadata from storage information as base64-json blob * @dev Combines the media data and metadata * @param name Name of NFT in metadata * @param description Description of NFT in metadata * @param imageURI URI of image to render for edition * @param animationURI URI of animation to render for edition * @param tokenOfEdition Token ID for specific token */ function createMetadataEdition( string memory name, string memory description, string memory imageURI, string memory animationURI, uint256 tokenOfEdition ) internal pure returns (string memory) { string memory _tokenMediaData = tokenMediaData(imageURI, animationURI); bytes memory json = createMetadataJSON(name, description, _tokenMediaData, tokenOfEdition); return encodeMetadataJSON(json); } /** * @param name Name of NFT in metadata * @param description Description of NFT in metadata * @param mediaData Data for media to include in json object * @param tokenOfEdition Token ID for specific token */ function createMetadataJSON( string memory name, string memory description, string memory mediaData, uint256 tokenOfEdition ) internal pure returns (bytes memory) { return abi.encodePacked( '{"name": "', name, " ", TWStrings.toString(tokenOfEdition), '", "', 'description": "', description, '", "', mediaData, 'properties": {"number": ', TWStrings.toString(tokenOfEdition), ', "name": "', name, '"}}' ); } /// Encodes the argument json bytes into base64-data uri format /// @param json Raw json to base64 and turn into a data-uri function encodeMetadataJSON(bytes memory json) internal pure returns (string memory) { return string(abi.encodePacked("data:application/json;base64,", Base64.encode(json))); } /// Generates edition metadata from storage information as base64-json blob /// Combines the media data and metadata /// @param imageUrl URL of image to render for edition /// @param animationUrl URL of animation to render for edition function tokenMediaData(string memory imageUrl, string memory animationUrl) internal pure returns (string memory) { bool hasImage = bytes(imageUrl).length > 0; bool hasAnimation = bytes(animationUrl).length > 0; if (hasImage && hasAnimation) { return string(abi.encodePacked('image": "', imageUrl, '", "animation_url": "', animationUrl, '", "')); } if (hasImage) { return string(abi.encodePacked('image": "', imageUrl, '", "')); } if (hasAnimation) { return string(abi.encodePacked('animation_url": "', animationUrl, '", "')); } return ""; } }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.0; /// @author thirdweb /** * @dev Collection of functions related to the address type */ library TWAddress { /** * @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. * * [EIP1884](https://eips.ethereum.org/EIPS/eip-1884) 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: Apache 2.0 pragma solidity ^0.8.0; /// @author thirdweb /** * @dev String operations. */ library TWStrings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (metatx/ERC2771Context.sol) pragma solidity ^0.8.11; import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; /** * @dev Context variant with ERC2771 support. */ abstract contract ERC2771ContextUpgradeable is Initializable, ContextUpgradeable { mapping(address => bool) private _trustedForwarder; function __ERC2771Context_init(address[] memory trustedForwarder) internal onlyInitializing { __Context_init_unchained(); __ERC2771Context_init_unchained(trustedForwarder); } function __ERC2771Context_init_unchained(address[] memory trustedForwarder) internal onlyInitializing { for (uint256 i = 0; i < trustedForwarder.length; i++) { _trustedForwarder[trustedForwarder[i]] = true; } } function isTrustedForwarder(address forwarder) public view virtual returns (bool) { return _trustedForwarder[forwarder]; } function _msgSender() internal view virtual override returns (address sender) { if (isTrustedForwarder(msg.sender)) { // The assembly code is more direct than the Solidity version using `abi.decode`. assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) } } else { return super._msgSender(); } } function _msgData() internal view virtual override returns (bytes calldata) { if (isTrustedForwarder(msg.sender)) { return msg.data[:msg.data.length - 20]; } else { return super._msgData(); } } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../../../../eip/interface/IERC20.sol"; import "../../../../lib/TWAddress.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using TWAddress for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol) pragma solidity ^0.8.0; /** * @dev Provides a set of functions to operate with Base64 strings. * * _Available since v4.5._ */ library Base64 { /** * @dev Base64 Encoding/Decoding Table */ string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /** * @dev Converts a `bytes` to its Bytes64 `string` representation. */ function encode(bytes memory data) internal pure returns (string memory) { /** * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol */ if (data.length == 0) return ""; // Loads the table into memory string memory table = _TABLE; // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter // and split into 4 numbers of 6 bits. // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up // - `data.length + 2` -> Round up // - `/ 3` -> Number of 3-bytes chunks // - `4 *` -> 4 characters for each chunk string memory result = new string(4 * ((data.length + 2) / 3)); /// @solidity memory-safe-assembly assembly { // Prepare the lookup table (skip the first "length" byte) let tablePtr := add(table, 1) // Prepare result pointer, jump over length let resultPtr := add(result, 32) // Run over the input, 3 bytes at a time for { let dataPtr := data let endPtr := add(data, mload(data)) } lt(dataPtr, endPtr) { } { // Advance 3 bytes dataPtr := add(dataPtr, 3) let input := mload(dataPtr) // To write each character, shift the 3 bytes (18 bits) chunk // 4 times in blocks of 6 bits for each character (18, 12, 6, 0) // and apply logical AND with 0x3F which is the number of // the previous character in the ASCII table prior to the Base64 Table // The result is then added to the table to get the character to write, // and finally write it in the result pointer but with a left shift // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F)))) resultPtr := add(resultPtr, 1) // Advance mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F)))) resultPtr := add(resultPtr, 1) // Advance } // When data `bytes` is not exactly 3 bytes long // it is padded with `=` characters at the end switch mod(mload(data), 3) case 1 { mstore8(sub(resultPtr, 1), 0x3d) mstore8(sub(resultPtr, 2), 0x3d) } case 2 { mstore8(sub(resultPtr, 1), 0x3d) } } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165Upgradeable.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 IERC2981Upgradeable is IERC165Upgradeable { /** * @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) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
// 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 AddressUpgradeable { /** * @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 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 v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { 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/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 IERC165Upgradeable { /** * @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); }
{ "optimizer": { "enabled": true, "runs": 20 }, "evmVersion": "london", "remappings": [ ":@chainlink/=lib/chainlink/", ":@ds-test/=lib/ds-test/src/", ":@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", ":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", ":@std/=lib/forge-std/src/", ":ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/", ":ERC721A/=lib/ERC721A/contracts/", ":chainlink/=lib/chainlink/", ":contracts/=contracts/", ":ds-test/=lib/ds-test/src/", ":dynamic-contracts/=lib/dynamic-contracts/src/", ":erc4626-tests/=lib/chainlink/contracts/foundry-lib/openzeppelin-contracts/lib/erc4626-tests/", ":erc721a-upgradeable/=lib/ERC721A-Upgradeable/", ":erc721a/=lib/ERC721A/", ":forge-std/=lib/forge-std/src/", ":openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", ":openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"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":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"maxClaimableSupply","type":"uint256"},{"internalType":"uint256","name":"supplyClaimed","type":"uint256"},{"internalType":"uint256","name":"quantityLimitPerWallet","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"string","name":"metadata","type":"string"}],"indexed":false,"internalType":"struct IClaimCondition.ClaimCondition[]","name":"claimConditions","type":"tuple[]"},{"indexed":false,"internalType":"bool","name":"resetEligibility","type":"bool"}],"name":"ClaimConditionsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"prevURI","type":"string"},{"indexed":false,"internalType":"string","name":"newURI","type":"string"}],"name":"ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newRoyaltyRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"newRoyaltyBps","type":"uint256"}],"name":"DefaultRoyalty","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"MetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"restriction","type":"bool"}],"name":"OperatorRestriction","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"prevOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"PrimarySaleRecipientUpdated","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":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"royaltyRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"royaltyBps","type":"uint256"}],"name":"RoyaltyForToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"description","type":"string"},{"indexed":false,"internalType":"string","name":"imageURI","type":"string"},{"indexed":false,"internalType":"string","name":"animationURI","type":"string"}],"name":"SharedMetadataUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"claimConditionIndex","type":"uint256"},{"indexed":true,"internalType":"address","name":"claimer","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"startTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quantityClaimed","type":"uint256"}],"name":"TokensClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"address","name":"_currency","type":"address"},{"internalType":"uint256","name":"_pricePerToken","type":"uint256"},{"components":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"quantityLimitPerWallet","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"}],"internalType":"struct IDrop.AllowlistProof","name":"_allowlistProof","type":"tuple"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"claim","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"claimCondition","outputs":[{"internalType":"uint256","name":"currentStartId","type":"uint256"},{"internalType":"uint256","name":"count","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721AUpgradeable.TokenOwnership","name":"ownership","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getActiveClaimConditionId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_conditionId","type":"uint256"}],"name":"getClaimConditionById","outputs":[{"components":[{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"maxClaimableSupply","type":"uint256"},{"internalType":"uint256","name":"supplyClaimed","type":"uint256"},{"internalType":"uint256","name":"quantityLimitPerWallet","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"string","name":"metadata","type":"string"}],"internalType":"struct IClaimCondition.ClaimCondition","name":"condition","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDefaultRoyaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint16","name":"","type":"uint16"}],"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":"member","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"count","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getRoyaltyInfoForToken","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_conditionId","type":"uint256"},{"internalType":"address","name":"_claimer","type":"address"}],"name":"getSupplyClaimedByWallet","outputs":[{"internalType":"uint256","name":"supplyClaimedByWallet","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":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRoleWithSwitch","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_defaultAdmin","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_contractURI","type":"string"},{"internalType":"address[]","name":"_trustedForwarders","type":"address[]"},{"internalType":"address","name":"_saleRecipient","type":"address"},{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint128","name":"_royaltyBps","type":"uint128"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","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":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextTokenIdToClaim","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextTokenIdToMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorRestriction","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"primarySaleRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","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":"payable","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":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"maxClaimableSupply","type":"uint256"},{"internalType":"uint256","name":"supplyClaimed","type":"uint256"},{"internalType":"uint256","name":"quantityLimitPerWallet","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"string","name":"metadata","type":"string"}],"internalType":"struct IClaimCondition.ClaimCondition[]","name":"_conditions","type":"tuple[]"},{"internalType":"bool","name":"_resetClaimEligibility","type":"bool"}],"name":"setClaimConditions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint256","name":"_royaltyBps","type":"uint256"}],"name":"setDefaultRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_restriction","type":"bool"}],"name":"setOperatorRestriction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_saleRecipient","type":"address"}],"name":"setPrimarySaleRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_bps","type":"uint256"}],"name":"setRoyaltyInfoForToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"imageURI","type":"string"},{"internalType":"string","name":"animationURI","type":"string"}],"internalType":"struct ISharedMetadata.SharedMetadataInfo","name":"_metadata","type":"tuple"}],"name":"setSharedMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sharedMetadata","outputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"imageURI","type":"string"},{"internalType":"string","name":"animationURI","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_subscription","type":"address"}],"name":"subscribeToRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMinted","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":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_conditionId","type":"uint256"},{"internalType":"address","name":"_claimer","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"address","name":"_currency","type":"address"},{"internalType":"uint256","name":"_pricePerToken","type":"uint256"},{"components":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"quantityLimitPerWallet","type":"uint256"},{"internalType":"uint256","name":"pricePerToken","type":"uint256"},{"internalType":"address","name":"currency","type":"address"}],"internalType":"struct IDrop.AllowlistProof","name":"_allowlistProof","type":"tuple"}],"name":"verifyClaim","outputs":[{"internalType":"bool","name":"isOverride","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620027db1760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b615ff7806200015c6000396000f3fe6080604052600436106102965760003560e01c80638462151c116101615780638462151c1461064b57806384bb1e42146106785780638da5cb5b1461068b5780639010d07c146106a957806391d14854146106c9578063938e3d7b146106e957806395d89b411461070957806399a2557a1461071e5780639bcf7a151461073e578063a217fddf1461075e578063a22cb46514610773578063a2309ff814610793578063a32fa5b3146107a8578063a7d27d9d146107c8578063ac9650d8146107e8578063acd083f81461047a578063ad1eefc514610815578063b24f2d3914610857578063b280f70314610882578063b88d4fde146108a7578063c23dc68f146108ba578063c68907de14610926578063c87b56dd1461093b578063ca15c8731461095b578063d547741f1461097b578063d637ed591461099b578063e6798baa146109cb578063e8a3d485146109df578063e985e9c5146109f457600080fd5b806301ffc9a71461029b57806306fdde03146102d0578063079fe40e146102f2578063081812fc14610314578063095ea7b31461033457806313af40351461034957806318160ddd1461036957806323a2902b1461038c57806323b872dd146103ac578063248a9ca3146103bf5780632a55205a146103ec5780632f2ff15d1461041a57806332f0cd641461043a57806336568abe1461045a5780633b1475a71461047a57806342842e0e1461048f57806342966c68146104a257806349c5c5b6146104c25780634cc157df146104e2578063504c6e0114610524578063572b6c051461053e57806357fd84551461055e578063600dd5ea1461057e5780636352211e1461059e5780636f4f2837146105be5780636f8934f4146105de57806370a082311461060b57806374bc7db71461062b575b600080fd5b3480156102a757600080fd5b506102bb6102b6366004614c8f565b610a14565b60405190151581526020015b60405180910390f35b3480156102dc57600080fd5b506102e5610a40565b6040516102c79190614d04565b3480156102fe57600080fd5b50610307610adb565b6040516102c79190614d17565b34801561032057600080fd5b5061030761032f366004614d2b565b610aea565b610347610342366004614d64565b610b2e565b005b34801561035557600080fd5b50610347610364366004614d90565b610bfb565b34801561037557600080fd5b5061037e610c2b565b6040519081526020016102c7565b34801561039857600080fd5b506102bb6103a7366004614dbf565b610c4b565b6103476103ba366004614e3c565b61100c565b3480156103cb57600080fd5b5061037e6103da366004614d2b565b6000908152600b602052604090205490565b3480156103f857600080fd5b5061040c610407366004614e7d565b6110f3565b6040516102c7929190614e9f565b34801561042657600080fd5b50610347610435366004614eb8565b611130565b34801561044657600080fd5b50610347610455366004614ef6565b6111ca565b34801561046657600080fd5b50610347610475366004614eb8565b61123b565b34801561048657600080fd5b5061037e61129a565b61034761049d366004614e3c565b6112a9565b3480156104ae57600080fd5b506103476104bd366004614d2b565b611385565b3480156104ce57600080fd5b506103476104dd36600461505c565b611390565b3480156104ee57600080fd5b506105026104fd366004614d2b565b611685565b604080516001600160a01b03909316835261ffff9091166020830152016102c7565b34801561053057600080fd5b506075546102bb9060ff1681565b34801561054a57600080fd5b506102bb610559366004614d90565b6116f0565b34801561056a57600080fd5b50610347610579366004614d90565b61170e565b34801561058a57600080fd5b50610347610599366004614d64565b61177e565b3480156105aa57600080fd5b506103076105b9366004614d2b565b6117ac565b3480156105ca57600080fd5b506103476105d9366004614d90565b6117b7565b3480156105ea57600080fd5b506105fe6105f9366004614d2b565b6117e4565b6040516102c7919061514b565b34801561061757600080fd5b5061037e610626366004614d90565b611941565b34801561063757600080fd5b50610347610646366004615203565b6119a0565b34801561065757600080fd5b5061066b610666366004614d90565b611ce4565b6040516102c79190615259565b610347610686366004615291565b611d13565b34801561069757600080fd5b506005546001600160a01b0316610307565b3480156106b557600080fd5b506103076106c4366004614e7d565b611e2b565b3480156106d557600080fd5b506102bb6106e4366004614eb8565b611f1a565b3480156106f557600080fd5b5061034761070436600461531e565b611f45565b34801561071557600080fd5b506102e5611f72565b34801561072a57600080fd5b5061066b610739366004615352565b611f8a565b34801561074a57600080fd5b50610347610759366004615387565b611fa1565b34801561076a57600080fd5b5061037e600081565b34801561077f57600080fd5b5061034761078e3660046153ae565b611fd0565b34801561079f57600080fd5b5061037e61208f565b3480156107b457600080fd5b506102bb6107c3366004614eb8565b6120a1565b3480156107d457600080fd5b506103476107e33660046153dc565b6120f7565b3480156107f457600080fd5b50610808610803366004615410565b612124565b6040516102c79190615451565b34801561082157600080fd5b5061037e610830366004614eb8565b60009182526010602090815260408084206001600160a01b03909316845291905290205490565b34801561086357600080fd5b506002546001600160a01b03811690600160a01b900461ffff16610502565b34801561088e57600080fd5b50610897612218565b6040516102c794939291906154b3565b6103476108b5366004615500565b612454565b3480156108c657600080fd5b506108da6108d5366004614d2b565b61253e565b6040516102c7919081516001600160a01b031681526020808301516001600160401b03169082015260408083015115159082015260609182015162ffffff169181019190915260800190565b34801561093257600080fd5b5061037e612585565b34801561094757600080fd5b506102e5610956366004614d2b565b612628565b34801561096757600080fd5b5061037e610976366004614d2b565b61266e565b34801561098757600080fd5b50610347610996366004614eb8565b6126f7565b3480156109a757600080fd5b50600d54600e546109b6919082565b604080519283526020830191909152016102c7565b3480156109d757600080fd5b50600161037e565b3480156109eb57600080fd5b506102e5612710565b348015610a0057600080fd5b506102bb610a0f36600461556b565b61279e565b6000610a1f826127ea565b80610a3a575063152a902d60e11b6001600160e01b03198316145b92915050565b6060610a4a612838565b6002018054610a5890615599565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8490615599565b8015610ad15780601f10610aa657610100808354040283529160200191610ad1565b820191906000526020600020905b815481529060010190602001808311610ab457829003601f168201915b5050505050905090565b6004546001600160a01b031690565b6000610af58261285c565b610b0957610b096333d1c03960e21b6128b8565b610b11612838565b60009283526006016020525060409020546001600160a01b031690565b607554829060ff1615610bec576daaeb6d7670e522a718067333cd4e3b15610bec57604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610b8390309085906004016155ce565b602060405180830381865afa158015610ba0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc491906155e8565b610bec5780604051633b79c77360e21b8152600401610be39190614d17565b60405180910390fd5b610bf683836128c2565b505050565b610c036128ce565b610c1f5760405162461bcd60e51b8152600401610be390615605565b610c28816128dc565b50565b60006001610c37612838565b60010154610c43612838565b540303919050565b6000868152600f60209081526040808320815161010081018352815481526001820154938101939093526002810154918301919091526003810154606083015260048101546080830152600581015460a083015260068101546001600160a01b031660c08301526007810180548493929160e0840191610cca90615599565b80601f0160208091040260200160405190810160405280929190818152602001828054610cf690615599565b8015610d435780601f10610d1857610100808354040283529160200191610d43565b820191906000526020600020905b815481529060010190602001808311610d2657829003601f168201915b50505091909252505050606081015160a082015160c08301516080840151939450919290919015610e2357610e1f610d7b878061562d565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505060808088015191508d9060208b01359060408c013590610dd0908d0160608e01614d90565b6040516001600160601b0319606095861b811660208301526034820194909452605481019290925290921b1660748201526088016040516020818303038152906040528051906020012061292e565b5094505b8415610ea8576020860135610e385782610e3e565b85602001355b925060001986604001351415610e545781610e5a565b85604001355b9150600019866040013514158015610e8b57506000610e7f6080880160608901614d90565b6001600160a01b031614155b610e955780610ea5565b610ea56080870160608801614d90565b90505b60008b81526010602090815260408083206001600160a01b03808f16855292529091205490898116908316141580610ee05750828814155b15610f205760405162461bcd60e51b815260206004820152601060248201526f2150726963654f7243757272656e637960801b6044820152606401610be3565b891580610f35575083610f33828c61568c565b115b15610f6b5760405162461bcd60e51b8152600401610be3906020808252600490820152632151747960e01b604082015260600190565b84602001518a8660400151610f80919061568c565b1115610fbb5760405162461bcd60e51b815260206004820152600a602482015269214d6178537570706c7960b01b6044820152606401610be3565b8451421015610ffd5760405162461bcd60e51b815260206004820152600e60248201526d18d85b9d0818db185a5b481e595d60921b6044820152606401610be3565b50505050509695505050505050565b607554839060ff16156110e2576daaeb6d7670e522a718067333cd4e3b156110e2576001600160a01b03811633141561104f5761104a8484846129fc565b6110ed565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c61711349061108290309033906004016155ce565b602060405180830381865afa15801561109f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c391906155e8565b6110e25733604051633b79c77360e21b8152600401610be39190614d17565b6110ed8484846129fc565b50505050565b60008060008061110286611685565b90945084925061ffff16905061271061111b82876156a4565b61112591906156d9565b925050509250929050565b6000828152600b60205260409020546111499033612bb5565b6000828152600a602090815260408083206001600160a01b038516845290915290205460ff16156111bc5760405162461bcd60e51b815260206004820152601d60248201527f43616e206f6e6c79206772616e7420746f206e6f6e20686f6c646572730000006044820152606401610be3565b6111c68282612c35565b5050565b6111d26128ce565b6112325760405162461bcd60e51b815260206004820152602b60248201527f4e6f7420617574686f72697a656420746f20736574206f70657261746f72207260448201526a32b9ba3934b1ba34b7b71760a91b6064820152608401610be3565b610c2881612c49565b336001600160a01b038216146112905760405162461bcd60e51b815260206004820152601a60248201527921b0b71037b7363c903932b737bab731b2903337b91039b2b63360311b6044820152606401610be3565b6111c68282612c91565b60006112a4612ce8565b905090565b607554839060ff161561137a576daaeb6d7670e522a718067333cd4e3b1561137a576001600160a01b0381163314156112e75761104a848484612cf8565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c61711349061131a90309033906004016155ce565b602060405180830381865afa158015611337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135b91906155e8565b61137a5733604051633b79c77360e21b8152600401610be39190614d17565b6110ed848484612cf8565b610c28816001612d13565b611398612e7c565b54610100900460ff166113b7576113ad612e7c565b5460ff16156113bb565b303b155b6114275760405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604482015276081a5cc8185b1c9958591e481a5b9a5d1a585b1a5e9959604a1b6064820152608401610be3565b6000611431612e7c565b54610100900460ff16159050801561147d57600161144d612e7c565b80549115156101000261ff0019909216919091179055600161146d612e7c565b805460ff19169115159190911790555b600054610100900460ff161580801561149d5750600054600160ff909116105b806114be57506114ac306127db565b1580156114be575060005460ff166001145b6115215760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610be3565b6000805460ff191660011790558015611544576000805461ff0019166101001790555b7f8502233096d909befbda0999bb8ea2f3a6be3c138b9fbf003752a4c8bce86f6c7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661158f88612ea0565b6115998b8b612ed8565b6115a1612f0f565b6115aa89612f30565b6115b38c6128dc565b6115bd6001612c49565b6115c860008d612c35565b6115d2818d612c35565b6115dc828d612c35565b6115e7826000612c35565b6115fa86866001600160801b0316613012565b61160387613096565b6076919091556077558015611652576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50801561167a576000611663612e7c565b80549115156101000261ff00199092169190911790555b505050505050505050565b6000818152600360209081526040808320815180830190925280546001600160a01b0316808352600190910154928201929092528291156116cc57805160208201516116e6565b6002546001600160a01b03811690600160a01b900461ffff165b9250925050915091565b6001600160a01b031660009081526043602052604090205460ff1690565b6117166128ce565b6117735760405162461bcd60e51b815260206004820152602860248201527f4e6f7420617574686f72697a656420746f2073756273637269626520746f207260448201526732b3b4b9ba393c9760c11b6064820152608401610be3565b610c288160016130e0565b6117866128ce565b6117a25760405162461bcd60e51b8152600401610be390615605565b6111c68282613012565b6000610a3a826131d8565b6117bf6128ce565b6117db5760405162461bcd60e51b8152600401610be390615605565b610c2881613096565b61183860405180610100016040528060008152602001600081526020016000815260200160008152602001600080191681526020016000815260200160006001600160a01b03168152602001606081525090565b6000828152600f6020908152604091829020825161010081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201546080820152600582015460a082015260068201546001600160a01b031660c082015260078201805491929160e0840191906118b890615599565b80601f01602080910402602001604051908101604052809291908181526020018280546118e490615599565b80156119315780601f1061190657610100808354040283529160200191611931565b820191906000526020600020905b81548152906001019060200180831161191457829003601f168201915b5050505050815250509050919050565b60006001600160a01b038216611961576119616323d3ad8160e21b6128b8565b6001600160401b03611971612838565b6005016000846001600160a01b03166001600160a01b0316815260200190815260200160002054169050919050565b6119a86128ce565b6119c45760405162461bcd60e51b8152600401610be390615605565b600d54600e548183156119de576119db828461568c565b90505b600e859055600d8190556000805b86811015611b9157801580611a245750878782818110611a0e57611a0e6156ed565b9050602002810190611a209190615703565b3582105b611a555760405162461bcd60e51b815260206004820152600260248201526114d560f21b6044820152606401610be3565b6000600f81611a64848761568c565b8152602001908152602001600020600201549050888883818110611a8a57611a8a6156ed565b9050602002810190611a9c9190615703565b60200135811115611ae45760405162461bcd60e51b81526020600482015260126024820152711b585e081cdd5c1c1b1e4818db185a5b595960721b6044820152606401610be3565b888883818110611af657611af66156ed565b9050602002810190611b089190615703565b600f6000611b16858861568c565b81526020019081526020016000208181611b30919061586e565b50819050600f6000611b42858861568c565b8152602081019190915260400160002060020155888883818110611b6857611b686156ed565b9050602002810190611b7a9190615703565b359250819050611b89816158ec565b9150506119ec565b508415611c1157835b82811015611c0b576000818152600f6020526040812081815560018101829055600281018290556003810182905560048101829055600581018290556006810180546001600160a01b031916905590611bf66007830182614b7f565b50508080611c03906158ec565b915050611b9a565b50611ca0565b85831115611ca057855b83811015611c9e57600f6000611c31838661568c565b81526020810191909152604001600090812081815560018101829055600281018290556003810182905560048101829055600581018290556006810180546001600160a01b031916905590611c896007830182614b7f565b50508080611c96906158ec565b915050611c1b565b505b7fbf4016fceeaaa4ac5cf4be865b559ff85825ab4ca7aa7b661d16e2f544c03098878787604051611cd393929190615975565b60405180910390a150505050505050565b606060016000611cf2612ce8565b90506060818314611d0b57611d08858484613296565b90505b949350505050565b6000611d1d612585565b9050611d3481611d2b61339e565b88888888610c4b565b506000818152600f602052604081206002018054889290611d5690849061568c565b909155505060008181526010602052604081208791611d7361339e565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254611da2919061568c565b90915550611db5905060008787876133a8565b6000611dc1888861345a565b9050876001600160a01b0316611dd561339e565b6001600160a01b0316837ffa76a4010d9533e3e964f2930a65fb6042a12fa6ff5b08281837a10b0be7321e848b604051611e19929190918252602082015260400190565b60405180910390a45050505050505050565b6000828152600c602052604081205481805b82811015611f11576000868152600c602090815260408083208484526001019091529020546001600160a01b031615611eba5784821415611ea8576000868152600c602090815260408083209383526001909301905220546001600160a01b03169250610a3a915050565b611eb360018361568c565b9150611eff565b611ec5866000611f1a565b8015611eec57506000868152600c6020908152604080832083805260020190915290205481145b15611eff57611efc60018361568c565b91505b611f0a60018261568c565b9050611e3d565b50505092915050565b6000918252600a602090815260408084206001600160a01b0393909316845291905290205460ff1690565b611f4d6128ce565b611f695760405162461bcd60e51b8152600401610be390615605565b610c2881612f30565b6060611f7c612838565b6003018054610a5890615599565b6060611f97848484613296565b90505b9392505050565b611fa96128ce565b611fc55760405162461bcd60e51b8152600401610be390615605565b610bf6838383613470565b607554829060ff1615612085576daaeb6d7670e522a718067333cd4e3b1561208557604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c61711349061202590309085906004016155ce565b602060405180830381865afa158015612042573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206691906155e8565b6120855780604051633b79c77360e21b8152600401610be39190614d17565b610bf68383613517565b6000600161209b612ce8565b03905090565b6000828152600a6020908152604080832083805290915281205460ff166120ee57506000828152600a602090815260408083206001600160a01b038516845290915290205460ff16610a3a565b50600192915050565b6120ff6135b9565b61211b5760405162461bcd60e51b8152600401610be390615605565b610c28816135c9565b6060816001600160401b0381111561213e5761213e614f13565b60405190808252806020026020018201604052801561217157816020015b606081526020019060019003908161215c5790505b50905060005b82811015612211576121e130858584818110612195576121956156ed565b90506020028101906121a79190615723565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506137f792505050565b8282815181106121f3576121f36156ed565b60200260200101819052508080612209906158ec565b915050612177565b5092915050565b60068054819061222790615599565b80601f016020809104026020016040519081016040528092919081815260200182805461225390615599565b80156122a05780601f10612275576101008083540402835291602001916122a0565b820191906000526020600020905b81548152906001019060200180831161228357829003601f168201915b5050505050908060010180546122b590615599565b80601f01602080910402602001604051908101604052809291908181526020018280546122e190615599565b801561232e5780601f106123035761010080835404028352916020019161232e565b820191906000526020600020905b81548152906001019060200180831161231157829003601f168201915b50505050509080600201805461234390615599565b80601f016020809104026020016040519081016040528092919081815260200182805461236f90615599565b80156123bc5780601f10612391576101008083540402835291602001916123bc565b820191906000526020600020905b81548152906001019060200180831161239f57829003601f168201915b5050505050908060030180546123d190615599565b80601f01602080910402602001604051908101604052809291908181526020018280546123fd90615599565b801561244a5780601f1061241f5761010080835404028352916020019161244a565b820191906000526020600020905b81548152906001019060200180831161242d57829003601f168201915b5050505050905084565b607554849060ff161561252b576daaeb6d7670e522a718067333cd4e3b1561252b576001600160a01b038116331415612498576124938585858561381c565b612537565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c6171134906124cb90309033906004016155ce565b602060405180830381865afa1580156124e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250c91906155e8565b61252b5733604051633b79c77360e21b8152600401610be39190614d17565b6125378585858561381c565b5050505050565b612546614bb9565b6001821061258057612556612ce8565b821015612580575b61256782613857565b612577576000199091019061255e565b610a3a82613877565b919050565b600e54600d54600091829161259a919061568c565b90505b600d548111156125f157600f60006125b6600184615a5d565b81526020019081526020016000206000015442106125df576125d9600182615a5d565b91505090565b806125e981615a74565b91505061259d565b5060405162461bcd60e51b815260206004820152600b60248201526a10a1a7a72224aa24a7a71760a91b6044820152606401610be3565b60606126338261285c565b6126655760405162461bcd60e51b815260206004820152600360248201526208525160ea1b6044820152606401610be3565b610a3a826138a2565b6000818152600c6020526040812054815b818110156126d2576000848152600c602090815260408083208484526001019091529020546001600160a01b0316156126c0576126bd60018461568c565b92505b6126cb60018261568c565b905061267f565b506126de836000611f1a565b156126f1576126ee60018361568c565b91505b50919050565b6000828152600b60205260409020546112909033612bb5565b6001805461271d90615599565b80601f016020809104026020016040519081016040528092919081815260200182805461274990615599565b80156127965780601f1061276b57610100808354040283529160200191612796565b820191906000526020600020905b81548152906001019060200180831161277957829003601f168201915b505050505081565b60006127a8612838565b6001600160a01b039384166000908152600791909101602090815260408083209490951682529290925250205460ff1690565b6001600160a01b03163b151590565b60006301ffc9a760e01b6001600160e01b03198316148061281b57506380ac58cd60e01b6001600160e01b03198316145b80610a3a5750506001600160e01b031916635b5e139f60e01b1490565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b6000816001116125805761286e612838565b548210156125805760005b612881612838565b600084815260049190910160205260409020549050806128ab576128a483615a74565b9250612879565b600160e01b161592915050565b8060005260046000fd5b6111c682826001613b1a565b60006112a4816106e4613bdd565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b6000808281805b87518110156129f0576129496002836156a4565b9150600088828151811061295f5761295f6156ed565b602002602001015190508084116129a15760408051602081018690529081018290526060016040516020818303038152906040528051906020012093506129dd565b60408051602081018390529081018590526060016040516020818303038152906040528051906020012093506001836129da919061568c565b92505b50806129e8816158ec565b915050612935565b50941495939450505050565b6000612a07826131d8565b6001600160a01b039485169490915081168414612a2d57612a2d62a1148160e81b6128b8565b600080612a3984613be7565b91509150612a5f8187612a4a61339e565b6001600160a01b039081169116811491141790565b612a8357612a6f86610a0f61339e565b612a8357612a83632ce44b5f60e11b6128b8565b612a908686866001613c0f565b8015612a9b57600082555b612aa3612838565b6001600160a01b0387166000908152600591909101602052604090208054600019019055612acf612838565b6001600160a01b03861660009081526005919091016020526040902080546001019055612b0085600160e11b613c9e565b612b08612838565b60008681526004919091016020526040902055600160e11b8316612b775760018401612b32612838565b60008281526004919091016020526040902054612b7557612b51612838565b548114612b755783612b61612838565b600083815260049190910160205260409020555b505b6001600160a01b038516848188600080516020615fa2833981519152600080a480612bac57612bac633a954ecd60e21b6128b8565b50505050505050565b6000828152600a602090815260408083206001600160a01b038516845290915290205460ff166111c657612bf3816001600160a01b03166014613cb3565b612bfe836020613cb3565b604051602001612c0f929190615aa7565b60408051601f198184030181529082905262461bcd60e51b8252610be391600401614d04565b612c3f8282613e4e565b6111c68282613ea9565b6075805460ff19168215159081179091556040519081527f38475885990d8dfe9ca01f0ef160a1b5514426eab9ddbc953a3353410ba78096906020015b60405180910390a150565b612c9b8282613f16565b6000828152600c602090815260408083206001600160a01b03851680855260028201808552838620805487526001909301855292852080546001600160a01b031916905584529152555050565b6000612cf2612838565b54919050565b610bf683838360405180602001604052806000815250612454565b6000612d1e836131d8565b905080600080612d2d86613be7565b915091508415612d6857612d448184612a4a61339e565b612d6857612d5483610a0f61339e565b612d6857612d68632ce44b5f60e11b6128b8565b612d76836000886001613c0f565b8015612d8157600082555b6001600160801b03612d91612838565b6001600160a01b0385166000908152600591909101602052604090208054919091019055612dc383600360e01b613c9e565b612dcb612838565b60008881526004919091016020526040902055600160e11b8416612e3a5760018601612df5612838565b60008281526004919091016020526040902054612e3857612e14612838565b548114612e385784612e24612838565b600083815260049190910160205260409020555b505b60405186906000906001600160a01b03861690600080516020615fa2833981519152908390a4612e68612838565b600190810180549091019055505050505050565b7fee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85f90565b600054610100900460ff16612ec75760405162461bcd60e51b8152600401610be390615b14565b612ecf613f78565b610c2881613f9f565b612ee0612e7c565b54610100900460ff16612f055760405162461bcd60e51b8152600401610be390615b5f565b6111c6828261402e565b612f2e733cc6cdda760b79bafa08df41ecfa224f810dceb660016140aa565b565b600060018054612f3f90615599565b80601f0160208091040260200160405190810160405280929190818152602001828054612f6b90615599565b8015612fb85780601f10612f8d57610100808354040283529160200191612fb8565b820191906000526020600020905b815481529060010190602001808311612f9b57829003601f168201915b50508551939450612fd493600193506020870192509050614be0565b507fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a168183604051613006929190615bb3565b60405180910390a15050565b6127108111156130345760405162461bcd60e51b8152600401610be390615be1565b600280546001600160a01b0384166001600160b01b03199091168117600160a01b61ffff851602179091556040518281527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb9060200160405180910390a25050565b600480546001600160a01b0319166001600160a01b0383169081179091556040517f299d17e95023f496e0ffc4909cff1a61f74bb5eb18de6f900f4155bfa1b3b33390600090a250565b6daaeb6d7670e522a718067333cd4e3b156111c6576001600160a01b0382163b156131a757801561317457604051633e9f1edf60e11b81526daaeb6d7670e522a718067333cd4e90637d3e3dbe9061313e90309086906004016155ce565b600060405180830381600087803b15801561315857600080fd5b505af115801561316c573d6000803e3d6000fd5b505050505050565b60405163a0af290360e01b81526daaeb6d7670e522a718067333cd4e9063a0af29039061313e90309086906004016155ce565b604051632210724360e11b81526daaeb6d7670e522a718067333cd4e90634420e4869061313e903090600401614d17565b600081600111613286576131ea612838565b600083815260049190910160205260409020549050806132765761320c612838565b54821061322357613223636f96cda160e11b6128b8565b61322b612838565b600019909201600081815260049390930160205260409092205490508061325157613223565b600160e01b811661326157919050565b613271636f96cda160e11b6128b8565b613223565b600160e01b811661328657919050565b612580636f96cda160e11b6128b8565b60608183106132af576132af631960ccad60e11b6128b8565b60018310156132bd57600192505b60006132c7612ce8565b90508083106132d4578092505b606060006132e187611941565b858710908102915081156133925781878703116132fe5786860391505b60405192506001820160051b8301604052600061331a8861253e565b90506000816040015161332b575080515b60005b6133378a613877565b925060408301516000811461334f5760009250613374565b83511561335b57835192505b8b831860601b613374576001820191508a8260051b8801525b5060018a019950888a148061338857508481145b1561332e57855250505b50909695505050505050565b60006112a4613bdd565b806133b2576110ed565b60006133be82856156a4565b905060006001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156133f057503481146133f4565b5034155b806134265760405162461bcd60e51b815260206004820152600260248201526110ab60f11b6044820152606401610be3565b60006001600160a01b0387161561343d5786613445565b613445610adb565b9050612bac85613453613bdd565b83866140b4565b6000613464612ce8565b9050610a3a83836140f9565b6127108111156134925760405162461bcd60e51b8152600401610be390615be1565b6040805180820182526001600160a01b038481168083526020808401868152600089815260038352869020945185546001600160a01b031916941693909317845591516001909301929092559151838152909185917f7365cf4122f072a3365c20d54eff9b38d73c096c28e1892ec8f5b0e403a0f12d910160405180910390a3505050565b80613520612838565b600701600061352d61339e565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff19169215159290921790915561357161339e565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516135ad911515815260200190565b60405180910390a35050565b60006112a46077546106e4613bdd565b6040805160808101909152806135df8380615723565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060209081019061362890840184615723565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200161366f6040840184615723565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016136b66060840184615723565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152508051805160069161370291839160200190614be0565b50602082810151805161371b9260018501920190614be0565b5060408201518051613737916002840191602090910190614be0565b5060608201518051613753916003840191602090910190614be0565b5050604080516000815260001960208201527f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c92500160405180910390a17f8edd7f36d5f01bd45e59cf55b0a670dcf701fc20f678970a8c243b2346d6acaf6137bc8280615723565b6137c96020850185615723565b6137d66040870187615723565b6137e36060890189615723565b604051612c86989796959493929190615c0a565b6060611f9a8383604051806060016040528060278152602001615f7b60279139614113565b61382784848461100c565b6001600160a01b0383163b156110ed57613843848484846141ee565b6110ed576110ed6368d2bf6b60e11b6128b8565b6000613861612838565b6000928352600401602052506040902054151590565b61387f614bb9565b610a3a61388a612838565b600084815260049190910160205260409020546142d3565b6060600060066040518060800160405290816000820180546138c390615599565b80601f01602080910402602001604051908101604052809291908181526020018280546138ef90615599565b801561393c5780601f106139115761010080835404028352916020019161393c565b820191906000526020600020905b81548152906001019060200180831161391f57829003601f168201915b5050505050815260200160018201805461395590615599565b80601f016020809104026020016040519081016040528092919081815260200182805461398190615599565b80156139ce5780601f106139a3576101008083540402835291602001916139ce565b820191906000526020600020905b8154815290600101906020018083116139b157829003601f168201915b505050505081526020016002820180546139e790615599565b80601f0160208091040260200160405190810160405280929190818152602001828054613a1390615599565b8015613a605780601f10613a3557610100808354040283529160200191613a60565b820191906000526020600020905b815481529060010190602001808311613a4357829003601f168201915b50505050508152602001600382018054613a7990615599565b80601f0160208091040260200160405190810160405280929190818152602001828054613aa590615599565b8015613af25780601f10613ac757610100808354040283529160200191613af2565b820191906000526020600020905b815481529060010190602001808311613ad557829003601f168201915b50505050508152505090506126ee816000015182602001518360400151846060015187614316565b6000613b25836117ac565b9050818015613b4d5750806001600160a01b0316613b4161339e565b6001600160a01b031614155b15613b7257613b5e81610a0f61339e565b613b7257613b726367d9dca160e11b6128b8565b83613b7b612838565b6000858152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551859287811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a450505050565b60006112a461434b565b6000806000613bf4612838565b60009485526006016020525050604090912080549092909150565b613c1c6076546000611f1a565b158015613c3157506001600160a01b03841615155b8015613c4557506001600160a01b03831615155b156110ed57613c5660765485611f1a565b158015613c6c5750613c6a60765484611f1a565b155b156110ed5760405162461bcd60e51b8152602060048201526002602482015261085560f21b6044820152606401610be3565b4260a01b176001600160a01b03919091161790565b60606000613cc28360026156a4565b613ccd90600261568c565b6001600160401b03811115613ce457613ce4614f13565b6040519080825280601f01601f191660200182016040528015613d0e576020820181803683370190505b509050600360fc1b81600081518110613d2957613d296156ed565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613d5857613d586156ed565b60200101906001600160f81b031916908160001a9053506000613d7c8460026156a4565b613d8790600161568c565b90505b6001811115613dff576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613dbb57613dbb6156ed565b1a60f81b828281518110613dd157613dd16156ed565b60200101906001600160f81b031916908160001a90535060049490941c93613df881615a74565b9050613d8a565b508315611f9a5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610be3565b6000828152600a602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6000828152600c6020526040812080549160019190613ec8838561568c565b90915550506000928352600c6020908152604080852083865260018101835281862080546001600160a01b039096166001600160a01b03199096168617905593855260029093019052912055565b613f208282612bb5565b6000828152600a602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600054610100900460ff16612f2e5760405162461bcd60e51b8152600401610be390615b14565b600054610100900460ff16613fc65760405162461bcd60e51b8152600401610be390615b14565b60005b81518110156111c657600160436000848481518110613fea57613fea6156ed565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580614026816158ec565b915050613fc9565b614036612e7c565b54610100900460ff1661405b5760405162461bcd60e51b8152600401610be390615b5f565b81614064612838565b600201908051906020019061407a929190614be0565b5080614084612838565b600301908051906020019061409a929190614be0565b5060016140a5612838565b555050565b6111c682826130e0565b806140be576110ed565b6001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156140ed5761104a828261436d565b6110ed8484848461440f565b6111c6828260405180602001604052806000815250614468565b606061411e846127db565b6141795760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610be3565b600080856001600160a01b0316856040516141949190615c6a565b600060405180830381855af49150503d80600081146141cf576040519150601f19603f3d011682016040523d82523d6000602084013e6141d4565b606091505b50915091506141e48282866144da565b9695505050505050565b6000836001600160a01b031663150b7a0261420761339e565b8786866040518563ffffffff1660e01b81526004016142299493929190615c7c565b6020604051808303816000875af1925050508015614264575060408051601f3d908101601f1916820190925261426191810190615caf565b60015b6142b6573d808015614292576040519150601f19603f3d011682016040523d82523d6000602084013e614297565b606091505b5080516142ae576142ae6368d2bf6b60e11b6128b8565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6142db614bb9565b6001600160a01b03821681526001600160401b0360a083901c166020820152600160e01b82161515604082015260e89190911c606082015290565b606060006143248585614513565b90506000614334888884876145a0565b905061433f816145e6565b98975050505050505050565b6000614356336116f0565b15614368575060131936013560601c90565b503390565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146143ba576040519150601f19603f3d011682016040523d82523d6000602084013e6143bf565b606091505b5050905080610bf65760405162461bcd60e51b815260206004820152601c60248201527b1b985d1a5d99481d1bdad95b881d1c985b9cd9995c8819985a5b195960221b6044820152606401610be3565b816001600160a01b0316836001600160a01b0316141561442e576110ed565b6001600160a01b0383163014156144535761104a6001600160a01b0385168383614617565b6110ed6001600160a01b03851684848461466d565b61447283836146a5565b6001600160a01b0383163b15610bf657600061448c612838565b5490508281035b6144a660008683806001019450866141ee565b6144ba576144ba6368d2bf6b60e11b6128b8565b81811061449357816144ca612838565b54146125375761253760006128b8565b606083156144e9575081611f9a565b8251156144f95782518084602001fd5b8160405162461bcd60e51b8152600401610be39190614d04565b8151815160609115801591151590829061452a5750805b1561455a578484604051602001614542929190615ccc565b60405160208183030381529060405292505050610a3a565b811561457157846040516020016145429190615d43565b801561458857836040516020016145429190615d83565b50506040805160208101909152600081529392505050565b6060846145ac83614784565b85856145b786614784565b896040516020016145cd96959493929190615dcb565b6040516020818303038152906040529050949350505050565b60606145f182614881565b6040516020016146019190615ee1565b6040516020818303038152906040529050919050565b610bf68363a9059cbb60e01b8484604051602401614636929190614e9f565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526149d4565b6040516001600160a01b03808516602483015283166044820152606481018290526110ed9085906323b872dd60e01b90608401614636565b60006146af612838565b549050816146c7576146c763b562e8dd60e01b6128b8565b6146d46000848385613c0f565b6146e4836001841460e11b613c9e565b6146ec612838565b600083815260049190910160205260409020556001600160401b018202614711612838565b6001600160a01b0385166000818152600592909201602052604090912080549092019091558061474a5761474a622e076360e81b6128b8565b818301825b80836000600080516020615fa2833981519152600080a46001018082141561474f578161477a612838565b5550610bf6915050565b6060816147a85750506040805180820190915260018152600360fc1b602082015290565b8160005b81156147d257806147bc816158ec565b91506147cb9050600a836156d9565b91506147ac565b6000816001600160401b038111156147ec576147ec614f13565b6040519080825280601f01601f191660200182016040528015614816576020820181803683370190505b5090505b8415611d0b5761482b600183615a5d565b9150614838600a86615f26565b61484390603061568c565b60f81b818381518110614858576148586156ed565b60200101906001600160f81b031916908160001a90535061487a600a866156d9565b945061481a565b60608151600014156148a157505060408051602081019091526000815290565b6000604051806060016040528060408152602001615f3b60409139905060006003845160026148d0919061568c565b6148da91906156d9565b6148e59060046156a4565b6001600160401b038111156148fc576148fc614f13565b6040519080825280601f01601f191660200182016040528015614926576020820181803683370190505b509050600182016020820185865187015b80821015614992576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250614937565b50506003865106600181146149ae57600281146149c1576149c9565b603d6001830353603d60028303536149c9565b603d60018303535b509195945050505050565b6000614a29826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614aa69092919063ffffffff16565b805190915015610bf65780806020019051810190614a4791906155e8565b610bf65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610be3565b6060611f97848460008585614aba856127db565b614b065760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610be3565b600080866001600160a01b03168587604051614b229190615c6a565b60006040518083038185875af1925050503d8060008114614b5f576040519150601f19603f3d011682016040523d82523d6000602084013e614b64565b606091505b5091509150614b748282866144da565b979650505050505050565b508054614b8b90615599565b6000825580601f10614b9b575050565b601f016020900490600052602060002090810190610c289190614c64565b60408051608081018252600080825260208201819052918101829052606081019190915290565b828054614bec90615599565b90600052602060002090601f016020900481019282614c0e5760008555614c54565b82601f10614c2757805160ff1916838001178555614c54565b82800160010185558215614c54579182015b82811115614c54578251825591602001919060010190614c39565b50614c60929150614c64565b5090565b5b80821115614c605760008155600101614c65565b6001600160e01b031981168114610c2857600080fd5b600060208284031215614ca157600080fd5b8135611f9a81614c79565b60005b83811015614cc7578181015183820152602001614caf565b838111156110ed5750506000910152565b60008151808452614cf0816020860160208601614cac565b601f01601f19169290920160200192915050565b602081526000611f9a6020830184614cd8565b6001600160a01b0391909116815260200190565b600060208284031215614d3d57600080fd5b5035919050565b6001600160a01b0381168114610c2857600080fd5b803561258081614d44565b60008060408385031215614d7757600080fd5b8235614d8281614d44565b946020939093013593505050565b600060208284031215614da257600080fd5b8135611f9a81614d44565b6000608082840312156126f157600080fd5b60008060008060008060c08789031215614dd857600080fd5b863595506020870135614dea81614d44565b9450604087013593506060870135614e0181614d44565b92506080870135915060a08701356001600160401b03811115614e2357600080fd5b614e2f89828a01614dad565b9150509295509295509295565b600080600060608486031215614e5157600080fd5b8335614e5c81614d44565b92506020840135614e6c81614d44565b929592945050506040919091013590565b60008060408385031215614e9057600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b60008060408385031215614ecb57600080fd5b823591506020830135614edd81614d44565b809150509250929050565b8015158114610c2857600080fd5b600060208284031215614f0857600080fd5b8135611f9a81614ee8565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614f5157614f51614f13565b604052919050565b600082601f830112614f6a57600080fd5b81356001600160401b03811115614f8357614f83614f13565b614f96601f8201601f1916602001614f29565b818152846020838601011115614fab57600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112614fd957600080fd5b813560206001600160401b03821115614ff457614ff4614f13565b8160051b615003828201614f29565b928352848101820192828101908785111561501d57600080fd5b83870192505b84831015614b7457823561503681614d44565b82529183019190830190615023565b80356001600160801b038116811461258057600080fd5b600080600080600080600080610100898b03121561507957600080fd5b61508289614d59565b975060208901356001600160401b038082111561509e57600080fd5b6150aa8c838d01614f59565b985060408b01359150808211156150c057600080fd5b6150cc8c838d01614f59565b975060608b01359150808211156150e257600080fd5b6150ee8c838d01614f59565b965060808b013591508082111561510457600080fd5b506151118b828c01614fc8565b94505061512060a08a01614d59565b925061512e60c08a01614d59565b915061513c60e08a01615045565b90509295985092959890939650565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c082015260018060a01b0360c08301511660e0820152600060e0830151610100808185015250611d0b610120840182614cd8565b60008083601f8401126151ca57600080fd5b5081356001600160401b038111156151e157600080fd5b6020830191508360208260051b85010111156151fc57600080fd5b9250929050565b60008060006040848603121561521857600080fd5b83356001600160401b0381111561522e57600080fd5b61523a868287016151b8565b909450925050602084013561524e81614ee8565b809150509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561339257835183529284019291840191600101615275565b60008060008060008060c087890312156152aa57600080fd5b86356152b581614d44565b95506020870135945060408701356152cc81614d44565b93506060870135925060808701356001600160401b03808211156152ef57600080fd5b6152fb8a838b01614dad565b935060a089013591508082111561531157600080fd5b50614e2f89828a01614f59565b60006020828403121561533057600080fd5b81356001600160401b0381111561534657600080fd5b611d0b84828501614f59565b60008060006060848603121561536757600080fd5b833561537281614d44565b95602085013595506040909401359392505050565b60008060006060848603121561539c57600080fd5b833592506020840135614e6c81614d44565b600080604083850312156153c157600080fd5b82356153cc81614d44565b91506020830135614edd81614ee8565b6000602082840312156153ee57600080fd5b81356001600160401b0381111561540457600080fd5b611d0b84828501614dad565b6000806020838503121561542357600080fd5b82356001600160401b0381111561543957600080fd5b615445858286016151b8565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156154a657603f19888603018452615494858351614cd8565b94509285019290850190600101615478565b5092979650505050505050565b6080815260006154c66080830187614cd8565b82810360208401526154d88187614cd8565b905082810360408401526154ec8186614cd8565b90508281036060840152614b748185614cd8565b6000806000806080858703121561551657600080fd5b843561552181614d44565b9350602085013561553181614d44565b92506040850135915060608501356001600160401b0381111561555357600080fd5b61555f87828801614f59565b91505092959194509250565b6000806040838503121561557e57600080fd5b823561558981614d44565b91506020830135614edd81614d44565b600181811c908216806155ad57607f821691505b602082108114156126f157634e487b7160e01b600052602260045260246000fd5b6001600160a01b0392831681529116602082015260400190565b6000602082840312156155fa57600080fd5b8151611f9a81614ee8565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b6000808335601e1984360301811261564457600080fd5b8301803591506001600160401b0382111561565e57600080fd5b6020019150600581901b36038213156151fc57600080fd5b634e487b7160e01b600052601160045260246000fd5b6000821982111561569f5761569f615676565b500190565b60008160001904831182151516156156be576156be615676565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826156e8576156e86156c3565b500490565b634e487b7160e01b600052603260045260246000fd5b6000823560fe1983360301811261571957600080fd5b9190910192915050565b6000808335601e1984360301811261573a57600080fd5b8301803591506001600160401b0382111561575457600080fd5b6020019150368190038213156151fc57600080fd5b601f821115610bf657600081815260208120601f850160051c810160208610156157905750805b601f850160051c820191505b8181101561316c5782815560010161579c565b6001600160401b038311156157c6576157c6614f13565b6157da836157d48354615599565b83615769565b6000601f84116001811461580e57600085156157f65750838201355b600019600387901b1c1916600186901b178355612537565b600083815260209020601f19861690835b8281101561583f578685013582556020948501946001909201910161581f565b508682101561585c5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b813581556020820135600182015560408201356002820155606082013560038201556080820135600482015560a082013560058201556006810160c08301356158b681614d44565b81546001600160a01b0319166001600160a01b03919091161790556158de60e0830183615723565b6110ed8183600786016157af565b600060001982141561590057615900615676565b5060010190565b6000808335601e1984360301811261591e57600080fd5b83016020810192503590506001600160401b0381111561593d57600080fd5b8036038313156151fc57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60408082528181018490526000906060808401600587901b850182018885805b8a811015615a4757888403605f190185528235368d900360fe190181126159ba578283fd5b8c018035855260208082013581870152888201358987015287820135888701526080808301359087015260a080830135908701526101009060c080840135615a0181614d44565b6001600160a01b03169088015260e0615a1c84820185615907565b945083828a0152615a30848a01868361594c565b998301999850505094909401935050600101615995565b50505086151560208701529350611d0b92505050565b600082821015615a6f57615a6f615676565b500390565b600081615a8357615a83615676565b506000190190565b60008151615a9d818560208601614cac565b9290920192915050565b7402832b936b4b9b9b4b7b7399d1030b1b1b7bab73a1605d1b815260008351615ad7816015850160208801614cac565b7001034b99036b4b9b9b4b733903937b6329607d1b6015918401918201528351615b08816026840160208801614cac565b01602601949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526034908201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604082015273206973206e6f7420696e697469616c697a696e6760601b606082015260800190565b604081526000615bc66040830185614cd8565b8281036020840152615bd88185614cd8565b95945050505050565b6020808252600f908201526e45786365656473206d61782062707360881b604082015260600190565b608081526000615c1e608083018a8c61594c565b8281036020840152615c3181898b61594c565b90508281036040840152615c4681878961594c565b90508281036060840152615c5b81858761594c565b9b9a5050505050505050505050565b60008251615719818460208701614cac565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906141e490830184614cd8565b600060208284031215615cc157600080fd5b8151611f9a81614c79565b6834b6b0b3b2911d101160b91b81528251600090615cf1816009850160208801614cac565b741116101130b734b6b0ba34b7b72fbab936111d101160591b6009918401918201528351615d2681601e840160208801614cac565b631116101160e11b601e9290910191820152602201949350505050565b6834b6b0b3b2911d101160b91b81528151600090615d68816009850160208701614cac565b631116101160e11b6009939091019283015250600d01919050565b7030b734b6b0ba34b7b72fbab936111d101160791b81528151600090615db0816011850160208701614cac565b631116101160e11b6011939091019283015250601501919050565b693d913730b6b2911d101160b11b81528651600090615df181600a850160208c01614cac565b600160fd1b600a918401918201528751615e1281600b840160208c01614cac565b631116101160e11b600b929091019182018190526e3232b9b1b934b83a34b7b7111d101160891b600f8301528751615e5181601e850160208c01614cac565b601e9201918201528551615e6c816022840160208a01614cac565b770383937b832b93a34b2b9911d103d91373ab6b132b9111d160451b60229290910191820152615ed4615ec5615ebf615ea8603a850189615a8b565b6a1610113730b6b2911d101160a91b8152600b0190565b86615a8b565b62227d7d60e81b815260030190565b9998505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251615f1981601d850160208701614cac565b91909101601d0192915050565b600082615f3557615f356156c3565b50069056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212208fddf07c3cfff705777fe90a266e5e442b7876be00d9e4ff036288e072737da064736f6c634300080c0033
Deployed Bytecode
0x6080604052600436106102965760003560e01c80638462151c116101615780638462151c1461064b57806384bb1e42146106785780638da5cb5b1461068b5780639010d07c146106a957806391d14854146106c9578063938e3d7b146106e957806395d89b411461070957806399a2557a1461071e5780639bcf7a151461073e578063a217fddf1461075e578063a22cb46514610773578063a2309ff814610793578063a32fa5b3146107a8578063a7d27d9d146107c8578063ac9650d8146107e8578063acd083f81461047a578063ad1eefc514610815578063b24f2d3914610857578063b280f70314610882578063b88d4fde146108a7578063c23dc68f146108ba578063c68907de14610926578063c87b56dd1461093b578063ca15c8731461095b578063d547741f1461097b578063d637ed591461099b578063e6798baa146109cb578063e8a3d485146109df578063e985e9c5146109f457600080fd5b806301ffc9a71461029b57806306fdde03146102d0578063079fe40e146102f2578063081812fc14610314578063095ea7b31461033457806313af40351461034957806318160ddd1461036957806323a2902b1461038c57806323b872dd146103ac578063248a9ca3146103bf5780632a55205a146103ec5780632f2ff15d1461041a57806332f0cd641461043a57806336568abe1461045a5780633b1475a71461047a57806342842e0e1461048f57806342966c68146104a257806349c5c5b6146104c25780634cc157df146104e2578063504c6e0114610524578063572b6c051461053e57806357fd84551461055e578063600dd5ea1461057e5780636352211e1461059e5780636f4f2837146105be5780636f8934f4146105de57806370a082311461060b57806374bc7db71461062b575b600080fd5b3480156102a757600080fd5b506102bb6102b6366004614c8f565b610a14565b60405190151581526020015b60405180910390f35b3480156102dc57600080fd5b506102e5610a40565b6040516102c79190614d04565b3480156102fe57600080fd5b50610307610adb565b6040516102c79190614d17565b34801561032057600080fd5b5061030761032f366004614d2b565b610aea565b610347610342366004614d64565b610b2e565b005b34801561035557600080fd5b50610347610364366004614d90565b610bfb565b34801561037557600080fd5b5061037e610c2b565b6040519081526020016102c7565b34801561039857600080fd5b506102bb6103a7366004614dbf565b610c4b565b6103476103ba366004614e3c565b61100c565b3480156103cb57600080fd5b5061037e6103da366004614d2b565b6000908152600b602052604090205490565b3480156103f857600080fd5b5061040c610407366004614e7d565b6110f3565b6040516102c7929190614e9f565b34801561042657600080fd5b50610347610435366004614eb8565b611130565b34801561044657600080fd5b50610347610455366004614ef6565b6111ca565b34801561046657600080fd5b50610347610475366004614eb8565b61123b565b34801561048657600080fd5b5061037e61129a565b61034761049d366004614e3c565b6112a9565b3480156104ae57600080fd5b506103476104bd366004614d2b565b611385565b3480156104ce57600080fd5b506103476104dd36600461505c565b611390565b3480156104ee57600080fd5b506105026104fd366004614d2b565b611685565b604080516001600160a01b03909316835261ffff9091166020830152016102c7565b34801561053057600080fd5b506075546102bb9060ff1681565b34801561054a57600080fd5b506102bb610559366004614d90565b6116f0565b34801561056a57600080fd5b50610347610579366004614d90565b61170e565b34801561058a57600080fd5b50610347610599366004614d64565b61177e565b3480156105aa57600080fd5b506103076105b9366004614d2b565b6117ac565b3480156105ca57600080fd5b506103476105d9366004614d90565b6117b7565b3480156105ea57600080fd5b506105fe6105f9366004614d2b565b6117e4565b6040516102c7919061514b565b34801561061757600080fd5b5061037e610626366004614d90565b611941565b34801561063757600080fd5b50610347610646366004615203565b6119a0565b34801561065757600080fd5b5061066b610666366004614d90565b611ce4565b6040516102c79190615259565b610347610686366004615291565b611d13565b34801561069757600080fd5b506005546001600160a01b0316610307565b3480156106b557600080fd5b506103076106c4366004614e7d565b611e2b565b3480156106d557600080fd5b506102bb6106e4366004614eb8565b611f1a565b3480156106f557600080fd5b5061034761070436600461531e565b611f45565b34801561071557600080fd5b506102e5611f72565b34801561072a57600080fd5b5061066b610739366004615352565b611f8a565b34801561074a57600080fd5b50610347610759366004615387565b611fa1565b34801561076a57600080fd5b5061037e600081565b34801561077f57600080fd5b5061034761078e3660046153ae565b611fd0565b34801561079f57600080fd5b5061037e61208f565b3480156107b457600080fd5b506102bb6107c3366004614eb8565b6120a1565b3480156107d457600080fd5b506103476107e33660046153dc565b6120f7565b3480156107f457600080fd5b50610808610803366004615410565b612124565b6040516102c79190615451565b34801561082157600080fd5b5061037e610830366004614eb8565b60009182526010602090815260408084206001600160a01b03909316845291905290205490565b34801561086357600080fd5b506002546001600160a01b03811690600160a01b900461ffff16610502565b34801561088e57600080fd5b50610897612218565b6040516102c794939291906154b3565b6103476108b5366004615500565b612454565b3480156108c657600080fd5b506108da6108d5366004614d2b565b61253e565b6040516102c7919081516001600160a01b031681526020808301516001600160401b03169082015260408083015115159082015260609182015162ffffff169181019190915260800190565b34801561093257600080fd5b5061037e612585565b34801561094757600080fd5b506102e5610956366004614d2b565b612628565b34801561096757600080fd5b5061037e610976366004614d2b565b61266e565b34801561098757600080fd5b50610347610996366004614eb8565b6126f7565b3480156109a757600080fd5b50600d54600e546109b6919082565b604080519283526020830191909152016102c7565b3480156109d757600080fd5b50600161037e565b3480156109eb57600080fd5b506102e5612710565b348015610a0057600080fd5b506102bb610a0f36600461556b565b61279e565b6000610a1f826127ea565b80610a3a575063152a902d60e11b6001600160e01b03198316145b92915050565b6060610a4a612838565b6002018054610a5890615599565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8490615599565b8015610ad15780601f10610aa657610100808354040283529160200191610ad1565b820191906000526020600020905b815481529060010190602001808311610ab457829003601f168201915b5050505050905090565b6004546001600160a01b031690565b6000610af58261285c565b610b0957610b096333d1c03960e21b6128b8565b610b11612838565b60009283526006016020525060409020546001600160a01b031690565b607554829060ff1615610bec576daaeb6d7670e522a718067333cd4e3b15610bec57604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c617113490610b8390309085906004016155ce565b602060405180830381865afa158015610ba0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc491906155e8565b610bec5780604051633b79c77360e21b8152600401610be39190614d17565b60405180910390fd5b610bf683836128c2565b505050565b610c036128ce565b610c1f5760405162461bcd60e51b8152600401610be390615605565b610c28816128dc565b50565b60006001610c37612838565b60010154610c43612838565b540303919050565b6000868152600f60209081526040808320815161010081018352815481526001820154938101939093526002810154918301919091526003810154606083015260048101546080830152600581015460a083015260068101546001600160a01b031660c08301526007810180548493929160e0840191610cca90615599565b80601f0160208091040260200160405190810160405280929190818152602001828054610cf690615599565b8015610d435780601f10610d1857610100808354040283529160200191610d43565b820191906000526020600020905b815481529060010190602001808311610d2657829003601f168201915b50505091909252505050606081015160a082015160c08301516080840151939450919290919015610e2357610e1f610d7b878061562d565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505060808088015191508d9060208b01359060408c013590610dd0908d0160608e01614d90565b6040516001600160601b0319606095861b811660208301526034820194909452605481019290925290921b1660748201526088016040516020818303038152906040528051906020012061292e565b5094505b8415610ea8576020860135610e385782610e3e565b85602001355b925060001986604001351415610e545781610e5a565b85604001355b9150600019866040013514158015610e8b57506000610e7f6080880160608901614d90565b6001600160a01b031614155b610e955780610ea5565b610ea56080870160608801614d90565b90505b60008b81526010602090815260408083206001600160a01b03808f16855292529091205490898116908316141580610ee05750828814155b15610f205760405162461bcd60e51b815260206004820152601060248201526f2150726963654f7243757272656e637960801b6044820152606401610be3565b891580610f35575083610f33828c61568c565b115b15610f6b5760405162461bcd60e51b8152600401610be3906020808252600490820152632151747960e01b604082015260600190565b84602001518a8660400151610f80919061568c565b1115610fbb5760405162461bcd60e51b815260206004820152600a602482015269214d6178537570706c7960b01b6044820152606401610be3565b8451421015610ffd5760405162461bcd60e51b815260206004820152600e60248201526d18d85b9d0818db185a5b481e595d60921b6044820152606401610be3565b50505050509695505050505050565b607554839060ff16156110e2576daaeb6d7670e522a718067333cd4e3b156110e2576001600160a01b03811633141561104f5761104a8484846129fc565b6110ed565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c61711349061108290309033906004016155ce565b602060405180830381865afa15801561109f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c391906155e8565b6110e25733604051633b79c77360e21b8152600401610be39190614d17565b6110ed8484846129fc565b50505050565b60008060008061110286611685565b90945084925061ffff16905061271061111b82876156a4565b61112591906156d9565b925050509250929050565b6000828152600b60205260409020546111499033612bb5565b6000828152600a602090815260408083206001600160a01b038516845290915290205460ff16156111bc5760405162461bcd60e51b815260206004820152601d60248201527f43616e206f6e6c79206772616e7420746f206e6f6e20686f6c646572730000006044820152606401610be3565b6111c68282612c35565b5050565b6111d26128ce565b6112325760405162461bcd60e51b815260206004820152602b60248201527f4e6f7420617574686f72697a656420746f20736574206f70657261746f72207260448201526a32b9ba3934b1ba34b7b71760a91b6064820152608401610be3565b610c2881612c49565b336001600160a01b038216146112905760405162461bcd60e51b815260206004820152601a60248201527921b0b71037b7363c903932b737bab731b2903337b91039b2b63360311b6044820152606401610be3565b6111c68282612c91565b60006112a4612ce8565b905090565b607554839060ff161561137a576daaeb6d7670e522a718067333cd4e3b1561137a576001600160a01b0381163314156112e75761104a848484612cf8565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c61711349061131a90309033906004016155ce565b602060405180830381865afa158015611337573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135b91906155e8565b61137a5733604051633b79c77360e21b8152600401610be39190614d17565b6110ed848484612cf8565b610c28816001612d13565b611398612e7c565b54610100900460ff166113b7576113ad612e7c565b5460ff16156113bb565b303b155b6114275760405162461bcd60e51b815260206004820152603760248201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604482015276081a5cc8185b1c9958591e481a5b9a5d1a585b1a5e9959604a1b6064820152608401610be3565b6000611431612e7c565b54610100900460ff16159050801561147d57600161144d612e7c565b80549115156101000261ff0019909216919091179055600161146d612e7c565b805460ff19169115159190911790555b600054610100900460ff161580801561149d5750600054600160ff909116105b806114be57506114ac306127db565b1580156114be575060005460ff166001145b6115215760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610be3565b6000805460ff191660011790558015611544576000805461ff0019166101001790555b7f8502233096d909befbda0999bb8ea2f3a6be3c138b9fbf003752a4c8bce86f6c7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661158f88612ea0565b6115998b8b612ed8565b6115a1612f0f565b6115aa89612f30565b6115b38c6128dc565b6115bd6001612c49565b6115c860008d612c35565b6115d2818d612c35565b6115dc828d612c35565b6115e7826000612c35565b6115fa86866001600160801b0316613012565b61160387613096565b6076919091556077558015611652576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50801561167a576000611663612e7c565b80549115156101000261ff00199092169190911790555b505050505050505050565b6000818152600360209081526040808320815180830190925280546001600160a01b0316808352600190910154928201929092528291156116cc57805160208201516116e6565b6002546001600160a01b03811690600160a01b900461ffff165b9250925050915091565b6001600160a01b031660009081526043602052604090205460ff1690565b6117166128ce565b6117735760405162461bcd60e51b815260206004820152602860248201527f4e6f7420617574686f72697a656420746f2073756273637269626520746f207260448201526732b3b4b9ba393c9760c11b6064820152608401610be3565b610c288160016130e0565b6117866128ce565b6117a25760405162461bcd60e51b8152600401610be390615605565b6111c68282613012565b6000610a3a826131d8565b6117bf6128ce565b6117db5760405162461bcd60e51b8152600401610be390615605565b610c2881613096565b61183860405180610100016040528060008152602001600081526020016000815260200160008152602001600080191681526020016000815260200160006001600160a01b03168152602001606081525090565b6000828152600f6020908152604091829020825161010081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201546080820152600582015460a082015260068201546001600160a01b031660c082015260078201805491929160e0840191906118b890615599565b80601f01602080910402602001604051908101604052809291908181526020018280546118e490615599565b80156119315780601f1061190657610100808354040283529160200191611931565b820191906000526020600020905b81548152906001019060200180831161191457829003601f168201915b5050505050815250509050919050565b60006001600160a01b038216611961576119616323d3ad8160e21b6128b8565b6001600160401b03611971612838565b6005016000846001600160a01b03166001600160a01b0316815260200190815260200160002054169050919050565b6119a86128ce565b6119c45760405162461bcd60e51b8152600401610be390615605565b600d54600e548183156119de576119db828461568c565b90505b600e859055600d8190556000805b86811015611b9157801580611a245750878782818110611a0e57611a0e6156ed565b9050602002810190611a209190615703565b3582105b611a555760405162461bcd60e51b815260206004820152600260248201526114d560f21b6044820152606401610be3565b6000600f81611a64848761568c565b8152602001908152602001600020600201549050888883818110611a8a57611a8a6156ed565b9050602002810190611a9c9190615703565b60200135811115611ae45760405162461bcd60e51b81526020600482015260126024820152711b585e081cdd5c1c1b1e4818db185a5b595960721b6044820152606401610be3565b888883818110611af657611af66156ed565b9050602002810190611b089190615703565b600f6000611b16858861568c565b81526020019081526020016000208181611b30919061586e565b50819050600f6000611b42858861568c565b8152602081019190915260400160002060020155888883818110611b6857611b686156ed565b9050602002810190611b7a9190615703565b359250819050611b89816158ec565b9150506119ec565b508415611c1157835b82811015611c0b576000818152600f6020526040812081815560018101829055600281018290556003810182905560048101829055600581018290556006810180546001600160a01b031916905590611bf66007830182614b7f565b50508080611c03906158ec565b915050611b9a565b50611ca0565b85831115611ca057855b83811015611c9e57600f6000611c31838661568c565b81526020810191909152604001600090812081815560018101829055600281018290556003810182905560048101829055600581018290556006810180546001600160a01b031916905590611c896007830182614b7f565b50508080611c96906158ec565b915050611c1b565b505b7fbf4016fceeaaa4ac5cf4be865b559ff85825ab4ca7aa7b661d16e2f544c03098878787604051611cd393929190615975565b60405180910390a150505050505050565b606060016000611cf2612ce8565b90506060818314611d0b57611d08858484613296565b90505b949350505050565b6000611d1d612585565b9050611d3481611d2b61339e565b88888888610c4b565b506000818152600f602052604081206002018054889290611d5690849061568c565b909155505060008181526010602052604081208791611d7361339e565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254611da2919061568c565b90915550611db5905060008787876133a8565b6000611dc1888861345a565b9050876001600160a01b0316611dd561339e565b6001600160a01b0316837ffa76a4010d9533e3e964f2930a65fb6042a12fa6ff5b08281837a10b0be7321e848b604051611e19929190918252602082015260400190565b60405180910390a45050505050505050565b6000828152600c602052604081205481805b82811015611f11576000868152600c602090815260408083208484526001019091529020546001600160a01b031615611eba5784821415611ea8576000868152600c602090815260408083209383526001909301905220546001600160a01b03169250610a3a915050565b611eb360018361568c565b9150611eff565b611ec5866000611f1a565b8015611eec57506000868152600c6020908152604080832083805260020190915290205481145b15611eff57611efc60018361568c565b91505b611f0a60018261568c565b9050611e3d565b50505092915050565b6000918252600a602090815260408084206001600160a01b0393909316845291905290205460ff1690565b611f4d6128ce565b611f695760405162461bcd60e51b8152600401610be390615605565b610c2881612f30565b6060611f7c612838565b6003018054610a5890615599565b6060611f97848484613296565b90505b9392505050565b611fa96128ce565b611fc55760405162461bcd60e51b8152600401610be390615605565b610bf6838383613470565b607554829060ff1615612085576daaeb6d7670e522a718067333cd4e3b1561208557604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c61711349061202590309085906004016155ce565b602060405180830381865afa158015612042573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206691906155e8565b6120855780604051633b79c77360e21b8152600401610be39190614d17565b610bf68383613517565b6000600161209b612ce8565b03905090565b6000828152600a6020908152604080832083805290915281205460ff166120ee57506000828152600a602090815260408083206001600160a01b038516845290915290205460ff16610a3a565b50600192915050565b6120ff6135b9565b61211b5760405162461bcd60e51b8152600401610be390615605565b610c28816135c9565b6060816001600160401b0381111561213e5761213e614f13565b60405190808252806020026020018201604052801561217157816020015b606081526020019060019003908161215c5790505b50905060005b82811015612211576121e130858584818110612195576121956156ed565b90506020028101906121a79190615723565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506137f792505050565b8282815181106121f3576121f36156ed565b60200260200101819052508080612209906158ec565b915050612177565b5092915050565b60068054819061222790615599565b80601f016020809104026020016040519081016040528092919081815260200182805461225390615599565b80156122a05780601f10612275576101008083540402835291602001916122a0565b820191906000526020600020905b81548152906001019060200180831161228357829003601f168201915b5050505050908060010180546122b590615599565b80601f01602080910402602001604051908101604052809291908181526020018280546122e190615599565b801561232e5780601f106123035761010080835404028352916020019161232e565b820191906000526020600020905b81548152906001019060200180831161231157829003601f168201915b50505050509080600201805461234390615599565b80601f016020809104026020016040519081016040528092919081815260200182805461236f90615599565b80156123bc5780601f10612391576101008083540402835291602001916123bc565b820191906000526020600020905b81548152906001019060200180831161239f57829003601f168201915b5050505050908060030180546123d190615599565b80601f01602080910402602001604051908101604052809291908181526020018280546123fd90615599565b801561244a5780601f1061241f5761010080835404028352916020019161244a565b820191906000526020600020905b81548152906001019060200180831161242d57829003601f168201915b5050505050905084565b607554849060ff161561252b576daaeb6d7670e522a718067333cd4e3b1561252b576001600160a01b038116331415612498576124938585858561381c565b612537565b604051633185c44d60e21b81526daaeb6d7670e522a718067333cd4e9063c6171134906124cb90309033906004016155ce565b602060405180830381865afa1580156124e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250c91906155e8565b61252b5733604051633b79c77360e21b8152600401610be39190614d17565b6125378585858561381c565b5050505050565b612546614bb9565b6001821061258057612556612ce8565b821015612580575b61256782613857565b612577576000199091019061255e565b610a3a82613877565b919050565b600e54600d54600091829161259a919061568c565b90505b600d548111156125f157600f60006125b6600184615a5d565b81526020019081526020016000206000015442106125df576125d9600182615a5d565b91505090565b806125e981615a74565b91505061259d565b5060405162461bcd60e51b815260206004820152600b60248201526a10a1a7a72224aa24a7a71760a91b6044820152606401610be3565b60606126338261285c565b6126655760405162461bcd60e51b815260206004820152600360248201526208525160ea1b6044820152606401610be3565b610a3a826138a2565b6000818152600c6020526040812054815b818110156126d2576000848152600c602090815260408083208484526001019091529020546001600160a01b0316156126c0576126bd60018461568c565b92505b6126cb60018261568c565b905061267f565b506126de836000611f1a565b156126f1576126ee60018361568c565b91505b50919050565b6000828152600b60205260409020546112909033612bb5565b6001805461271d90615599565b80601f016020809104026020016040519081016040528092919081815260200182805461274990615599565b80156127965780601f1061276b57610100808354040283529160200191612796565b820191906000526020600020905b81548152906001019060200180831161277957829003601f168201915b505050505081565b60006127a8612838565b6001600160a01b039384166000908152600791909101602090815260408083209490951682529290925250205460ff1690565b6001600160a01b03163b151590565b60006301ffc9a760e01b6001600160e01b03198316148061281b57506380ac58cd60e01b6001600160e01b03198316145b80610a3a5750506001600160e01b031916635b5e139f60e01b1490565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b6000816001116125805761286e612838565b548210156125805760005b612881612838565b600084815260049190910160205260409020549050806128ab576128a483615a74565b9250612879565b600160e01b161592915050565b8060005260046000fd5b6111c682826001613b1a565b60006112a4816106e4613bdd565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b6000808281805b87518110156129f0576129496002836156a4565b9150600088828151811061295f5761295f6156ed565b602002602001015190508084116129a15760408051602081018690529081018290526060016040516020818303038152906040528051906020012093506129dd565b60408051602081018390529081018590526060016040516020818303038152906040528051906020012093506001836129da919061568c565b92505b50806129e8816158ec565b915050612935565b50941495939450505050565b6000612a07826131d8565b6001600160a01b039485169490915081168414612a2d57612a2d62a1148160e81b6128b8565b600080612a3984613be7565b91509150612a5f8187612a4a61339e565b6001600160a01b039081169116811491141790565b612a8357612a6f86610a0f61339e565b612a8357612a83632ce44b5f60e11b6128b8565b612a908686866001613c0f565b8015612a9b57600082555b612aa3612838565b6001600160a01b0387166000908152600591909101602052604090208054600019019055612acf612838565b6001600160a01b03861660009081526005919091016020526040902080546001019055612b0085600160e11b613c9e565b612b08612838565b60008681526004919091016020526040902055600160e11b8316612b775760018401612b32612838565b60008281526004919091016020526040902054612b7557612b51612838565b548114612b755783612b61612838565b600083815260049190910160205260409020555b505b6001600160a01b038516848188600080516020615fa2833981519152600080a480612bac57612bac633a954ecd60e21b6128b8565b50505050505050565b6000828152600a602090815260408083206001600160a01b038516845290915290205460ff166111c657612bf3816001600160a01b03166014613cb3565b612bfe836020613cb3565b604051602001612c0f929190615aa7565b60408051601f198184030181529082905262461bcd60e51b8252610be391600401614d04565b612c3f8282613e4e565b6111c68282613ea9565b6075805460ff19168215159081179091556040519081527f38475885990d8dfe9ca01f0ef160a1b5514426eab9ddbc953a3353410ba78096906020015b60405180910390a150565b612c9b8282613f16565b6000828152600c602090815260408083206001600160a01b03851680855260028201808552838620805487526001909301855292852080546001600160a01b031916905584529152555050565b6000612cf2612838565b54919050565b610bf683838360405180602001604052806000815250612454565b6000612d1e836131d8565b905080600080612d2d86613be7565b915091508415612d6857612d448184612a4a61339e565b612d6857612d5483610a0f61339e565b612d6857612d68632ce44b5f60e11b6128b8565b612d76836000886001613c0f565b8015612d8157600082555b6001600160801b03612d91612838565b6001600160a01b0385166000908152600591909101602052604090208054919091019055612dc383600360e01b613c9e565b612dcb612838565b60008881526004919091016020526040902055600160e11b8416612e3a5760018601612df5612838565b60008281526004919091016020526040902054612e3857612e14612838565b548114612e385784612e24612838565b600083815260049190910160205260409020555b505b60405186906000906001600160a01b03861690600080516020615fa2833981519152908390a4612e68612838565b600190810180549091019055505050505050565b7fee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85f90565b600054610100900460ff16612ec75760405162461bcd60e51b8152600401610be390615b14565b612ecf613f78565b610c2881613f9f565b612ee0612e7c565b54610100900460ff16612f055760405162461bcd60e51b8152600401610be390615b5f565b6111c6828261402e565b612f2e733cc6cdda760b79bafa08df41ecfa224f810dceb660016140aa565b565b600060018054612f3f90615599565b80601f0160208091040260200160405190810160405280929190818152602001828054612f6b90615599565b8015612fb85780601f10612f8d57610100808354040283529160200191612fb8565b820191906000526020600020905b815481529060010190602001808311612f9b57829003601f168201915b50508551939450612fd493600193506020870192509050614be0565b507fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a168183604051613006929190615bb3565b60405180910390a15050565b6127108111156130345760405162461bcd60e51b8152600401610be390615be1565b600280546001600160a01b0384166001600160b01b03199091168117600160a01b61ffff851602179091556040518281527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb9060200160405180910390a25050565b600480546001600160a01b0319166001600160a01b0383169081179091556040517f299d17e95023f496e0ffc4909cff1a61f74bb5eb18de6f900f4155bfa1b3b33390600090a250565b6daaeb6d7670e522a718067333cd4e3b156111c6576001600160a01b0382163b156131a757801561317457604051633e9f1edf60e11b81526daaeb6d7670e522a718067333cd4e90637d3e3dbe9061313e90309086906004016155ce565b600060405180830381600087803b15801561315857600080fd5b505af115801561316c573d6000803e3d6000fd5b505050505050565b60405163a0af290360e01b81526daaeb6d7670e522a718067333cd4e9063a0af29039061313e90309086906004016155ce565b604051632210724360e11b81526daaeb6d7670e522a718067333cd4e90634420e4869061313e903090600401614d17565b600081600111613286576131ea612838565b600083815260049190910160205260409020549050806132765761320c612838565b54821061322357613223636f96cda160e11b6128b8565b61322b612838565b600019909201600081815260049390930160205260409092205490508061325157613223565b600160e01b811661326157919050565b613271636f96cda160e11b6128b8565b613223565b600160e01b811661328657919050565b612580636f96cda160e11b6128b8565b60608183106132af576132af631960ccad60e11b6128b8565b60018310156132bd57600192505b60006132c7612ce8565b90508083106132d4578092505b606060006132e187611941565b858710908102915081156133925781878703116132fe5786860391505b60405192506001820160051b8301604052600061331a8861253e565b90506000816040015161332b575080515b60005b6133378a613877565b925060408301516000811461334f5760009250613374565b83511561335b57835192505b8b831860601b613374576001820191508a8260051b8801525b5060018a019950888a148061338857508481145b1561332e57855250505b50909695505050505050565b60006112a4613bdd565b806133b2576110ed565b60006133be82856156a4565b905060006001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156133f057503481146133f4565b5034155b806134265760405162461bcd60e51b815260206004820152600260248201526110ab60f11b6044820152606401610be3565b60006001600160a01b0387161561343d5786613445565b613445610adb565b9050612bac85613453613bdd565b83866140b4565b6000613464612ce8565b9050610a3a83836140f9565b6127108111156134925760405162461bcd60e51b8152600401610be390615be1565b6040805180820182526001600160a01b038481168083526020808401868152600089815260038352869020945185546001600160a01b031916941693909317845591516001909301929092559151838152909185917f7365cf4122f072a3365c20d54eff9b38d73c096c28e1892ec8f5b0e403a0f12d910160405180910390a3505050565b80613520612838565b600701600061352d61339e565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff19169215159290921790915561357161339e565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516135ad911515815260200190565b60405180910390a35050565b60006112a46077546106e4613bdd565b6040805160808101909152806135df8380615723565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060209081019061362890840184615723565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200161366f6040840184615723565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016136b66060840184615723565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152508051805160069161370291839160200190614be0565b50602082810151805161371b9260018501920190614be0565b5060408201518051613737916002840191602090910190614be0565b5060608201518051613753916003840191602090910190614be0565b5050604080516000815260001960208201527f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c92500160405180910390a17f8edd7f36d5f01bd45e59cf55b0a670dcf701fc20f678970a8c243b2346d6acaf6137bc8280615723565b6137c96020850185615723565b6137d66040870187615723565b6137e36060890189615723565b604051612c86989796959493929190615c0a565b6060611f9a8383604051806060016040528060278152602001615f7b60279139614113565b61382784848461100c565b6001600160a01b0383163b156110ed57613843848484846141ee565b6110ed576110ed6368d2bf6b60e11b6128b8565b6000613861612838565b6000928352600401602052506040902054151590565b61387f614bb9565b610a3a61388a612838565b600084815260049190910160205260409020546142d3565b6060600060066040518060800160405290816000820180546138c390615599565b80601f01602080910402602001604051908101604052809291908181526020018280546138ef90615599565b801561393c5780601f106139115761010080835404028352916020019161393c565b820191906000526020600020905b81548152906001019060200180831161391f57829003601f168201915b5050505050815260200160018201805461395590615599565b80601f016020809104026020016040519081016040528092919081815260200182805461398190615599565b80156139ce5780601f106139a3576101008083540402835291602001916139ce565b820191906000526020600020905b8154815290600101906020018083116139b157829003601f168201915b505050505081526020016002820180546139e790615599565b80601f0160208091040260200160405190810160405280929190818152602001828054613a1390615599565b8015613a605780601f10613a3557610100808354040283529160200191613a60565b820191906000526020600020905b815481529060010190602001808311613a4357829003601f168201915b50505050508152602001600382018054613a7990615599565b80601f0160208091040260200160405190810160405280929190818152602001828054613aa590615599565b8015613af25780601f10613ac757610100808354040283529160200191613af2565b820191906000526020600020905b815481529060010190602001808311613ad557829003601f168201915b50505050508152505090506126ee816000015182602001518360400151846060015187614316565b6000613b25836117ac565b9050818015613b4d5750806001600160a01b0316613b4161339e565b6001600160a01b031614155b15613b7257613b5e81610a0f61339e565b613b7257613b726367d9dca160e11b6128b8565b83613b7b612838565b6000858152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551859287811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a450505050565b60006112a461434b565b6000806000613bf4612838565b60009485526006016020525050604090912080549092909150565b613c1c6076546000611f1a565b158015613c3157506001600160a01b03841615155b8015613c4557506001600160a01b03831615155b156110ed57613c5660765485611f1a565b158015613c6c5750613c6a60765484611f1a565b155b156110ed5760405162461bcd60e51b8152602060048201526002602482015261085560f21b6044820152606401610be3565b4260a01b176001600160a01b03919091161790565b60606000613cc28360026156a4565b613ccd90600261568c565b6001600160401b03811115613ce457613ce4614f13565b6040519080825280601f01601f191660200182016040528015613d0e576020820181803683370190505b509050600360fc1b81600081518110613d2957613d296156ed565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613d5857613d586156ed565b60200101906001600160f81b031916908160001a9053506000613d7c8460026156a4565b613d8790600161568c565b90505b6001811115613dff576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613dbb57613dbb6156ed565b1a60f81b828281518110613dd157613dd16156ed565b60200101906001600160f81b031916908160001a90535060049490941c93613df881615a74565b9050613d8a565b508315611f9a5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610be3565b6000828152600a602090815260408083206001600160a01b0385168085529252808320805460ff1916600117905551339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6000828152600c6020526040812080549160019190613ec8838561568c565b90915550506000928352600c6020908152604080852083865260018101835281862080546001600160a01b039096166001600160a01b03199096168617905593855260029093019052912055565b613f208282612bb5565b6000828152600a602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600054610100900460ff16612f2e5760405162461bcd60e51b8152600401610be390615b14565b600054610100900460ff16613fc65760405162461bcd60e51b8152600401610be390615b14565b60005b81518110156111c657600160436000848481518110613fea57613fea6156ed565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580614026816158ec565b915050613fc9565b614036612e7c565b54610100900460ff1661405b5760405162461bcd60e51b8152600401610be390615b5f565b81614064612838565b600201908051906020019061407a929190614be0565b5080614084612838565b600301908051906020019061409a929190614be0565b5060016140a5612838565b555050565b6111c682826130e0565b806140be576110ed565b6001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156140ed5761104a828261436d565b6110ed8484848461440f565b6111c6828260405180602001604052806000815250614468565b606061411e846127db565b6141795760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610be3565b600080856001600160a01b0316856040516141949190615c6a565b600060405180830381855af49150503d80600081146141cf576040519150601f19603f3d011682016040523d82523d6000602084013e6141d4565b606091505b50915091506141e48282866144da565b9695505050505050565b6000836001600160a01b031663150b7a0261420761339e565b8786866040518563ffffffff1660e01b81526004016142299493929190615c7c565b6020604051808303816000875af1925050508015614264575060408051601f3d908101601f1916820190925261426191810190615caf565b60015b6142b6573d808015614292576040519150601f19603f3d011682016040523d82523d6000602084013e614297565b606091505b5080516142ae576142ae6368d2bf6b60e11b6128b8565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6142db614bb9565b6001600160a01b03821681526001600160401b0360a083901c166020820152600160e01b82161515604082015260e89190911c606082015290565b606060006143248585614513565b90506000614334888884876145a0565b905061433f816145e6565b98975050505050505050565b6000614356336116f0565b15614368575060131936013560601c90565b503390565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146143ba576040519150601f19603f3d011682016040523d82523d6000602084013e6143bf565b606091505b5050905080610bf65760405162461bcd60e51b815260206004820152601c60248201527b1b985d1a5d99481d1bdad95b881d1c985b9cd9995c8819985a5b195960221b6044820152606401610be3565b816001600160a01b0316836001600160a01b0316141561442e576110ed565b6001600160a01b0383163014156144535761104a6001600160a01b0385168383614617565b6110ed6001600160a01b03851684848461466d565b61447283836146a5565b6001600160a01b0383163b15610bf657600061448c612838565b5490508281035b6144a660008683806001019450866141ee565b6144ba576144ba6368d2bf6b60e11b6128b8565b81811061449357816144ca612838565b54146125375761253760006128b8565b606083156144e9575081611f9a565b8251156144f95782518084602001fd5b8160405162461bcd60e51b8152600401610be39190614d04565b8151815160609115801591151590829061452a5750805b1561455a578484604051602001614542929190615ccc565b60405160208183030381529060405292505050610a3a565b811561457157846040516020016145429190615d43565b801561458857836040516020016145429190615d83565b50506040805160208101909152600081529392505050565b6060846145ac83614784565b85856145b786614784565b896040516020016145cd96959493929190615dcb565b6040516020818303038152906040529050949350505050565b60606145f182614881565b6040516020016146019190615ee1565b6040516020818303038152906040529050919050565b610bf68363a9059cbb60e01b8484604051602401614636929190614e9f565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526149d4565b6040516001600160a01b03808516602483015283166044820152606481018290526110ed9085906323b872dd60e01b90608401614636565b60006146af612838565b549050816146c7576146c763b562e8dd60e01b6128b8565b6146d46000848385613c0f565b6146e4836001841460e11b613c9e565b6146ec612838565b600083815260049190910160205260409020556001600160401b018202614711612838565b6001600160a01b0385166000818152600592909201602052604090912080549092019091558061474a5761474a622e076360e81b6128b8565b818301825b80836000600080516020615fa2833981519152600080a46001018082141561474f578161477a612838565b5550610bf6915050565b6060816147a85750506040805180820190915260018152600360fc1b602082015290565b8160005b81156147d257806147bc816158ec565b91506147cb9050600a836156d9565b91506147ac565b6000816001600160401b038111156147ec576147ec614f13565b6040519080825280601f01601f191660200182016040528015614816576020820181803683370190505b5090505b8415611d0b5761482b600183615a5d565b9150614838600a86615f26565b61484390603061568c565b60f81b818381518110614858576148586156ed565b60200101906001600160f81b031916908160001a90535061487a600a866156d9565b945061481a565b60608151600014156148a157505060408051602081019091526000815290565b6000604051806060016040528060408152602001615f3b60409139905060006003845160026148d0919061568c565b6148da91906156d9565b6148e59060046156a4565b6001600160401b038111156148fc576148fc614f13565b6040519080825280601f01601f191660200182016040528015614926576020820181803683370190505b509050600182016020820185865187015b80821015614992576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250614937565b50506003865106600181146149ae57600281146149c1576149c9565b603d6001830353603d60028303536149c9565b603d60018303535b509195945050505050565b6000614a29826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614aa69092919063ffffffff16565b805190915015610bf65780806020019051810190614a4791906155e8565b610bf65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610be3565b6060611f97848460008585614aba856127db565b614b065760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610be3565b600080866001600160a01b03168587604051614b229190615c6a565b60006040518083038185875af1925050503d8060008114614b5f576040519150601f19603f3d011682016040523d82523d6000602084013e614b64565b606091505b5091509150614b748282866144da565b979650505050505050565b508054614b8b90615599565b6000825580601f10614b9b575050565b601f016020900490600052602060002090810190610c289190614c64565b60408051608081018252600080825260208201819052918101829052606081019190915290565b828054614bec90615599565b90600052602060002090601f016020900481019282614c0e5760008555614c54565b82601f10614c2757805160ff1916838001178555614c54565b82800160010185558215614c54579182015b82811115614c54578251825591602001919060010190614c39565b50614c60929150614c64565b5090565b5b80821115614c605760008155600101614c65565b6001600160e01b031981168114610c2857600080fd5b600060208284031215614ca157600080fd5b8135611f9a81614c79565b60005b83811015614cc7578181015183820152602001614caf565b838111156110ed5750506000910152565b60008151808452614cf0816020860160208601614cac565b601f01601f19169290920160200192915050565b602081526000611f9a6020830184614cd8565b6001600160a01b0391909116815260200190565b600060208284031215614d3d57600080fd5b5035919050565b6001600160a01b0381168114610c2857600080fd5b803561258081614d44565b60008060408385031215614d7757600080fd5b8235614d8281614d44565b946020939093013593505050565b600060208284031215614da257600080fd5b8135611f9a81614d44565b6000608082840312156126f157600080fd5b60008060008060008060c08789031215614dd857600080fd5b863595506020870135614dea81614d44565b9450604087013593506060870135614e0181614d44565b92506080870135915060a08701356001600160401b03811115614e2357600080fd5b614e2f89828a01614dad565b9150509295509295509295565b600080600060608486031215614e5157600080fd5b8335614e5c81614d44565b92506020840135614e6c81614d44565b929592945050506040919091013590565b60008060408385031215614e9057600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b60008060408385031215614ecb57600080fd5b823591506020830135614edd81614d44565b809150509250929050565b8015158114610c2857600080fd5b600060208284031215614f0857600080fd5b8135611f9a81614ee8565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614f5157614f51614f13565b604052919050565b600082601f830112614f6a57600080fd5b81356001600160401b03811115614f8357614f83614f13565b614f96601f8201601f1916602001614f29565b818152846020838601011115614fab57600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112614fd957600080fd5b813560206001600160401b03821115614ff457614ff4614f13565b8160051b615003828201614f29565b928352848101820192828101908785111561501d57600080fd5b83870192505b84831015614b7457823561503681614d44565b82529183019190830190615023565b80356001600160801b038116811461258057600080fd5b600080600080600080600080610100898b03121561507957600080fd5b61508289614d59565b975060208901356001600160401b038082111561509e57600080fd5b6150aa8c838d01614f59565b985060408b01359150808211156150c057600080fd5b6150cc8c838d01614f59565b975060608b01359150808211156150e257600080fd5b6150ee8c838d01614f59565b965060808b013591508082111561510457600080fd5b506151118b828c01614fc8565b94505061512060a08a01614d59565b925061512e60c08a01614d59565b915061513c60e08a01615045565b90509295985092959890939650565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152608082015160a082015260a082015160c082015260018060a01b0360c08301511660e0820152600060e0830151610100808185015250611d0b610120840182614cd8565b60008083601f8401126151ca57600080fd5b5081356001600160401b038111156151e157600080fd5b6020830191508360208260051b85010111156151fc57600080fd5b9250929050565b60008060006040848603121561521857600080fd5b83356001600160401b0381111561522e57600080fd5b61523a868287016151b8565b909450925050602084013561524e81614ee8565b809150509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561339257835183529284019291840191600101615275565b60008060008060008060c087890312156152aa57600080fd5b86356152b581614d44565b95506020870135945060408701356152cc81614d44565b93506060870135925060808701356001600160401b03808211156152ef57600080fd5b6152fb8a838b01614dad565b935060a089013591508082111561531157600080fd5b50614e2f89828a01614f59565b60006020828403121561533057600080fd5b81356001600160401b0381111561534657600080fd5b611d0b84828501614f59565b60008060006060848603121561536757600080fd5b833561537281614d44565b95602085013595506040909401359392505050565b60008060006060848603121561539c57600080fd5b833592506020840135614e6c81614d44565b600080604083850312156153c157600080fd5b82356153cc81614d44565b91506020830135614edd81614ee8565b6000602082840312156153ee57600080fd5b81356001600160401b0381111561540457600080fd5b611d0b84828501614dad565b6000806020838503121561542357600080fd5b82356001600160401b0381111561543957600080fd5b615445858286016151b8565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156154a657603f19888603018452615494858351614cd8565b94509285019290850190600101615478565b5092979650505050505050565b6080815260006154c66080830187614cd8565b82810360208401526154d88187614cd8565b905082810360408401526154ec8186614cd8565b90508281036060840152614b748185614cd8565b6000806000806080858703121561551657600080fd5b843561552181614d44565b9350602085013561553181614d44565b92506040850135915060608501356001600160401b0381111561555357600080fd5b61555f87828801614f59565b91505092959194509250565b6000806040838503121561557e57600080fd5b823561558981614d44565b91506020830135614edd81614d44565b600181811c908216806155ad57607f821691505b602082108114156126f157634e487b7160e01b600052602260045260246000fd5b6001600160a01b0392831681529116602082015260400190565b6000602082840312156155fa57600080fd5b8151611f9a81614ee8565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b6000808335601e1984360301811261564457600080fd5b8301803591506001600160401b0382111561565e57600080fd5b6020019150600581901b36038213156151fc57600080fd5b634e487b7160e01b600052601160045260246000fd5b6000821982111561569f5761569f615676565b500190565b60008160001904831182151516156156be576156be615676565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826156e8576156e86156c3565b500490565b634e487b7160e01b600052603260045260246000fd5b6000823560fe1983360301811261571957600080fd5b9190910192915050565b6000808335601e1984360301811261573a57600080fd5b8301803591506001600160401b0382111561575457600080fd5b6020019150368190038213156151fc57600080fd5b601f821115610bf657600081815260208120601f850160051c810160208610156157905750805b601f850160051c820191505b8181101561316c5782815560010161579c565b6001600160401b038311156157c6576157c6614f13565b6157da836157d48354615599565b83615769565b6000601f84116001811461580e57600085156157f65750838201355b600019600387901b1c1916600186901b178355612537565b600083815260209020601f19861690835b8281101561583f578685013582556020948501946001909201910161581f565b508682101561585c5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b813581556020820135600182015560408201356002820155606082013560038201556080820135600482015560a082013560058201556006810160c08301356158b681614d44565b81546001600160a01b0319166001600160a01b03919091161790556158de60e0830183615723565b6110ed8183600786016157af565b600060001982141561590057615900615676565b5060010190565b6000808335601e1984360301811261591e57600080fd5b83016020810192503590506001600160401b0381111561593d57600080fd5b8036038313156151fc57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60408082528181018490526000906060808401600587901b850182018885805b8a811015615a4757888403605f190185528235368d900360fe190181126159ba578283fd5b8c018035855260208082013581870152888201358987015287820135888701526080808301359087015260a080830135908701526101009060c080840135615a0181614d44565b6001600160a01b03169088015260e0615a1c84820185615907565b945083828a0152615a30848a01868361594c565b998301999850505094909401935050600101615995565b50505086151560208701529350611d0b92505050565b600082821015615a6f57615a6f615676565b500390565b600081615a8357615a83615676565b506000190190565b60008151615a9d818560208601614cac565b9290920192915050565b7402832b936b4b9b9b4b7b7399d1030b1b1b7bab73a1605d1b815260008351615ad7816015850160208801614cac565b7001034b99036b4b9b9b4b733903937b6329607d1b6015918401918201528351615b08816026840160208801614cac565b01602601949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526034908201527f455243373231415f5f496e697469616c697a61626c653a20636f6e7472616374604082015273206973206e6f7420696e697469616c697a696e6760601b606082015260800190565b604081526000615bc66040830185614cd8565b8281036020840152615bd88185614cd8565b95945050505050565b6020808252600f908201526e45786365656473206d61782062707360881b604082015260600190565b608081526000615c1e608083018a8c61594c565b8281036020840152615c3181898b61594c565b90508281036040840152615c4681878961594c565b90508281036060840152615c5b81858761594c565b9b9a5050505050505050505050565b60008251615719818460208701614cac565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906141e490830184614cd8565b600060208284031215615cc157600080fd5b8151611f9a81614c79565b6834b6b0b3b2911d101160b91b81528251600090615cf1816009850160208801614cac565b741116101130b734b6b0ba34b7b72fbab936111d101160591b6009918401918201528351615d2681601e840160208801614cac565b631116101160e11b601e9290910191820152602201949350505050565b6834b6b0b3b2911d101160b91b81528151600090615d68816009850160208701614cac565b631116101160e11b6009939091019283015250600d01919050565b7030b734b6b0ba34b7b72fbab936111d101160791b81528151600090615db0816011850160208701614cac565b631116101160e11b6011939091019283015250601501919050565b693d913730b6b2911d101160b11b81528651600090615df181600a850160208c01614cac565b600160fd1b600a918401918201528751615e1281600b840160208c01614cac565b631116101160e11b600b929091019182018190526e3232b9b1b934b83a34b7b7111d101160891b600f8301528751615e5181601e850160208c01614cac565b601e9201918201528551615e6c816022840160208a01614cac565b770383937b832b93a34b2b9911d103d91373ab6b132b9111d160451b60229290910191820152615ed4615ec5615ebf615ea8603a850189615a8b565b6a1610113730b6b2911d101160a91b8152600b0190565b86615a8b565b62227d7d60e81b815260030190565b9998505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251615f1981601d850160208701614cac565b91909101601d0192915050565b600082615f3557615f356156c3565b50069056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212208fddf07c3cfff705777fe90a266e5e442b7876be00d9e4ff036288e072737da064736f6c634300080c0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.