ETH Price: $3,167.94 (+2.24%)

Contract

0x10D89160d4ab5E4D5aEa718B67154121b23dd7F3
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60a06040163204442023-01-02 17:00:35686 days ago1672678835IN
 Create: MVHQ
0 ETH0.0955527820.06372455

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MVHQ

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 30 : MVHQ.sol
// 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;

    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 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");
            }
        }
        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");
        _;
    }
}

File 2 of 30 : ERC1155.sol
// 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;
    }
}

File 3 of 30 : IERC1155.sol
// 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;
}

File 4 of 30 : IERC1155Receiver.sol
// 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);
}

File 5 of 30 : IERC1155MetadataURI.sol
// 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);
}

File 6 of 30 : Address.sol
// 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);
        }
    }
}

File 7 of 30 : Context.sol
// 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;
    }
}

File 8 of 30 : ERC165.sol
// 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;
    }
}

File 9 of 30 : IERC165.sol
// 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);
}

File 10 of 30 : AccessControlUpgradeable.sol
// 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;
}

File 11 of 30 : IAccessControlUpgradeable.sol
// 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;
}

File 12 of 30 : draft-IERC1822Upgradeable.sol
// 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);
}

File 13 of 30 : ERC1967UpgradeUpgradeable.sol
// 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;
}

File 14 of 30 : IBeaconUpgradeable.sol
// 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);
}

File 15 of 30 : Initializable.sol
// 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;
    }
}

File 16 of 30 : UUPSUpgradeable.sol
// 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;
}

File 17 of 30 : IERC721ReceiverUpgradeable.sol
// 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);
}

File 18 of 30 : IERC721Upgradeable.sol
// 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);
}

File 19 of 30 : IERC721MetadataUpgradeable.sol
// 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);
}

File 20 of 30 : AddressUpgradeable.sol
// 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);
        }
    }
}

File 21 of 30 : ContextUpgradeable.sol
// 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;
}

File 22 of 30 : StorageSlotUpgradeable.sol
// 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
        }
    }
}

File 23 of 30 : StringsUpgradeable.sol
// 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);
    }
}

File 24 of 30 : ERC165Upgradeable.sol
// 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;
}

File 25 of 30 : IERC165Upgradeable.sol
// 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);
}

File 26 of 30 : MathUpgradeable.sol
// 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);
        }
    }
}

File 27 of 30 : ERC721AUUPSUpgradeable.sol
// 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 {}
}

File 28 of 30 : ERC721ABurnableUUPSUpgradeable.sol
// 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);
    }
}

File 29 of 30 : ERC721AGoverenedUUPSUpgradeable.sol
// 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);
    }
}

File 30 of 30 : ERC721AQueryableUUPSUpgradeable.sol
// 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;
        }
    }
}

