Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Multichain Info
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60a06040 | 16686673 | 587 days ago | IN | 0 ETH | 0.18944124 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
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:
MVHQ
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "./erc721a/contracts/extensions/ERC721AQueryableUUPSUpgradeable.sol"; import "./erc721a/contracts/extensions/ERC721ABurnableUUPSUpgradeable.sol"; import "./erc721a/contracts/extensions/ERC721AGoverenedUUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; /// @title MVHQ /// @author @KfishNFT /// @notice Metaverse HQ Key Collection /** @dev Any function which updates state will require a signature from an address with the correct role This is an upgradeable contract using UUPSUpgradeable (IERC1822Proxiable / ERC1967Proxy) from OpenZeppelin */ contract MVHQ is Initializable, AccessControlUpgradeable, ERC721AQueryableUUPSUpgradeable, ERC721ABurnableUUPSUpgradeable, ERC721AGoverenedUUPSUpgradeable, IERC1155Receiver { using StringsUpgradeable for uint256; /// @notice role assigned to an address that can perform upgrades to the contract /// @dev role can be granted by the DEFAULT_ADMIN_ROLE bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE"); /// @notice role assigned to addresses that can perform managemenet actions /// @dev role can be granted by the DEFAULT_ADMIN_ROLE bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE"); /// @notice role assigned to addresses that can perform mint/burn operations /// @dev role can be granted by the DEFAULT_ADMIN_ROLE bytes32 public constant ORCHESTRATOR_ROLE = keccak256("ORCHESTRATOR_ROLE"); /// @notice opensea Storefront ERC1155 contract ERC1155 public constant OSSF = ERC1155(0x495f947276749Ce646f68AC8c248420045cb7b5e); /// @notice opensea Storefront ERC1155 MVHQ Token ID uint256 public constant OSMVHQ_TOKENID = 70196056058896361747704672441801371315898722973429726505227809712513925252572; /// @notice flag whether claiming is available or not bool public claimActive; /// @notice base URI used to retrieve metadata /// @dev tokenURI will use .json at the end for each token starting from 1 and ending at 2000 string public baseURI; /// @notice setting an owner in order to comply with ownable interfaces /// @dev this variable was only added for compatibility with contracts that request an owner address public owner; /// @notice a way to keep track of flagged keys that are untransferable uint256[] private flaggedKeys; /// @notice a way to keep track of flagged addresses that are unable to transfer keys address[] private flaggedAddresses; /// @notice whale status requirement uint256 public whaleRequirement; /// @notice whether to refund gas of key claims bool public isRefundingGas; /// @notice the max amount that will be refunded in key claims uint256 public maxRefundAmount; /// @notice the gas units buffer for refunds uint256 public refundGasBuffer; /// @notice current season year start uint256 public season; /// @notice keeping track of whale tokens to avoid burning them mapping(uint256 => bool) private _whaleTokens; /// @notice current max token id uint256 public maxTokenId; /// @notice bool pause transfers bool public pauseTransfers; /// @notice bool pause whale transfers bool public pauseWhaleTransfers; /// @notice operator filter registry address public operatorFilterRegistry; /// @notice if an operator filter registry should be used bool public operatorFilterRegistryEnabled; event KeysClaimed(address indexed sender, uint256 amount); event KeyFlagged(address indexed sender, uint256 tokenId); event KeyUnflagged(address indexed sender, uint256 tokenId); event AddressFlagged(address indexed sender, address flaggedAddress); event AddressUnflagged(address indexed sender, address unflaggedAddress); event AdminTransfer(address indexed sender, address from, address to, uint256 tokenId); event LegacyKeysTransferred(address indexed sender, address to, uint256 quantity); event KeyBurned(address indexed sender, uint256 tokenId); event OwnershipTransferred(address indexed sender, address previousOwner, address newOwner); event BaseURIChanged(address indexed sender, string previousURI, string newURI); event WhaleRequirementChanged(address indexed sender, uint256 previousQuantity, uint256 newQuantity); event ClaimActiveChanged(address indexed sender, bool active); event Refunded(address indexed refunded, uint256 amount); event Received(address indexed sender, uint256 amount); event KeysMinted(address indexed receiver, uint256[] tokenIds, bool whaleTokens); event KeyMinted(address indexed receiver, uint256 tokenId, bool whaleToken); /// @notice Initializer function which replaces constructor for upgradeable contracts /// @dev This should be called at deploy time /// @param baseURI_ the URI with the metadata function initialize(string memory baseURI_) public initializer { __ERC721A_init("MVHQ", "MVHQ"); __AccessControl_init(); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); baseURI = baseURI_; whaleRequirement = 5; owner = msg.sender; isRefundingGas = true; maxRefundAmount = 0.01 ether; refundGasBuffer = 32196; } /// @notice Callable by users that have legacy MVHQ keys. Their keys will be transferred to this contract in the process /// @dev unfortunately Opensea does not allow burning storefront keys unless the sender has all of the supply function claimKeys() external isRefunding { require(isManagerOrAdmin(msg.sender) || claimActive, "MVHQ: claiming not active"); require(OSSF.isApprovedForAll(msg.sender, address(this)), "MVHQ: approval required"); uint256 claimable = OSSF.balanceOf(msg.sender, OSMVHQ_TOKENID); require(claimable > 0, "MVHQ: no claimable keys"); uint256[] memory ids = new uint256[](1); uint256[] memory amounts = new uint256[](1); ids[0] = OSMVHQ_TOKENID; amounts[0] = claimable; OSSF.safeTransferFrom(msg.sender, address(this), OSMVHQ_TOKENID, claimable, bytes("0x0")); _safeMint(msg.sender, claimable); emit KeysClaimed(msg.sender, claimable); } /// @notice function required to receive eth receive() external payable managed { emit Received(msg.sender, msg.value); } /* View Functions */ /// @notice check whether an address meets the whale requirement /// @param address_ the address to check /// @return whether the address is a whale function isWhale(address address_) external view returns (bool) { return balanceOf(address_) >= whaleRequirement; } /// @notice Check whether a key has been flagged /// @param tokenId_ the key's token id function isKeyFlagged(uint256 tokenId_) public view returns (bool) { for (uint256 i = 0; i < flaggedKeys.length; i++) { if (flaggedKeys[i] == tokenId_) return true; } return false; } /// @notice Retrieve list of flagged keys function getFlaggedKeys() external view returns (uint256[] memory) { return flaggedKeys; } /// @notice Check whether an address has been flagged /// @param address_ the address function isAddressFlagged(address address_) public view returns (bool) { for (uint256 i = 0; i < flaggedAddresses.length; i++) { if (flaggedAddresses[i] == address_) return true; } return false; } /// @notice Get list of flagged addresses function getFlaggedAddresses() external view returns (address[] memory) { return flaggedAddresses; } /// @notice Balance of legacy MVHQ Keys of an address /// @param address_ The address to check balance for function balanceOfLegacyKeys(address address_) external view returns (uint256) { return OSSF.balanceOf(address_, OSMVHQ_TOKENID); } /* Managed Functions */ /// @notice used to set the whale requirement /// @param quantity_ the amount required function setWhaleRequirement(uint256 quantity_) external managed { uint256 previousQuantity = whaleRequirement; whaleRequirement = quantity_; emit WhaleRequirementChanged(msg.sender, previousQuantity, quantity_); } /// @notice used to flag an address and remove the ability for it to transfer keys /// @dev callable by admin or manager /// @param address_ the address that will be flagged function flagAddress(address address_) external managed { flaggedAddresses.push(address_); emit AddressFlagged(msg.sender, address_); } /// @notice used to remove the flag of an address and restore the ability for it to transfer keys /// @dev callable by admin or manager /// @param address_ the address that will be unflagged function unflagAddress(address address_) external managed { for (uint256 i = 0; i < flaggedAddresses.length; i++) { if (flaggedAddresses[i] == address_) { flaggedAddresses[i] = flaggedAddresses[flaggedAddresses.length - 1]; flaggedAddresses.pop(); break; } } emit AddressUnflagged(msg.sender, address_); } /// @notice used to flag a key and make it untransferrable /// @dev callable by admin or manager /// @param tokenId_ the key that will be flagged function flagKey(uint256 tokenId_) external managed { flaggedKeys.push(tokenId_); emit KeyFlagged(msg.sender, tokenId_); } /// @notice used to remove the flag of a key and restore the ability for it to be transferred /// @dev callable by admin or manager /// @param tokenId_ the key that will be unflagged function unflagKey(uint256 tokenId_) external managed { for (uint256 i = 0; i < flaggedKeys.length; i++) { if (flaggedKeys[i] == tokenId_) { flaggedKeys[i] = flaggedKeys[flaggedKeys.length - 1]; flaggedKeys.pop(); break; } } emit KeyUnflagged(msg.sender, tokenId_); } /* Admin Functions */ /// @notice admin transfer of token from one address to another and meant to be used with extreme care /// @dev only callable from an address with the admin role /// @param from_ the address that holds the tokenId /// @param to_ the address which will receive the tokenId /// @param tokenId_ the key's tokenId function adminTransfer( address from_, address to_, uint256 tokenId_ ) external onlyRole(DEFAULT_ADMIN_ROLE) { _adminTransferFrom(from_, to_, tokenId_); emit AdminTransfer(msg.sender, from_, to_, tokenId_); } /// @notice admin function used to transfer legacy keys to an address /// @dev the address can't be the burn address unless the contract holds all legacy keys /// @param to_ the address that will receive all the legacy keys function transferLegacyKeys(address to_) external onlyRole(DEFAULT_ADMIN_ROLE) { uint256 balance = OSSF.balanceOf(address(this), OSMVHQ_TOKENID); require(balance > 0, "MVHQ: no legacy keys to transfer"); OSSF.safeTransferFrom(address(this), to_, OSMVHQ_TOKENID, balance, bytes("0x0")); emit LegacyKeysTransferred(msg.sender, to_, balance); } /// @notice this function will burn keys minted from this address /// @dev it will not work with legacy keys /// @param tokenId_ the key's tokenId function burn(uint256 tokenId_) public override onlyRole(DEFAULT_ADMIN_ROLE) { _burn(tokenId_, false); emit KeyBurned(msg.sender, tokenId_); } /// @notice toggle the claiming functionality /// @param _claimActive whether it will be active or not function setClaimActive(bool _claimActive) external onlyRole(DEFAULT_ADMIN_ROLE) { claimActive = _claimActive; emit ClaimActiveChanged(msg.sender, _claimActive); } /// @notice Used to set the baseURI for metadata /// @param baseURI_ the base URI function setBaseURI(string memory baseURI_) external onlyRole(DEFAULT_ADMIN_ROLE) { string memory previousURI = baseURI; baseURI = baseURI_; emit BaseURIChanged(msg.sender, previousURI, baseURI_); } /// @notice Used to toggle between refunding key claims /// @param isRefundingGas_ true to refund function setIsRefundingGas(bool isRefundingGas_) external onlyRole(DEFAULT_ADMIN_ROLE) { isRefundingGas = isRefundingGas_; } /// @notice The maximum eth to refund per key claim transaction /// @param maxRefundAmount_ the new max refund amount function setMaxRefundAmount(uint256 maxRefundAmount_) external onlyRole(DEFAULT_ADMIN_ROLE) { maxRefundAmount = maxRefundAmount_; } /// @notice The gas units buffer for refunds /// @dev this is to include the transfer gas itself /// @param refundGasBuffer_ the new max refund amount function setRefundGasBuffer(uint256 refundGasBuffer_) external onlyRole(DEFAULT_ADMIN_ROLE) { refundGasBuffer = refundGasBuffer_; } /// @notice Set the current season function setSeason(uint256 newSeason) external onlyRole(DEFAULT_ADMIN_ROLE) { require(newSeason > 0, "MVHQ: invalid season"); season = newSeason; } /// @notice Toggle Transfer Pause function toggleTransfers() external onlyRole(DEFAULT_ADMIN_ROLE) { pauseTransfers = !pauseTransfers; } /// @notice Toggle Transfer Pause function toggleWhaleTransfers() external onlyRole(DEFAULT_ADMIN_ROLE) { pauseWhaleTransfers = !pauseWhaleTransfers; } /// @notice Set Max Token ID /// @dev this is to prevent minting more than allowed /// @param maxTokenId_ the new max token id function setMaxTokenId(uint256 maxTokenId_) external onlyRole(DEFAULT_ADMIN_ROLE) { require(maxTokenId_ >= _currentIndex, "MVHQ: max token id invalid"); maxTokenId = maxTokenId_; } /// @notice Set the Operator Filter Registry address /// @dev The signature to check must be "isOperatorAllowed(address,address)", address(this), operator /// @param operatorFilterRegistry_ The address of the Operator Filter Registry function setOperatorFilterRegistry(address operatorFilterRegistry_) external onlyRole(DEFAULT_ADMIN_ROLE) { operatorFilterRegistry = operatorFilterRegistry_; } /// @notice Set whether an operator filter registry should be used /// @param operatorFilterRegistryEnabled_ The address of the Operator Filter Registry function setOperatorFilterRegistryEnabled(bool operatorFilterRegistryEnabled_) external onlyRole(DEFAULT_ADMIN_ROLE) { require(operatorFilterRegistry.code.length > 0, "MVHQ: operator filter registry address is not a contract"); operatorFilterRegistryEnabled = operatorFilterRegistryEnabled_; } /// @notice Withdraw function in case anyone sends ETH to contract by mistake function withdraw() external payable onlyRole(DEFAULT_ADMIN_ROLE) { // solhint-disable-next-line avoid-low-level-calls (bool success, ) = payable(msg.sender).call{value: address(this).balance}(""); require(success, "MVHQ: failed to withdraw"); } /// @notice Used to set a new owner value /// @dev This is not the same as Ownable and was only added for compatibility /// @param newOwner_ the new owner function transferOwnership(address newOwner_) external onlyRole(DEFAULT_ADMIN_ROLE) { address previousOwner = owner; owner = newOwner_; emit OwnershipTransferred(msg.sender, previousOwner, newOwner_); } /// @notice Used to burn a range tokens at the end of a season /// @dev Whale tokens and already burned tokens will be skipped /// @param initialTokenId_ the first token to be burned /// @param endTokenId_ the last token to be burned function burnRange(uint256 initialTokenId_, uint256 endTokenId_) external onlyRole(DEFAULT_ADMIN_ROLE) { require(initialTokenId_ > 0 && endTokenId_ <= _totalMinted(), "MVHQ: invalid token range"); for (uint256 i = initialTokenId_; i <= endTokenId_; i++) { if(!_whaleTokens[i] && _exists(i)) { _burn(i, false); } } } function burnTokens(uint256[] calldata tokenIds) external onlyRole(DEFAULT_ADMIN_ROLE) { for (uint256 i = 0; i < tokenIds.length; i++) { if(!_whaleTokens[tokenIds[i]] && _exists(tokenIds[i])) { _burn(tokenIds[i], false); } } } /// @notice Used to burn a batch of token ids owned by a single address /// @dev Whale tokens, burned tokens, and wrong ownership will revert /// @param tokensOwner_ the owner of the tokens /// @param tokenIds_ the tokens to be burned function burnBatch(address tokensOwner_, uint256[] calldata tokenIds_) external onlyRole(ORCHESTRATOR_ROLE) { for (uint256 i = 0; i < tokenIds_.length; i++) { require(ownerOf(tokenIds_[i]) == tokensOwner_, "MVHQ: token not owned by tokensOwner"); require(!_whaleTokens[tokenIds_[i]], "MVHQ: whale token cannot be burned"); _burn(tokenIds_[i], false); } } /// @notice Batch minting to a list of receivers /// @dev Does not work for whales and regular keys at the same time /// @param receivers_ the list of addresses that will receive keys /// @param quantities_ the quantities each address will receive /// @param whaleMint_ whether the mints correspond to whale tokens or regular ones function mintBatch(address[] calldata receivers_, uint256[] calldata quantities_, bool whaleMint_) external onlyRole(DEFAULT_ADMIN_ROLE) { require(receivers_.length == quantities_.length, "MVHQ: receivers and quantities length mismatch"); for (uint256 i = 0; i < receivers_.length; i++) { _mintKeys(receivers_[i], quantities_[i], whaleMint_); } } function mint(address receiver_) external onlyRole(ORCHESTRATOR_ROLE) { require(_currentIndex <= maxTokenId, "MVHQ: would exceed max token id"); uint256 nextTokenId = _currentIndex; _safeMint(receiver_, 1); emit KeyMinted(receiver_, nextTokenId, false); } /// @notice Batch minting to a list of receivers /// @dev Does not work for whales and regular keys at the same time /// @param receiver_ the list of addresses that will receive keys /// @param quantity_ the quantities each address will receive /// @param whaleMint_ whether the mints correspond to whale tokens or regular ones function _mintKeys(address receiver_, uint256 quantity_, bool whaleMint_) private { uint256 nextTokenId = _currentIndex; uint256[] memory tokenIds = new uint256[](quantity_); if(whaleMint_) { for (uint256 i = 0; i < quantity_; i++) { _whaleTokens[nextTokenId] = true; tokenIds[i] = nextTokenId++; } } else { for (uint256 i = 0; i < quantity_; i++) { tokenIds[i] = nextTokenId++; } } _safeMint(receiver_, quantity_); } /* ERC721A Overrides */ /// @notice Override of ERC721A start token ID /// @return the initial tokenId function _startTokenId() internal view virtual override returns (uint256) { return 1; } /// @notice Override of ERC721A tokenURI(uint256) /// @dev returns baseURI + tokenId.json /// @param tokenId the tokenId without offsets /// @return the tokenURI with metadata function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); if (bytes(baseURI).length > 0) { return string.concat(baseURI, tokenId.toString()); } else { return ""; } } /// @notice Override of ERC721A and AccessControlUpgradeable supportsInterface function /// @param interfaceId the interfaceId /// @return bool if interfaceId is supported or not function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControlUpgradeable, ERC721AUUPSUpgradeable, IERC165) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || interfaceId == type(AccessControlUpgradeable).interfaceId || interfaceId == type(IERC165).interfaceId || super.supportsInterface(interfaceId); } /// @notice Hook to check whether a key is transferrable /// @dev admins can always transfer regardless of whether keys are flagged /// @param from address that holds the tokenId /// @param to address that will receive the tokenId /// @param startTokenId index of first tokenId that will be transferred /// @param quantity amount that will be transferred function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal override { if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) { require(!isAddressFlagged(from), "MVHQ: key holder address is flagged"); require(!isAddressFlagged(to), "MVHQ: key receiver address is flagged"); for (uint256 i = startTokenId; i < startTokenId + quantity; i++) { require(!isKeyFlagged(i), "MVHQ: key is flagged"); _whaleTokens[i] ? require(pauseWhaleTransfers == false, "MVHQ: whale transfers paused") : require(pauseTransfers == false, "MVHQ: transfers paused"); } } if(operatorFilterRegistryEnabled && operatorFilterRegistry.code.length > 0) { // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory data) = operatorFilterRegistry.call(abi.encodeWithSignature("isOperatorAllowed(address,address)", address(this), msg.sender)); require(success, "MVHQ: operator filtered"); } super._beforeTokenTransfers(from, to, startTokenId, quantity); } /// @notice UUPS Upgradeable authorization function /// @dev only the UPGRADER_ROLE can upgrade the contract /// @param newImplementation the address of the new implementation // solhint-disable-next-line no-empty-blocks function _authorizeUpgrade(address newImplementation) internal override onlyRole(UPGRADER_ROLE) {} function isManagerOrAdmin(address sender_) internal view returns (bool) { return hasRole(MANAGER_ROLE, sender_) || hasRole(DEFAULT_ADMIN_ROLE, sender_); } /// @dev required in order to receive ERC155 tokenIds function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external override returns (bytes4) { return this.onERC1155Received.selector; } /// @dev required in order to receive ERC155 tokenIds function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external override returns (bytes4) { return this.onERC1155BatchReceived.selector; } /* Modifiers */ /// @notice Used to refund a transaction gas cost modifier isRefunding() { uint256 initialGas = gasleft() + refundGasBuffer; _; if (isRefundingGas && address(this).balance >= maxRefundAmount) { uint256 gasCost = (initialGas - gasleft()) * tx.gasprice; payable(msg.sender).transfer(gasCost > maxRefundAmount ? maxRefundAmount : gasCost); emit Refunded(msg.sender, gasCost); } } /// @notice Modifier that ensures the function is being called by an address that is either a manager or a default admin modifier managed() { require(isManagerOrAdmin(msg.sender), "MVHQ: not authorized"); _; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; import "./IERC1155.sol"; import "./IERC1155Receiver.sol"; import "./extensions/IERC1155MetadataURI.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: address zero is not a valid owner"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner or approved" ); _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner or approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, to, ids, amounts, data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; emit TransferSingle(operator, from, to, id, amount); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } emit TransferSingle(operator, from, address(0), id, amount); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } } emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `ids` and `amounts` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non-ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non-ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.0; import "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(account), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } /** * @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[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @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) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @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 v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// 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. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ 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. * * 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. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * 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. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ 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. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @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.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @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); }
// 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://consensys.net/diligence/blog/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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/MathUpgradeable.sol"; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = MathUpgradeable.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, MathUpgradeable.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @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 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // Creator: Chiru Labs pragma solidity ^0.8.4; import '@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol'; import '@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol'; import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol'; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; error ApprovalCallerNotOwnerNorApproved(); error ApprovalQueryForNonexistentToken(); error ApproveToCaller(); error ApprovalToCurrentOwner(); error BalanceQueryForZeroAddress(); error MintToZeroAddress(); error MintZeroQuantity(); error OwnerQueryForNonexistentToken(); error TransferCallerNotOwnerNorApproved(); error TransferFromIncorrectOwner(); error TransferToNonERC721ReceiverImplementer(); error TransferToZeroAddress(); error URIQueryForNonexistentToken(); /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256). */ abstract contract ERC721AUUPSUpgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable, UUPSUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Compiler will pack this into a single 256bit word. struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; } // Compiler will pack this into a single 256bit word. struct AddressData { // Realistically, 2**64-1 is more than enough. uint64 balance; // Keeps track of mint count with minimal overhead for tokenomics. uint64 numberMinted; // Keeps track of burn count with minimal overhead for tokenomics. uint64 numberBurned; // For miscellaneous variable(s) pertaining to the address // (e.g. number of whitelist mint slots used). // If there are multiple variables, please pack them into a uint64. uint64 aux; } // The tokenId of the next token to be minted. uint256 internal _currentIndex; // The number of tokens burned. uint256 internal _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details. mapping(uint256 => TokenOwnership) internal _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721A_init_unchained(name_, symbol_); __Context_init_unchained(); __ERC165_init_unchained(); } function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } /** * To change the starting tokenId, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens. */ function totalSupply() public view returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than _currentIndex - _startTokenId() times unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { // Counter underflow is impossible as _currentIndex does not decrement, // and it is initialized to _startTokenId() unchecked { return _currentIndex - _startTokenId(); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return uint256(_addressData[owner].balance); } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberMinted); } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return uint256(_addressData[owner].numberBurned); } /** * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return _addressData[owner].aux; } /** * Sets the auxillary 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 { _addressData[owner].aux = aux; } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr && curr < _currentIndex) { TokenOwnership memory ownership = _ownerships[curr]; if (!ownership.burned) { if (ownership.addr != address(0)) { return ownership; } // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } } } } revert OwnerQueryForNonexistentToken(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return _ownershipOf(tokenId).addr; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ''; } /** * @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, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public override { address owner = ERC721AUUPSUpgradeable.ownerOf(tokenId); if (to == owner) revert ApprovalToCurrentOwner(); if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) { revert ApprovalCallerNotOwnerNorApproved(); } _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { if (operator == _msgSender()) revert ApproveToCaller(); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { _transfer(from, to, tokenId); if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @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 (`_mint`), */ function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned; } function _safeMint(address to, uint256 quantity) internal { _safeMint(to, 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. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _mint(to, quantity, _data, true); } /** * @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. */ function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; if (safe && to.isContract()) { do { emit Transfer(address(0), to, updatedIndex); if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (updatedIndex != end); // Reentrancy protection if (_currentIndex != startTokenId) revert(); } else { do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex != end); } _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) private { _transfer(from, to, tokenId, true); } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId, bool approvalCheck ) internal virtual { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); if (prevOwnership.addr != from) revert TransferFromIncorrectOwner(); if(approvalCheck) { bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); } _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, from); // 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 { _addressData[from].balance -= 1; _addressData[to].balance += 1; TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = to; currSlot.startTimestamp = uint64(block.timestamp); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev This is 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 { TokenOwnership memory prevOwnership = _ownershipOf(tokenId); address from = prevOwnership.addr; if (approvalCheck) { bool isApprovedOrOwner = (_msgSender() == from || isApprovedForAll(from, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); } // Clear approvals from the previous owner _approve(address(0), tokenId, from); // 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 { AddressData storage addressData = _addressData[from]; addressData.balance -= 1; addressData.numberBurned += 1; // Keep track of who burned the token, and the timestamp of burning. TokenOwnership storage currSlot = _ownerships[tokenId]; currSlot.addr = from; currSlot.startTimestamp = uint64(block.timestamp); currSlot.burned = true; // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; TokenOwnership storage nextSlot = _ownerships[nextTokenId]; if (nextSlot.addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId != _currentIndex) { nextSlot.addr = from; nextSlot.startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, address(0), tokenId); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) internal { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } /** * @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 {} }
// SPDX-License-Identifier: MIT // Creator: Chiru Labs pragma solidity ^0.8.4; import '../ERC721AUUPSUpgradeable.sol'; /** * @title ERC721A Burnable Token * @dev ERC721A Token that can be irreversibly burned (destroyed). */ abstract contract ERC721ABurnableUUPSUpgradeable is ERC721AUUPSUpgradeable { /** * @dev Burns `tokenId`. See {ERC721A-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { _burn(tokenId, true); } }
// SPDX-License-Identifier: MIT // Creator: Chiru Labs pragma solidity ^0.8.4; import '../ERC721AUUPSUpgradeable.sol'; /** * @title ERC721A Goverend Token * @dev ERC721A Token that can transferred without approval. */ abstract contract ERC721AGoverenedUUPSUpgradeable is ERC721AUUPSUpgradeable { /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _adminTransferFrom( address from, address to, uint256 tokenId ) internal { _transfer(from, to, tokenId, false); } }
// SPDX-License-Identifier: MIT // Creator: Chiru Labs pragma solidity ^0.8.4; import '../ERC721AUUPSUpgradeable.sol'; error InvalidQueryRange(); /** * @title ERC721A Queryable * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryableUUPSUpgradeable is ERC721AUUPSUpgradeable { /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * - `addr` = `address(0)` * - `startTimestamp` = `0` * - `burned` = `false` * * If the `tokenId` is burned: * - `addr` = `<Address of owner before token was burned>` * - `startTimestamp` = `<Timestamp when token was burned>` * - `burned = `true` * * Otherwise: * - `addr` = `<Address of owner>` * - `startTimestamp` = `<Timestamp of start of ownership>` * - `burned = `false` */ function explicitOwnershipOf(uint256 tokenId) public view returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _currentIndex) { return ownership; } ownership = _ownerships[tokenId]; if (ownership.burned) { return ownership; } return _ownershipOf(tokenId); } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory) { unchecked { uint256 tokenIdsLength = tokenIds.length; TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength); for (uint256 i; i != tokenIdsLength; ++i) { ownerships[i] = explicitOwnershipOf(tokenIds[i]); } return ownerships; } } /** * @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) { unchecked { if (start >= stop) revert InvalidQueryRange(); uint256 tokenIdsIdx; uint256 stopLimit = _currentIndex; // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, _currentIndex)`. if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`, // to cater for cases where `balanceOf(owner)` is too big. if (start < stop) { uint256 rangeLength = stop - start; if (rangeLength < tokenIdsMaxLength) { tokenIdsMaxLength = rangeLength; } } else { tokenIdsMaxLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength); if (tokenIdsMaxLength == 0) { return tokenIds; } // 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; } for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) { ownership = _ownerships[i]; if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } // Downsize the array to fit. assembly { mstore(tokenIds, tokenIdsIdx) } return tokenIds; } } /** * @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 pfp collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; address currOwnershipAddr; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); TokenOwnership memory ownership; for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { ownership = _ownerships[i]; if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } return tokenIds; } } }
{ "remappings": [ "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","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":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"flaggedAddress","type":"address"}],"name":"AddressFlagged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"unflaggedAddress","type":"address"}],"name":"AddressUnflagged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"AdminTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"string","name":"previousURI","type":"string"},{"indexed":false,"internalType":"string","name":"newURI","type":"string"}],"name":"BaseURIChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bool","name":"active","type":"bool"}],"name":"ClaimActiveChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"KeyBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"KeyFlagged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"whaleToken","type":"bool"}],"name":"KeyMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"KeyUnflagged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"KeysClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"bool","name":"whaleTokens","type":"bool"}],"name":"KeysMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"LegacyKeysTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Received","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"refunded","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousQuantity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newQuantity","type":"uint256"}],"name":"WhaleRequirementChanged","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ORCHESTRATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OSMVHQ_TOKENID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OSSF","outputs":[{"internalType":"contract ERC1155","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from_","type":"address"},{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"adminTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"balanceOfLegacyKeys","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokensOwner_","type":"address"},{"internalType":"uint256[]","name":"tokenIds_","type":"uint256[]"}],"name":"burnBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"initialTokenId_","type":"uint256"},{"internalType":"uint256","name":"endTokenId_","type":"uint256"}],"name":"burnRange","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"burnTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimKeys","outputs":[],"stateMutability":"nonpayable","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":"struct ERC721AUUPSUpgradeable.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"}],"internalType":"struct ERC721AUUPSUpgradeable.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"flagAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"flagKey","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFlaggedAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFlaggedKeys","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"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":"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":"string","name":"baseURI_","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"isAddressFlagged","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"isKeyFlagged","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isRefundingGas","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"isWhale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxRefundAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver_","type":"address"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"receivers_","type":"address[]"},{"internalType":"uint256[]","name":"quantities_","type":"uint256[]"},{"internalType":"bool","name":"whaleMint_","type":"bool"}],"name":"mintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"operatorFilterRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorFilterRegistryEnabled","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":"pauseTransfers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseWhaleTransfers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"refundGasBuffer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"season","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_claimActive","type":"bool"}],"name":"setClaimActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"isRefundingGas_","type":"bool"}],"name":"setIsRefundingGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxRefundAmount_","type":"uint256"}],"name":"setMaxRefundAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxTokenId_","type":"uint256"}],"name":"setMaxTokenId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operatorFilterRegistry_","type":"address"}],"name":"setOperatorFilterRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"operatorFilterRegistryEnabled_","type":"bool"}],"name":"setOperatorFilterRegistryEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"refundGasBuffer_","type":"uint256"}],"name":"setRefundGasBuffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newSeason","type":"uint256"}],"name":"setSeason","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity_","type":"uint256"}],"name":"setWhaleRequirement","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":[],"name":"toggleTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleWhaleTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"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":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to_","type":"address"}],"name":"transferLegacyKeys","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner_","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"unflagAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"unflagKey","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"whaleRequirement","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a06040523060805234801561001457600080fd5b506080516157fe6200004d6000396000818161135b0152818161139b0152818161198b015281816119cb0152611a5a01526157fe6000f3fe6080604052600436106104825760003560e01c806373417b0911610255578063b2dc5dc311610144578063d4d9b343116100c1578063e985e9c511610085578063e985e9c514610e5d578063ec87621c14610ea7578063f23a6e6114610edb578063f2fde38b14610f08578063f62d188814610f28578063f72c0d8b14610f4857600080fd5b8063d4d9b34314610dbd578063d547741f14610ddd578063da72c1e814610dfd578063daad792014610e1d578063e127c45014610e3d57600080fd5b8063c50b0fb011610108578063c50b0fb014610d29578063c802668d14610d40578063c87b56dd14610d60578063cfba9fab14610d80578063d4a6a2fd14610da257600080fd5b8063b2dc5dc314610c5d578063b2ea46c114610c7d578063b88d4fde14610c94578063bc197c8114610cb4578063c23dc68f14610cfc57600080fd5b806391d14854116101d2578063a217fddf11610196578063a217fddf14610bc1578063a22cb46514610bd6578063ae34490414610bf6578063af88fac914610c16578063b0ccc31e14610c3657600080fd5b806391d1485414610b2c57806395d89b4114610b4c5780639937b0ce14610b6157806399a2557a14610b815780639a760fc614610ba157600080fd5b80638da5cb5b116102195780638da5cb5b14610a915780638df9389c14610ab25780638ef1e25914610ada5780638faf6c3114610afa57806391ba317a14610b1557600080fd5b806373417b0914610a03578063768ac99d14610a235780637ab4d1de14610a385780637ccd134a14610a4f5780638462151c14610a7157600080fd5b806342842e0e1161037157806355f804b3116102ee57806367a53173116102b257806367a531731461096c5780636a6278421461098c5780636a9d57fd146109ac5780636c0360eb146109ce57806370a08231146109e357600080fd5b806355f804b3146108ca5780635a50fd50146108ea5780635bbb21771461090a5780636352211e14610937578063658247a01461095757600080fd5b806347af99571161033557806347af9957146108475780634996527c146108625780634be2ede4146108825780634f1ef286146108a257806352d1902d146108b557600080fd5b806342842e0e146107a55780634294e544146107c5578063429644d9146107e557806342966c681461080557806345d464a91461082557600080fd5b8063248a9ca3116103ff5780633659cfe6116103c35780633659cfe61461072857806337cb2e091461074857806338d023c2146107685780633ccfd60b146107885780633e5ac28f1461079057600080fd5b8063248a9ca31461068157806328bbc5c1146106b15780632efbeccd146106c85780632f2ff15d146106e857806336568abe1461070857600080fd5b8063154974091161044657806315497409146105e457806318160ddd146106045780631cc26da814610621578063202fcbbd1461064157806323b872dd1461066157600080fd5b806301ffc9a7146104f157806306fdde0314610526578063081812fc14610548578063095ea7b31461058057806309e0a34f146105a257600080fd5b366104ec5761049033610f7c565b6104b55760405162461bcd60e51b81526004016104ac90614a4d565b60405180910390fd5b60405134815233907f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f885258749060200160405180910390a2005b600080fd5b3480156104fd57600080fd5b5061051161050c366004614a91565b610fbf565b60405190151581526020015b60405180910390f35b34801561053257600080fd5b5061053b611035565b60405161051d9190614b06565b34801561055457600080fd5b50610568610563366004614b19565b6110c7565b6040516001600160a01b03909116815260200161051d565b34801561058c57600080fd5b506105a061059b366004614b49565b61110c565b005b3480156105ae57600080fd5b506105d67fe098e2e7d2d4d3ca0e3877ceaaf3cdfbd47483f6699688ad12b1d6732deef10b81565b60405190815260200161051d565b3480156105f057600080fd5b506105a06105ff366004614b19565b611199565b34801561061057600080fd5b5060fc5460fb5403600019016105d6565b34801561062d57600080fd5b5061010f5461051190610100900460ff1681565b34801561064d57600080fd5b506105a061065c366004614b19565b61122d565b34801561066d57600080fd5b506105a061067c366004614b73565b611291565b34801561068d57600080fd5b506105d661069c366004614b19565b60009081526065602052604090206001015490565b3480156106bd57600080fd5b506105d661010a5481565b3480156106d457600080fd5b506105a06106e3366004614b19565b61129c565b3480156106f457600080fd5b506105a0610703366004614baf565b6112ae565b34801561071457600080fd5b506105a0610723366004614baf565b6112d3565b34801561073457600080fd5b506105a0610743366004614bdb565b611351565b34801561075457600080fd5b506105a0610763366004614bdb565b611430565b34801561077457600080fd5b506105a0610783366004614b19565b6114d6565b6105a0611544565b34801561079c57600080fd5b506105a06115e7565b3480156107b157600080fd5b506105a06107c0366004614b73565b611608565b3480156107d157600080fd5b506105a06107e0366004614bdb565b611623565b3480156107f157600080fd5b506105d6610800366004614bdb565b611791565b34801561081157600080fd5b506105a0610820366004614b19565b611822565b34801561083157600080fd5b5061010f5461051190600160b01b900460ff1681565b34801561085357600080fd5b5061010f546105119060ff1681565b34801561086e57600080fd5b506105a061087d366004614bdb565b61186a565b34801561088e57600080fd5b506105a061089d366004614c4f565b6118a1565b6105a06108b0366004614d8f565b611981565b3480156108c157600080fd5b506105d6611a4d565b3480156108d657600080fd5b506105a06108e5366004614ddc565b611b00565b3480156108f657600080fd5b506105a0610905366004614b19565b611bfa565b34801561091657600080fd5b5061092a610925366004614e24565b611d10565b60405161051d9190614ec9565b34801561094357600080fd5b50610568610952366004614b19565b611dd6565b34801561096357600080fd5b506105a0611de8565b34801561097857600080fd5b506105a0610987366004614f33565b612228565b34801561099857600080fd5b506105a06109a7366004614bdb565b6122db565b3480156109b857600080fd5b506109c16123a9565b60405161051d9190614f74565b3480156109da57600080fd5b5061053b612401565b3480156109ef57600080fd5b506105d66109fe366004614bdb565b612490565b348015610a0f57600080fd5b506105a0610a1e366004614fac565b6124df565b348015610a2f57600080fd5b506105a061252e565b348015610a4457600080fd5b506105d66101085481565b348015610a5b57600080fd5b50610a64612558565b60405161051d9190614fc9565b348015610a7d57600080fd5b506109c1610a8c366004614bdb565b6125ba565b348015610a9d57600080fd5b5061010554610568906001600160a01b031681565b348015610abe57600080fd5b5061056873495f947276749ce646f68ac8c248420045cb7b5e81565b348015610ae657600080fd5b50610511610af5366004614bdb565b6126ff565b348015610b0657600080fd5b50610109546105119060ff1681565b348015610b2157600080fd5b506105d661010e5481565b348015610b3857600080fd5b50610511610b47366004614baf565b612716565b348015610b5857600080fd5b5061053b612741565b348015610b6d57600080fd5b50610511610b7c366004614b19565b612750565b348015610b8d57600080fd5b506109c1610b9c36600461500a565b6127a8565b348015610bad57600080fd5b50610511610bbc366004614bdb565b61296b565b348015610bcd57600080fd5b506105d6600081565b348015610be257600080fd5b506105a0610bf136600461503d565b6129cd565b348015610c0257600080fd5b506105a0610c11366004614fac565b612a63565b348015610c2257600080fd5b506105a0610c31366004614b19565b612a83565b348015610c4257600080fd5b5061010f54610568906201000090046001600160a01b031681565b348015610c6957600080fd5b506105a0610c78366004615074565b612adc565b348015610c8957600080fd5b506105d661010b5481565b348015610ca057600080fd5b506105a0610caf3660046150c6565b612c58565b348015610cc057600080fd5b50610ce3610ccf36600461516e565b63bc197c8160e01b98975050505050505050565b6040516001600160e01b0319909116815260200161051d565b348015610d0857600080fd5b50610d1c610d17366004614b19565b612ca3565b60405161051d9190615228565b348015610d3557600080fd5b506105d661010c5481565b348015610d4c57600080fd5b506105a0610d5b36600461525d565b612d5d565b348015610d6c57600080fd5b5061053b610d7b366004614b19565b612e19565b348015610d8c57600080fd5b506105d660008051602061574283398151915281565b348015610dae57600080fd5b50610103546105119060ff1681565b348015610dc957600080fd5b506105a0610dd8366004614b19565b612ea5565b348015610de957600080fd5b506105a0610df8366004614baf565b612eb7565b348015610e0957600080fd5b506105a0610e18366004614b73565b612edc565b348015610e2957600080fd5b506105a0610e38366004614fac565b612f45565b348015610e4957600080fd5b506105a0610e58366004614bdb565b612ff6565b348015610e6957600080fd5b50610511610e7836600461527f565b6001600160a01b0391821660009081526101026020908152604080832093909416825291909152205460ff1690565b348015610eb357600080fd5b506105d67f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b348015610ee757600080fd5b50610ce3610ef63660046152a9565b63f23a6e6160e01b9695505050505050565b348015610f1457600080fd5b506105a0610f23366004614bdb565b6131b2565b348015610f3457600080fd5b506105a0610f43366004614ddc565b61321a565b348015610f5457600080fd5b506105d67f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b6000610fa87f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0883612716565b80610fb95750610fb9600083612716565b92915050565b60006001600160e01b031982166380ac58cd60e01b1480610ff057506001600160e01b03198216635b5e139f60e01b145b8061100b57506001600160e01b0319821663da8def7360e01b145b8061102657506001600160e01b031982166301ffc9a760e01b145b80610fb95750610fb9826133c7565b606060fd805461104490615320565b80601f016020809104026020016040519081016040528092919081815260200182805461107090615320565b80156110bd5780601f10611092576101008083540402835291602001916110bd565b820191906000526020600020905b8154815290600101906020018083116110a057829003601f168201915b5050505050905090565b60006110d282613407565b6110ef576040516333d1c03960e21b815260040160405180910390fd5b50600090815261010160205260409020546001600160a01b031690565b600061111782611dd6565b9050806001600160a01b0316836001600160a01b03160361114b5760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b0382161480159061116b57506111698133610e78565b155b15611189576040516367d9dca160e11b815260040160405180910390fd5b611194838383613441565b505050565b6111a233610f7c565b6111be5760405162461bcd60e51b81526004016104ac90614a4d565b61010680546001810182556000919091527fc9ef9fceea91e87b2c84ea400a44fde78842aae8aa24cd4b502ce5fb4d91e63b0181905560405181815233907f540e004b1e599d2b6e04cb22f77b5c15ed1a83347064d867e964e25a073f5dd7906020015b60405180910390a250565b60006112388161349e565b60fb5482101561128a5760405162461bcd60e51b815260206004820152601a60248201527f4d5648513a206d617820746f6b656e20696420696e76616c696400000000000060448201526064016104ac565b5061010e55565b6111948383836134a8565b60006112a78161349e565b5061010a55565b6000828152606560205260409020600101546112c98161349e565b61119483836134b5565b6001600160a01b03811633146113435760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016104ac565b61134d828261353b565b5050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036113995760405162461bcd60e51b81526004016104ac9061535a565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166113e2600080516020615762833981519152546001600160a01b031690565b6001600160a01b0316146114085760405162461bcd60e51b81526004016104ac906153a6565b611411816135a2565b6040805160008082526020820190925261142d918391906135cc565b50565b61143933610f7c565b6114555760405162461bcd60e51b81526004016104ac90614a4d565b61010780546001810182556000919091527f47c4908e245f386bfc1825973249847f4053a761ddb4880ad63c323a7b5a2a250180546001600160a01b0319166001600160a01b03831690811790915560405190815233907ff34c09a7cee2ec36676b00d8197a8db8ba2c6e091727126e27c8e3c34747f1a390602001611222565b6114df33610f7c565b6114fb5760405162461bcd60e51b81526004016104ac90614a4d565b610108805490829055604080518281526020810184905233917fa091af460c0b001329ed8c9156f41f3efcc95ae5136f2c44f6746c4d778cf7fc91015b60405180910390a25050565b600061154f8161349e565b604051600090339047908381818185875af1925050503d8060008114611591576040519150601f19603f3d011682016040523d82523d6000602084013e611596565b606091505b505090508061134d5760405162461bcd60e51b815260206004820152601860248201527f4d5648513a206661696c656420746f207769746864726177000000000000000060448201526064016104ac565b60006115f28161349e565b5061010f805460ff19811660ff90911615179055565b61119483838360405180602001604052806000815250612c58565b61162c33610f7c565b6116485760405162461bcd60e51b81526004016104ac90614a4d565b60005b6101075481101561175557816001600160a01b03166101078281548110611674576116746153f2565b6000918252602090912001546001600160a01b03160361174357610107805461169f9060019061541e565b815481106116af576116af6153f2565b60009182526020909120015461010780546001600160a01b0390921691839081106116dc576116dc6153f2565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555061010780548061171c5761171c615435565b600082815260209020810160001990810180546001600160a01b0319169055019055611755565b8061174d8161544b565b91505061164b565b506040516001600160a01b038216815233907fcc229432447e3f287b17d54ea5b3efb13d26e022102362f4d8eba4ac37fb8c7690602001611222565b604051627eeac760e11b81526001600160a01b0382166004820152600080516020615742833981519152602482015260009073495f947276749ce646f68ac8c248420045cb7b5e9062fdd58e90604401602060405180830381865afa1580156117fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb99190615464565b600061182d8161349e565b611838826000613737565b60405182815233907feb1a139f5480882ec767b34b3d7386a850268910ed1dc7acb55c88a1e3a238ec90602001611538565b60006118758161349e565b5061010f80546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b60006118ac8161349e565b8483146119125760405162461bcd60e51b815260206004820152602e60248201527f4d5648513a2072656365697665727320616e64207175616e746974696573206c60448201526d0cadccee8d040dad2e6dac2e8c6d60931b60648201526084016104ac565b60005b8581101561197857611966878783818110611932576119326153f2565b90506020020160208101906119479190614bdb565b868684818110611959576119596153f2565b90506020020135856138ec565b806119708161544b565b915050611915565b50505050505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036119c95760405162461bcd60e51b81526004016104ac9061535a565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611a12600080516020615762833981519152546001600160a01b031690565b6001600160a01b031614611a385760405162461bcd60e51b81526004016104ac906153a6565b611a41826135a2565b61134d828260016135cc565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611aed5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016104ac565b5060008051602061576283398151915290565b6000611b0b8161349e565b60006101048054611b1b90615320565b80601f0160208091040260200160405190810160405280929190818152602001828054611b4790615320565b8015611b945780601f10611b6957610100808354040283529160200191611b94565b820191906000526020600020905b815481529060010190602001808311611b7757829003601f168201915b50508651939450611bb193610104935060208801925090506149b4565b50336001600160a01b03167f92bf6a7b8937c17e6781a68d61f9fe6a5ce08604b96ca2206f311049a3a295ea8285604051611bed92919061547d565b60405180910390a2505050565b611c0333610f7c565b611c1f5760405162461bcd60e51b81526004016104ac90614a4d565b60005b61010654811015611cdd57816101068281548110611c4257611c426153f2565b906000526020600020015403611ccb576101068054611c639060019061541e565b81548110611c7357611c736153f2565b90600052602060002001546101068281548110611c9257611c926153f2565b600091825260209091200155610106805480611cb057611cb0615435565b60019003818190600052602060002001600090559055611cdd565b80611cd58161544b565b915050611c22565b5060405181815233907f5bff50bb0ea7b604b792895e3a30ed31d4502d8c105e5c7c7982c8ac765beb8190602001611222565b80516060906000816001600160401b03811115611d2f57611d2f614cd2565b604051908082528060200260200182016040528015611d7a57816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181611d4d5790505b50905060005b828114611dce57611da9858281518110611d9c57611d9c6153f2565b6020026020010151612ca3565b828281518110611dbb57611dbb6153f2565b6020908102919091010152600101611d80565b509392505050565b6000611de1826139f3565b5192915050565b600061010b545a611df991906154a2565b9050611e0433610f7c565b80611e1257506101035460ff165b611e5e5760405162461bcd60e51b815260206004820152601960248201527f4d5648513a20636c61696d696e67206e6f74206163746976650000000000000060448201526064016104ac565b60405163e985e9c560e01b815233600482015230602482015273495f947276749ce646f68ac8c248420045cb7b5e9063e985e9c590604401602060405180830381865afa158015611eb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ed791906154ba565b611f235760405162461bcd60e51b815260206004820152601760248201527f4d5648513a20617070726f76616c20726571756972656400000000000000000060448201526064016104ac565b604051627eeac760e11b8152336004820152600080516020615742833981519152602482015260009073495f947276749ce646f68ac8c248420045cb7b5e9062fdd58e90604401602060405180830381865afa158015611f87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fab9190615464565b905060008111611ffd5760405162461bcd60e51b815260206004820152601760248201527f4d5648513a206e6f20636c61696d61626c65206b65797300000000000000000060448201526064016104ac565b60408051600180825281830190925260009160208083019080368337505060408051600180825281830190925292935060009291506020808301908036833701905050905060008051602061574283398151915282600081518110612064576120646153f2565b6020026020010181815250508281600081518110612084576120846153f2565b60200260200101818152505073495f947276749ce646f68ac8c248420045cb7b5e6001600160a01b031663f242432a3330600080516020615742833981519152876040518060400160405280600381526020016203078360ec1b8152506040518663ffffffff1660e01b81526004016121019594939291906154d7565b600060405180830381600087803b15801561211b57600080fd5b505af115801561212f573d6000803e3d6000fd5b5050505061213d3384613b1b565b60405183815233907f6df341e167ad905feb841b44d47d5589106540c65e6fe465047aaf23cd30c5a89060200160405180910390a250506101095460ff169050801561218c575061010a544710155b1561142d5760003a5a61219f908461541e565b6121a9919061551c565b9050336001600160a01b03166108fc61010a5483116121c857826121cd565b61010a545b6040518115909202916000818181858888f193505050501580156121f5573d6000803e3d6000fd5b5060405181815233907fd7dee2702d63ad89917b6a4da9981c90c4d24f8c2bdfd64c604ecae57d8d065190602001611538565b60006122338161349e565b60005b828110156122d55761010d6000858584818110612255576122556153f2565b602090810292909201358352508101919091526040016000205460ff1615801561229b575061229b84848381811061228f5761228f6153f2565b90506020020135613407565b156122c3576122c38484838181106122b5576122b56153f2565b905060200201356000613737565b806122cd8161544b565b915050612236565b50505050565b7fe098e2e7d2d4d3ca0e3877ceaaf3cdfbd47483f6699688ad12b1d6732deef10b6123058161349e565b61010e5460fb54111561235a5760405162461bcd60e51b815260206004820152601f60248201527f4d5648513a20776f756c6420657863656564206d617820746f6b656e2069640060448201526064016104ac565b60fb54612368836001613b1b565b60408051828152600060208201526001600160a01b038516917ff77ae1a2d08f704c6f96fbda4f182340181248bdb7483eb9fa8cefdbf2d079829101611bed565b60606101068054806020026020016040519081016040528092919081815260200182805480156110bd57602002820191906000526020600020905b8154815260200190600101908083116123e4575050505050905090565b610104805461240f90615320565b80601f016020809104026020016040519081016040528092919081815260200182805461243b90615320565b80156124885780601f1061245d57610100808354040283529160200191612488565b820191906000526020600020905b81548152906001019060200180831161246b57829003601f168201915b505050505081565b60006001600160a01b0382166124b9576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b0316600090815261010060205260409020546001600160401b031690565b60006124ea8161349e565b610103805460ff191683151590811790915560405190815233907fcfac0d114d14393344fe66cb124151c2877a3634ed09c8ee2994553274cbc25690602001611538565b60006125398161349e565b5061010f805461ff001981166101009182900460ff1615909102179055565b60606101078054806020026020016040519081016040528092919081815260200182805480156110bd57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612593575050505050905090565b606060008060006125ca85612490565b90506000816001600160401b038111156125e6576125e6614cd2565b60405190808252806020026020018201604052801561260f578160200160208202803683370190505b509050612635604080516060810182526000808252602082018190529181019190915290565b60015b8386146126f357600081815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b909104909116151591810182905292506126eb5781516001600160a01b0316156126ac57815194505b876001600160a01b0316856001600160a01b0316036126eb57808387806001019850815181106126de576126de6153f2565b6020026020010181815250505b600101612638565b50909695505050505050565b60006101085461270e83612490565b101592915050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060fe805461104490615320565b6000805b6101065481101561279f57826101068281548110612774576127746153f2565b90600052602060002001540361278d5750600192915050565b806127978161544b565b915050612754565b50600092915050565b60608183106127ca57604051631960ccad60e11b815260040160405180910390fd5b60fb5460009060018510156127de57600194505b808411156127ea578093505b60006127f587612490565b905084861015612814578585038181101561280e578091505b50612818565b5060005b6000816001600160401b0381111561283257612832614cd2565b60405190808252806020026020018201604052801561285b578160200160208202803683370190505b5090508160000361287157935061296492505050565b600061287c88612ca3565b90506000816040015161288d575080515b885b88811415801561289f5750848714155b1561295857600081815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b909104909116151591810182905293506129505782516001600160a01b03161561291157825191505b8a6001600160a01b0316826001600160a01b0316036129505780848880600101995081518110612943576129436153f2565b6020026020010181815250505b60010161288f565b50505092835250909150505b9392505050565b6000805b6101075481101561279f57826001600160a01b03166101078281548110612998576129986153f2565b6000918252602090912001546001600160a01b0316036129bb5750600192915050565b806129c58161544b565b91505061296f565b336001600160a01b038316036129f65760405163b06307db60e01b815260040160405180910390fd5b336000818152610102602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000612a6e8161349e565b50610109805460ff1916911515919091179055565b6000612a8e8161349e565b60008211612ad55760405162461bcd60e51b815260206004820152601460248201527326ab24289d1034b73b30b634b21039b2b0b9b7b760611b60448201526064016104ac565b5061010c55565b7fe098e2e7d2d4d3ca0e3877ceaaf3cdfbd47483f6699688ad12b1d6732deef10b612b068161349e565b60005b82811015612c5157846001600160a01b0316612b3c858584818110612b3057612b306153f2565b90506020020135611dd6565b6001600160a01b031614612b9e5760405162461bcd60e51b8152602060048201526024808201527f4d5648513a20746f6b656e206e6f74206f776e656420627920746f6b656e734f6044820152633bb732b960e11b60648201526084016104ac565b61010d6000858584818110612bb557612bb56153f2565b602090810292909201358352508101919091526040016000205460ff1615612c2a5760405162461bcd60e51b815260206004820152602260248201527f4d5648513a207768616c6520746f6b656e2063616e6e6f74206265206275726e604482015261195960f21b60648201526084016104ac565b612c3f8484838181106122b5576122b56153f2565b80612c498161544b565b915050612b09565b5050505050565b612c638484846134a8565b6001600160a01b0383163b15158015612c855750612c8384848484613b35565b155b156122d5576040516368d2bf6b60e11b815260040160405180910390fd5b60408051606080820183526000808352602080840182905283850182905284519283018552818352820181905292810192909252906001831080612ce9575060fb548310155b15612cf45792915050565b50600082815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b9091049091161580159282019290925290612d545792915050565b612964836139f3565b6000612d688161349e565b600083118015612d7e575060fb54600019018211155b612dca5760405162461bcd60e51b815260206004820152601960248201527f4d5648513a20696e76616c696420746f6b656e2072616e67650000000000000060448201526064016104ac565b825b8281116122d557600081815261010d602052604090205460ff16158015612df75750612df781613407565b15612e0757612e07816000613737565b80612e118161544b565b915050612dcc565b6060612e2482613407565b612e4157604051630a14c4b560e41b815260040160405180910390fd5b60006101048054612e5190615320565b90501115612e8c57610104612e6583613c21565b604051602001612e76929190615557565b6040516020818303038152906040529050919050565b505060408051602081019091526000815290565b919050565b6000612eb08161349e565b5061010b55565b600082815260656020526040902060010154612ed28161349e565b611194838361353b565b6000612ee78161349e565b612ef2848484613cb3565b604080516001600160a01b0386811682528516602082015290810183905233907f360bb0808951709e17b8c0ff5cf74aa15579508d1227398aac32794efdfe75ea9060600160405180910390a250505050565b6000612f508161349e565b61010f546201000090046001600160a01b03163b612fd65760405162461bcd60e51b815260206004820152603860248201527f4d5648513a206f70657261746f722066696c746572207265676973747279206160448201527f646472657373206973206e6f74206120636f6e7472616374000000000000000060648201526084016104ac565b5061010f8054911515600160b01b0260ff60b01b19909216919091179055565b60006130018161349e565b604051627eeac760e11b8152306004820152600080516020615742833981519152602482015260009073495f947276749ce646f68ac8c248420045cb7b5e9062fdd58e90604401602060405180830381865afa158015613065573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130899190615464565b9050600081116130db5760405162461bcd60e51b815260206004820181905260248201527f4d5648513a206e6f206c6567616379206b65797320746f207472616e7366657260448201526064016104ac565b604080518082018252600381526203078360ec1b60208201529051637921219560e11b815273495f947276749ce646f68ac8c248420045cb7b5e9163f242432a9161313f9130918891600080516020615742833981519152918891906004016154d7565b600060405180830381600087803b15801561315957600080fd5b505af115801561316d573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018590523393507ffeb6c27c598d8581a441fc8e59e9ef9fc43c0a609af2aed0554a05b5aaa6fca6925001611bed565b60006131bd8161349e565b61010580546001600160a01b038481166001600160a01b0319831681179093556040805191909216808252602082019390935233917fc8894f26f396ce8c004245c8b7cd1b92103a6e4302fcbab883987149ac01b7ec9101611bed565b600054610100900460ff161580801561323a5750600054600160ff909116105b806132545750303b158015613254575060005460ff166001145b6132b75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016104ac565b6000805460ff1916600117905580156132da576000805461ff0019166101001790555b61331c604051806040016040528060048152602001634d56485160e01b815250604051806040016040528060048152602001634d56485160e01b815250613cc0565b613324613cfd565b61332f6000336134b5565b8151613343906101049060208501906149b4565b5060056101085561010580546001600160a01b03191633179055610109805460ff19166001179055662386f26fc1000061010a55617dc461010b55801561134d576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60006001600160e01b031982166380ac58cd60e01b14806133f857506001600160e01b03198216635b5e139f60e01b145b80610fb95750610fb982613d26565b60008160011115801561341b575060fb5482105b8015610fb9575050600090815260ff6020819052604090912054600160e01b9004161590565b6000828152610101602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b61142d8133613d5b565b6111948383836001613db4565b6134bf8282612716565b61134d5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556134f73390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6135458282612716565b1561134d5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e361134d8161349e565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156135ff5761119483613fa3565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015613659575060408051601f3d908101601f1916820190925261365691810190615464565b60015b6136bc5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016104ac565b600080516020615762833981519152811461372b5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016104ac565b5061119483838361403f565b6000613742836139f3565b805190915082156137a8576000336001600160a01b038316148061376b575061376b8233610e78565b8061378657503361377b866110c7565b6001600160a01b0316145b9050806137a657604051632ce44b5f60e11b815260040160405180910390fd5b505b6137b460008583613441565b6001600160a01b038082166000818152610100602090815260408083208054600160801b6000196001600160401b0380841691909101811667ffffffffffffffff198416811783900482166001908101831690930277ffffffffffffffff0000000000000000ffffffffffffffff19909416179290921783558b865260ff909452828520805460ff60e01b1942909316600160a01b026001600160e01b03199091169097179690961716600160e01b1785559189018084529220805491949091166138b35760fb5482146138b357805460208701516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038716171781555b5050604051869250600091506001600160a01b038416906000805160206157a9833981519152908390a4505060fc805460010190555050565b60fb546000836001600160401b0381111561390957613909614cd2565b604051908082528060200260200182016040528015613932578160200160208202803683370190505b50905082156139a15760005b8481101561399b57600083815261010d60205260409020805460ff191660011790558261396a8161544b565b935082828151811061397e5761397e6153f2565b6020908102919091010152806139938161544b565b91505061393e565b506139e9565b60005b848110156139e757826139b68161544b565b93508282815181106139ca576139ca6153f2565b6020908102919091010152806139df8161544b565b9150506139a4565b505b612c518585613b1b565b60408051606081018252600080825260208201819052918101919091528180600111158015613a23575060fb5481105b15613b0257600081815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b909104909116151591810182905290613b005780516001600160a01b031615613a96579392505050565b5060001901600081815260ff6020818152604092839020835160608101855290546001600160a01b0381168083526001600160401b03600160a01b83041693830193909352600160e01b90049092161515928201929092529015613afb579392505050565b613a96565b505b604051636f96cda160e11b815260040160405180910390fd5b61134d828260405180602001604052806000815250614064565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613b6a9033908990889088906004016155f4565b6020604051808303816000875af1925050508015613ba5575060408051601f3d908101601f19168201909252613ba291810190615631565b60015b613c03573d808015613bd3576040519150601f19603f3d011682016040523d82523d6000602084013e613bd8565b606091505b508051600003613bfb576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b60606000613c2e83614071565b60010190506000816001600160401b03811115613c4d57613c4d614cd2565b6040519080825280601f01601f191660200182016040528015613c77576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613c8157509392505050565b6111948383836000613db4565b600054610100900460ff16613ce75760405162461bcd60e51b81526004016104ac9061564e565b613cf18282614149565b613cf9613cfd565b61134d5b600054610100900460ff16613d245760405162461bcd60e51b81526004016104ac9061564e565b565b60006001600160e01b03198216637965db0b60e01b1480610fb957506301ffc9a760e01b6001600160e01b0319831614610fb9565b613d658282612716565b61134d57613d72816141a1565b613d7d8360206141b3565b604051602001613d8e929190615699565b60408051601f198184030181529082905262461bcd60e51b82526104ac91600401614b06565b6000613dbf836139f3565b9050846001600160a01b031681600001516001600160a01b031614613df65760405162a1148160e81b815260040160405180910390fd5b8115613e7e576000336001600160a01b0387161480613e1a5750613e1a8633610e78565b80613e35575033613e2a856110c7565b6001600160a01b0316145b905080613e5557604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516613e7c57604051633a954ecd60e21b815260040160405180910390fd5b505b613e8b858585600161434e565b613e9760008487613441565b6001600160a01b03858116600090815261010060209081526040808320805467ffffffffffffffff198082166001600160401b039283166000190183161790925589861680865283862080549384169383166001908101841694909417905589865260ff90945282852080546001600160e01b031916909417600160a01b42909216919091021783558701808452922080549193909116613f6c5760fb548214613f6c57805460208501516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03166000805160206157a983398151915260405160405180910390a4612c51565b6001600160a01b0381163b6140105760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016104ac565b60008051602061576283398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61404883614687565b6000825111806140555750805b15611194576122d583836146c7565b61119483838360016147bb565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106140b05772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106140dc576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106140fa57662386f26fc10000830492506010015b6305f5e1008310614112576305f5e100830492506008015b612710831061412657612710830492506004015b60648310614138576064830492506002015b600a8310610fb95760010192915050565b600054610100900460ff166141705760405162461bcd60e51b81526004016104ac9061564e565b81516141839060fd9060208501906149b4565b5080516141979060fe9060208401906149b4565b50600160fb555050565b6060610fb96001600160a01b03831660145b606060006141c283600261551c565b6141cd9060026154a2565b6001600160401b038111156141e4576141e4614cd2565b6040519080825280601f01601f19166020018201604052801561420e576020820181803683370190505b509050600360fc1b81600081518110614229576142296153f2565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614258576142586153f2565b60200101906001600160f81b031916908160001a905350600061427c84600261551c565b6142879060016154a2565b90505b60018111156142ff576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106142bb576142bb6153f2565b1a60f81b8282815181106142d1576142d16153f2565b60200101906001600160f81b031916908160001a90535060049490941c936142f88161570e565b905061428a565b5083156129645760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104ac565b614359600033612716565b614559576143668461296b565b156143bf5760405162461bcd60e51b815260206004820152602360248201527f4d5648513a206b657920686f6c646572206164647265737320697320666c616760448201526219d95960ea1b60648201526084016104ac565b6143c88361296b565b156144235760405162461bcd60e51b815260206004820152602560248201527f4d5648513a206b6579207265636569766572206164647265737320697320666c6044820152641859d9d95960da1b60648201526084016104ac565b815b61442f82846154a2565b8110156145575761443f81612750565b156144835760405162461bcd60e51b8152602060048201526014602482015273135592144e881ad95e481a5cc8199b1859d9d95960621b60448201526064016104ac565b600081815261010d602052604090205460ff166144ec5761010f5460ff16156144e75760405162461bcd60e51b8152602060048201526016602482015275135592144e881d1c985b9cd9995c9cc81c185d5cd95960521b60448201526064016104ac565b614545565b61010f54610100900460ff16156145455760405162461bcd60e51b815260206004820152601c60248201527f4d5648513a207768616c65207472616e7366657273207061757365640000000060448201526064016104ac565b8061454f8161544b565b915050614425565b505b61010f54600160b01b900460ff168015614585575061010f546201000090046001600160a01b03163b15155b156146825761010f546040513060248201523360448201526000918291620100009091046001600160a01b03169060640160408051601f198184030181529181526020820180516001600160e01b0316633185c44d60e21b179052516145eb9190615725565b6000604051808303816000865af19150503d8060008114614628576040519150601f19603f3d011682016040523d82523d6000602084013e61462d565b606091505b50915091508161467f5760405162461bcd60e51b815260206004820152601760248201527f4d5648513a206f70657261746f722066696c746572656400000000000000000060448201526064016104ac565b50505b6122d5565b61469081613fa3565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61472f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016104ac565b600080846001600160a01b03168460405161474a9190615725565b600060405180830381855af49150503d8060008114614785576040519150601f19603f3d011682016040523d82523d6000602084013e61478a565b606091505b50915091506147b2828260405180606001604052806027815260200161578260279139614976565b95945050505050565b60fb546001600160a01b0385166147e457604051622e076360e81b815260040160405180910390fd5b836000036148055760405163b562e8dd60e01b815260040160405180910390fd5b614812600086838761434e565b6001600160a01b03851660008181526101006020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c0181169092021790915585845260ff90925290912080546001600160e01b031916909217600160a01b4290921691909102179055808085018380156148c457506001600160a01b0387163b15155b1561493a575b60405182906001600160a01b038916906000906000805160206157a9833981519152908290a46149036000888480600101955088613b35565b614920576040516368d2bf6b60e11b815260040160405180910390fd5b8082036148ca578260fb541461493557600080fd5b61496d565b5b6040516001830192906001600160a01b038916906000906000805160206157a9833981519152908290a480820361493b575b5060fb55612c51565b60608315614985575081612964565b612964838381511561499a5781518083602001fd5b8060405162461bcd60e51b81526004016104ac9190614b06565b8280546149c090615320565b90600052602060002090601f0160209004810192826149e25760008555614a28565b82601f106149fb57805160ff1916838001178555614a28565b82800160010185558215614a28579182015b82811115614a28578251825591602001919060010190614a0d565b50614a34929150614a38565b5090565b5b80821115614a345760008155600101614a39565b602080825260149082015273135592144e881b9bdd08185d5d1a1bdc9a5e995960621b604082015260600190565b6001600160e01b03198116811461142d57600080fd5b600060208284031215614aa357600080fd5b813561296481614a7b565b60005b83811015614ac9578181015183820152602001614ab1565b838111156122d55750506000910152565b60008151808452614af2816020860160208601614aae565b601f01601f19169290920160200192915050565b6020815260006129646020830184614ada565b600060208284031215614b2b57600080fd5b5035919050565b80356001600160a01b0381168114612ea057600080fd5b60008060408385031215614b5c57600080fd5b614b6583614b32565b946020939093013593505050565b600080600060608486031215614b8857600080fd5b614b9184614b32565b9250614b9f60208501614b32565b9150604084013590509250925092565b60008060408385031215614bc257600080fd5b82359150614bd260208401614b32565b90509250929050565b600060208284031215614bed57600080fd5b61296482614b32565b60008083601f840112614c0857600080fd5b5081356001600160401b03811115614c1f57600080fd5b6020830191508360208260051b8501011115614c3a57600080fd5b9250929050565b801515811461142d57600080fd5b600080600080600060608688031215614c6757600080fd5b85356001600160401b0380821115614c7e57600080fd5b614c8a89838a01614bf6565b90975095506020880135915080821115614ca357600080fd5b50614cb088828901614bf6565b9094509250506040860135614cc481614c41565b809150509295509295909350565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614d1057614d10614cd2565b604052919050565b60006001600160401b03831115614d3157614d31614cd2565b614d44601f8401601f1916602001614ce8565b9050828152838383011115614d5857600080fd5b828260208301376000602084830101529392505050565b600082601f830112614d8057600080fd5b61296483833560208501614d18565b60008060408385031215614da257600080fd5b614dab83614b32565b915060208301356001600160401b03811115614dc657600080fd5b614dd285828601614d6f565b9150509250929050565b600060208284031215614dee57600080fd5b81356001600160401b03811115614e0457600080fd5b8201601f81018413614e1557600080fd5b613c1984823560208401614d18565b60006020808385031215614e3757600080fd5b82356001600160401b0380821115614e4e57600080fd5b818501915085601f830112614e6257600080fd5b813581811115614e7457614e74614cd2565b8060051b9150614e85848301614ce8565b8181529183018401918481019088841115614e9f57600080fd5b938501935b83851015614ebd57843582529385019390850190614ea4565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b818110156126f357614f2083855180516001600160a01b031682526020808201516001600160401b0316908301526040908101511515910152565b9284019260609290920191600101614ee5565b60008060208385031215614f4657600080fd5b82356001600160401b03811115614f5c57600080fd5b614f6885828601614bf6565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156126f357835183529284019291840191600101614f90565b600060208284031215614fbe57600080fd5b813561296481614c41565b6020808252825182820181905260009190848201906040850190845b818110156126f35783516001600160a01b031683529284019291840191600101614fe5565b60008060006060848603121561501f57600080fd5b61502884614b32565b95602085013595506040909401359392505050565b6000806040838503121561505057600080fd5b61505983614b32565b9150602083013561506981614c41565b809150509250929050565b60008060006040848603121561508957600080fd5b61509284614b32565b925060208401356001600160401b038111156150ad57600080fd5b6150b986828701614bf6565b9497909650939450505050565b600080600080608085870312156150dc57600080fd5b6150e585614b32565b93506150f360208601614b32565b92506040850135915060608501356001600160401b0381111561511557600080fd5b61512187828801614d6f565b91505092959194509250565b60008083601f84011261513f57600080fd5b5081356001600160401b0381111561515657600080fd5b602083019150836020828501011115614c3a57600080fd5b60008060008060008060008060a0898b03121561518a57600080fd5b61519389614b32565b97506151a160208a01614b32565b965060408901356001600160401b03808211156151bd57600080fd5b6151c98c838d01614bf6565b909850965060608b01359150808211156151e257600080fd5b6151ee8c838d01614bf6565b909650945060808b013591508082111561520757600080fd5b506152148b828c0161512d565b999c989b5096995094979396929594505050565b81516001600160a01b031681526020808301516001600160401b03169082015260408083015115159082015260608101610fb9565b6000806040838503121561527057600080fd5b50508035926020909101359150565b6000806040838503121561529257600080fd5b61529b83614b32565b9150614bd260208401614b32565b60008060008060008060a087890312156152c257600080fd5b6152cb87614b32565b95506152d960208801614b32565b9450604087013593506060870135925060808701356001600160401b0381111561530257600080fd5b61530e89828a0161512d565b979a9699509497509295939492505050565b600181811c9082168061533457607f821691505b60208210810361535457634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008282101561543057615430615408565b500390565b634e487b7160e01b600052603160045260246000fd5b60006001820161545d5761545d615408565b5060010190565b60006020828403121561547657600080fd5b5051919050565b6040815260006154906040830185614ada565b82810360208401526147b28185614ada565b600082198211156154b5576154b5615408565b500190565b6000602082840312156154cc57600080fd5b815161296481614c41565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061551190830184614ada565b979650505050505050565b600081600019048311821515161561553657615536615408565b500290565b6000815161554d818560208601614aae565b9290920192915050565b600080845481600182811c91508083168061557357607f831692505b6020808410820361559257634e487b7160e01b86526022600452602486fd5b8180156155a657600181146155b7576155e4565b60ff198616895284890196506155e4565b60008b81526020902060005b868110156155dc5781548b8201529085019083016155c3565b505084890196505b5050505050506147b2818561553b565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061562790830184614ada565b9695505050505050565b60006020828403121561564357600080fd5b815161296481614a7b565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516156d1816017850160208801614aae565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615702816028840160208801614aae565b01602801949350505050565b60008161571d5761571d615408565b506000190190565b60008251615737818460208701614aae565b919091019291505056fe9b318f4ce0672a3f1ac661d9739a947f38b863a00000000000000100000005dc360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212203bb830f4ce012d4d6e64420bbea06cb4b6d081e2014dc954e60f592943a7ee8264736f6c634300080d0033
Deployed Bytecode
0x6080604052600436106104825760003560e01c806373417b0911610255578063b2dc5dc311610144578063d4d9b343116100c1578063e985e9c511610085578063e985e9c514610e5d578063ec87621c14610ea7578063f23a6e6114610edb578063f2fde38b14610f08578063f62d188814610f28578063f72c0d8b14610f4857600080fd5b8063d4d9b34314610dbd578063d547741f14610ddd578063da72c1e814610dfd578063daad792014610e1d578063e127c45014610e3d57600080fd5b8063c50b0fb011610108578063c50b0fb014610d29578063c802668d14610d40578063c87b56dd14610d60578063cfba9fab14610d80578063d4a6a2fd14610da257600080fd5b8063b2dc5dc314610c5d578063b2ea46c114610c7d578063b88d4fde14610c94578063bc197c8114610cb4578063c23dc68f14610cfc57600080fd5b806391d14854116101d2578063a217fddf11610196578063a217fddf14610bc1578063a22cb46514610bd6578063ae34490414610bf6578063af88fac914610c16578063b0ccc31e14610c3657600080fd5b806391d1485414610b2c57806395d89b4114610b4c5780639937b0ce14610b6157806399a2557a14610b815780639a760fc614610ba157600080fd5b80638da5cb5b116102195780638da5cb5b14610a915780638df9389c14610ab25780638ef1e25914610ada5780638faf6c3114610afa57806391ba317a14610b1557600080fd5b806373417b0914610a03578063768ac99d14610a235780637ab4d1de14610a385780637ccd134a14610a4f5780638462151c14610a7157600080fd5b806342842e0e1161037157806355f804b3116102ee57806367a53173116102b257806367a531731461096c5780636a6278421461098c5780636a9d57fd146109ac5780636c0360eb146109ce57806370a08231146109e357600080fd5b806355f804b3146108ca5780635a50fd50146108ea5780635bbb21771461090a5780636352211e14610937578063658247a01461095757600080fd5b806347af99571161033557806347af9957146108475780634996527c146108625780634be2ede4146108825780634f1ef286146108a257806352d1902d146108b557600080fd5b806342842e0e146107a55780634294e544146107c5578063429644d9146107e557806342966c681461080557806345d464a91461082557600080fd5b8063248a9ca3116103ff5780633659cfe6116103c35780633659cfe61461072857806337cb2e091461074857806338d023c2146107685780633ccfd60b146107885780633e5ac28f1461079057600080fd5b8063248a9ca31461068157806328bbc5c1146106b15780632efbeccd146106c85780632f2ff15d146106e857806336568abe1461070857600080fd5b8063154974091161044657806315497409146105e457806318160ddd146106045780631cc26da814610621578063202fcbbd1461064157806323b872dd1461066157600080fd5b806301ffc9a7146104f157806306fdde0314610526578063081812fc14610548578063095ea7b31461058057806309e0a34f146105a257600080fd5b366104ec5761049033610f7c565b6104b55760405162461bcd60e51b81526004016104ac90614a4d565b60405180910390fd5b60405134815233907f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f885258749060200160405180910390a2005b600080fd5b3480156104fd57600080fd5b5061051161050c366004614a91565b610fbf565b60405190151581526020015b60405180910390f35b34801561053257600080fd5b5061053b611035565b60405161051d9190614b06565b34801561055457600080fd5b50610568610563366004614b19565b6110c7565b6040516001600160a01b03909116815260200161051d565b34801561058c57600080fd5b506105a061059b366004614b49565b61110c565b005b3480156105ae57600080fd5b506105d67fe098e2e7d2d4d3ca0e3877ceaaf3cdfbd47483f6699688ad12b1d6732deef10b81565b60405190815260200161051d565b3480156105f057600080fd5b506105a06105ff366004614b19565b611199565b34801561061057600080fd5b5060fc5460fb5403600019016105d6565b34801561062d57600080fd5b5061010f5461051190610100900460ff1681565b34801561064d57600080fd5b506105a061065c366004614b19565b61122d565b34801561066d57600080fd5b506105a061067c366004614b73565b611291565b34801561068d57600080fd5b506105d661069c366004614b19565b60009081526065602052604090206001015490565b3480156106bd57600080fd5b506105d661010a5481565b3480156106d457600080fd5b506105a06106e3366004614b19565b61129c565b3480156106f457600080fd5b506105a0610703366004614baf565b6112ae565b34801561071457600080fd5b506105a0610723366004614baf565b6112d3565b34801561073457600080fd5b506105a0610743366004614bdb565b611351565b34801561075457600080fd5b506105a0610763366004614bdb565b611430565b34801561077457600080fd5b506105a0610783366004614b19565b6114d6565b6105a0611544565b34801561079c57600080fd5b506105a06115e7565b3480156107b157600080fd5b506105a06107c0366004614b73565b611608565b3480156107d157600080fd5b506105a06107e0366004614bdb565b611623565b3480156107f157600080fd5b506105d6610800366004614bdb565b611791565b34801561081157600080fd5b506105a0610820366004614b19565b611822565b34801561083157600080fd5b5061010f5461051190600160b01b900460ff1681565b34801561085357600080fd5b5061010f546105119060ff1681565b34801561086e57600080fd5b506105a061087d366004614bdb565b61186a565b34801561088e57600080fd5b506105a061089d366004614c4f565b6118a1565b6105a06108b0366004614d8f565b611981565b3480156108c157600080fd5b506105d6611a4d565b3480156108d657600080fd5b506105a06108e5366004614ddc565b611b00565b3480156108f657600080fd5b506105a0610905366004614b19565b611bfa565b34801561091657600080fd5b5061092a610925366004614e24565b611d10565b60405161051d9190614ec9565b34801561094357600080fd5b50610568610952366004614b19565b611dd6565b34801561096357600080fd5b506105a0611de8565b34801561097857600080fd5b506105a0610987366004614f33565b612228565b34801561099857600080fd5b506105a06109a7366004614bdb565b6122db565b3480156109b857600080fd5b506109c16123a9565b60405161051d9190614f74565b3480156109da57600080fd5b5061053b612401565b3480156109ef57600080fd5b506105d66109fe366004614bdb565b612490565b348015610a0f57600080fd5b506105a0610a1e366004614fac565b6124df565b348015610a2f57600080fd5b506105a061252e565b348015610a4457600080fd5b506105d66101085481565b348015610a5b57600080fd5b50610a64612558565b60405161051d9190614fc9565b348015610a7d57600080fd5b506109c1610a8c366004614bdb565b6125ba565b348015610a9d57600080fd5b5061010554610568906001600160a01b031681565b348015610abe57600080fd5b5061056873495f947276749ce646f68ac8c248420045cb7b5e81565b348015610ae657600080fd5b50610511610af5366004614bdb565b6126ff565b348015610b0657600080fd5b50610109546105119060ff1681565b348015610b2157600080fd5b506105d661010e5481565b348015610b3857600080fd5b50610511610b47366004614baf565b612716565b348015610b5857600080fd5b5061053b612741565b348015610b6d57600080fd5b50610511610b7c366004614b19565b612750565b348015610b8d57600080fd5b506109c1610b9c36600461500a565b6127a8565b348015610bad57600080fd5b50610511610bbc366004614bdb565b61296b565b348015610bcd57600080fd5b506105d6600081565b348015610be257600080fd5b506105a0610bf136600461503d565b6129cd565b348015610c0257600080fd5b506105a0610c11366004614fac565b612a63565b348015610c2257600080fd5b506105a0610c31366004614b19565b612a83565b348015610c4257600080fd5b5061010f54610568906201000090046001600160a01b031681565b348015610c6957600080fd5b506105a0610c78366004615074565b612adc565b348015610c8957600080fd5b506105d661010b5481565b348015610ca057600080fd5b506105a0610caf3660046150c6565b612c58565b348015610cc057600080fd5b50610ce3610ccf36600461516e565b63bc197c8160e01b98975050505050505050565b6040516001600160e01b0319909116815260200161051d565b348015610d0857600080fd5b50610d1c610d17366004614b19565b612ca3565b60405161051d9190615228565b348015610d3557600080fd5b506105d661010c5481565b348015610d4c57600080fd5b506105a0610d5b36600461525d565b612d5d565b348015610d6c57600080fd5b5061053b610d7b366004614b19565b612e19565b348015610d8c57600080fd5b506105d660008051602061574283398151915281565b348015610dae57600080fd5b50610103546105119060ff1681565b348015610dc957600080fd5b506105a0610dd8366004614b19565b612ea5565b348015610de957600080fd5b506105a0610df8366004614baf565b612eb7565b348015610e0957600080fd5b506105a0610e18366004614b73565b612edc565b348015610e2957600080fd5b506105a0610e38366004614fac565b612f45565b348015610e4957600080fd5b506105a0610e58366004614bdb565b612ff6565b348015610e6957600080fd5b50610511610e7836600461527f565b6001600160a01b0391821660009081526101026020908152604080832093909416825291909152205460ff1690565b348015610eb357600080fd5b506105d67f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b348015610ee757600080fd5b50610ce3610ef63660046152a9565b63f23a6e6160e01b9695505050505050565b348015610f1457600080fd5b506105a0610f23366004614bdb565b6131b2565b348015610f3457600080fd5b506105a0610f43366004614ddc565b61321a565b348015610f5457600080fd5b506105d67f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b6000610fa87f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0883612716565b80610fb95750610fb9600083612716565b92915050565b60006001600160e01b031982166380ac58cd60e01b1480610ff057506001600160e01b03198216635b5e139f60e01b145b8061100b57506001600160e01b0319821663da8def7360e01b145b8061102657506001600160e01b031982166301ffc9a760e01b145b80610fb95750610fb9826133c7565b606060fd805461104490615320565b80601f016020809104026020016040519081016040528092919081815260200182805461107090615320565b80156110bd5780601f10611092576101008083540402835291602001916110bd565b820191906000526020600020905b8154815290600101906020018083116110a057829003601f168201915b5050505050905090565b60006110d282613407565b6110ef576040516333d1c03960e21b815260040160405180910390fd5b50600090815261010160205260409020546001600160a01b031690565b600061111782611dd6565b9050806001600160a01b0316836001600160a01b03160361114b5760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b0382161480159061116b57506111698133610e78565b155b15611189576040516367d9dca160e11b815260040160405180910390fd5b611194838383613441565b505050565b6111a233610f7c565b6111be5760405162461bcd60e51b81526004016104ac90614a4d565b61010680546001810182556000919091527fc9ef9fceea91e87b2c84ea400a44fde78842aae8aa24cd4b502ce5fb4d91e63b0181905560405181815233907f540e004b1e599d2b6e04cb22f77b5c15ed1a83347064d867e964e25a073f5dd7906020015b60405180910390a250565b60006112388161349e565b60fb5482101561128a5760405162461bcd60e51b815260206004820152601a60248201527f4d5648513a206d617820746f6b656e20696420696e76616c696400000000000060448201526064016104ac565b5061010e55565b6111948383836134a8565b60006112a78161349e565b5061010a55565b6000828152606560205260409020600101546112c98161349e565b61119483836134b5565b6001600160a01b03811633146113435760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016104ac565b61134d828261353b565b5050565b6001600160a01b037f0000000000000000000000001b6e11dd3828f544ea87c8a927fad0b72840b6491630036113995760405162461bcd60e51b81526004016104ac9061535a565b7f0000000000000000000000001b6e11dd3828f544ea87c8a927fad0b72840b6496001600160a01b03166113e2600080516020615762833981519152546001600160a01b031690565b6001600160a01b0316146114085760405162461bcd60e51b81526004016104ac906153a6565b611411816135a2565b6040805160008082526020820190925261142d918391906135cc565b50565b61143933610f7c565b6114555760405162461bcd60e51b81526004016104ac90614a4d565b61010780546001810182556000919091527f47c4908e245f386bfc1825973249847f4053a761ddb4880ad63c323a7b5a2a250180546001600160a01b0319166001600160a01b03831690811790915560405190815233907ff34c09a7cee2ec36676b00d8197a8db8ba2c6e091727126e27c8e3c34747f1a390602001611222565b6114df33610f7c565b6114fb5760405162461bcd60e51b81526004016104ac90614a4d565b610108805490829055604080518281526020810184905233917fa091af460c0b001329ed8c9156f41f3efcc95ae5136f2c44f6746c4d778cf7fc91015b60405180910390a25050565b600061154f8161349e565b604051600090339047908381818185875af1925050503d8060008114611591576040519150601f19603f3d011682016040523d82523d6000602084013e611596565b606091505b505090508061134d5760405162461bcd60e51b815260206004820152601860248201527f4d5648513a206661696c656420746f207769746864726177000000000000000060448201526064016104ac565b60006115f28161349e565b5061010f805460ff19811660ff90911615179055565b61119483838360405180602001604052806000815250612c58565b61162c33610f7c565b6116485760405162461bcd60e51b81526004016104ac90614a4d565b60005b6101075481101561175557816001600160a01b03166101078281548110611674576116746153f2565b6000918252602090912001546001600160a01b03160361174357610107805461169f9060019061541e565b815481106116af576116af6153f2565b60009182526020909120015461010780546001600160a01b0390921691839081106116dc576116dc6153f2565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555061010780548061171c5761171c615435565b600082815260209020810160001990810180546001600160a01b0319169055019055611755565b8061174d8161544b565b91505061164b565b506040516001600160a01b038216815233907fcc229432447e3f287b17d54ea5b3efb13d26e022102362f4d8eba4ac37fb8c7690602001611222565b604051627eeac760e11b81526001600160a01b0382166004820152600080516020615742833981519152602482015260009073495f947276749ce646f68ac8c248420045cb7b5e9062fdd58e90604401602060405180830381865afa1580156117fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb99190615464565b600061182d8161349e565b611838826000613737565b60405182815233907feb1a139f5480882ec767b34b3d7386a850268910ed1dc7acb55c88a1e3a238ec90602001611538565b60006118758161349e565b5061010f80546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b60006118ac8161349e565b8483146119125760405162461bcd60e51b815260206004820152602e60248201527f4d5648513a2072656365697665727320616e64207175616e746974696573206c60448201526d0cadccee8d040dad2e6dac2e8c6d60931b60648201526084016104ac565b60005b8581101561197857611966878783818110611932576119326153f2565b90506020020160208101906119479190614bdb565b868684818110611959576119596153f2565b90506020020135856138ec565b806119708161544b565b915050611915565b50505050505050565b6001600160a01b037f0000000000000000000000001b6e11dd3828f544ea87c8a927fad0b72840b6491630036119c95760405162461bcd60e51b81526004016104ac9061535a565b7f0000000000000000000000001b6e11dd3828f544ea87c8a927fad0b72840b6496001600160a01b0316611a12600080516020615762833981519152546001600160a01b031690565b6001600160a01b031614611a385760405162461bcd60e51b81526004016104ac906153a6565b611a41826135a2565b61134d828260016135cc565b6000306001600160a01b037f0000000000000000000000001b6e11dd3828f544ea87c8a927fad0b72840b6491614611aed5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016104ac565b5060008051602061576283398151915290565b6000611b0b8161349e565b60006101048054611b1b90615320565b80601f0160208091040260200160405190810160405280929190818152602001828054611b4790615320565b8015611b945780601f10611b6957610100808354040283529160200191611b94565b820191906000526020600020905b815481529060010190602001808311611b7757829003601f168201915b50508651939450611bb193610104935060208801925090506149b4565b50336001600160a01b03167f92bf6a7b8937c17e6781a68d61f9fe6a5ce08604b96ca2206f311049a3a295ea8285604051611bed92919061547d565b60405180910390a2505050565b611c0333610f7c565b611c1f5760405162461bcd60e51b81526004016104ac90614a4d565b60005b61010654811015611cdd57816101068281548110611c4257611c426153f2565b906000526020600020015403611ccb576101068054611c639060019061541e565b81548110611c7357611c736153f2565b90600052602060002001546101068281548110611c9257611c926153f2565b600091825260209091200155610106805480611cb057611cb0615435565b60019003818190600052602060002001600090559055611cdd565b80611cd58161544b565b915050611c22565b5060405181815233907f5bff50bb0ea7b604b792895e3a30ed31d4502d8c105e5c7c7982c8ac765beb8190602001611222565b80516060906000816001600160401b03811115611d2f57611d2f614cd2565b604051908082528060200260200182016040528015611d7a57816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181611d4d5790505b50905060005b828114611dce57611da9858281518110611d9c57611d9c6153f2565b6020026020010151612ca3565b828281518110611dbb57611dbb6153f2565b6020908102919091010152600101611d80565b509392505050565b6000611de1826139f3565b5192915050565b600061010b545a611df991906154a2565b9050611e0433610f7c565b80611e1257506101035460ff165b611e5e5760405162461bcd60e51b815260206004820152601960248201527f4d5648513a20636c61696d696e67206e6f74206163746976650000000000000060448201526064016104ac565b60405163e985e9c560e01b815233600482015230602482015273495f947276749ce646f68ac8c248420045cb7b5e9063e985e9c590604401602060405180830381865afa158015611eb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ed791906154ba565b611f235760405162461bcd60e51b815260206004820152601760248201527f4d5648513a20617070726f76616c20726571756972656400000000000000000060448201526064016104ac565b604051627eeac760e11b8152336004820152600080516020615742833981519152602482015260009073495f947276749ce646f68ac8c248420045cb7b5e9062fdd58e90604401602060405180830381865afa158015611f87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fab9190615464565b905060008111611ffd5760405162461bcd60e51b815260206004820152601760248201527f4d5648513a206e6f20636c61696d61626c65206b65797300000000000000000060448201526064016104ac565b60408051600180825281830190925260009160208083019080368337505060408051600180825281830190925292935060009291506020808301908036833701905050905060008051602061574283398151915282600081518110612064576120646153f2565b6020026020010181815250508281600081518110612084576120846153f2565b60200260200101818152505073495f947276749ce646f68ac8c248420045cb7b5e6001600160a01b031663f242432a3330600080516020615742833981519152876040518060400160405280600381526020016203078360ec1b8152506040518663ffffffff1660e01b81526004016121019594939291906154d7565b600060405180830381600087803b15801561211b57600080fd5b505af115801561212f573d6000803e3d6000fd5b5050505061213d3384613b1b565b60405183815233907f6df341e167ad905feb841b44d47d5589106540c65e6fe465047aaf23cd30c5a89060200160405180910390a250506101095460ff169050801561218c575061010a544710155b1561142d5760003a5a61219f908461541e565b6121a9919061551c565b9050336001600160a01b03166108fc61010a5483116121c857826121cd565b61010a545b6040518115909202916000818181858888f193505050501580156121f5573d6000803e3d6000fd5b5060405181815233907fd7dee2702d63ad89917b6a4da9981c90c4d24f8c2bdfd64c604ecae57d8d065190602001611538565b60006122338161349e565b60005b828110156122d55761010d6000858584818110612255576122556153f2565b602090810292909201358352508101919091526040016000205460ff1615801561229b575061229b84848381811061228f5761228f6153f2565b90506020020135613407565b156122c3576122c38484838181106122b5576122b56153f2565b905060200201356000613737565b806122cd8161544b565b915050612236565b50505050565b7fe098e2e7d2d4d3ca0e3877ceaaf3cdfbd47483f6699688ad12b1d6732deef10b6123058161349e565b61010e5460fb54111561235a5760405162461bcd60e51b815260206004820152601f60248201527f4d5648513a20776f756c6420657863656564206d617820746f6b656e2069640060448201526064016104ac565b60fb54612368836001613b1b565b60408051828152600060208201526001600160a01b038516917ff77ae1a2d08f704c6f96fbda4f182340181248bdb7483eb9fa8cefdbf2d079829101611bed565b60606101068054806020026020016040519081016040528092919081815260200182805480156110bd57602002820191906000526020600020905b8154815260200190600101908083116123e4575050505050905090565b610104805461240f90615320565b80601f016020809104026020016040519081016040528092919081815260200182805461243b90615320565b80156124885780601f1061245d57610100808354040283529160200191612488565b820191906000526020600020905b81548152906001019060200180831161246b57829003601f168201915b505050505081565b60006001600160a01b0382166124b9576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b0316600090815261010060205260409020546001600160401b031690565b60006124ea8161349e565b610103805460ff191683151590811790915560405190815233907fcfac0d114d14393344fe66cb124151c2877a3634ed09c8ee2994553274cbc25690602001611538565b60006125398161349e565b5061010f805461ff001981166101009182900460ff1615909102179055565b60606101078054806020026020016040519081016040528092919081815260200182805480156110bd57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612593575050505050905090565b606060008060006125ca85612490565b90506000816001600160401b038111156125e6576125e6614cd2565b60405190808252806020026020018201604052801561260f578160200160208202803683370190505b509050612635604080516060810182526000808252602082018190529181019190915290565b60015b8386146126f357600081815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b909104909116151591810182905292506126eb5781516001600160a01b0316156126ac57815194505b876001600160a01b0316856001600160a01b0316036126eb57808387806001019850815181106126de576126de6153f2565b6020026020010181815250505b600101612638565b50909695505050505050565b60006101085461270e83612490565b101592915050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060fe805461104490615320565b6000805b6101065481101561279f57826101068281548110612774576127746153f2565b90600052602060002001540361278d5750600192915050565b806127978161544b565b915050612754565b50600092915050565b60608183106127ca57604051631960ccad60e11b815260040160405180910390fd5b60fb5460009060018510156127de57600194505b808411156127ea578093505b60006127f587612490565b905084861015612814578585038181101561280e578091505b50612818565b5060005b6000816001600160401b0381111561283257612832614cd2565b60405190808252806020026020018201604052801561285b578160200160208202803683370190505b5090508160000361287157935061296492505050565b600061287c88612ca3565b90506000816040015161288d575080515b885b88811415801561289f5750848714155b1561295857600081815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b909104909116151591810182905293506129505782516001600160a01b03161561291157825191505b8a6001600160a01b0316826001600160a01b0316036129505780848880600101995081518110612943576129436153f2565b6020026020010181815250505b60010161288f565b50505092835250909150505b9392505050565b6000805b6101075481101561279f57826001600160a01b03166101078281548110612998576129986153f2565b6000918252602090912001546001600160a01b0316036129bb5750600192915050565b806129c58161544b565b91505061296f565b336001600160a01b038316036129f65760405163b06307db60e01b815260040160405180910390fd5b336000818152610102602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000612a6e8161349e565b50610109805460ff1916911515919091179055565b6000612a8e8161349e565b60008211612ad55760405162461bcd60e51b815260206004820152601460248201527326ab24289d1034b73b30b634b21039b2b0b9b7b760611b60448201526064016104ac565b5061010c55565b7fe098e2e7d2d4d3ca0e3877ceaaf3cdfbd47483f6699688ad12b1d6732deef10b612b068161349e565b60005b82811015612c5157846001600160a01b0316612b3c858584818110612b3057612b306153f2565b90506020020135611dd6565b6001600160a01b031614612b9e5760405162461bcd60e51b8152602060048201526024808201527f4d5648513a20746f6b656e206e6f74206f776e656420627920746f6b656e734f6044820152633bb732b960e11b60648201526084016104ac565b61010d6000858584818110612bb557612bb56153f2565b602090810292909201358352508101919091526040016000205460ff1615612c2a5760405162461bcd60e51b815260206004820152602260248201527f4d5648513a207768616c6520746f6b656e2063616e6e6f74206265206275726e604482015261195960f21b60648201526084016104ac565b612c3f8484838181106122b5576122b56153f2565b80612c498161544b565b915050612b09565b5050505050565b612c638484846134a8565b6001600160a01b0383163b15158015612c855750612c8384848484613b35565b155b156122d5576040516368d2bf6b60e11b815260040160405180910390fd5b60408051606080820183526000808352602080840182905283850182905284519283018552818352820181905292810192909252906001831080612ce9575060fb548310155b15612cf45792915050565b50600082815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b9091049091161580159282019290925290612d545792915050565b612964836139f3565b6000612d688161349e565b600083118015612d7e575060fb54600019018211155b612dca5760405162461bcd60e51b815260206004820152601960248201527f4d5648513a20696e76616c696420746f6b656e2072616e67650000000000000060448201526064016104ac565b825b8281116122d557600081815261010d602052604090205460ff16158015612df75750612df781613407565b15612e0757612e07816000613737565b80612e118161544b565b915050612dcc565b6060612e2482613407565b612e4157604051630a14c4b560e41b815260040160405180910390fd5b60006101048054612e5190615320565b90501115612e8c57610104612e6583613c21565b604051602001612e76929190615557565b6040516020818303038152906040529050919050565b505060408051602081019091526000815290565b919050565b6000612eb08161349e565b5061010b55565b600082815260656020526040902060010154612ed28161349e565b611194838361353b565b6000612ee78161349e565b612ef2848484613cb3565b604080516001600160a01b0386811682528516602082015290810183905233907f360bb0808951709e17b8c0ff5cf74aa15579508d1227398aac32794efdfe75ea9060600160405180910390a250505050565b6000612f508161349e565b61010f546201000090046001600160a01b03163b612fd65760405162461bcd60e51b815260206004820152603860248201527f4d5648513a206f70657261746f722066696c746572207265676973747279206160448201527f646472657373206973206e6f74206120636f6e7472616374000000000000000060648201526084016104ac565b5061010f8054911515600160b01b0260ff60b01b19909216919091179055565b60006130018161349e565b604051627eeac760e11b8152306004820152600080516020615742833981519152602482015260009073495f947276749ce646f68ac8c248420045cb7b5e9062fdd58e90604401602060405180830381865afa158015613065573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130899190615464565b9050600081116130db5760405162461bcd60e51b815260206004820181905260248201527f4d5648513a206e6f206c6567616379206b65797320746f207472616e7366657260448201526064016104ac565b604080518082018252600381526203078360ec1b60208201529051637921219560e11b815273495f947276749ce646f68ac8c248420045cb7b5e9163f242432a9161313f9130918891600080516020615742833981519152918891906004016154d7565b600060405180830381600087803b15801561315957600080fd5b505af115801561316d573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018590523393507ffeb6c27c598d8581a441fc8e59e9ef9fc43c0a609af2aed0554a05b5aaa6fca6925001611bed565b60006131bd8161349e565b61010580546001600160a01b038481166001600160a01b0319831681179093556040805191909216808252602082019390935233917fc8894f26f396ce8c004245c8b7cd1b92103a6e4302fcbab883987149ac01b7ec9101611bed565b600054610100900460ff161580801561323a5750600054600160ff909116105b806132545750303b158015613254575060005460ff166001145b6132b75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016104ac565b6000805460ff1916600117905580156132da576000805461ff0019166101001790555b61331c604051806040016040528060048152602001634d56485160e01b815250604051806040016040528060048152602001634d56485160e01b815250613cc0565b613324613cfd565b61332f6000336134b5565b8151613343906101049060208501906149b4565b5060056101085561010580546001600160a01b03191633179055610109805460ff19166001179055662386f26fc1000061010a55617dc461010b55801561134d576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60006001600160e01b031982166380ac58cd60e01b14806133f857506001600160e01b03198216635b5e139f60e01b145b80610fb95750610fb982613d26565b60008160011115801561341b575060fb5482105b8015610fb9575050600090815260ff6020819052604090912054600160e01b9004161590565b6000828152610101602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b61142d8133613d5b565b6111948383836001613db4565b6134bf8282612716565b61134d5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556134f73390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6135458282612716565b1561134d5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e361134d8161349e565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156135ff5761119483613fa3565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015613659575060408051601f3d908101601f1916820190925261365691810190615464565b60015b6136bc5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016104ac565b600080516020615762833981519152811461372b5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016104ac565b5061119483838361403f565b6000613742836139f3565b805190915082156137a8576000336001600160a01b038316148061376b575061376b8233610e78565b8061378657503361377b866110c7565b6001600160a01b0316145b9050806137a657604051632ce44b5f60e11b815260040160405180910390fd5b505b6137b460008583613441565b6001600160a01b038082166000818152610100602090815260408083208054600160801b6000196001600160401b0380841691909101811667ffffffffffffffff198416811783900482166001908101831690930277ffffffffffffffff0000000000000000ffffffffffffffff19909416179290921783558b865260ff909452828520805460ff60e01b1942909316600160a01b026001600160e01b03199091169097179690961716600160e01b1785559189018084529220805491949091166138b35760fb5482146138b357805460208701516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038716171781555b5050604051869250600091506001600160a01b038416906000805160206157a9833981519152908390a4505060fc805460010190555050565b60fb546000836001600160401b0381111561390957613909614cd2565b604051908082528060200260200182016040528015613932578160200160208202803683370190505b50905082156139a15760005b8481101561399b57600083815261010d60205260409020805460ff191660011790558261396a8161544b565b935082828151811061397e5761397e6153f2565b6020908102919091010152806139938161544b565b91505061393e565b506139e9565b60005b848110156139e757826139b68161544b565b93508282815181106139ca576139ca6153f2565b6020908102919091010152806139df8161544b565b9150506139a4565b505b612c518585613b1b565b60408051606081018252600080825260208201819052918101919091528180600111158015613a23575060fb5481105b15613b0257600081815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b909104909116151591810182905290613b005780516001600160a01b031615613a96579392505050565b5060001901600081815260ff6020818152604092839020835160608101855290546001600160a01b0381168083526001600160401b03600160a01b83041693830193909352600160e01b90049092161515928201929092529015613afb579392505050565b613a96565b505b604051636f96cda160e11b815260040160405180910390fd5b61134d828260405180602001604052806000815250614064565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613b6a9033908990889088906004016155f4565b6020604051808303816000875af1925050508015613ba5575060408051601f3d908101601f19168201909252613ba291810190615631565b60015b613c03573d808015613bd3576040519150601f19603f3d011682016040523d82523d6000602084013e613bd8565b606091505b508051600003613bfb576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b60606000613c2e83614071565b60010190506000816001600160401b03811115613c4d57613c4d614cd2565b6040519080825280601f01601f191660200182016040528015613c77576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613c8157509392505050565b6111948383836000613db4565b600054610100900460ff16613ce75760405162461bcd60e51b81526004016104ac9061564e565b613cf18282614149565b613cf9613cfd565b61134d5b600054610100900460ff16613d245760405162461bcd60e51b81526004016104ac9061564e565b565b60006001600160e01b03198216637965db0b60e01b1480610fb957506301ffc9a760e01b6001600160e01b0319831614610fb9565b613d658282612716565b61134d57613d72816141a1565b613d7d8360206141b3565b604051602001613d8e929190615699565b60408051601f198184030181529082905262461bcd60e51b82526104ac91600401614b06565b6000613dbf836139f3565b9050846001600160a01b031681600001516001600160a01b031614613df65760405162a1148160e81b815260040160405180910390fd5b8115613e7e576000336001600160a01b0387161480613e1a5750613e1a8633610e78565b80613e35575033613e2a856110c7565b6001600160a01b0316145b905080613e5557604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516613e7c57604051633a954ecd60e21b815260040160405180910390fd5b505b613e8b858585600161434e565b613e9760008487613441565b6001600160a01b03858116600090815261010060209081526040808320805467ffffffffffffffff198082166001600160401b039283166000190183161790925589861680865283862080549384169383166001908101841694909417905589865260ff90945282852080546001600160e01b031916909417600160a01b42909216919091021783558701808452922080549193909116613f6c5760fb548214613f6c57805460208501516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03166000805160206157a983398151915260405160405180910390a4612c51565b6001600160a01b0381163b6140105760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016104ac565b60008051602061576283398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61404883614687565b6000825111806140555750805b15611194576122d583836146c7565b61119483838360016147bb565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106140b05772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106140dc576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106140fa57662386f26fc10000830492506010015b6305f5e1008310614112576305f5e100830492506008015b612710831061412657612710830492506004015b60648310614138576064830492506002015b600a8310610fb95760010192915050565b600054610100900460ff166141705760405162461bcd60e51b81526004016104ac9061564e565b81516141839060fd9060208501906149b4565b5080516141979060fe9060208401906149b4565b50600160fb555050565b6060610fb96001600160a01b03831660145b606060006141c283600261551c565b6141cd9060026154a2565b6001600160401b038111156141e4576141e4614cd2565b6040519080825280601f01601f19166020018201604052801561420e576020820181803683370190505b509050600360fc1b81600081518110614229576142296153f2565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614258576142586153f2565b60200101906001600160f81b031916908160001a905350600061427c84600261551c565b6142879060016154a2565b90505b60018111156142ff576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106142bb576142bb6153f2565b1a60f81b8282815181106142d1576142d16153f2565b60200101906001600160f81b031916908160001a90535060049490941c936142f88161570e565b905061428a565b5083156129645760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104ac565b614359600033612716565b614559576143668461296b565b156143bf5760405162461bcd60e51b815260206004820152602360248201527f4d5648513a206b657920686f6c646572206164647265737320697320666c616760448201526219d95960ea1b60648201526084016104ac565b6143c88361296b565b156144235760405162461bcd60e51b815260206004820152602560248201527f4d5648513a206b6579207265636569766572206164647265737320697320666c6044820152641859d9d95960da1b60648201526084016104ac565b815b61442f82846154a2565b8110156145575761443f81612750565b156144835760405162461bcd60e51b8152602060048201526014602482015273135592144e881ad95e481a5cc8199b1859d9d95960621b60448201526064016104ac565b600081815261010d602052604090205460ff166144ec5761010f5460ff16156144e75760405162461bcd60e51b8152602060048201526016602482015275135592144e881d1c985b9cd9995c9cc81c185d5cd95960521b60448201526064016104ac565b614545565b61010f54610100900460ff16156145455760405162461bcd60e51b815260206004820152601c60248201527f4d5648513a207768616c65207472616e7366657273207061757365640000000060448201526064016104ac565b8061454f8161544b565b915050614425565b505b61010f54600160b01b900460ff168015614585575061010f546201000090046001600160a01b03163b15155b156146825761010f546040513060248201523360448201526000918291620100009091046001600160a01b03169060640160408051601f198184030181529181526020820180516001600160e01b0316633185c44d60e21b179052516145eb9190615725565b6000604051808303816000865af19150503d8060008114614628576040519150601f19603f3d011682016040523d82523d6000602084013e61462d565b606091505b50915091508161467f5760405162461bcd60e51b815260206004820152601760248201527f4d5648513a206f70657261746f722066696c746572656400000000000000000060448201526064016104ac565b50505b6122d5565b61469081613fa3565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b61472f5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016104ac565b600080846001600160a01b03168460405161474a9190615725565b600060405180830381855af49150503d8060008114614785576040519150601f19603f3d011682016040523d82523d6000602084013e61478a565b606091505b50915091506147b2828260405180606001604052806027815260200161578260279139614976565b95945050505050565b60fb546001600160a01b0385166147e457604051622e076360e81b815260040160405180910390fd5b836000036148055760405163b562e8dd60e01b815260040160405180910390fd5b614812600086838761434e565b6001600160a01b03851660008181526101006020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c0181169092021790915585845260ff90925290912080546001600160e01b031916909217600160a01b4290921691909102179055808085018380156148c457506001600160a01b0387163b15155b1561493a575b60405182906001600160a01b038916906000906000805160206157a9833981519152908290a46149036000888480600101955088613b35565b614920576040516368d2bf6b60e11b815260040160405180910390fd5b8082036148ca578260fb541461493557600080fd5b61496d565b5b6040516001830192906001600160a01b038916906000906000805160206157a9833981519152908290a480820361493b575b5060fb55612c51565b60608315614985575081612964565b612964838381511561499a5781518083602001fd5b8060405162461bcd60e51b81526004016104ac9190614b06565b8280546149c090615320565b90600052602060002090601f0160209004810192826149e25760008555614a28565b82601f106149fb57805160ff1916838001178555614a28565b82800160010185558215614a28579182015b82811115614a28578251825591602001919060010190614a0d565b50614a34929150614a38565b5090565b5b80821115614a345760008155600101614a39565b602080825260149082015273135592144e881b9bdd08185d5d1a1bdc9a5e995960621b604082015260600190565b6001600160e01b03198116811461142d57600080fd5b600060208284031215614aa357600080fd5b813561296481614a7b565b60005b83811015614ac9578181015183820152602001614ab1565b838111156122d55750506000910152565b60008151808452614af2816020860160208601614aae565b601f01601f19169290920160200192915050565b6020815260006129646020830184614ada565b600060208284031215614b2b57600080fd5b5035919050565b80356001600160a01b0381168114612ea057600080fd5b60008060408385031215614b5c57600080fd5b614b6583614b32565b946020939093013593505050565b600080600060608486031215614b8857600080fd5b614b9184614b32565b9250614b9f60208501614b32565b9150604084013590509250925092565b60008060408385031215614bc257600080fd5b82359150614bd260208401614b32565b90509250929050565b600060208284031215614bed57600080fd5b61296482614b32565b60008083601f840112614c0857600080fd5b5081356001600160401b03811115614c1f57600080fd5b6020830191508360208260051b8501011115614c3a57600080fd5b9250929050565b801515811461142d57600080fd5b600080600080600060608688031215614c6757600080fd5b85356001600160401b0380821115614c7e57600080fd5b614c8a89838a01614bf6565b90975095506020880135915080821115614ca357600080fd5b50614cb088828901614bf6565b9094509250506040860135614cc481614c41565b809150509295509295909350565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614d1057614d10614cd2565b604052919050565b60006001600160401b03831115614d3157614d31614cd2565b614d44601f8401601f1916602001614ce8565b9050828152838383011115614d5857600080fd5b828260208301376000602084830101529392505050565b600082601f830112614d8057600080fd5b61296483833560208501614d18565b60008060408385031215614da257600080fd5b614dab83614b32565b915060208301356001600160401b03811115614dc657600080fd5b614dd285828601614d6f565b9150509250929050565b600060208284031215614dee57600080fd5b81356001600160401b03811115614e0457600080fd5b8201601f81018413614e1557600080fd5b613c1984823560208401614d18565b60006020808385031215614e3757600080fd5b82356001600160401b0380821115614e4e57600080fd5b818501915085601f830112614e6257600080fd5b813581811115614e7457614e74614cd2565b8060051b9150614e85848301614ce8565b8181529183018401918481019088841115614e9f57600080fd5b938501935b83851015614ebd57843582529385019390850190614ea4565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b818110156126f357614f2083855180516001600160a01b031682526020808201516001600160401b0316908301526040908101511515910152565b9284019260609290920191600101614ee5565b60008060208385031215614f4657600080fd5b82356001600160401b03811115614f5c57600080fd5b614f6885828601614bf6565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156126f357835183529284019291840191600101614f90565b600060208284031215614fbe57600080fd5b813561296481614c41565b6020808252825182820181905260009190848201906040850190845b818110156126f35783516001600160a01b031683529284019291840191600101614fe5565b60008060006060848603121561501f57600080fd5b61502884614b32565b95602085013595506040909401359392505050565b6000806040838503121561505057600080fd5b61505983614b32565b9150602083013561506981614c41565b809150509250929050565b60008060006040848603121561508957600080fd5b61509284614b32565b925060208401356001600160401b038111156150ad57600080fd5b6150b986828701614bf6565b9497909650939450505050565b600080600080608085870312156150dc57600080fd5b6150e585614b32565b93506150f360208601614b32565b92506040850135915060608501356001600160401b0381111561511557600080fd5b61512187828801614d6f565b91505092959194509250565b60008083601f84011261513f57600080fd5b5081356001600160401b0381111561515657600080fd5b602083019150836020828501011115614c3a57600080fd5b60008060008060008060008060a0898b03121561518a57600080fd5b61519389614b32565b97506151a160208a01614b32565b965060408901356001600160401b03808211156151bd57600080fd5b6151c98c838d01614bf6565b909850965060608b01359150808211156151e257600080fd5b6151ee8c838d01614bf6565b909650945060808b013591508082111561520757600080fd5b506152148b828c0161512d565b999c989b5096995094979396929594505050565b81516001600160a01b031681526020808301516001600160401b03169082015260408083015115159082015260608101610fb9565b6000806040838503121561527057600080fd5b50508035926020909101359150565b6000806040838503121561529257600080fd5b61529b83614b32565b9150614bd260208401614b32565b60008060008060008060a087890312156152c257600080fd5b6152cb87614b32565b95506152d960208801614b32565b9450604087013593506060870135925060808701356001600160401b0381111561530257600080fd5b61530e89828a0161512d565b979a9699509497509295939492505050565b600181811c9082168061533457607f821691505b60208210810361535457634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008282101561543057615430615408565b500390565b634e487b7160e01b600052603160045260246000fd5b60006001820161545d5761545d615408565b5060010190565b60006020828403121561547657600080fd5b5051919050565b6040815260006154906040830185614ada565b82810360208401526147b28185614ada565b600082198211156154b5576154b5615408565b500190565b6000602082840312156154cc57600080fd5b815161296481614c41565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061551190830184614ada565b979650505050505050565b600081600019048311821515161561553657615536615408565b500290565b6000815161554d818560208601614aae565b9290920192915050565b600080845481600182811c91508083168061557357607f831692505b6020808410820361559257634e487b7160e01b86526022600452602486fd5b8180156155a657600181146155b7576155e4565b60ff198616895284890196506155e4565b60008b81526020902060005b868110156155dc5781548b8201529085019083016155c3565b505084890196505b5050505050506147b2818561553b565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061562790830184614ada565b9695505050505050565b60006020828403121561564357600080fd5b815161296481614a7b565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516156d1816017850160208801614aae565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615702816028840160208801614aae565b01602801949350505050565b60008161571d5761571d615408565b506000190190565b60008251615737818460208701614aae565b919091019291505056fe9b318f4ce0672a3f1ac661d9739a947f38b863a00000000000000100000005dc360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212203bb830f4ce012d4d6e64420bbea06cb4b6d081e2014dc954e60f592943a7ee8264736f6c634300080d0033
Loading...
Loading
Loading...
Loading
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.