Settings
{
  "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

Contract ABI

[{"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":"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":"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"}]

60a06040523060805234801561001457600080fd5b5060805161553861004c600039600081816112a6015281816112e60152818161189f015281816118df015261196e01526155386000f3fe6080604052600436106104565760003560e01c806373417b091161023f578063b2dc5dc311610139578063d4d9b343116100b6578063ec87621c1161007a578063ec87621c14610df2578063f23a6e6114610e26578063f2fde38b14610e53578063f62d188814610e73578063f72c0d8b14610e9357600080fd5b8063d4d9b34314610d28578063d547741f14610d48578063da72c1e814610d68578063e127c45014610d88578063e985e9c514610da857600080fd5b8063c50b0fb0116100fd578063c50b0fb014610c94578063c802668d14610cab578063c87b56dd14610ccb578063cfba9fab14610ceb578063d4a6a2fd14610d0d57600080fd5b8063b2dc5dc314610bc8578063b2ea46c114610be8578063b88d4fde14610bff578063bc197c8114610c1f578063c23dc68f14610c6757600080fd5b806391ba317a116101c75780639a760fc61161018b5780639a760fc614610b33578063a217fddf14610b53578063a22cb46514610b68578063ae34490414610b88578063af88fac914610ba857600080fd5b806391ba317a14610aa757806391d1485414610abe57806395d89b4114610ade5780639937b0ce14610af357806399a2557a14610b1357600080fd5b80638462151c1161020e5780638462151c14610a035780638da5cb5b14610a235780638df9389c14610a445780638ef1e25914610a6c5780638faf6c3114610a8c57600080fd5b806373417b0914610995578063768ac99d146109b55780637ab4d1de146109ca5780637ccd134a146109e157600080fd5b80633e5ac28f1161035057806355f804b3116102d857806367a531731161029c57806367a53173146108fe5780636a6278421461091e5780636a9d57fd1461093e5780636c0360eb1461096057806370a082311461097557600080fd5b806355f804b31461085c5780635a50fd501461087c5780635bbb21771461089c5780636352211e146108c9578063658247a0146108e957600080fd5b806342966c681161031f57806342966c68146107d957806347af9957146107f95780634be2ede4146108145780634f1ef2861461083457806352d1902d1461084757600080fd5b80633e5ac28f1461076457806342842e0e146107795780634294e54414610799578063429644d9146107b957600080fd5b806323b872dd116103de57806336568abe116103a257806336568abe146106dc5780633659cfe6146106fc57806337cb2e091461071c57806338d023c21461073c5780633ccfd60b1461075c57600080fd5b806323b872dd14610635578063248a9ca31461065557806328bbc5c1146106855780632efbeccd1461069c5780632f2ff15d146106bc57600080fd5b806309e0a34f1161042557806309e0a34f1461057657806315497409146105b857806318160ddd146105d85780631cc26da8146105f5578063202fcbbd1461061557600080fd5b806301ffc9a7146104c557806306fdde03146104fa578063081812fc1461051c578063095ea7b31461055457600080fd5b366104c05761046433610ec7565b6104895760405162461bcd60e51b815260040161048090614787565b60405180910390fd5b60405134815233907f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f885258749060200160405180910390a2005b600080fd5b3480156104d157600080fd5b506104e56104e03660046147cb565b610f0a565b60405190151581526020015b60405180910390f35b34801561050657600080fd5b5061050f610f80565b6040516104f19190614840565b34801561052857600080fd5b5061053c610537366004614853565b611012565b6040516001600160a01b0390911681526020016104f1565b34801561056057600080fd5b5061057461056f366004614883565b611057565b005b34801561058257600080fd5b506105aa7fe098e2e7d2d4d3ca0e3877ceaaf3cdfbd47483f6699688ad12b1d6732deef10b81565b6040519081526020016104f1565b3480156105c457600080fd5b506105746105d3366004614853565b6110e4565b3480156105e457600080fd5b5060fc5460fb5403600019016105aa565b34801561060157600080fd5b5061010f546104e590610100900460ff1681565b34801561062157600080fd5b50610574610630366004614853565b611178565b34801561064157600080fd5b506105746106503660046148ad565b6111dc565b34801561066157600080fd5b506105aa610670366004614853565b60009081526065602052604090206001015490565b34801561069157600080fd5b506105aa61010a5481565b3480156106a857600080fd5b506105746106b7366004614853565b6111e7565b3480156106c857600080fd5b506105746106d73660046148e9565b6111f9565b3480156106e857600080fd5b506105746106f73660046148e9565b61121e565b34801561070857600080fd5b50610574610717366004614915565b61129c565b34801561072857600080fd5b50610574610737366004614915565b61137b565b34801561074857600080fd5b50610574610757366004614853565b611421565b61057461148f565b34801561077057600080fd5b50610574611532565b34801561078557600080fd5b506105746107943660046148ad565b611553565b3480156107a557600080fd5b506105746107b4366004614915565b61156e565b3480156107c557600080fd5b506105aa6107d4366004614915565b6116dc565b3480156107e557600080fd5b506105746107f4366004614853565b61176d565b34801561080557600080fd5b5061010f546104e59060ff1681565b34801561082057600080fd5b5061057461082f366004614989565b6117b5565b610574610842366004614ac9565b611895565b34801561085357600080fd5b506105aa611961565b34801561086857600080fd5b50610574610877366004614b16565b611a14565b34801561088857600080fd5b50610574610897366004614853565b611b0e565b3480156108a857600080fd5b506108bc6108b7366004614b5e565b611c24565b6040516104f19190614c03565b3480156108d557600080fd5b5061053c6108e4366004614853565b611cea565b3480156108f557600080fd5b50610574611cfc565b34801561090a57600080fd5b50610574610919366004614c6d565b61213c565b34801561092a57600080fd5b50610574610939366004614915565b6121ef565b34801561094a57600080fd5b506109536122bd565b6040516104f19190614cae565b34801561096c57600080fd5b5061050f612315565b34801561098157600080fd5b506105aa610990366004614915565b6123a4565b3480156109a157600080fd5b506105746109b0366004614ce6565b6123f3565b3480156109c157600080fd5b50610574612442565b3480156109d657600080fd5b506105aa6101085481565b3480156109ed57600080fd5b506109f661246c565b6040516104f19190614d03565b348015610a0f57600080fd5b50610953610a1e366004614915565b6124ce565b348015610a2f57600080fd5b506101055461053c906001600160a01b031681565b348015610a5057600080fd5b5061053c73495f947276749ce646f68ac8c248420045cb7b5e81565b348015610a7857600080fd5b506104e5610a87366004614915565b612613565b348015610a9857600080fd5b50610109546104e59060ff1681565b348015610ab357600080fd5b506105aa61010e5481565b348015610aca57600080fd5b506104e5610ad93660046148e9565b61262a565b348015610aea57600080fd5b5061050f612655565b348015610aff57600080fd5b506104e5610b0e366004614853565b612664565b348015610b1f57600080fd5b50610953610b2e366004614d44565b6126bc565b348015610b3f57600080fd5b506104e5610b4e366004614915565b61287f565b348015610b5f57600080fd5b506105aa600081565b348015610b7457600080fd5b50610574610b83366004614d77565b6128e1565b348015610b9457600080fd5b50610574610ba3366004614ce6565b612977565b348015610bb457600080fd5b50610574610bc3366004614853565b612997565b348015610bd457600080fd5b50610574610be3366004614dae565b6129f0565b348015610bf457600080fd5b506105aa61010b5481565b348015610c0b57600080fd5b50610574610c1a366004614e00565b612b6c565b348015610c2b57600080fd5b50610c4e610c3a366004614ea8565b63bc197c8160e01b98975050505050505050565b6040516001600160e01b031990911681526020016104f1565b348015610c7357600080fd5b50610c87610c82366004614853565b612bb7565b6040516104f19190614f62565b348015610ca057600080fd5b506105aa61010c5481565b348015610cb757600080fd5b50610574610cc6366004614f97565b612c71565b348015610cd757600080fd5b5061050f610ce6366004614853565b612d2d565b348015610cf757600080fd5b506105aa60008051602061547c83398151915281565b348015610d1957600080fd5b50610103546104e59060ff1681565b348015610d3457600080fd5b50610574610d43366004614853565b612db9565b348015610d5457600080fd5b50610574610d633660046148e9565b612dcb565b348015610d7457600080fd5b50610574610d833660046148ad565b612df0565b348015610d9457600080fd5b50610574610da3366004614915565b612e59565b348015610db457600080fd5b506104e5610dc3366004614fb9565b6001600160a01b0391821660009081526101026020908152604080832093909416825291909152205460ff1690565b348015610dfe57600080fd5b506105aa7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b348015610e3257600080fd5b50610c4e610e41366004614fe3565b63f23a6e6160e01b9695505050505050565b348015610e5f57600080fd5b50610574610e6e366004614915565b613015565b348015610e7f57600080fd5b50610574610e8e366004614b16565b61307d565b348015610e9f57600080fd5b506105aa7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b6000610ef37f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b088361262a565b80610f045750610f0460008361262a565b92915050565b60006001600160e01b031982166380ac58cd60e01b1480610f3b57506001600160e01b03198216635b5e139f60e01b145b80610f5657506001600160e01b0319821663da8def7360e01b145b80610f7157506001600160e01b031982166301ffc9a760e01b145b80610f045750610f048261322a565b606060fd8054610f8f9061505a565b80601f0160208091040260200160405190810160405280929190818152602001828054610fbb9061505a565b80156110085780601f10610fdd57610100808354040283529160200191611008565b820191906000526020600020905b815481529060010190602001808311610feb57829003601f168201915b5050505050905090565b600061101d8261326a565b61103a576040516333d1c03960e21b815260040160405180910390fd5b50600090815261010160205260409020546001600160a01b031690565b600061106282611cea565b9050806001600160a01b0316836001600160a01b0316036110965760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b038216148015906110b657506110b48133610dc3565b155b156110d4576040516367d9dca160e11b815260040160405180910390fd5b6110df8383836132a4565b505050565b6110ed33610ec7565b6111095760405162461bcd60e51b815260040161048090614787565b61010680546001810182556000919091527fc9ef9fceea91e87b2c84ea400a44fde78842aae8aa24cd4b502ce5fb4d91e63b0181905560405181815233907f540e004b1e599d2b6e04cb22f77b5c15ed1a83347064d867e964e25a073f5dd7906020015b60405180910390a250565b600061118381613301565b60fb548210156111d55760405162461bcd60e51b815260206004820152601a60248201527f4d5648513a206d617820746f6b656e20696420696e76616c69640000000000006044820152606401610480565b5061010e55565b6110df83838361330b565b60006111f281613301565b5061010a55565b60008281526065602052604090206001015461121481613301565b6110df8383613318565b6001600160a01b038116331461128e5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610480565b611298828261339e565b5050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036112e45760405162461bcd60e51b815260040161048090615094565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661132d60008051602061549c833981519152546001600160a01b031690565b6001600160a01b0316146113535760405162461bcd60e51b8152600401610480906150e0565b61135c81613405565b604080516000808252602082019092526113789183919061342f565b50565b61138433610ec7565b6113a05760405162461bcd60e51b815260040161048090614787565b61010780546001810182556000919091527f47c4908e245f386bfc1825973249847f4053a761ddb4880ad63c323a7b5a2a250180546001600160a01b0319166001600160a01b03831690811790915560405190815233907ff34c09a7cee2ec36676b00d8197a8db8ba2c6e091727126e27c8e3c34747f1a39060200161116d565b61142a33610ec7565b6114465760405162461bcd60e51b815260040161048090614787565b610108805490829055604080518281526020810184905233917fa091af460c0b001329ed8c9156f41f3efcc95ae5136f2c44f6746c4d778cf7fc91015b60405180910390a25050565b600061149a81613301565b604051600090339047908381818185875af1925050503d80600081146114dc576040519150601f19603f3d011682016040523d82523d6000602084013e6114e1565b606091505b50509050806112985760405162461bcd60e51b815260206004820152601860248201527f4d5648513a206661696c656420746f20776974686472617700000000000000006044820152606401610480565b600061153d81613301565b5061010f805460ff19811660ff90911615179055565b6110df83838360405180602001604052806000815250612b6c565b61157733610ec7565b6115935760405162461bcd60e51b815260040161048090614787565b60005b610107548110156116a057816001600160a01b031661010782815481106115bf576115bf61512c565b6000918252602090912001546001600160a01b03160361168e5761010780546115ea90600190615158565b815481106115fa576115fa61512c565b60009182526020909120015461010780546001600160a01b0390921691839081106116275761162761512c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506101078054806116675761166761516f565b600082815260209020810160001990810180546001600160a01b03191690550190556116a0565b8061169881615185565b915050611596565b506040516001600160a01b038216815233907fcc229432447e3f287b17d54ea5b3efb13d26e022102362f4d8eba4ac37fb8c769060200161116d565b604051627eeac760e11b81526001600160a01b038216600482015260008051602061547c833981519152602482015260009073495f947276749ce646f68ac8c248420045cb7b5e9062fdd58e90604401602060405180830381865afa158015611749573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f04919061519e565b600061177881613301565b61178382600061359a565b60405182815233907feb1a139f5480882ec767b34b3d7386a850268910ed1dc7acb55c88a1e3a238ec90602001611483565b60006117c081613301565b8483146118265760405162461bcd60e51b815260206004820152602e60248201527f4d5648513a2072656365697665727320616e64207175616e746974696573206c60448201526d0cadccee8d040dad2e6dac2e8c6d60931b6064820152608401610480565b60005b8581101561188c5761187a8787838181106118465761184661512c565b905060200201602081019061185b9190614915565b86868481811061186d5761186d61512c565b905060200201358561374f565b8061188481615185565b915050611829565b50505050505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036118dd5760405162461bcd60e51b815260040161048090615094565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661192660008051602061549c833981519152546001600160a01b031690565b6001600160a01b03161461194c5760405162461bcd60e51b8152600401610480906150e0565b61195582613405565b6112988282600161342f565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611a015760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610480565b5060008051602061549c83398151915290565b6000611a1f81613301565b60006101048054611a2f9061505a565b80601f0160208091040260200160405190810160405280929190818152602001828054611a5b9061505a565b8015611aa85780601f10611a7d57610100808354040283529160200191611aa8565b820191906000526020600020905b815481529060010190602001808311611a8b57829003601f168201915b50508651939450611ac593610104935060208801925090506146ee565b50336001600160a01b03167f92bf6a7b8937c17e6781a68d61f9fe6a5ce08604b96ca2206f311049a3a295ea8285604051611b019291906151b7565b60405180910390a2505050565b611b1733610ec7565b611b335760405162461bcd60e51b815260040161048090614787565b60005b61010654811015611bf157816101068281548110611b5657611b5661512c565b906000526020600020015403611bdf576101068054611b7790600190615158565b81548110611b8757611b8761512c565b90600052602060002001546101068281548110611ba657611ba661512c565b600091825260209091200155610106805480611bc457611bc461516f565b60019003818190600052602060002001600090559055611bf1565b80611be981615185565b915050611b36565b5060405181815233907f5bff50bb0ea7b604b792895e3a30ed31d4502d8c105e5c7c7982c8ac765beb819060200161116d565b80516060906000816001600160401b03811115611c4357611c43614a0c565b604051908082528060200260200182016040528015611c8e57816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181611c615790505b50905060005b828114611ce257611cbd858281518110611cb057611cb061512c565b6020026020010151612bb7565b828281518110611ccf57611ccf61512c565b6020908102919091010152600101611c94565b509392505050565b6000611cf582613856565b5192915050565b600061010b545a611d0d91906151dc565b9050611d1833610ec7565b80611d2657506101035460ff165b611d725760405162461bcd60e51b815260206004820152601960248201527f4d5648513a20636c61696d696e67206e6f7420616374697665000000000000006044820152606401610480565b60405163e985e9c560e01b815233600482015230602482015273495f947276749ce646f68ac8c248420045cb7b5e9063e985e9c590604401602060405180830381865afa158015611dc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611deb91906151f4565b611e375760405162461bcd60e51b815260206004820152601760248201527f4d5648513a20617070726f76616c2072657175697265640000000000000000006044820152606401610480565b604051627eeac760e11b815233600482015260008051602061547c833981519152602482015260009073495f947276749ce646f68ac8c248420045cb7b5e9062fdd58e90604401602060405180830381865afa158015611e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ebf919061519e565b905060008111611f115760405162461bcd60e51b815260206004820152601760248201527f4d5648513a206e6f20636c61696d61626c65206b6579730000000000000000006044820152606401610480565b60408051600180825281830190925260009160208083019080368337505060408051600180825281830190925292935060009291506020808301908036833701905050905060008051602061547c83398151915282600081518110611f7857611f7861512c565b6020026020010181815250508281600081518110611f9857611f9861512c565b60200260200101818152505073495f947276749ce646f68ac8c248420045cb7b5e6001600160a01b031663f242432a333060008051602061547c833981519152876040518060400160405280600381526020016203078360ec1b8152506040518663ffffffff1660e01b8152600401612015959493929190615211565b600060405180830381600087803b15801561202f57600080fd5b505af1158015612043573d6000803e3d6000fd5b50505050612051338461397e565b60405183815233907f6df341e167ad905feb841b44d47d5589106540c65e6fe465047aaf23cd30c5a89060200160405180910390a250506101095460ff16905080156120a0575061010a544710155b156113785760003a5a6120b39084615158565b6120bd9190615256565b9050336001600160a01b03166108fc61010a5483116120dc57826120e1565b61010a545b6040518115909202916000818181858888f19350505050158015612109573d6000803e3d6000fd5b5060405181815233907fd7dee2702d63ad89917b6a4da9981c90c4d24f8c2bdfd64c604ecae57d8d065190602001611483565b600061214781613301565b60005b828110156121e95761010d60008585848181106121695761216961512c565b602090810292909201358352508101919091526040016000205460ff161580156121af57506121af8484838181106121a3576121a361512c565b9050602002013561326a565b156121d7576121d78484838181106121c9576121c961512c565b90506020020135600061359a565b806121e181615185565b91505061214a565b50505050565b7fe098e2e7d2d4d3ca0e3877ceaaf3cdfbd47483f6699688ad12b1d6732deef10b61221981613301565b61010e5460fb54111561226e5760405162461bcd60e51b815260206004820152601f60248201527f4d5648513a20776f756c6420657863656564206d617820746f6b656e206964006044820152606401610480565b60fb5461227c83600161397e565b60408051828152600060208201526001600160a01b038516917ff77ae1a2d08f704c6f96fbda4f182340181248bdb7483eb9fa8cefdbf2d079829101611b01565b606061010680548060200260200160405190810160405280929190818152602001828054801561100857602002820191906000526020600020905b8154815260200190600101908083116122f8575050505050905090565b61010480546123239061505a565b80601f016020809104026020016040519081016040528092919081815260200182805461234f9061505a565b801561239c5780601f106123715761010080835404028352916020019161239c565b820191906000526020600020905b81548152906001019060200180831161237f57829003601f168201915b505050505081565b60006001600160a01b0382166123cd576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b0316600090815261010060205260409020546001600160401b031690565b60006123fe81613301565b610103805460ff191683151590811790915560405190815233907fcfac0d114d14393344fe66cb124151c2877a3634ed09c8ee2994553274cbc25690602001611483565b600061244d81613301565b5061010f805461ff001981166101009182900460ff1615909102179055565b606061010780548060200260200160405190810160405280929190818152602001828054801561100857602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116124a7575050505050905090565b606060008060006124de856123a4565b90506000816001600160401b038111156124fa576124fa614a0c565b604051908082528060200260200182016040528015612523578160200160208202803683370190505b509050612549604080516060810182526000808252602082018190529181019190915290565b60015b83861461260757600081815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b909104909116151591810182905292506125ff5781516001600160a01b0316156125c057815194505b876001600160a01b0316856001600160a01b0316036125ff57808387806001019850815181106125f2576125f261512c565b6020026020010181815250505b60010161254c565b50909695505050505050565b600061010854612622836123a4565b101592915050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060fe8054610f8f9061505a565b6000805b610106548110156126b3578261010682815481106126885761268861512c565b9060005260206000200154036126a15750600192915050565b806126ab81615185565b915050612668565b50600092915050565b60608183106126de57604051631960ccad60e11b815260040160405180910390fd5b60fb5460009060018510156126f257600194505b808411156126fe578093505b6000612709876123a4565b9050848610156127285785850381811015612722578091505b5061272c565b5060005b6000816001600160401b0381111561274657612746614a0c565b60405190808252806020026020018201604052801561276f578160200160208202803683370190505b5090508160000361278557935061287892505050565b600061279088612bb7565b9050600081604001516127a1575080515b885b8881141580156127b35750848714155b1561286c57600081815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b909104909116151591810182905293506128645782516001600160a01b03161561282557825191505b8a6001600160a01b0316826001600160a01b03160361286457808488806001019950815181106128575761285761512c565b6020026020010181815250505b6001016127a3565b50505092835250909150505b9392505050565b6000805b610107548110156126b357826001600160a01b031661010782815481106128ac576128ac61512c565b6000918252602090912001546001600160a01b0316036128cf5750600192915050565b806128d981615185565b915050612883565b336001600160a01b0383160361290a5760405163b06307db60e01b815260040160405180910390fd5b336000818152610102602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600061298281613301565b50610109805460ff1916911515919091179055565b60006129a281613301565b600082116129e95760405162461bcd60e51b815260206004820152601460248201527326ab24289d1034b73b30b634b21039b2b0b9b7b760611b6044820152606401610480565b5061010c55565b7fe098e2e7d2d4d3ca0e3877ceaaf3cdfbd47483f6699688ad12b1d6732deef10b612a1a81613301565b60005b82811015612b6557846001600160a01b0316612a50858584818110612a4457612a4461512c565b90506020020135611cea565b6001600160a01b031614612ab25760405162461bcd60e51b8152602060048201526024808201527f4d5648513a20746f6b656e206e6f74206f776e656420627920746f6b656e734f6044820152633bb732b960e11b6064820152608401610480565b61010d6000858584818110612ac957612ac961512c565b602090810292909201358352508101919091526040016000205460ff1615612b3e5760405162461bcd60e51b815260206004820152602260248201527f4d5648513a207768616c6520746f6b656e2063616e6e6f74206265206275726e604482015261195960f21b6064820152608401610480565b612b538484838181106121c9576121c961512c565b80612b5d81615185565b915050612a1d565b5050505050565b612b7784848461330b565b6001600160a01b0383163b15158015612b995750612b9784848484613998565b155b156121e9576040516368d2bf6b60e11b815260040160405180910390fd5b60408051606080820183526000808352602080840182905283850182905284519283018552818352820181905292810192909252906001831080612bfd575060fb548310155b15612c085792915050565b50600082815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b9091049091161580159282019290925290612c685792915050565b61287883613856565b6000612c7c81613301565b600083118015612c92575060fb54600019018211155b612cde5760405162461bcd60e51b815260206004820152601960248201527f4d5648513a20696e76616c696420746f6b656e2072616e6765000000000000006044820152606401610480565b825b8281116121e957600081815261010d602052604090205460ff16158015612d0b5750612d0b8161326a565b15612d1b57612d1b81600061359a565b80612d2581615185565b915050612ce0565b6060612d388261326a565b612d5557604051630a14c4b560e41b815260040160405180910390fd5b60006101048054612d659061505a565b90501115612da057610104612d7983613a84565b604051602001612d8a929190615291565b6040516020818303038152906040529050919050565b505060408051602081019091526000815290565b919050565b6000612dc481613301565b5061010b55565b600082815260656020526040902060010154612de681613301565b6110df838361339e565b6000612dfb81613301565b612e06848484613b16565b604080516001600160a01b0386811682528516602082015290810183905233907f360bb0808951709e17b8c0ff5cf74aa15579508d1227398aac32794efdfe75ea9060600160405180910390a250505050565b6000612e6481613301565b604051627eeac760e11b815230600482015260008051602061547c833981519152602482015260009073495f947276749ce646f68ac8c248420045cb7b5e9062fdd58e90604401602060405180830381865afa158015612ec8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eec919061519e565b905060008111612f3e5760405162461bcd60e51b815260206004820181905260248201527f4d5648513a206e6f206c6567616379206b65797320746f207472616e736665726044820152606401610480565b604080518082018252600381526203078360ec1b60208201529051637921219560e11b815273495f947276749ce646f68ac8c248420045cb7b5e9163f242432a91612fa2913091889160008051602061547c83398151915291889190600401615211565b600060405180830381600087803b158015612fbc57600080fd5b505af1158015612fd0573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018590523393507ffeb6c27c598d8581a441fc8e59e9ef9fc43c0a609af2aed0554a05b5aaa6fca6925001611b01565b600061302081613301565b61010580546001600160a01b038481166001600160a01b0319831681179093556040805191909216808252602082019390935233917fc8894f26f396ce8c004245c8b7cd1b92103a6e4302fcbab883987149ac01b7ec9101611b01565b600054610100900460ff161580801561309d5750600054600160ff909116105b806130b75750303b1580156130b7575060005460ff166001145b61311a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610480565b6000805460ff19166001179055801561313d576000805461ff0019166101001790555b61317f604051806040016040528060048152602001634d56485160e01b815250604051806040016040528060048152602001634d56485160e01b815250613b23565b613187613b60565b613192600033613318565b81516131a6906101049060208501906146ee565b5060056101085561010580546001600160a01b03191633179055610109805460ff19166001179055662386f26fc1000061010a55617dc461010b558015611298576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60006001600160e01b031982166380ac58cd60e01b148061325b57506001600160e01b03198216635b5e139f60e01b145b80610f045750610f0482613b89565b60008160011115801561327e575060fb5482105b8015610f04575050600090815260ff6020819052604090912054600160e01b9004161590565b6000828152610101602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6113788133613bbe565b6110df8383836001613c17565b613322828261262a565b6112985760008281526065602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561335a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6133a8828261262a565b156112985760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e361129881613301565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615613462576110df83613e06565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156134bc575060408051601f3d908101601f191682019092526134b99181019061519e565b60015b61351f5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610480565b60008051602061549c833981519152811461358e5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610480565b506110df838383613ea2565b60006135a583613856565b8051909150821561360b576000336001600160a01b03831614806135ce57506135ce8233610dc3565b806135e95750336135de86611012565b6001600160a01b0316145b90508061360957604051632ce44b5f60e11b815260040160405180910390fd5b505b613617600085836132a4565b6001600160a01b038082166000818152610100602090815260408083208054600160801b6000196001600160401b0380841691909101811667ffffffffffffffff198416811783900482166001908101831690930277ffffffffffffffff0000000000000000ffffffffffffffff19909416179290921783558b865260ff909452828520805460ff60e01b1942909316600160a01b026001600160e01b03199091169097179690961716600160e01b1785559189018084529220805491949091166137165760fb54821461371657805460208701516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038716171781555b5050604051869250600091506001600160a01b038416906000805160206154e3833981519152908390a4505060fc805460010190555050565b60fb546000836001600160401b0381111561376c5761376c614a0c565b604051908082528060200260200182016040528015613795578160200160208202803683370190505b50905082156138045760005b848110156137fe57600083815261010d60205260409020805460ff19166001179055826137cd81615185565b93508282815181106137e1576137e161512c565b6020908102919091010152806137f681615185565b9150506137a1565b5061384c565b60005b8481101561384a578261381981615185565b935082828151811061382d5761382d61512c565b60209081029190910101528061384281615185565b915050613807565b505b612b65858561397e565b60408051606081018252600080825260208201819052918101919091528180600111158015613886575060fb5481105b1561396557600081815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b9091049091161515918101829052906139635780516001600160a01b0316156138f9579392505050565b5060001901600081815260ff6020818152604092839020835160608101855290546001600160a01b0381168083526001600160401b03600160a01b83041693830193909352600160e01b9004909216151592820192909252901561395e579392505050565b6138f9565b505b604051636f96cda160e11b815260040160405180910390fd5b611298828260405180602001604052806000815250613ec7565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906139cd90339089908890889060040161532e565b6020604051808303816000875af1925050508015613a08575060408051601f3d908101601f19168201909252613a059181019061536b565b60015b613a66573d808015613a36576040519150601f19603f3d011682016040523d82523d6000602084013e613a3b565b606091505b508051600003613a5e576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b60606000613a9183613ed4565b60010190506000816001600160401b03811115613ab057613ab0614a0c565b6040519080825280601f01601f191660200182016040528015613ada576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613ae457509392505050565b6110df8383836000613c17565b600054610100900460ff16613b4a5760405162461bcd60e51b815260040161048090615388565b613b548282613fac565b613b5c613b60565b6112985b600054610100900460ff16613b875760405162461bcd60e51b815260040161048090615388565b565b60006001600160e01b03198216637965db0b60e01b1480610f0457506301ffc9a760e01b6001600160e01b0319831614610f04565b613bc8828261262a565b61129857613bd581614004565b613be0836020614016565b604051602001613bf19291906153d3565b60408051601f198184030181529082905262461bcd60e51b825261048091600401614840565b6000613c2283613856565b9050846001600160a01b031681600001516001600160a01b031614613c595760405162a1148160e81b815260040160405180910390fd5b8115613ce1576000336001600160a01b0387161480613c7d5750613c7d8633610dc3565b80613c98575033613c8d85611012565b6001600160a01b0316145b905080613cb857604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516613cdf57604051633a954ecd60e21b815260040160405180910390fd5b505b613cee85858560016141b1565b613cfa600084876132a4565b6001600160a01b03858116600090815261010060209081526040808320805467ffffffffffffffff198082166001600160401b039283166000190183161790925589861680865283862080549384169383166001908101841694909417905589865260ff90945282852080546001600160e01b031916909417600160a01b42909216919091021783558701808452922080549193909116613dcf5760fb548214613dcf57805460208501516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03166000805160206154e383398151915260405160405180910390a4612b65565b6001600160a01b0381163b613e735760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610480565b60008051602061549c83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b613eab836143c1565b600082511180613eb85750805b156110df576121e98383614401565b6110df83838360016144f5565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310613f135772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310613f3f576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310613f5d57662386f26fc10000830492506010015b6305f5e1008310613f75576305f5e100830492506008015b6127108310613f8957612710830492506004015b60648310613f9b576064830492506002015b600a8310610f045760010192915050565b600054610100900460ff16613fd35760405162461bcd60e51b815260040161048090615388565b8151613fe69060fd9060208501906146ee565b508051613ffa9060fe9060208401906146ee565b50600160fb555050565b6060610f046001600160a01b03831660145b60606000614025836002615256565b6140309060026151dc565b6001600160401b0381111561404757614047614a0c565b6040519080825280601f01601f191660200182016040528015614071576020820181803683370190505b509050600360fc1b8160008151811061408c5761408c61512c565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106140bb576140bb61512c565b60200101906001600160f81b031916908160001a90535060006140df846002615256565b6140ea9060016151dc565b90505b6001811115614162576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061411e5761411e61512c565b1a60f81b8282815181106141345761413461512c565b60200101906001600160f81b031916908160001a90535060049490941c9361415b81615448565b90506140ed565b5083156128785760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610480565b6141bc60003361262a565b6143bc576141c98461287f565b156142225760405162461bcd60e51b815260206004820152602360248201527f4d5648513a206b657920686f6c646572206164647265737320697320666c616760448201526219d95960ea1b6064820152608401610480565b61422b8361287f565b156142865760405162461bcd60e51b815260206004820152602560248201527f4d5648513a206b6579207265636569766572206164647265737320697320666c6044820152641859d9d95960da1b6064820152608401610480565b815b61429282846151dc565b8110156143ba576142a281612664565b156142e65760405162461bcd60e51b8152602060048201526014602482015273135592144e881ad95e481a5cc8199b1859d9d95960621b6044820152606401610480565b600081815261010d602052604090205460ff1661434f5761010f5460ff161561434a5760405162461bcd60e51b8152602060048201526016602482015275135592144e881d1c985b9cd9995c9cc81c185d5cd95960521b6044820152606401610480565b6143a8565b61010f54610100900460ff16156143a85760405162461bcd60e51b815260206004820152601c60248201527f4d5648513a207768616c65207472616e736665727320706175736564000000006044820152606401610480565b806143b281615185565b915050614288565b505b6121e9565b6143ca81613e06565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6144695760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610480565b600080846001600160a01b031684604051614484919061545f565b600060405180830381855af49150503d80600081146144bf576040519150601f19603f3d011682016040523d82523d6000602084013e6144c4565b606091505b50915091506144ec82826040518060600160405280602781526020016154bc602791396146b0565b95945050505050565b60fb546001600160a01b03851661451e57604051622e076360e81b815260040160405180910390fd5b8360000361453f5760405163b562e8dd60e01b815260040160405180910390fd5b61454c60008683876141b1565b6001600160a01b03851660008181526101006020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c0181169092021790915585845260ff90925290912080546001600160e01b031916909217600160a01b4290921691909102179055808085018380156145fe57506001600160a01b0387163b15155b15614674575b60405182906001600160a01b038916906000906000805160206154e3833981519152908290a461463d6000888480600101955088613998565b61465a576040516368d2bf6b60e11b815260040160405180910390fd5b808203614604578260fb541461466f57600080fd5b6146a7565b5b6040516001830192906001600160a01b038916906000906000805160206154e3833981519152908290a4808203614675575b5060fb55612b65565b606083156146bf575081612878565b61287883838151156146d45781518083602001fd5b8060405162461bcd60e51b81526004016104809190614840565b8280546146fa9061505a565b90600052602060002090601f01602090048101928261471c5760008555614762565b82601f1061473557805160ff1916838001178555614762565b82800160010185558215614762579182015b82811115614762578251825591602001919060010190614747565b5061476e929150614772565b5090565b5b8082111561476e5760008155600101614773565b602080825260149082015273135592144e881b9bdd08185d5d1a1bdc9a5e995960621b604082015260600190565b6001600160e01b03198116811461137857600080fd5b6000602082840312156147dd57600080fd5b8135612878816147b5565b60005b838110156148035781810151838201526020016147eb565b838111156121e95750506000910152565b6000815180845261482c8160208601602086016147e8565b601f01601f19169290920160200192915050565b6020815260006128786020830184614814565b60006020828403121561486557600080fd5b5035919050565b80356001600160a01b0381168114612db457600080fd5b6000806040838503121561489657600080fd5b61489f8361486c565b946020939093013593505050565b6000806000606084860312156148c257600080fd5b6148cb8461486c565b92506148d96020850161486c565b9150604084013590509250925092565b600080604083850312156148fc57600080fd5b8235915061490c6020840161486c565b90509250929050565b60006020828403121561492757600080fd5b6128788261486c565b60008083601f84011261494257600080fd5b5081356001600160401b0381111561495957600080fd5b6020830191508360208260051b850101111561497457600080fd5b9250929050565b801515811461137857600080fd5b6000806000806000606086880312156149a157600080fd5b85356001600160401b03808211156149b857600080fd5b6149c489838a01614930565b909750955060208801359150808211156149dd57600080fd5b506149ea88828901614930565b90945092505060408601356149fe8161497b565b809150509295509295909350565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614a4a57614a4a614a0c565b604052919050565b60006001600160401b03831115614a6b57614a6b614a0c565b614a7e601f8401601f1916602001614a22565b9050828152838383011115614a9257600080fd5b828260208301376000602084830101529392505050565b600082601f830112614aba57600080fd5b61287883833560208501614a52565b60008060408385031215614adc57600080fd5b614ae58361486c565b915060208301356001600160401b03811115614b0057600080fd5b614b0c85828601614aa9565b9150509250929050565b600060208284031215614b2857600080fd5b81356001600160401b03811115614b3e57600080fd5b8201601f81018413614b4f57600080fd5b613a7c84823560208401614a52565b60006020808385031215614b7157600080fd5b82356001600160401b0380821115614b8857600080fd5b818501915085601f830112614b9c57600080fd5b813581811115614bae57614bae614a0c565b8060051b9150614bbf848301614a22565b8181529183018401918481019088841115614bd957600080fd5b938501935b83851015614bf757843582529385019390850190614bde565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561260757614c5a83855180516001600160a01b031682526020808201516001600160401b0316908301526040908101511515910152565b9284019260609290920191600101614c1f565b60008060208385031215614c8057600080fd5b82356001600160401b03811115614c9657600080fd5b614ca285828601614930565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561260757835183529284019291840191600101614cca565b600060208284031215614cf857600080fd5b81356128788161497b565b6020808252825182820181905260009190848201906040850190845b818110156126075783516001600160a01b031683529284019291840191600101614d1f565b600080600060608486031215614d5957600080fd5b614d628461486c565b95602085013595506040909401359392505050565b60008060408385031215614d8a57600080fd5b614d938361486c565b91506020830135614da38161497b565b809150509250929050565b600080600060408486031215614dc357600080fd5b614dcc8461486c565b925060208401356001600160401b03811115614de757600080fd5b614df386828701614930565b9497909650939450505050565b60008060008060808587031215614e1657600080fd5b614e1f8561486c565b9350614e2d6020860161486c565b92506040850135915060608501356001600160401b03811115614e4f57600080fd5b614e5b87828801614aa9565b91505092959194509250565b60008083601f840112614e7957600080fd5b5081356001600160401b03811115614e9057600080fd5b60208301915083602082850101111561497457600080fd5b60008060008060008060008060a0898b031215614ec457600080fd5b614ecd8961486c565b9750614edb60208a0161486c565b965060408901356001600160401b0380821115614ef757600080fd5b614f038c838d01614930565b909850965060608b0135915080821115614f1c57600080fd5b614f288c838d01614930565b909650945060808b0135915080821115614f4157600080fd5b50614f4e8b828c01614e67565b999c989b5096995094979396929594505050565b81516001600160a01b031681526020808301516001600160401b03169082015260408083015115159082015260608101610f04565b60008060408385031215614faa57600080fd5b50508035926020909101359150565b60008060408385031215614fcc57600080fd5b614fd58361486c565b915061490c6020840161486c565b60008060008060008060a08789031215614ffc57600080fd5b6150058761486c565b95506150136020880161486c565b9450604087013593506060870135925060808701356001600160401b0381111561503c57600080fd5b61504889828a01614e67565b979a9699509497509295939492505050565b600181811c9082168061506e57607f821691505b60208210810361508e57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008282101561516a5761516a615142565b500390565b634e487b7160e01b600052603160045260246000fd5b60006001820161519757615197615142565b5060010190565b6000602082840312156151b057600080fd5b5051919050565b6040815260006151ca6040830185614814565b82810360208401526144ec8185614814565b600082198211156151ef576151ef615142565b500190565b60006020828403121561520657600080fd5b81516128788161497b565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061524b90830184614814565b979650505050505050565b600081600019048311821515161561527057615270615142565b500290565b600081516152878185602086016147e8565b9290920192915050565b600080845481600182811c9150808316806152ad57607f831692505b602080841082036152cc57634e487b7160e01b86526022600452602486fd5b8180156152e057600181146152f15761531e565b60ff1986168952848901965061531e565b60008b81526020902060005b868110156153165781548b8201529085019083016152fd565b505084890196505b5050505050506144ec8185615275565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061536190830184614814565b9695505050505050565b60006020828403121561537d57600080fd5b8151612878816147b5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161540b8160178501602088016147e8565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161543c8160288401602088016147e8565b01602801949350505050565b60008161545757615457615142565b506000190190565b600082516154718184602087016147e8565b919091019291505056fe9b318f4ce0672a3f1ac661d9739a947f38b863a00000000000000100000005dc360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122097bf97a3c1b67dcdd5b9ce4b35d54fa20473e72ffe5ea5143b3f72b4701122fe64736f6c634300080d0033

Deployed Bytecode

0x6080604052600436106104565760003560e01c806373417b091161023f578063b2dc5dc311610139578063d4d9b343116100b6578063ec87621c1161007a578063ec87621c14610df2578063f23a6e6114610e26578063f2fde38b14610e53578063f62d188814610e73578063f72c0d8b14610e9357600080fd5b8063d4d9b34314610d28578063d547741f14610d48578063da72c1e814610d68578063e127c45014610d88578063e985e9c514610da857600080fd5b8063c50b0fb0116100fd578063c50b0fb014610c94578063c802668d14610cab578063c87b56dd14610ccb578063cfba9fab14610ceb578063d4a6a2fd14610d0d57600080fd5b8063b2dc5dc314610bc8578063b2ea46c114610be8578063b88d4fde14610bff578063bc197c8114610c1f578063c23dc68f14610c6757600080fd5b806391ba317a116101c75780639a760fc61161018b5780639a760fc614610b33578063a217fddf14610b53578063a22cb46514610b68578063ae34490414610b88578063af88fac914610ba857600080fd5b806391ba317a14610aa757806391d1485414610abe57806395d89b4114610ade5780639937b0ce14610af357806399a2557a14610b1357600080fd5b80638462151c1161020e5780638462151c14610a035780638da5cb5b14610a235780638df9389c14610a445780638ef1e25914610a6c5780638faf6c3114610a8c57600080fd5b806373417b0914610995578063768ac99d146109b55780637ab4d1de146109ca5780637ccd134a146109e157600080fd5b80633e5ac28f1161035057806355f804b3116102d857806367a531731161029c57806367a53173146108fe5780636a6278421461091e5780636a9d57fd1461093e5780636c0360eb1461096057806370a082311461097557600080fd5b806355f804b31461085c5780635a50fd501461087c5780635bbb21771461089c5780636352211e146108c9578063658247a0146108e957600080fd5b806342966c681161031f57806342966c68146107d957806347af9957146107f95780634be2ede4146108145780634f1ef2861461083457806352d1902d1461084757600080fd5b80633e5ac28f1461076457806342842e0e146107795780634294e54414610799578063429644d9146107b957600080fd5b806323b872dd116103de57806336568abe116103a257806336568abe146106dc5780633659cfe6146106fc57806337cb2e091461071c57806338d023c21461073c5780633ccfd60b1461075c57600080fd5b806323b872dd14610635578063248a9ca31461065557806328bbc5c1146106855780632efbeccd1461069c5780632f2ff15d146106bc57600080fd5b806309e0a34f1161042557806309e0a34f1461057657806315497409146105b857806318160ddd146105d85780631cc26da8146105f5578063202fcbbd1461061557600080fd5b806301ffc9a7146104c557806306fdde03146104fa578063081812fc1461051c578063095ea7b31461055457600080fd5b366104c05761046433610ec7565b6104895760405162461bcd60e51b815260040161048090614787565b60405180910390fd5b60405134815233907f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f885258749060200160405180910390a2005b600080fd5b3480156104d157600080fd5b506104e56104e03660046147cb565b610f0a565b60405190151581526020015b60405180910390f35b34801561050657600080fd5b5061050f610f80565b6040516104f19190614840565b34801561052857600080fd5b5061053c610537366004614853565b611012565b6040516001600160a01b0390911681526020016104f1565b34801561056057600080fd5b5061057461056f366004614883565b611057565b005b34801561058257600080fd5b506105aa7fe098e2e7d2d4d3ca0e3877ceaaf3cdfbd47483f6699688ad12b1d6732deef10b81565b6040519081526020016104f1565b3480156105c457600080fd5b506105746105d3366004614853565b6110e4565b3480156105e457600080fd5b5060fc5460fb5403600019016105aa565b34801561060157600080fd5b5061010f546104e590610100900460ff1681565b34801561062157600080fd5b50610574610630366004614853565b611178565b34801561064157600080fd5b506105746106503660046148ad565b6111dc565b34801561066157600080fd5b506105aa610670366004614853565b60009081526065602052604090206001015490565b34801561069157600080fd5b506105aa61010a5481565b3480156106a857600080fd5b506105746106b7366004614853565b6111e7565b3480156106c857600080fd5b506105746106d73660046148e9565b6111f9565b3480156106e857600080fd5b506105746106f73660046148e9565b61121e565b34801561070857600080fd5b50610574610717366004614915565b61129c565b34801561072857600080fd5b50610574610737366004614915565b61137b565b34801561074857600080fd5b50610574610757366004614853565b611421565b61057461148f565b34801561077057600080fd5b50610574611532565b34801561078557600080fd5b506105746107943660046148ad565b611553565b3480156107a557600080fd5b506105746107b4366004614915565b61156e565b3480156107c557600080fd5b506105aa6107d4366004614915565b6116dc565b3480156107e557600080fd5b506105746107f4366004614853565b61176d565b34801561080557600080fd5b5061010f546104e59060ff1681565b34801561082057600080fd5b5061057461082f366004614989565b6117b5565b610574610842366004614ac9565b611895565b34801561085357600080fd5b506105aa611961565b34801561086857600080fd5b50610574610877366004614b16565b611a14565b34801561088857600080fd5b50610574610897366004614853565b611b0e565b3480156108a857600080fd5b506108bc6108b7366004614b5e565b611c24565b6040516104f19190614c03565b3480156108d557600080fd5b5061053c6108e4366004614853565b611cea565b3480156108f557600080fd5b50610574611cfc565b34801561090a57600080fd5b50610574610919366004614c6d565b61213c565b34801561092a57600080fd5b50610574610939366004614915565b6121ef565b34801561094a57600080fd5b506109536122bd565b6040516104f19190614cae565b34801561096c57600080fd5b5061050f612315565b34801561098157600080fd5b506105aa610990366004614915565b6123a4565b3480156109a157600080fd5b506105746109b0366004614ce6565b6123f3565b3480156109c157600080fd5b50610574612442565b3480156109d657600080fd5b506105aa6101085481565b3480156109ed57600080fd5b506109f661246c565b6040516104f19190614d03565b348015610a0f57600080fd5b50610953610a1e366004614915565b6124ce565b348015610a2f57600080fd5b506101055461053c906001600160a01b031681565b348015610a5057600080fd5b5061053c73495f947276749ce646f68ac8c248420045cb7b5e81565b348015610a7857600080fd5b506104e5610a87366004614915565b612613565b348015610a9857600080fd5b50610109546104e59060ff1681565b348015610ab357600080fd5b506105aa61010e5481565b348015610aca57600080fd5b506104e5610ad93660046148e9565b61262a565b348015610aea57600080fd5b5061050f612655565b348015610aff57600080fd5b506104e5610b0e366004614853565b612664565b348015610b1f57600080fd5b50610953610b2e366004614d44565b6126bc565b348015610b3f57600080fd5b506104e5610b4e366004614915565b61287f565b348015610b5f57600080fd5b506105aa600081565b348015610b7457600080fd5b50610574610b83366004614d77565b6128e1565b348015610b9457600080fd5b50610574610ba3366004614ce6565b612977565b348015610bb457600080fd5b50610574610bc3366004614853565b612997565b348015610bd457600080fd5b50610574610be3366004614dae565b6129f0565b348015610bf457600080fd5b506105aa61010b5481565b348015610c0b57600080fd5b50610574610c1a366004614e00565b612b6c565b348015610c2b57600080fd5b50610c4e610c3a366004614ea8565b63bc197c8160e01b98975050505050505050565b6040516001600160e01b031990911681526020016104f1565b348015610c7357600080fd5b50610c87610c82366004614853565b612bb7565b6040516104f19190614f62565b348015610ca057600080fd5b506105aa61010c5481565b348015610cb757600080fd5b50610574610cc6366004614f97565b612c71565b348015610cd757600080fd5b5061050f610ce6366004614853565b612d2d565b348015610cf757600080fd5b506105aa60008051602061547c83398151915281565b348015610d1957600080fd5b50610103546104e59060ff1681565b348015610d3457600080fd5b50610574610d43366004614853565b612db9565b348015610d5457600080fd5b50610574610d633660046148e9565b612dcb565b348015610d7457600080fd5b50610574610d833660046148ad565b612df0565b348015610d9457600080fd5b50610574610da3366004614915565b612e59565b348015610db457600080fd5b506104e5610dc3366004614fb9565b6001600160a01b0391821660009081526101026020908152604080832093909416825291909152205460ff1690565b348015610dfe57600080fd5b506105aa7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b348015610e3257600080fd5b50610c4e610e41366004614fe3565b63f23a6e6160e01b9695505050505050565b348015610e5f57600080fd5b50610574610e6e366004614915565b613015565b348015610e7f57600080fd5b50610574610e8e366004614b16565b61307d565b348015610e9f57600080fd5b506105aa7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e381565b6000610ef37f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b088361262a565b80610f045750610f0460008361262a565b92915050565b60006001600160e01b031982166380ac58cd60e01b1480610f3b57506001600160e01b03198216635b5e139f60e01b145b80610f5657506001600160e01b0319821663da8def7360e01b145b80610f7157506001600160e01b031982166301ffc9a760e01b145b80610f045750610f048261322a565b606060fd8054610f8f9061505a565b80601f0160208091040260200160405190810160405280929190818152602001828054610fbb9061505a565b80156110085780601f10610fdd57610100808354040283529160200191611008565b820191906000526020600020905b815481529060010190602001808311610feb57829003601f168201915b5050505050905090565b600061101d8261326a565b61103a576040516333d1c03960e21b815260040160405180910390fd5b50600090815261010160205260409020546001600160a01b031690565b600061106282611cea565b9050806001600160a01b0316836001600160a01b0316036110965760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b038216148015906110b657506110b48133610dc3565b155b156110d4576040516367d9dca160e11b815260040160405180910390fd5b6110df8383836132a4565b505050565b6110ed33610ec7565b6111095760405162461bcd60e51b815260040161048090614787565b61010680546001810182556000919091527fc9ef9fceea91e87b2c84ea400a44fde78842aae8aa24cd4b502ce5fb4d91e63b0181905560405181815233907f540e004b1e599d2b6e04cb22f77b5c15ed1a83347064d867e964e25a073f5dd7906020015b60405180910390a250565b600061118381613301565b60fb548210156111d55760405162461bcd60e51b815260206004820152601a60248201527f4d5648513a206d617820746f6b656e20696420696e76616c69640000000000006044820152606401610480565b5061010e55565b6110df83838361330b565b60006111f281613301565b5061010a55565b60008281526065602052604090206001015461121481613301565b6110df8383613318565b6001600160a01b038116331461128e5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610480565b611298828261339e565b5050565b6001600160a01b037f00000000000000000000000010d89160d4ab5e4d5aea718b67154121b23dd7f31630036112e45760405162461bcd60e51b815260040161048090615094565b7f00000000000000000000000010d89160d4ab5e4d5aea718b67154121b23dd7f36001600160a01b031661132d60008051602061549c833981519152546001600160a01b031690565b6001600160a01b0316146113535760405162461bcd60e51b8152600401610480906150e0565b61135c81613405565b604080516000808252602082019092526113789183919061342f565b50565b61138433610ec7565b6113a05760405162461bcd60e51b815260040161048090614787565b61010780546001810182556000919091527f47c4908e245f386bfc1825973249847f4053a761ddb4880ad63c323a7b5a2a250180546001600160a01b0319166001600160a01b03831690811790915560405190815233907ff34c09a7cee2ec36676b00d8197a8db8ba2c6e091727126e27c8e3c34747f1a39060200161116d565b61142a33610ec7565b6114465760405162461bcd60e51b815260040161048090614787565b610108805490829055604080518281526020810184905233917fa091af460c0b001329ed8c9156f41f3efcc95ae5136f2c44f6746c4d778cf7fc91015b60405180910390a25050565b600061149a81613301565b604051600090339047908381818185875af1925050503d80600081146114dc576040519150601f19603f3d011682016040523d82523d6000602084013e6114e1565b606091505b50509050806112985760405162461bcd60e51b815260206004820152601860248201527f4d5648513a206661696c656420746f20776974686472617700000000000000006044820152606401610480565b600061153d81613301565b5061010f805460ff19811660ff90911615179055565b6110df83838360405180602001604052806000815250612b6c565b61157733610ec7565b6115935760405162461bcd60e51b815260040161048090614787565b60005b610107548110156116a057816001600160a01b031661010782815481106115bf576115bf61512c565b6000918252602090912001546001600160a01b03160361168e5761010780546115ea90600190615158565b815481106115fa576115fa61512c565b60009182526020909120015461010780546001600160a01b0390921691839081106116275761162761512c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506101078054806116675761166761516f565b600082815260209020810160001990810180546001600160a01b03191690550190556116a0565b8061169881615185565b915050611596565b506040516001600160a01b038216815233907fcc229432447e3f287b17d54ea5b3efb13d26e022102362f4d8eba4ac37fb8c769060200161116d565b604051627eeac760e11b81526001600160a01b038216600482015260008051602061547c833981519152602482015260009073495f947276749ce646f68ac8c248420045cb7b5e9062fdd58e90604401602060405180830381865afa158015611749573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f04919061519e565b600061177881613301565b61178382600061359a565b60405182815233907feb1a139f5480882ec767b34b3d7386a850268910ed1dc7acb55c88a1e3a238ec90602001611483565b60006117c081613301565b8483146118265760405162461bcd60e51b815260206004820152602e60248201527f4d5648513a2072656365697665727320616e64207175616e746974696573206c60448201526d0cadccee8d040dad2e6dac2e8c6d60931b6064820152608401610480565b60005b8581101561188c5761187a8787838181106118465761184661512c565b905060200201602081019061185b9190614915565b86868481811061186d5761186d61512c565b905060200201358561374f565b8061188481615185565b915050611829565b50505050505050565b6001600160a01b037f00000000000000000000000010d89160d4ab5e4d5aea718b67154121b23dd7f31630036118dd5760405162461bcd60e51b815260040161048090615094565b7f00000000000000000000000010d89160d4ab5e4d5aea718b67154121b23dd7f36001600160a01b031661192660008051602061549c833981519152546001600160a01b031690565b6001600160a01b03161461194c5760405162461bcd60e51b8152600401610480906150e0565b61195582613405565b6112988282600161342f565b6000306001600160a01b037f00000000000000000000000010d89160d4ab5e4d5aea718b67154121b23dd7f31614611a015760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610480565b5060008051602061549c83398151915290565b6000611a1f81613301565b60006101048054611a2f9061505a565b80601f0160208091040260200160405190810160405280929190818152602001828054611a5b9061505a565b8015611aa85780601f10611a7d57610100808354040283529160200191611aa8565b820191906000526020600020905b815481529060010190602001808311611a8b57829003601f168201915b50508651939450611ac593610104935060208801925090506146ee565b50336001600160a01b03167f92bf6a7b8937c17e6781a68d61f9fe6a5ce08604b96ca2206f311049a3a295ea8285604051611b019291906151b7565b60405180910390a2505050565b611b1733610ec7565b611b335760405162461bcd60e51b815260040161048090614787565b60005b61010654811015611bf157816101068281548110611b5657611b5661512c565b906000526020600020015403611bdf576101068054611b7790600190615158565b81548110611b8757611b8761512c565b90600052602060002001546101068281548110611ba657611ba661512c565b600091825260209091200155610106805480611bc457611bc461516f565b60019003818190600052602060002001600090559055611bf1565b80611be981615185565b915050611b36565b5060405181815233907f5bff50bb0ea7b604b792895e3a30ed31d4502d8c105e5c7c7982c8ac765beb819060200161116d565b80516060906000816001600160401b03811115611c4357611c43614a0c565b604051908082528060200260200182016040528015611c8e57816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181611c615790505b50905060005b828114611ce257611cbd858281518110611cb057611cb061512c565b6020026020010151612bb7565b828281518110611ccf57611ccf61512c565b6020908102919091010152600101611c94565b509392505050565b6000611cf582613856565b5192915050565b600061010b545a611d0d91906151dc565b9050611d1833610ec7565b80611d2657506101035460ff165b611d725760405162461bcd60e51b815260206004820152601960248201527f4d5648513a20636c61696d696e67206e6f7420616374697665000000000000006044820152606401610480565b60405163e985e9c560e01b815233600482015230602482015273495f947276749ce646f68ac8c248420045cb7b5e9063e985e9c590604401602060405180830381865afa158015611dc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611deb91906151f4565b611e375760405162461bcd60e51b815260206004820152601760248201527f4d5648513a20617070726f76616c2072657175697265640000000000000000006044820152606401610480565b604051627eeac760e11b815233600482015260008051602061547c833981519152602482015260009073495f947276749ce646f68ac8c248420045cb7b5e9062fdd58e90604401602060405180830381865afa158015611e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ebf919061519e565b905060008111611f115760405162461bcd60e51b815260206004820152601760248201527f4d5648513a206e6f20636c61696d61626c65206b6579730000000000000000006044820152606401610480565b60408051600180825281830190925260009160208083019080368337505060408051600180825281830190925292935060009291506020808301908036833701905050905060008051602061547c83398151915282600081518110611f7857611f7861512c565b6020026020010181815250508281600081518110611f9857611f9861512c565b60200260200101818152505073495f947276749ce646f68ac8c248420045cb7b5e6001600160a01b031663f242432a333060008051602061547c833981519152876040518060400160405280600381526020016203078360ec1b8152506040518663ffffffff1660e01b8152600401612015959493929190615211565b600060405180830381600087803b15801561202f57600080fd5b505af1158015612043573d6000803e3d6000fd5b50505050612051338461397e565b60405183815233907f6df341e167ad905feb841b44d47d5589106540c65e6fe465047aaf23cd30c5a89060200160405180910390a250506101095460ff16905080156120a0575061010a544710155b156113785760003a5a6120b39084615158565b6120bd9190615256565b9050336001600160a01b03166108fc61010a5483116120dc57826120e1565b61010a545b6040518115909202916000818181858888f19350505050158015612109573d6000803e3d6000fd5b5060405181815233907fd7dee2702d63ad89917b6a4da9981c90c4d24f8c2bdfd64c604ecae57d8d065190602001611483565b600061214781613301565b60005b828110156121e95761010d60008585848181106121695761216961512c565b602090810292909201358352508101919091526040016000205460ff161580156121af57506121af8484838181106121a3576121a361512c565b9050602002013561326a565b156121d7576121d78484838181106121c9576121c961512c565b90506020020135600061359a565b806121e181615185565b91505061214a565b50505050565b7fe098e2e7d2d4d3ca0e3877ceaaf3cdfbd47483f6699688ad12b1d6732deef10b61221981613301565b61010e5460fb54111561226e5760405162461bcd60e51b815260206004820152601f60248201527f4d5648513a20776f756c6420657863656564206d617820746f6b656e206964006044820152606401610480565b60fb5461227c83600161397e565b60408051828152600060208201526001600160a01b038516917ff77ae1a2d08f704c6f96fbda4f182340181248bdb7483eb9fa8cefdbf2d079829101611b01565b606061010680548060200260200160405190810160405280929190818152602001828054801561100857602002820191906000526020600020905b8154815260200190600101908083116122f8575050505050905090565b61010480546123239061505a565b80601f016020809104026020016040519081016040528092919081815260200182805461234f9061505a565b801561239c5780601f106123715761010080835404028352916020019161239c565b820191906000526020600020905b81548152906001019060200180831161237f57829003601f168201915b505050505081565b60006001600160a01b0382166123cd576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b0316600090815261010060205260409020546001600160401b031690565b60006123fe81613301565b610103805460ff191683151590811790915560405190815233907fcfac0d114d14393344fe66cb124151c2877a3634ed09c8ee2994553274cbc25690602001611483565b600061244d81613301565b5061010f805461ff001981166101009182900460ff1615909102179055565b606061010780548060200260200160405190810160405280929190818152602001828054801561100857602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116124a7575050505050905090565b606060008060006124de856123a4565b90506000816001600160401b038111156124fa576124fa614a0c565b604051908082528060200260200182016040528015612523578160200160208202803683370190505b509050612549604080516060810182526000808252602082018190529181019190915290565b60015b83861461260757600081815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b909104909116151591810182905292506125ff5781516001600160a01b0316156125c057815194505b876001600160a01b0316856001600160a01b0316036125ff57808387806001019850815181106125f2576125f261512c565b6020026020010181815250505b60010161254c565b50909695505050505050565b600061010854612622836123a4565b101592915050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060fe8054610f8f9061505a565b6000805b610106548110156126b3578261010682815481106126885761268861512c565b9060005260206000200154036126a15750600192915050565b806126ab81615185565b915050612668565b50600092915050565b60608183106126de57604051631960ccad60e11b815260040160405180910390fd5b60fb5460009060018510156126f257600194505b808411156126fe578093505b6000612709876123a4565b9050848610156127285785850381811015612722578091505b5061272c565b5060005b6000816001600160401b0381111561274657612746614a0c565b60405190808252806020026020018201604052801561276f578160200160208202803683370190505b5090508160000361278557935061287892505050565b600061279088612bb7565b9050600081604001516127a1575080515b885b8881141580156127b35750848714155b1561286c57600081815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b909104909116151591810182905293506128645782516001600160a01b03161561282557825191505b8a6001600160a01b0316826001600160a01b03160361286457808488806001019950815181106128575761285761512c565b6020026020010181815250505b6001016127a3565b50505092835250909150505b9392505050565b6000805b610107548110156126b357826001600160a01b031661010782815481106128ac576128ac61512c565b6000918252602090912001546001600160a01b0316036128cf5750600192915050565b806128d981615185565b915050612883565b336001600160a01b0383160361290a5760405163b06307db60e01b815260040160405180910390fd5b336000818152610102602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600061298281613301565b50610109805460ff1916911515919091179055565b60006129a281613301565b600082116129e95760405162461bcd60e51b815260206004820152601460248201527326ab24289d1034b73b30b634b21039b2b0b9b7b760611b6044820152606401610480565b5061010c55565b7fe098e2e7d2d4d3ca0e3877ceaaf3cdfbd47483f6699688ad12b1d6732deef10b612a1a81613301565b60005b82811015612b6557846001600160a01b0316612a50858584818110612a4457612a4461512c565b90506020020135611cea565b6001600160a01b031614612ab25760405162461bcd60e51b8152602060048201526024808201527f4d5648513a20746f6b656e206e6f74206f776e656420627920746f6b656e734f6044820152633bb732b960e11b6064820152608401610480565b61010d6000858584818110612ac957612ac961512c565b602090810292909201358352508101919091526040016000205460ff1615612b3e5760405162461bcd60e51b815260206004820152602260248201527f4d5648513a207768616c6520746f6b656e2063616e6e6f74206265206275726e604482015261195960f21b6064820152608401610480565b612b538484838181106121c9576121c961512c565b80612b5d81615185565b915050612a1d565b5050505050565b612b7784848461330b565b6001600160a01b0383163b15158015612b995750612b9784848484613998565b155b156121e9576040516368d2bf6b60e11b815260040160405180910390fd5b60408051606080820183526000808352602080840182905283850182905284519283018552818352820181905292810192909252906001831080612bfd575060fb548310155b15612c085792915050565b50600082815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b9091049091161580159282019290925290612c685792915050565b61287883613856565b6000612c7c81613301565b600083118015612c92575060fb54600019018211155b612cde5760405162461bcd60e51b815260206004820152601960248201527f4d5648513a20696e76616c696420746f6b656e2072616e6765000000000000006044820152606401610480565b825b8281116121e957600081815261010d602052604090205460ff16158015612d0b5750612d0b8161326a565b15612d1b57612d1b81600061359a565b80612d2581615185565b915050612ce0565b6060612d388261326a565b612d5557604051630a14c4b560e41b815260040160405180910390fd5b60006101048054612d659061505a565b90501115612da057610104612d7983613a84565b604051602001612d8a929190615291565b6040516020818303038152906040529050919050565b505060408051602081019091526000815290565b919050565b6000612dc481613301565b5061010b55565b600082815260656020526040902060010154612de681613301565b6110df838361339e565b6000612dfb81613301565b612e06848484613b16565b604080516001600160a01b0386811682528516602082015290810183905233907f360bb0808951709e17b8c0ff5cf74aa15579508d1227398aac32794efdfe75ea9060600160405180910390a250505050565b6000612e6481613301565b604051627eeac760e11b815230600482015260008051602061547c833981519152602482015260009073495f947276749ce646f68ac8c248420045cb7b5e9062fdd58e90604401602060405180830381865afa158015612ec8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eec919061519e565b905060008111612f3e5760405162461bcd60e51b815260206004820181905260248201527f4d5648513a206e6f206c6567616379206b65797320746f207472616e736665726044820152606401610480565b604080518082018252600381526203078360ec1b60208201529051637921219560e11b815273495f947276749ce646f68ac8c248420045cb7b5e9163f242432a91612fa2913091889160008051602061547c83398151915291889190600401615211565b600060405180830381600087803b158015612fbc57600080fd5b505af1158015612fd0573d6000803e3d6000fd5b5050604080516001600160a01b0387168152602081018590523393507ffeb6c27c598d8581a441fc8e59e9ef9fc43c0a609af2aed0554a05b5aaa6fca6925001611b01565b600061302081613301565b61010580546001600160a01b038481166001600160a01b0319831681179093556040805191909216808252602082019390935233917fc8894f26f396ce8c004245c8b7cd1b92103a6e4302fcbab883987149ac01b7ec9101611b01565b600054610100900460ff161580801561309d5750600054600160ff909116105b806130b75750303b1580156130b7575060005460ff166001145b61311a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610480565b6000805460ff19166001179055801561313d576000805461ff0019166101001790555b61317f604051806040016040528060048152602001634d56485160e01b815250604051806040016040528060048152602001634d56485160e01b815250613b23565b613187613b60565b613192600033613318565b81516131a6906101049060208501906146ee565b5060056101085561010580546001600160a01b03191633179055610109805460ff19166001179055662386f26fc1000061010a55617dc461010b558015611298576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60006001600160e01b031982166380ac58cd60e01b148061325b57506001600160e01b03198216635b5e139f60e01b145b80610f045750610f0482613b89565b60008160011115801561327e575060fb5482105b8015610f04575050600090815260ff6020819052604090912054600160e01b9004161590565b6000828152610101602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6113788133613bbe565b6110df8383836001613c17565b613322828261262a565b6112985760008281526065602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561335a3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6133a8828261262a565b156112985760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e361129881613301565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615613462576110df83613e06565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156134bc575060408051601f3d908101601f191682019092526134b99181019061519e565b60015b61351f5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610480565b60008051602061549c833981519152811461358e5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610480565b506110df838383613ea2565b60006135a583613856565b8051909150821561360b576000336001600160a01b03831614806135ce57506135ce8233610dc3565b806135e95750336135de86611012565b6001600160a01b0316145b90508061360957604051632ce44b5f60e11b815260040160405180910390fd5b505b613617600085836132a4565b6001600160a01b038082166000818152610100602090815260408083208054600160801b6000196001600160401b0380841691909101811667ffffffffffffffff198416811783900482166001908101831690930277ffffffffffffffff0000000000000000ffffffffffffffff19909416179290921783558b865260ff909452828520805460ff60e01b1942909316600160a01b026001600160e01b03199091169097179690961716600160e01b1785559189018084529220805491949091166137165760fb54821461371657805460208701516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038716171781555b5050604051869250600091506001600160a01b038416906000805160206154e3833981519152908390a4505060fc805460010190555050565b60fb546000836001600160401b0381111561376c5761376c614a0c565b604051908082528060200260200182016040528015613795578160200160208202803683370190505b50905082156138045760005b848110156137fe57600083815261010d60205260409020805460ff19166001179055826137cd81615185565b93508282815181106137e1576137e161512c565b6020908102919091010152806137f681615185565b9150506137a1565b5061384c565b60005b8481101561384a578261381981615185565b935082828151811061382d5761382d61512c565b60209081029190910101528061384281615185565b915050613807565b505b612b65858561397e565b60408051606081018252600080825260208201819052918101919091528180600111158015613886575060fb5481105b1561396557600081815260ff6020818152604092839020835160608101855290546001600160a01b03811682526001600160401b03600160a01b82041692820192909252600160e01b9091049091161515918101829052906139635780516001600160a01b0316156138f9579392505050565b5060001901600081815260ff6020818152604092839020835160608101855290546001600160a01b0381168083526001600160401b03600160a01b83041693830193909352600160e01b9004909216151592820192909252901561395e579392505050565b6138f9565b505b604051636f96cda160e11b815260040160405180910390fd5b611298828260405180602001604052806000815250613ec7565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906139cd90339089908890889060040161532e565b6020604051808303816000875af1925050508015613a08575060408051601f3d908101601f19168201909252613a059181019061536b565b60015b613a66573d808015613a36576040519150601f19603f3d011682016040523d82523d6000602084013e613a3b565b606091505b508051600003613a5e576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b60606000613a9183613ed4565b60010190506000816001600160401b03811115613ab057613ab0614a0c565b6040519080825280601f01601f191660200182016040528015613ada576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084613ae457509392505050565b6110df8383836000613c17565b600054610100900460ff16613b4a5760405162461bcd60e51b815260040161048090615388565b613b548282613fac565b613b5c613b60565b6112985b600054610100900460ff16613b875760405162461bcd60e51b815260040161048090615388565b565b60006001600160e01b03198216637965db0b60e01b1480610f0457506301ffc9a760e01b6001600160e01b0319831614610f04565b613bc8828261262a565b61129857613bd581614004565b613be0836020614016565b604051602001613bf19291906153d3565b60408051601f198184030181529082905262461bcd60e51b825261048091600401614840565b6000613c2283613856565b9050846001600160a01b031681600001516001600160a01b031614613c595760405162a1148160e81b815260040160405180910390fd5b8115613ce1576000336001600160a01b0387161480613c7d5750613c7d8633610dc3565b80613c98575033613c8d85611012565b6001600160a01b0316145b905080613cb857604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516613cdf57604051633a954ecd60e21b815260040160405180910390fd5b505b613cee85858560016141b1565b613cfa600084876132a4565b6001600160a01b03858116600090815261010060209081526040808320805467ffffffffffffffff198082166001600160401b039283166000190183161790925589861680865283862080549384169383166001908101841694909417905589865260ff90945282852080546001600160e01b031916909417600160a01b42909216919091021783558701808452922080549193909116613dcf5760fb548214613dcf57805460208501516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03166000805160206154e383398151915260405160405180910390a4612b65565b6001600160a01b0381163b613e735760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610480565b60008051602061549c83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b613eab836143c1565b600082511180613eb85750805b156110df576121e98383614401565b6110df83838360016144f5565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310613f135772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310613f3f576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310613f5d57662386f26fc10000830492506010015b6305f5e1008310613f75576305f5e100830492506008015b6127108310613f8957612710830492506004015b60648310613f9b576064830492506002015b600a8310610f045760010192915050565b600054610100900460ff16613fd35760405162461bcd60e51b815260040161048090615388565b8151613fe69060fd9060208501906146ee565b508051613ffa9060fe9060208401906146ee565b50600160fb555050565b6060610f046001600160a01b03831660145b60606000614025836002615256565b6140309060026151dc565b6001600160401b0381111561404757614047614a0c565b6040519080825280601f01601f191660200182016040528015614071576020820181803683370190505b509050600360fc1b8160008151811061408c5761408c61512c565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106140bb576140bb61512c565b60200101906001600160f81b031916908160001a90535060006140df846002615256565b6140ea9060016151dc565b90505b6001811115614162576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061411e5761411e61512c565b1a60f81b8282815181106141345761413461512c565b60200101906001600160f81b031916908160001a90535060049490941c9361415b81615448565b90506140ed565b5083156128785760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610480565b6141bc60003361262a565b6143bc576141c98461287f565b156142225760405162461bcd60e51b815260206004820152602360248201527f4d5648513a206b657920686f6c646572206164647265737320697320666c616760448201526219d95960ea1b6064820152608401610480565b61422b8361287f565b156142865760405162461bcd60e51b815260206004820152602560248201527f4d5648513a206b6579207265636569766572206164647265737320697320666c6044820152641859d9d95960da1b6064820152608401610480565b815b61429282846151dc565b8110156143ba576142a281612664565b156142e65760405162461bcd60e51b8152602060048201526014602482015273135592144e881ad95e481a5cc8199b1859d9d95960621b6044820152606401610480565b600081815261010d602052604090205460ff1661434f5761010f5460ff161561434a5760405162461bcd60e51b8152602060048201526016602482015275135592144e881d1c985b9cd9995c9cc81c185d5cd95960521b6044820152606401610480565b6143a8565b61010f54610100900460ff16156143a85760405162461bcd60e51b815260206004820152601c60248201527f4d5648513a207768616c65207472616e736665727320706175736564000000006044820152606401610480565b806143b281615185565b915050614288565b505b6121e9565b6143ca81613e06565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6144695760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610480565b600080846001600160a01b031684604051614484919061545f565b600060405180830381855af49150503d80600081146144bf576040519150601f19603f3d011682016040523d82523d6000602084013e6144c4565b606091505b50915091506144ec82826040518060600160405280602781526020016154bc602791396146b0565b95945050505050565b60fb546001600160a01b03851661451e57604051622e076360e81b815260040160405180910390fd5b8360000361453f5760405163b562e8dd60e01b815260040160405180910390fd5b61454c60008683876141b1565b6001600160a01b03851660008181526101006020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c0181169092021790915585845260ff90925290912080546001600160e01b031916909217600160a01b4290921691909102179055808085018380156145fe57506001600160a01b0387163b15155b15614674575b60405182906001600160a01b038916906000906000805160206154e3833981519152908290a461463d6000888480600101955088613998565b61465a576040516368d2bf6b60e11b815260040160405180910390fd5b808203614604578260fb541461466f57600080fd5b6146a7565b5b6040516001830192906001600160a01b038916906000906000805160206154e3833981519152908290a4808203614675575b5060fb55612b65565b606083156146bf575081612878565b61287883838151156146d45781518083602001fd5b8060405162461bcd60e51b81526004016104809190614840565b8280546146fa9061505a565b90600052602060002090601f01602090048101928261471c5760008555614762565b82601f1061473557805160ff1916838001178555614762565b82800160010185558215614762579182015b82811115614762578251825591602001919060010190614747565b5061476e929150614772565b5090565b5b8082111561476e5760008155600101614773565b602080825260149082015273135592144e881b9bdd08185d5d1a1bdc9a5e995960621b604082015260600190565b6001600160e01b03198116811461137857600080fd5b6000602082840312156147dd57600080fd5b8135612878816147b5565b60005b838110156148035781810151838201526020016147eb565b838111156121e95750506000910152565b6000815180845261482c8160208601602086016147e8565b601f01601f19169290920160200192915050565b6020815260006128786020830184614814565b60006020828403121561486557600080fd5b5035919050565b80356001600160a01b0381168114612db457600080fd5b6000806040838503121561489657600080fd5b61489f8361486c565b946020939093013593505050565b6000806000606084860312156148c257600080fd5b6148cb8461486c565b92506148d96020850161486c565b9150604084013590509250925092565b600080604083850312156148fc57600080fd5b8235915061490c6020840161486c565b90509250929050565b60006020828403121561492757600080fd5b6128788261486c565b60008083601f84011261494257600080fd5b5081356001600160401b0381111561495957600080fd5b6020830191508360208260051b850101111561497457600080fd5b9250929050565b801515811461137857600080fd5b6000806000806000606086880312156149a157600080fd5b85356001600160401b03808211156149b857600080fd5b6149c489838a01614930565b909750955060208801359150808211156149dd57600080fd5b506149ea88828901614930565b90945092505060408601356149fe8161497b565b809150509295509295909350565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614a4a57614a4a614a0c565b604052919050565b60006001600160401b03831115614a6b57614a6b614a0c565b614a7e601f8401601f1916602001614a22565b9050828152838383011115614a9257600080fd5b828260208301376000602084830101529392505050565b600082601f830112614aba57600080fd5b61287883833560208501614a52565b60008060408385031215614adc57600080fd5b614ae58361486c565b915060208301356001600160401b03811115614b0057600080fd5b614b0c85828601614aa9565b9150509250929050565b600060208284031215614b2857600080fd5b81356001600160401b03811115614b3e57600080fd5b8201601f81018413614b4f57600080fd5b613a7c84823560208401614a52565b60006020808385031215614b7157600080fd5b82356001600160401b0380821115614b8857600080fd5b818501915085601f830112614b9c57600080fd5b813581811115614bae57614bae614a0c565b8060051b9150614bbf848301614a22565b8181529183018401918481019088841115614bd957600080fd5b938501935b83851015614bf757843582529385019390850190614bde565b98975050505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561260757614c5a83855180516001600160a01b031682526020808201516001600160401b0316908301526040908101511515910152565b9284019260609290920191600101614c1f565b60008060208385031215614c8057600080fd5b82356001600160401b03811115614c9657600080fd5b614ca285828601614930565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561260757835183529284019291840191600101614cca565b600060208284031215614cf857600080fd5b81356128788161497b565b6020808252825182820181905260009190848201906040850190845b818110156126075783516001600160a01b031683529284019291840191600101614d1f565b600080600060608486031215614d5957600080fd5b614d628461486c565b95602085013595506040909401359392505050565b60008060408385031215614d8a57600080fd5b614d938361486c565b91506020830135614da38161497b565b809150509250929050565b600080600060408486031215614dc357600080fd5b614dcc8461486c565b925060208401356001600160401b03811115614de757600080fd5b614df386828701614930565b9497909650939450505050565b60008060008060808587031215614e1657600080fd5b614e1f8561486c565b9350614e2d6020860161486c565b92506040850135915060608501356001600160401b03811115614e4f57600080fd5b614e5b87828801614aa9565b91505092959194509250565b60008083601f840112614e7957600080fd5b5081356001600160401b03811115614e9057600080fd5b60208301915083602082850101111561497457600080fd5b60008060008060008060008060a0898b031215614ec457600080fd5b614ecd8961486c565b9750614edb60208a0161486c565b965060408901356001600160401b0380821115614ef757600080fd5b614f038c838d01614930565b909850965060608b0135915080821115614f1c57600080fd5b614f288c838d01614930565b909650945060808b0135915080821115614f4157600080fd5b50614f4e8b828c01614e67565b999c989b5096995094979396929594505050565b81516001600160a01b031681526020808301516001600160401b03169082015260408083015115159082015260608101610f04565b60008060408385031215614faa57600080fd5b50508035926020909101359150565b60008060408385031215614fcc57600080fd5b614fd58361486c565b915061490c6020840161486c565b60008060008060008060a08789031215614ffc57600080fd5b6150058761486c565b95506150136020880161486c565b9450604087013593506060870135925060808701356001600160401b0381111561503c57600080fd5b61504889828a01614e67565b979a9699509497509295939492505050565b600181811c9082168061506e57607f821691505b60208210810361508e57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008282101561516a5761516a615142565b500390565b634e487b7160e01b600052603160045260246000fd5b60006001820161519757615197615142565b5060010190565b6000602082840312156151b057600080fd5b5051919050565b6040815260006151ca6040830185614814565b82810360208401526144ec8185614814565b600082198211156151ef576151ef615142565b500190565b60006020828403121561520657600080fd5b81516128788161497b565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061524b90830184614814565b979650505050505050565b600081600019048311821515161561527057615270615142565b500290565b600081516152878185602086016147e8565b9290920192915050565b600080845481600182811c9150808316806152ad57607f831692505b602080841082036152cc57634e487b7160e01b86526022600452602486fd5b8180156152e057600181146152f15761531e565b60ff1986168952848901965061531e565b60008b81526020902060005b868110156153165781548b8201529085019083016152fd565b505084890196505b5050505050506144ec8185615275565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061536190830184614814565b9695505050505050565b60006020828403121561537d57600080fd5b8151612878816147b5565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161540b8160178501602088016147e8565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161543c8160288401602088016147e8565b01602801949350505050565b60008161545757615457615142565b506000190190565b600082516154718184602087016147e8565b919091019291505056fe9b318f4ce0672a3f1ac661d9739a947f38b863a00000000000000100000005dc360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122097bf97a3c1b67dcdd5b9ce4b35d54fa20473e72ffe5ea5143b3f72b4701122fe64736f6c634300080d0033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.