ETH Price: $3,148.99 (+3.16%)
Gas: 5 Gwei

Contract

0x1eed2902355612F8CeE08289Fc4aE2772d5Bc161
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Transfer From196013542024-04-07 4:11:2313 days ago1712463083IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0014333415.15901755
Set Approval For...196013532024-04-07 4:11:1113 days ago1712463071IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0006233611.951424
Set Approval For...195587252024-04-01 4:49:5919 days ago1711946999IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0007988415.32640585
Set Approval For...195431792024-03-30 0:21:3522 days ago1711758095IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0010263319.69108785
Set Approval For...194947162024-03-23 3:46:3528 days ago1711165595IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0009639718.48636196
Set Approval For...194204892024-03-12 17:28:2339 days ago1710264503IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.00528129101.32568587
Set Approval For...193029582024-02-25 6:58:3555 days ago1708844315IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0012625224.2224115
Set Approval For...191661822024-02-06 2:19:5974 days ago1707185999IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0012038723.08705954
Set Approval For...191405302024-02-02 11:51:5978 days ago1706874719IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0005516218.25978044
Set Approval For...190812962024-01-25 4:37:4786 days ago1706157467IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0004051413.41088492
Set Approval For...190812922024-01-25 4:36:5986 days ago1706157419IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0003628512.00149116
Set Approval For...190338532024-01-18 12:49:3593 days ago1705582175IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0010188333.72493905
Set Approval For...190060512024-01-14 15:34:4797 days ago1705246487IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0020052138.47150292
Set Approval For...189988292024-01-13 15:21:2398 days ago1705159283IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0010321519.80275822
Set Approval For...189140722024-01-01 17:29:11110 days ago1704130151IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0007587614.55747331
Set Approval For...189044162023-12-31 8:57:35111 days ago1704013055IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0006676712.80980549
Set Approval For...189038292023-12-31 6:58:35111 days ago1704005915IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0005605110.73916073
Safe Transfer Fr...189035032023-12-31 5:53:11111 days ago1704001991IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0009297312.07034474
Safe Transfer Fr...189021072023-12-31 1:10:47112 days ago1703985047IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0011600114.17666061
Set Approval For...188485542023-12-23 12:36:23119 days ago1703334983IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0011586922.22067411
Set Approval For...188016752023-12-16 22:45:23126 days ago1702766723IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0022692743.51859939
Set Approval For...187466192023-12-09 5:34:11133 days ago1702100051IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.001331925.55361662
Set Approval For...186277602023-11-22 14:06:23150 days ago1700661983IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.01288702246.84945481
Set Approval For...186097732023-11-20 1:37:59153 days ago1700444279IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.0009274417.79370982
Set Approval For...185353252023-11-09 15:36:35163 days ago1699544195IN
My Imaginary Friend by Kai: KAIIF Token
0 ETH0.00864529165.59969871
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To Value
146749622022-04-28 20:28:46723 days ago1651177726
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146749472022-04-28 20:26:01723 days ago1651177561
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146749202022-04-28 20:19:26723 days ago1651177166
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146749162022-04-28 20:18:15723 days ago1651177095
My Imaginary Friend by Kai: KAIIF Token
1 ETH
146749042022-04-28 20:14:44723 days ago1651176884
My Imaginary Friend by Kai: KAIIF Token
2 ETH
146748682022-04-28 20:06:58723 days ago1651176418
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146748472022-04-28 20:04:03723 days ago1651176243
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146748452022-04-28 20:02:57723 days ago1651176177
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146748402022-04-28 20:01:21723 days ago1651176081
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146748342022-04-28 19:58:33723 days ago1651175913
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146748322022-04-28 19:58:21723 days ago1651175901
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146748312022-04-28 19:58:10723 days ago1651175890
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146748242022-04-28 19:56:30723 days ago1651175790
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146748222022-04-28 19:56:24723 days ago1651175784
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146748132022-04-28 19:55:08723 days ago1651175708
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146748102022-04-28 19:54:47723 days ago1651175687
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146748082022-04-28 19:54:41723 days ago1651175681
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146747872022-04-28 19:50:12723 days ago1651175412
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146747472022-04-28 19:42:24723 days ago1651174944
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146747472022-04-28 19:42:24723 days ago1651174944
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146747182022-04-28 19:36:48723 days ago1651174608
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146747012022-04-28 19:32:23723 days ago1651174343
My Imaginary Friend by Kai: KAIIF Token
2 ETH
146746652022-04-28 19:24:47723 days ago1651173887
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146746582022-04-28 19:23:03723 days ago1651173783
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
146746502022-04-28 19:21:23723 days ago1651173683
My Imaginary Friend by Kai: KAIIF Token
0.5 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ImaginaryFriend

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, Unlicense license
File 1 of 32 : ImaginaryFriend.sol
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2022 divergence.xyz
pragma solidity >=0.8.0 <0.9.0;

import "@divergencetech/ethier/contracts/erc721/ERC721ACommon.sol";
import "@divergencetech/ethier/contracts/erc721/BaseTokenURI.sol";
import "@divergencetech/ethier/contracts/crypto/SignatureChecker.sol";
import "@divergencetech/ethier/contracts/sales/FixedPriceSeller.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";

import "./Common.sol";
import "./Serializer.sol";
import "./IMetadataRenderer.sol";

contract ImaginaryFriend is
    ERC721ACommon,
    FixedPriceSeller,
    BaseTokenURI,
    ERC2981
{
    using EnumerableSet for EnumerableSet.AddressSet;
    using SignatureChecker for EnumerableSet.AddressSet;
    using Deserializer for FeaturesSerialized;
    using Serializer for Features;

    uint256 private constant MAX_NUM_TOKENS = 3000;

    /// @notice Set of addresses that are approved to issue early access.
    /// allowances.
    EnumerableSet.AddressSet private _signersEarlyAccess;

    /// @notice Set of addresses that are approved to issue quiz allowances.
    EnumerableSet.AddressSet private _signersQuiz;

    /// @notice Stores the number of tokens minted from am allowance during the
    /// early access stage.
    /// @dev Used in `mintEarlyAccess`
    mapping(bytes32 => uint256) public numMintedFrom;

    /// @notice Contains quiz results for the tokens.
    /// @dev Null corresponds to the quiz not being answered.
    /// @dev Storing a serialized version of the data was needed to enable a
    /// more efficient handling in memory.
    mapping(uint256 => FeaturesSerialized) private _tokenFeatures;

    /// @notice The metadata renderer
    IMetadataRenderer public renderer;

    /// @notice Flag to disable use of setRenderer().
    bool private rendererLocked;

    /// @notice The different minting states of the collection.
    /// @dev This is used to enable/disable the respective minting methods.
    /// Closed = no minting
    /// EarlyAccess = mint using signatures, see `mintEarlyAccess`
    /// Public = public minting, see `mintPublic`
    enum MintingStage {
        Closed,
        EarlyAccess1,
        EarlyAccess2,
        EarlyAccess3,
        EarlyAccess4,
        Public
    }

    /// @notice The current minting stage of the contract.
    MintingStage public mintingStage;

    /// @notice The different states of the quiz.
    /// @dev This is used to control the behavior of `setQuizAnswers`,
    /// `_tokenFeatures` and `tokenURI`.
    /// Closed = quiz answers cannot be set in the contract. All tokenURIs
    /// point to the fallback URL.
    /// Open = quiz answers can be stored using `setQuizAnswers`. The
    /// corresponding token metadata and image URI will be returned.
    /// Finished = quiz answers can no longer be stored. Token metadata, etc.
    /// of the unanswered tokens will be autogenerated.
    enum QuizStage {
        Closed,
        Open,
        Finished
    }

    /// @notice The current state of the quiz.
    QuizStage public quizStage;

    constructor(
        address signerEarlyAccess,
        address signerQuiz,
        address payable paymentSplitter,
        address payable royaltyReceiver,
        string memory baseURI
    )
        ERC721ACommon("My Imaginary Friend by Kai", "KAIIF")
        FixedPriceSeller(
            0.5 ether,
            Seller.SellerConfig({
                totalInventory: MAX_NUM_TOKENS,
                maxPerAddress: 1,
                maxPerTx: 1,
                freeQuota: 300,
                reserveFreeQuota: true,
                lockFreeQuota: false,
                lockTotalInventory: true
            }),
            paymentSplitter
        )
        BaseTokenURI(baseURI)
    {
        _signersEarlyAccess.add(signerEarlyAccess);
        _signersQuiz.add(signerQuiz);

        _setDefaultRoyalty(royaltyReceiver, _feeDenominator() / 10); // 10 %
    }

    // -------------------------------------------------------------------------
    //
    //  Minting
    //
    // -------------------------------------------------------------------------

    /// @notice Minting interface for wallets on the early-access lists.
    /// @dev Only active during early-access `mintingStage`.
    /// @dev The minter might be different than the receiver.
    /// @param to Token receiver
    /// @param num Number of tokens to be minted.
    /// @param numMax Max number of tokens that can be minted to the receiver.
    /// @param nonce additional signature salt.
    /// @param signature to prove that the receiver is allowed to get mints.
    /// @dev The signed messages is generated by concatenating
    /// `address(this) || stage || to || numMax || nonce`.
    function mintEarlyAccess(
        MintingStage stage,
        address to,
        uint16 num,
        uint16 numMax,
        uint128 nonce,
        bytes calldata signature
    )
        external
        payable
        onlyBetweenMintingStages(MintingStage.EarlyAccess1, MintingStage.Public)
        bypassSellerLimits
    {
        if (mintingStage < stage) revert WrongStage();
        bytes32 message = SignatureChecker.generateMessage(
            abi.encodePacked(address(this), stage, to, numMax, nonce)
        );

        if (num + numMintedFrom[message] > numMax)
            revert TooManyMintsRequested();

        _signersEarlyAccess.requireValidSignature(message, signature);
        numMintedFrom[message] += num;

        _purchase(to, num);
    }

    /// @notice Public minting interface.
    /// @dev Only active during public `mintingStage`.
    /// @param num Number of tokens to be minted.
    function mintPublic(uint16 num)
        external
        payable
        onlyDuringMintingStage(MintingStage.Public)
    {
        _purchase(msg.sender, num);
    }

    /// @notice Mints tokens with the given sets of features.
    /// @dev Can only be called by the owner. Draws from the pool of free mints.
    /// @param to The token receiver.
    /// @param features Array of features that the minted tokens should have.
    function mintWithFeatures(address to, Features[] calldata features)
        external
        onlyOwner
    {
        uint256 num = features.length;
        uint256 nextId = totalSupply();
        purchaseFreeOfCharge(to, num);
        for (uint256 idx = 0; idx < num; ++idx) {
            _setFeatures(nextId, features[idx]);
            ++nextId;
        }
    }

    /// @notice Callback to handle purchasing logic.
    /// @dev The `freeOfCharge` boolean flag is deliberately ignored.
    function _handlePurchase(
        address to,
        uint256 num,
        bool
    ) internal override {
        _safeMint(to, num);
    }

    // -------------------------------------------------------------------------
    //
    //  Quiz
    //
    // -------------------------------------------------------------------------

    /// @notice Stores the `feature`s for a given token that resulted from the
    /// quiz.
    /// @dev Only active during open `quizState`.
    /// @dev The golden propperty of the `features` argument is ignored.
    /// @dev Can only be called once per token by either the token owner or
    /// approved wallets.
    /// @param tokenId The tokenId for which the results will be stored.
    /// @param features The quiz results to be stored.
    /// @param signature To prove that the caller is allowed to set the given
    /// features.
    function setQuizResults(
        uint256 tokenId,
        Features calldata features,
        bytes calldata signature
    ) external onlyWhileQuizOpen onlyApprovedOrOwner(tokenId) {
        if (_tokenFeatures[tokenId].isSet()) revert QuizResultsAlreadySet();

        bytes32 message = SignatureChecker.generateMessage(
            abi.encodePacked(
                address(this),
                tokenId,
                features.background,
                features.body,
                features.mouth,
                features.eyes,
                features.special
            )
        );
        _signersQuiz.requireValidSignature(message, signature);
        _setFeatures(tokenId, features);
    }

    /// @notice Checks if the quiz has already been answered for a given token.
    /// @dev Reverts if the token doesn't exist.
    /// @param tokenId The token of interest.
    function hasQuizResults(uint256 tokenId)
        external
        view
        tokenExists(tokenId)
        returns (bool)
    {
        return _tokenFeatures[tokenId].isSet();
    }

    /// @notice Sets the features for a given token.
    /// @dev Ensures that only the genesis token is golden.
    function _setFeatures(uint256 tokenId, Features memory features) internal {
        features.golden = (tokenId == 0);
        _validateFeatures(features);
        _tokenFeatures[tokenId] = features.serialize();
    }

    /// @notice Checks if token features are valid.
    /// @dev Reverts on invalid features.
    function _validateFeatures(Features memory results) internal pure {
        if (
            results.background > 0 &&
            results.body > 0 &&
            results.mouth > 0 &&
            results.eyes > 0 &&
            results.background <= NUM_BACKGROUNDS &&
            results.body <= NUM_BODIES &&
            results.mouth <= NUM_MOUTHS &&
            results.eyes <= NUM_EYES &&
            results.special <= Special.Both
        ) return;

        revert InvalidTokenFeatures();
    }

    // -------------------------------------------------------------------------
    //
    //  Signature validataion
    //
    // -------------------------------------------------------------------------

    /// @notice Removes and adds addresses to the set of allowed signers for
    /// early access mint allowances.
    /// @dev Removal is performed before addition.
    function changeSignersEarlyAccess(
        address[] calldata delSigners,
        address[] calldata addSigners
    ) external onlyOwner {
        _changeSigners(_signersEarlyAccess, delSigners, addSigners);
    }

    /// @notice Returns the signer addresses that are approved to issue
    /// allowances for the early-access minting.
    function getSignersEarlyAccess() external view returns (address[] memory) {
        return _getSigners(_signersEarlyAccess);
    }

    /// @notice Removes and adds addresses to the set of allowed signers for
    /// quiz results.
    /// @dev Removal is performed before addition.
    function changeSignersQuiz(
        address[] calldata delSigners,
        address[] calldata addSigners
    ) external onlyOwner {
        _changeSigners(_signersQuiz, delSigners, addSigners);
    }

    /// @notice Returns the signer addresses that are approved to issue
    /// allowances for the early-access minting.
    function getSignersQuiz() external view returns (address[] memory) {
        return _getSigners(_signersQuiz);
    }

    /// @notice Removes and adds addresses to the set of allowed signers.
    /// @dev Removal is performed before addition.
    function _changeSigners(
        EnumerableSet.AddressSet storage signers,
        address[] calldata delSigners,
        address[] calldata addSigners
    ) internal {
        for (uint256 idx; idx < delSigners.length; ++idx) {
            signers.remove(delSigners[idx]);
        }
        for (uint256 idx; idx < addSigners.length; ++idx) {
            signers.add(addSigners[idx]);
        }
    }

    /// @notice Returns the signer addresses in a given set.
    function _getSigners(EnumerableSet.AddressSet storage signers)
        internal
        view
        returns (address[] memory)
    {
        uint256 len = signers.length();
        address[] memory signers_ = new address[](len);
        for (uint256 idx = 0; idx < len; ++idx) {
            signers_[idx] = signers.at(idx);
        }
        return signers_;
    }

    // -------------------------------------------------------------------------
    //
    //  Metadata
    //
    // -------------------------------------------------------------------------

    /// @notice Sets the address of the rendering contract.
    function setRenderer(IMetadataRenderer renderer_) public onlyOwner {
        if (rendererLocked) revert RendererLocked();
        renderer = renderer_;
    }

    /// @notice Permanently disables `setRenderer`
    function lockRenderer() external onlyOwner {
        rendererLocked = true;
    }

    /// @notice Retrieves the features of an existing token.
    /// @param tokenId The token of interest.
    /// @dev Forwards the call to the metadata render.
    function tokenFeatures(uint256 tokenId)
        external
        view
        tokenExists(tokenId)
        returns (Features memory)
    {
        FeaturesSerialized data = _tokenFeatures[tokenId];
        FeaturesSerialized[] memory all = _loadAllTokenFeatures();
        bool autogenerate = (quizStage == QuizStage.Finished);

        (Features memory features, ) = renderer.tokenFeatures(
            tokenId,
            data,
            all,
            autogenerate
        );

        return features;
    }

    /// @notice Retrieves the data-uri encoded metadata json for an existing
    /// token.
    /// @param tokenId The token of interest.
    /// @dev Forwards the call to the metadata render.
    function tokenURI(uint256 tokenId)
        public
        view
        override
        tokenExists(tokenId)
        returns (string memory)
    {
        FeaturesSerialized data = _tokenFeatures[tokenId];
        FeaturesSerialized[] memory all = _loadAllTokenFeatures();
        bool autogenerate = (quizStage == QuizStage.Finished);

        return
            renderer.tokenURI(
                tokenId,
                data,
                _baseURI(),
                all,
                autogenerate,
                countSiblings
            );
    }

    /// @notice Loads all token features to memory.
    /// @dev This also loads data for unminted tokens (which will be zeroes).
    /// This ensures that the entropy derived therefrom can only be affected by
    /// actual quiz answers. Hence, allowing tokens to be safely minted even
    /// after the quiz was already finished without affecting the
    /// randomized autogeneration.
    function _loadAllTokenFeatures()
        private
        view
        returns (FeaturesSerialized[] memory)
    {
        FeaturesSerialized[] memory all = new FeaturesSerialized[](
            MAX_NUM_TOKENS
        );
        for (uint256 idx = 0; idx < MAX_NUM_TOKENS; idx++) {
            all[idx] = _tokenFeatures[idx];
        }
        return all;
    }

    // -------------------------------------------------------------------------
    //
    //  Royalties
    //
    // -------------------------------------------------------------------------

    /// @notice Sets the royalty receiver and percentage (in units of 0.01%).
    function setDefaultRoyalty(address receiver, uint96 feeNumerator)
        external
        onlyOwner
    {
        _setDefaultRoyalty(receiver, feeNumerator);
    }

    // -------------------------------------------------------------------------
    //
    //  Internals
    //
    // -------------------------------------------------------------------------

    /// @notice Sets the contract to a given minting stage.
    /// @dev Imposes minting limits when switching to public minting.
    function setMintingStage(MintingStage stage) external onlyOwner {
        mintingStage = stage;
    }

    /// @notice Sets the progress of the quiz to a given state.
    function setQuizStage(QuizStage stage) external onlyOwner {
        quizStage = stage;
    }

    /// @notice Sets limitations for minting.
    /// @dev This is a convenience interface for `setSellerConfig`.
    /// It is intended to eventuallty relax minting limits for the public
    /// minting stage.
    function setMintingLimits(uint256 maxPerAddress, uint256 maxPerTx)
        external
        onlyOwner
    {
        sellerConfig.maxPerAddress = maxPerAddress;
        sellerConfig.maxPerTx = maxPerTx;
    }

    /// @notice Determines if siblings are counted.
    bool private countSiblings;

    /// @notice Toggles `countSiblings`
    function setCountSiblings(bool toggle) external onlyOwner {
        countSiblings = toggle;
    }

    /// @notice Ensures that a method can only be called during a certain
    /// minting stage.
    modifier onlyDuringMintingStage(MintingStage stage) {
        if (mintingStage != stage) revert WrongStage();
        _;
    }

    /// @notice Ensures that a method can only be called between certain
    /// minting stages.
    modifier onlyBetweenMintingStages(MintingStage from, MintingStage to) {
        if (mintingStage < from || to < mintingStage) revert WrongStage();
        _;
    }

    /// @notice Ensures that a method can only be called while the quiz is open.
    modifier onlyWhileQuizOpen() {
        if (quizStage != QuizStage.Open) revert WrongStage();
        _;
    }

    /// @notice Bypasses ethiers Seller limits for a given method.
    modifier bypassSellerLimits() {
        SellerConfig memory savedConfig = sellerConfig;
        sellerConfig.maxPerTx = 0;
        sellerConfig.maxPerAddress = 0;
        _;
        sellerConfig.maxPerTx = savedConfig.maxPerTx;
        sellerConfig.maxPerAddress = savedConfig.maxPerAddress;
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721ACommon, ERC2981)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

    function _baseURI()
        internal
        view
        override(ERC721A, BaseTokenURI)
        returns (string memory)
    {
        return BaseTokenURI._baseURI();
    }

    // -------------------------------------------------------------------------
    //
    //  Errors
    //
    // -------------------------------------------------------------------------

    error TooManyMintsRequested();
    error RendererLocked();
    error WrongStage();
    error InvalidTokenFeatures();
    error TokenNotYetRevealed();
    error QuizResultsAlreadySet();
}

File 2 of 32 : SignatureChecker.sol
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

/**
@title SignatureChecker
@notice Additional functions for EnumerableSet.Addresset that require a valid
ECDSA signature of a standardized message, signed by any member of the set.
 */
library SignatureChecker {
    using EnumerableSet for EnumerableSet.AddressSet;

    /**
    @notice Requires that the message has not been used previously and that the
    recovered signer is contained in the signers AddressSet.
    @dev Convenience wrapper for message generation + signature verification
    + marking message as used
    @param signers Set of addresses from which signatures are accepted.
    @param usedMessages Set of already-used messages.
    @param signature ECDSA signature of message.
     */
    function requireValidSignature(
        EnumerableSet.AddressSet storage signers,
        bytes memory data,
        bytes calldata signature,
        mapping(bytes32 => bool) storage usedMessages
    ) internal {
        bytes32 message = generateMessage(data);
        require(
            !usedMessages[message],
            "SignatureChecker: Message already used"
        );
        usedMessages[message] = true;
        requireValidSignature(signers, message, signature);
    }

    /**
    @notice Requires that the message has not been used previously and that the
    recovered signer is contained in the signers AddressSet.
    @dev Convenience wrapper for message generation + signature verification.
     */
    function requireValidSignature(
        EnumerableSet.AddressSet storage signers,
        bytes memory data,
        bytes calldata signature
    ) internal view {
        bytes32 message = generateMessage(data);
        requireValidSignature(signers, message, signature);
    }

    /**
    @notice Requires that the message has not been used previously and that the
    recovered signer is contained in the signers AddressSet.
    @dev Convenience wrapper for message generation from address +
    signature verification.
     */
    function requireValidSignature(
        EnumerableSet.AddressSet storage signers,
        address a,
        bytes calldata signature
    ) internal view {
        bytes32 message = generateMessage(abi.encodePacked(a));
        requireValidSignature(signers, message, signature);
    }

    /**
    @notice Common validator logic, checking if the recovered signer is
    contained in the signers AddressSet.
    */
    function validSignature(
        EnumerableSet.AddressSet storage signers,
        bytes32 message,
        bytes calldata signature
    ) internal view returns (bool) {
        return signers.contains(ECDSA.recover(message, signature));
    }

    /**
    @notice Requires that the recovered signer is contained in the signers
    AddressSet.
    @dev Convenience wrapper that reverts if the signature validation fails.
    */
    function requireValidSignature(
        EnumerableSet.AddressSet storage signers,
        bytes32 message,
        bytes calldata signature
    ) internal view {
        require(
            validSignature(signers, message, signature),
            "SignatureChecker: Invalid signature"
        );
    }

    /**
    @notice Generates a message for a given data input that will be signed
    off-chain using ECDSA.
    @dev For multiple data fields, a standard concatenation using 
    `abi.encodePacked` is commonly used to build data.
     */
    function generateMessage(bytes memory data)
        internal
        pure
        returns (bytes32)
    {
        return ECDSA.toEthSignedMessageHash(data);
    }
}

File 3 of 32 : BaseTokenURI.sol
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;

import "@openzeppelin/contracts/access/Ownable.sol";

/**
@notice ERC721 extension that overrides the OpenZeppelin _baseURI() function to
return a prefix that can be set by the contract owner.
 */
contract BaseTokenURI is Ownable {
    /// @notice Base token URI used as a prefix by tokenURI().
    string public baseTokenURI;

    constructor(string memory _baseTokenURI) {
        setBaseTokenURI(_baseTokenURI);
    }

    /// @notice Sets the base token URI prefix.
    function setBaseTokenURI(string memory _baseTokenURI) public onlyOwner {
        baseTokenURI = _baseTokenURI;
    }

    /**
    @notice Concatenates and returns the base token URI and the token ID without
    any additional characters (e.g. a slash).
    @dev This requires that an inheriting contract that also inherits from OZ's
    ERC721 will have to override both contracts; although we could simply
    require that users implement their own _baseURI() as here, this can easily
    be forgotten and the current approach guides them with compiler errors. This
    favours the latter half of "APIs should be easy to use and hard to misuse"
    from https://www.infoq.com/articles/API-Design-Joshua-Bloch/.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return baseTokenURI;
    }
}

File 4 of 32 : ERC721ACommon.sol
// SPDX-License-Identifier: MIT
// Copyright (c) 2022 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;

import "./ERC721APreApproval.sol";
import "../utils/OwnerPausable.sol";

/**
@notice An ERC721A contract with common functionality:
 - OpenSea gas-free listings
 - Pausable with toggling functions exposed to Owner only
 */
contract ERC721ACommon is ERC721APreApproval, OwnerPausable {
    constructor(string memory name, string memory symbol)
        ERC721A(name, symbol)
    {} // solhint-disable-line no-empty-blocks

    /// @notice Requires that the token exists.
    modifier tokenExists(uint256 tokenId) {
        require(ERC721A._exists(tokenId), "ERC721ACommon: Token doesn't exist");
        _;
    }

    /// @notice Requires that msg.sender owns or is approved for the token.
    modifier onlyApprovedOrOwner(uint256 tokenId) {
        require(
            _ownershipOf(tokenId).addr == _msgSender() ||
                getApproved(tokenId) == _msgSender(),
            "ERC721ACommon: Not approved nor owner"
        );
        _;
    }

    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual override {
        require(!paused(), "ERC721ACommon: paused");
        super._beforeTokenTransfers(from, to, startTokenId, quantity);
    }

    /// @notice Overrides supportsInterface as required by inheritance.
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC721A)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }
}

File 5 of 32 : ERC721APreApproval.sol
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;

import "../thirdparty/opensea/OpenSeaGasFreeListing.sol";
import "erc721a/contracts/ERC721A.sol";

/// @notice Pre-approval of OpenSea proxies for gas-less listing
/// @dev This wrapper allows users to revoke the pre-approval of their
/// associated proxy and emits the corresponding events. This is necessary for
/// external tools to index approvals correctly and inform the user.
/// @dev The pre-approval is triggered on a per-wallet basis during the first
/// transfer transactions. It will only be enabled for wallets with an existing
/// proxy. Not having a proxy incurs a gas overhead.
/// @dev This wrapper optimizes for the following scenario:
/// - The majority of users already have a wyvern proxy
/// - Most of them want to transfer tokens via wyvern exchanges
abstract contract ERC721APreApproval is ERC721A {
    /// @dev It is important that Active remains at first position, since this
    /// is the scenario that we are trying to optimize for.
    enum State {
        Active,
        Inactive
    }

    /// @notice The state of the pre-approval for a given owner
    mapping(address => State) private state;

    /// @dev Returns true if either standard `isApprovedForAll()` or if the
    /// `operator` is the OpenSea proxy for the `owner` provided the
    /// pre-approval is active.
    function isApprovedForAll(address owner, address operator)
        public
        view
        virtual
        override
        returns (bool)
    {
        if (super.isApprovedForAll(owner, operator)) {
            return true;
        }

        return
            state[owner] == State.Active &&
            OpenSeaGasFreeListing.isApprovedForAll(owner, operator);
    }

    /// @dev Uses the standard `setApprovalForAll` or toggles the pre-approval
    /// state if `operator` is the OpenSea proxy for the sender.
    function setApprovalForAll(address operator, bool approved)
        public
        virtual
        override
    {
        address owner = _msgSender();
        if (operator == OpenSeaGasFreeListing.proxyFor(owner)) {
            state[owner] = approved ? State.Active : State.Inactive;
            emit ApprovalForAll(owner, operator, approved);
        } else {
            super.setApprovalForAll(operator, approved);
        }
    }

    /// @dev Checks if the receiver has an existing proxy. If not, the
    /// pre-approval is disabled.
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual override {
        super._beforeTokenTransfers(from, to, startTokenId, quantity);

        // Exclude burns and inactive pre-approvals
        if (to == address(0) || state[to] == State.Inactive) {
            return;
        }

        address operator = OpenSeaGasFreeListing.proxyFor(to);

        // Disable if `to` has no proxy
        if (operator == address(0)) {
            state[to] = State.Inactive;
            return;
        }

        // Avoid emitting unnecessary events.
        if (balanceOf(to) == 0) {
            emit ApprovalForAll(to, operator, true);
        }
    }
}

File 6 of 32 : FixedPriceSeller.sol
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;

import "./Seller.sol";

/// @notice A Seller with fixed per-item price.
abstract contract FixedPriceSeller is Seller {
    constructor(
        uint256 _price,
        Seller.SellerConfig memory sellerConfig,
        address payable _beneficiary
    ) Seller(sellerConfig, _beneficiary) {
        setPrice(_price);
    }

    /**
    @notice The fixed per-item price.
    @dev Fixed as in not changing with time nor number of items, but not a
    constant.
     */
    uint256 public price;

    /// @notice Sets the per-item price.
    function setPrice(uint256 _price) public onlyOwner {
        price = _price;
    }

    /**
    @notice Override of Seller.cost() with fixed price.
    @dev The second parameter, metadata propagated from the call to _purchase(),
    is ignored.
     */
    function cost(uint256 n, uint256) public view override returns (uint256) {
        return n * price;
    }
}

File 7 of 32 : Seller.sol
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;

import "../utils/Monotonic.sol";
import "../utils/OwnerPausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

/**
@notice An abstract contract providing the _purchase() function to:
 - Enforce per-wallet / per-transaction limits
 - Calculate required cost, forwarding to a beneficiary, and refunding extra
 */
abstract contract Seller is OwnerPausable, ReentrancyGuard {
    using Address for address payable;
    using Monotonic for Monotonic.Increaser;
    using Strings for uint256;

    /**
    @dev Note that the address limits are vulnerable to wallet farming.
    @param maxPerAddress Unlimited if zero.
    @param maxPerTex Unlimited if zero.
    @param freeQuota Maximum number that can be purchased free of charge by
    the contract owner.
    @param reserveFreeQuota Whether to excplitly reserve the freeQuota amount
    and not let it be eroded by regular purchases.
    @param lockFreeQuota If true, calls to setSellerConfig() will ignore changes
    to freeQuota. Can be locked after initial setting, but not unlocked. This
    allows a contract owner to commit to a maximum number of reserved items.
    @param lockTotalInventory Similar to lockFreeQuota but applied to
    totalInventory.
    */
    struct SellerConfig {
        uint256 totalInventory;
        uint256 maxPerAddress;
        uint256 maxPerTx;
        uint248 freeQuota;
        bool reserveFreeQuota;
        bool lockFreeQuota;
        bool lockTotalInventory;
    }

    constructor(SellerConfig memory config, address payable _beneficiary) {
        setSellerConfig(config);
        setBeneficiary(_beneficiary);
    }

    /// @notice Configuration of purchase limits.
    SellerConfig public sellerConfig;

    /// @notice Sets the seller config.
    function setSellerConfig(SellerConfig memory config) public onlyOwner {
        require(
            config.totalInventory >= config.freeQuota,
            "Seller: excessive free quota"
        );
        require(
            config.totalInventory >= _totalSold.current(),
            "Seller: inventory < already sold"
        );
        require(
            config.freeQuota >= purchasedFreeOfCharge.current(),
            "Seller: free quota < already used"
        );

        // Overriding the in-memory fields before copying the whole struct, as
        // against writing individual fields, gives a greater guarantee of
        // correctness as the code is simpler to read.
        if (sellerConfig.lockTotalInventory) {
            config.lockTotalInventory = true;
            config.totalInventory = sellerConfig.totalInventory;
        }
        if (sellerConfig.lockFreeQuota) {
            config.lockFreeQuota = true;
            config.freeQuota = sellerConfig.freeQuota;
        }
        sellerConfig = config;
    }

    /// @notice Recipient of revenues.
    address payable public beneficiary;

    /// @notice Sets the recipient of revenues.
    function setBeneficiary(address payable _beneficiary) public onlyOwner {
        beneficiary = _beneficiary;
    }

    /**
    @dev Must return the current cost of a batch of items. This may be constant
    or, for example, decreasing for a Dutch auction or increasing for a bonding
    curve.
    @param n The number of items being purchased.
    @param metadata Arbitrary data, propagated by the call to _purchase() that
    can be used to charge different prices. This value is a uint256 instead of
    bytes as this allows simple passing of a set cost (see
    ArbitraryPriceSeller).
     */
    function cost(uint256 n, uint256 metadata)
        public
        view
        virtual
        returns (uint256);

    /**
    @dev Called by both _purchase() and purchaseFreeOfCharge() after all limits
    have been put in place; must perform all contract-specific sale logic, e.g.
    ERC721 minting. When _handlePurchase() is called, the value returned by
    Seller.totalSold() will be the pre-purchase amount.
    @param to The recipient of the item(s).
    @param n The number of items allowed to be purchased, which MAY be less than
    to the number passed to _purchase() but SHALL be greater than zero.
    @param freeOfCharge Indicates that the call originated from
    purchaseFreeOfCharge() and not _purchase().
    */
    function _handlePurchase(
        address to,
        uint256 n,
        bool freeOfCharge
    ) internal virtual;

    /**
    @notice Tracks total number of items sold by this contract, including those
    purchased free of charge by the contract owner.
     */
    Monotonic.Increaser private _totalSold;

    /// @notice Returns the total number of items sold by this contract.
    function totalSold() public view returns (uint256) {
        return _totalSold.current();
    }

    /**
    @notice Tracks the number of items already bought by an address, regardless
    of transferring out (in the case of ERC721).
    @dev This isn't public as it may be skewed due to differences in msg.sender
    and tx.origin, which it treats in the same way such that
    sum(_bought)>=totalSold().
     */
    mapping(address => uint256) private _bought;

    /**
    @notice Returns min(n, max(extra items addr can purchase)) and reverts if 0.
    @param zeroMsg The message with which to revert on 0 extra.
     */
    function _capExtra(
        uint256 n,
        address addr,
        string memory zeroMsg
    ) internal view returns (uint256) {
        uint256 extra = sellerConfig.maxPerAddress - _bought[addr];
        if (extra == 0) {
            revert(string(abi.encodePacked("Seller: ", zeroMsg)));
        }
        return Math.min(n, extra);
    }

    /// @notice Emitted when a buyer is refunded.
    event Refund(address indexed buyer, uint256 amount);

    /// @notice Emitted on all purchases of non-zero amount.
    event Revenue(
        address indexed beneficiary,
        uint256 numPurchased,
        uint256 amount
    );

    /// @notice Tracks number of items purchased free of charge.
    Monotonic.Increaser private purchasedFreeOfCharge;

    /**
    @notice Allows the contract owner to purchase without payment, within the
    quota enforced by the SellerConfig.
     */
    function purchaseFreeOfCharge(address to, uint256 n)
        public
        onlyOwner
        whenNotPaused
    {
        uint256 freeQuota = sellerConfig.freeQuota;
        n = Math.min(n, freeQuota - purchasedFreeOfCharge.current());
        require(n > 0, "Seller: Free quota exceeded");

        uint256 totalInventory = sellerConfig.totalInventory;
        n = Math.min(n, totalInventory - _totalSold.current());
        require(n > 0, "Seller: Sold out");

        _handlePurchase(to, n, true);

        _totalSold.add(n);
        purchasedFreeOfCharge.add(n);
        assert(_totalSold.current() <= totalInventory);
        assert(purchasedFreeOfCharge.current() <= freeQuota);
    }

    /**
    @notice Convenience function for calling _purchase() with empty costMetadata
    when unneeded.
     */
    function _purchase(address to, uint256 requested) internal virtual {
        _purchase(to, requested, 0);
    }

    /**
    @notice Enforces all purchase limits (counts and costs) before calling
    _handlePurchase(), after which the received funds are disbursed to the
    beneficiary, less any required refunds.
    @param to The final recipient of the item(s).
    @param requested The number of items requested for purchase, which MAY be
    reduced when passed to _handlePurchase().
    @param costMetadata Arbitrary data, propagated in the call to cost(), to be
    optionally used in determining the price.
     */
    function _purchase(
        address to,
        uint256 requested,
        uint256 costMetadata
    ) internal nonReentrant whenNotPaused {
        /**
         * ##### CHECKS
         */
        SellerConfig memory config = sellerConfig;

        uint256 n = config.maxPerTx == 0
            ? requested
            : Math.min(requested, config.maxPerTx);

        uint256 maxAvailable;
        uint256 sold;

        if (config.reserveFreeQuota) {
            maxAvailable = config.totalInventory - config.freeQuota;
            sold = _totalSold.current() - purchasedFreeOfCharge.current();
        } else {
            maxAvailable = config.totalInventory;
            sold = _totalSold.current();
        }

        n = Math.min(n, maxAvailable - sold);
        require(n > 0, "Seller: Sold out");

        if (config.maxPerAddress > 0) {
            bool alsoLimitSender = _msgSender() != to;
            // solhint-disable-next-line avoid-tx-origin
            bool alsoLimitOrigin = tx.origin != _msgSender() && tx.origin != to;

            n = _capExtra(n, to, "Buyer limit");
            if (alsoLimitSender) {
                n = _capExtra(n, _msgSender(), "Sender limit");
            }
            if (alsoLimitOrigin) {
                // solhint-disable-next-line avoid-tx-origin
                n = _capExtra(n, tx.origin, "Origin limit");
            }

            _bought[to] += n;
            if (alsoLimitSender) {
                _bought[_msgSender()] += n;
            }
            if (alsoLimitOrigin) {
                // solhint-disable-next-line avoid-tx-origin
                _bought[tx.origin] += n;
            }
        }

        uint256 _cost = cost(n, costMetadata);
        if (msg.value < _cost) {
            revert(
                string(
                    abi.encodePacked(
                        "Seller: Costs ",
                        (_cost / 1e9).toString(),
                        " GWei"
                    )
                )
            );
        }

        /**
         * ##### EFFECTS
         */

        _handlePurchase(to, n, false);
        _totalSold.add(n);
        assert(_totalSold.current() <= config.totalInventory);

        /**
         * ##### INTERACTIONS
         */

        // Ideally we'd be using a PullPayment here, but the user experience is
        // poor when there's a variable cost or the number of items purchased
        // has been capped. We've addressed reentrancy with both a nonReentrant
        // modifier and the checks, effects, interactions pattern.

        if (_cost > 0) {
            beneficiary.sendValue(_cost);
            emit Revenue(beneficiary, n, _cost);
        }

        if (msg.value > _cost) {
            address payable reimburse = payable(_msgSender());
            uint256 refund = msg.value - _cost;

            // Using Address.sendValue() here would mask the revertMsg upon
            // reentrancy, but we want to expose it to allow for more precise
            // testing. This otherwise uses the exact same pattern as
            // Address.sendValue().
            // solhint-disable-next-line avoid-low-level-calls
            (bool success, bytes memory returnData) = reimburse.call{
                value: refund
            }("");
            // Although `returnData` will have a spurious prefix, all we really
            // care about is that it contains the ReentrancyGuard reversion
            // message so we can check in the tests.
            require(success, string(returnData));

            emit Refund(reimburse, refund);
        }
    }
}

File 8 of 32 : OpenSeaGasFreeListing.sol
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;

// Inspired by BaseOpenSea by Simon Fremaux (@dievardump) but without the need
// to pass specific addresses depending on deployment network.
// https://gist.github.com/dievardump/483eb43bc6ed30b14f01e01842e3339b/

import "./ProxyRegistry.sol";

/// @notice Library to achieve gas-free listings on OpenSea.
library OpenSeaGasFreeListing {
    /**
    @notice Returns whether the operator is an OpenSea proxy for the owner, thus
    allowing it to list without the token owner paying gas.
    @dev ERC{721,1155}.isApprovedForAll should be overriden to also check if
    this function returns true.
     */
    function isApprovedForAll(address owner, address operator)
        internal
        view
        returns (bool)
    {
        address proxy = proxyFor(owner);
        return proxy != address(0) && proxy == operator;
    }

    /**
    @notice Returns the OpenSea proxy address for the owner.
     */
    function proxyFor(address owner) internal view returns (address) {
        address registry;
        uint256 chainId;

        assembly {
            chainId := chainid()
            switch chainId
            // Production networks are placed higher to minimise the number of
            // checks performed and therefore reduce gas. By the same rationale,
            // mainnet comes before Polygon as it's more expensive.
            case 1 {
                // mainnet
                registry := 0xa5409ec958c83c3f309868babaca7c86dcb077c1
            }
            case 137 {
                // polygon
                registry := 0x58807baD0B376efc12F5AD86aAc70E78ed67deaE
            }
            case 4 {
                // rinkeby
                registry := 0xf57b2c51ded3a29e6891aba85459d600256cf317
            }
            case 80001 {
                // mumbai
                registry := 0xff7Ca10aF37178BdD056628eF42fD7F799fAc77c
            }
            case 1337 {
                // The geth SimulatedBackend iff used with the ethier
                // openseatest package. This is mocked as a Wyvern proxy as it's
                // more complex than the 0x ones.
                registry := 0xE1a2bbc877b29ADBC56D2659DBcb0ae14ee62071
            }
        }

        // Unlike Wyvern, the registry itself is the proxy for all owners on 0x
        // chains.
        if (registry == address(0) || chainId == 137 || chainId == 80001) {
            return registry;
        }

        return address(ProxyRegistry(registry).proxies(owner));
    }
}

File 9 of 32 : ProxyRegistry.sol
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;

/// @notice A minimal interface describing OpenSea's Wyvern proxy registry.
contract ProxyRegistry {
    mapping(address => OwnableDelegateProxy) public proxies;
}

/**
@dev This pattern of using an empty contract is cargo-culted directly from
OpenSea's example code. TODO: it's likely that the above mapping can be changed
to address => address without affecting anything, but further investigation is
needed (i.e. is there a subtle reason that OpenSea released it like this?).
 */
// solhint-disable-next-line no-empty-blocks
contract OwnableDelegateProxy {

}

File 10 of 32 : Monotonic.sol
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;

/**
@notice Provides monotonic increasing and decreasing values, similar to
OpenZeppelin's Counter but (a) limited in direction, and (b) allowing for steps
> 1.
 */
library Monotonic {
    /**
    @notice Holds a value that can only increase.
    @dev The internal value MUST NOT be accessed directly. Instead use current()
    and add().
     */
    struct Increaser {
        uint256 value;
    }

    /// @notice Returns the current value of the Increaser.
    function current(Increaser storage incr) internal view returns (uint256) {
        return incr.value;
    }

    /// @notice Adds x to the Increaser's value.
    function add(Increaser storage incr, uint256 x) internal {
        incr.value += x;
    }

    /**
    @notice Holds a value that can only decrease.
    @dev The internal value MUST NOT be accessed directly. Instead use current()
    and subtract().
     */
    struct Decreaser {
        uint256 value;
    }

    /// @notice Returns the current value of the Decreaser.
    function current(Decreaser storage decr) internal view returns (uint256) {
        return decr.value;
    }

    /// @notice Subtracts x from the Decreaser's value.
    function subtract(Decreaser storage decr, uint256 x) internal {
        decr.value -= x;
    }
}

File 11 of 32 : OwnerPausable.sol
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)
pragma solidity >=0.8.0 <0.9.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

/// @notice A Pausable contract that can only be toggled by the Owner.
contract OwnerPausable is Ownable, Pausable {
    /// @notice Pauses the contract.
    function pause() public onlyOwner {
        Pausable._pause();
    }

    /// @notice Unpauses the contract.
    function unpause() public onlyOwner {
        Pausable._unpause();
    }
}

File 12 of 32 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 13 of 32 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)

pragma solidity ^0.8.0;

import "../utils/introspection/IERC165.sol";

File 14 of 32 : IERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be payed in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

File 15 of 32 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 16 of 32 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 17 of 32 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 18 of 32 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 IERC721Receiver {
    /**
     * @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 `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 19 of 32 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @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 32 : ERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.0;

import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
 *
 * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
 * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
 * fee is specified in basis points by default.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 *
 * _Available since v4.5._
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    RoyaltyInfo private _defaultRoyaltyInfo;
    mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) {
        return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(uint256 _tokenId, uint256 _salePrice)
        external
        view
        virtual
        override
        returns (address, uint256)
    {
        RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];

        if (royalty.receiver == address(0)) {
            royalty = _defaultRoyaltyInfo;
        }

        uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();

        return (royalty.receiver, royaltyAmount);
    }

    /**
     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
     * override.
     */
    function _feeDenominator() internal pure virtual returns (uint96) {
        return 10000;
    }

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: invalid receiver");

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Removes default royalty information.
     */
    function _deleteDefaultRoyalty() internal virtual {
        delete _defaultRoyaltyInfo;
    }

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `tokenId` must be already minted.
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(
        uint256 tokenId,
        address receiver,
        uint96 feeNumerator
    ) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: Invalid parameters");

        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Resets royalty information for the token id back to the global default.
     */
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        delete _tokenRoyaltyInfo[tokenId];
    }
}

File 21 of 32 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 22 of 32 : 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 23 of 32 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 24 of 32 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 25 of 32 : 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 26 of 32 : 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 27 of 32 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @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 / b + (a % b == 0 ? 0 : 1);
    }
}

File 28 of 32 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

File 29 of 32 : Common.sol
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2022 divergence.xyz
pragma solidity >=0.8.8 <0.9.0;

uint8 constant NUM_BACKGROUNDS = 13;
uint8 constant NUM_BODIES = 36;
uint8 constant NUM_MOUTHS = 35;
uint8 constant NUM_EYES = 45;

/// @notice The possible values of the Special trait.
enum Special {
    None,
    Devil,
    Angel,
    Both
}

/// @notice The features an ImaginaryFriend can have.
/// @dev The features are base 1 - zero means the corresponding trait is
/// deactivated.
struct Features {
    uint8 background;
    uint8 body;
    uint8 mouth;
    uint8 eyes;
    Special special;
    bool golden;
}

/// @notice A serialized version of `Features`
type FeaturesSerialized is bytes32;

File 30 of 32 : IMetadataRenderer.sol
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2022 divergence.xyz
pragma solidity >=0.8.8 <0.9.0;

import "./Common.sol";

interface IMetadataRenderer {
    function tokenFeatures(
        uint256 tokenId,
        FeaturesSerialized data,
        FeaturesSerialized[] memory allData,
        bool autogenerate
    ) external view returns (Features memory, bool);

    function tokenURI(
        uint256 tokenId,
        FeaturesSerialized data,
        string memory baseURI,
        FeaturesSerialized[] memory allData,
        bool autogenerate,
        bool countSiblings
    ) external view returns (string memory);
}

File 32 of 32 : Serializer.sol
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) 2022 divergence.xyz
pragma solidity >=0.8.8 <0.9.0;

import "./Common.sol";

/// @notice A helper library for `TokenData` serialization.
/// @dev Data is serialized by following the same order and bit-width of fields
/// as given in the definition of the structs using litte-endian encoding.
/// `TokenDataSerialized` will therefore only ever use the rightmost 80 bits.
library Serializer {
    /// @notice Serializes a given set of features.
    function serialize(Features memory features)
        internal
        pure
        returns (FeaturesSerialized)
    {
        unchecked {
            uint48 packed;
            packed += features.background;
            packed <<= 8;
            packed += features.body;
            packed <<= 8;
            packed += features.mouth;
            packed <<= 8;
            packed += features.eyes;
            packed <<= 8;
            packed += uint8(features.special);
            packed <<= 8;
            packed += features.golden ? 1 : 0;
            return FeaturesSerialized.wrap(bytes32(uint256(packed)));
        }
    }

    /// @notice The hash based on which features can be considered to be the
    /// same.
    /// @dev Just a serializaiton and cast
    function hash(Features memory features) internal pure returns (bytes32) {
        return bytes32(FeaturesSerialized.unwrap(serialize(features)));
    }
}

/// @notice A helper library for `TokenDataSerialized` unpacking.
library Deserializer {
    /// @notice Retrieves the `feature` field from serialized data.
    /// @notice Deserializes data into a struct.
    function deserialize(FeaturesSerialized data_)
        internal
        pure
        returns (Features memory)
    {
        unchecked {
            Features memory feats;
            uint256 data = _toUint256(data_);
            feats.golden = uint8(data) == 1;
            data >>= 8;
            feats.special = Special(uint8(data));
            data >>= 8;
            feats.eyes = uint8(data);
            data >>= 8;
            feats.mouth = uint8(data);
            data >>= 8;
            feats.body = uint8(data);
            data >>= 8;
            feats.background = uint8(data);
            return feats;
        }
    }

    /// @notice Checks it the data is set, i.e. non-zero
    function isSet(FeaturesSerialized data) internal pure returns (bool) {
        return FeaturesSerialized.unwrap(data) != 0;
    }

    /// @notice Converts the serialized data to an `uint`.
    function _toUint256(FeaturesSerialized data)
        private
        pure
        returns (uint256)
    {
        return uint256(FeaturesSerialized.unwrap(data));
    }

    /// @notice The hash based on which features can be considered to be the
    /// same.
    /// @dev Just the serialized version
    function hash(FeaturesSerialized features) internal pure returns (bytes32) {
        return FeaturesSerialized.unwrap(features);
    }
}

File 33 of 32 : ERC721A.sol
// SPDX-License-Identifier: MIT
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/utils/introspection/ERC165.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).
 */
contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings 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;

    constructor(string memory name_, string memory symbol_) {
        _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(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).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 = ERC721A.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 {
        TokenOwnership memory prevOwnership = _ownershipOf(tokenId);

        if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();

        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();
        }

        _beforeTokenTransfers(from, address(0), 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 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);
        _afterTokenTransfers(from, address(0), tokenId, 1);

        // 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
    ) private {
        _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 IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
            return retval == IERC721Receiver(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 {}
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"signerEarlyAccess","type":"address"},{"internalType":"address","name":"signerQuiz","type":"address"},{"internalType":"address payable","name":"paymentSplitter","type":"address"},{"internalType":"address payable","name":"royaltyReceiver","type":"address"},{"internalType":"string","name":"baseURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"InvalidTokenFeatures","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"QuizResultsAlreadySet","type":"error"},{"inputs":[],"name":"RendererLocked","type":"error"},{"inputs":[],"name":"TokenNotYetRevealed","type":"error"},{"inputs":[],"name":"TooManyMintsRequested","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"WrongStage","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Refund","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":false,"internalType":"uint256","name":"numPurchased","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Revenue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"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":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beneficiary","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"delSigners","type":"address[]"},{"internalType":"address[]","name":"addSigners","type":"address[]"}],"name":"changeSignersEarlyAccess","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"delSigners","type":"address[]"},{"internalType":"address[]","name":"addSigners","type":"address[]"}],"name":"changeSignersQuiz","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"n","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSignersEarlyAccess","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSignersQuiz","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"hasQuizResults","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":[],"name":"lockRenderer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum ImaginaryFriend.MintingStage","name":"stage","type":"uint8"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint16","name":"num","type":"uint16"},{"internalType":"uint16","name":"numMax","type":"uint16"},{"internalType":"uint128","name":"nonce","type":"uint128"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"mintEarlyAccess","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"num","type":"uint16"}],"name":"mintPublic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"components":[{"internalType":"uint8","name":"background","type":"uint8"},{"internalType":"uint8","name":"body","type":"uint8"},{"internalType":"uint8","name":"mouth","type":"uint8"},{"internalType":"uint8","name":"eyes","type":"uint8"},{"internalType":"enum Special","name":"special","type":"uint8"},{"internalType":"bool","name":"golden","type":"bool"}],"internalType":"struct Features[]","name":"features","type":"tuple[]"}],"name":"mintWithFeatures","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintingStage","outputs":[{"internalType":"enum ImaginaryFriend.MintingStage","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"numMintedFrom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"n","type":"uint256"}],"name":"purchaseFreeOfCharge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"quizStage","outputs":[{"internalType":"enum ImaginaryFriend.QuizStage","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renderer","outputs":[{"internalType":"contract IMetadataRenderer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sellerConfig","outputs":[{"internalType":"uint256","name":"totalInventory","type":"uint256"},{"internalType":"uint256","name":"maxPerAddress","type":"uint256"},{"internalType":"uint256","name":"maxPerTx","type":"uint256"},{"internalType":"uint248","name":"freeQuota","type":"uint248"},{"internalType":"bool","name":"reserveFreeQuota","type":"bool"},{"internalType":"bool","name":"lockFreeQuota","type":"bool"},{"internalType":"bool","name":"lockTotalInventory","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseTokenURI","type":"string"}],"name":"setBaseTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_beneficiary","type":"address"}],"name":"setBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"toggle","type":"bool"}],"name":"setCountSiblings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxPerAddress","type":"uint256"},{"internalType":"uint256","name":"maxPerTx","type":"uint256"}],"name":"setMintingLimits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum ImaginaryFriend.MintingStage","name":"stage","type":"uint8"}],"name":"setMintingStage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint8","name":"background","type":"uint8"},{"internalType":"uint8","name":"body","type":"uint8"},{"internalType":"uint8","name":"mouth","type":"uint8"},{"internalType":"uint8","name":"eyes","type":"uint8"},{"internalType":"enum Special","name":"special","type":"uint8"},{"internalType":"bool","name":"golden","type":"bool"}],"internalType":"struct Features","name":"features","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"setQuizResults","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum ImaginaryFriend.QuizStage","name":"stage","type":"uint8"}],"name":"setQuizStage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMetadataRenderer","name":"renderer_","type":"address"}],"name":"setRenderer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"totalInventory","type":"uint256"},{"internalType":"uint256","name":"maxPerAddress","type":"uint256"},{"internalType":"uint256","name":"maxPerTx","type":"uint256"},{"internalType":"uint248","name":"freeQuota","type":"uint248"},{"internalType":"bool","name":"reserveFreeQuota","type":"bool"},{"internalType":"bool","name":"lockFreeQuota","type":"bool"},{"internalType":"bool","name":"lockTotalInventory","type":"bool"}],"internalType":"struct Seller.SellerConfig","name":"config","type":"tuple"}],"name":"setSellerConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenFeatures","outputs":[{"components":[{"internalType":"uint8","name":"background","type":"uint8"},{"internalType":"uint8","name":"body","type":"uint8"},{"internalType":"uint8","name":"mouth","type":"uint8"},{"internalType":"uint8","name":"eyes","type":"uint8"},{"internalType":"enum Special","name":"special","type":"uint8"},{"internalType":"bool","name":"golden","type":"bool"}],"internalType":"struct Features","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620055ec380380620055ec8339810160408190526200003491620007ce565b806706f05b59d3b200006040518060e00160405280610bb88152602001600181526020016001815260200161012c6001600160f81b03168152602001600115158152602001600015158152602001600115158152508581816040518060400160405280601a81526020017f4d7920496d6167696e61727920467269656e64206279204b61690000000000008152506040518060400160405280600581526020016425a0a4a4a360d91b81525081818160029080519060200190620000fa929190620006f9565b50805162000110906003906020840190620006f9565b505060008055506200012233620001cc565b50506009805460ff60a01b191690556001600a5562000141826200021e565b6200014c8162000461565b506200015a905083620004ce565b5050506200016e816200051e60201b60201c565b506200018a8560186200058260201b62001e041790919060201c565b50620001a684601a6200058260201b62001e041790919060201c565b50620001c182620001bb600a61271062000904565b620005a2565b505050505062000976565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6009546001600160a01b031633146200026d5760405162461bcd60e51b81526020600482018190526024820152600080516020620055cc83398151915260448201526064015b60405180910390fd5b80606001516001600160f81b031681600001511015620002d05760405162461bcd60e51b815260206004820152601c60248201527f53656c6c65723a2065786365737369766520667265652071756f746100000000604482015260640162000264565b620002e76011620006a360201b62001e191760201c565b81511015620003395760405162461bcd60e51b815260206004820181905260248201527f53656c6c65723a20696e76656e746f7279203c20616c726561647920736f6c64604482015260640162000264565b620003506013620006a360201b62001e191760201c565b81606001516001600160f81b03161015620003b85760405162461bcd60e51b815260206004820152602160248201527f53656c6c65723a20667265652071756f7461203c20616c7265616479207573656044820152601960fa1b606482015260840162000264565b600f54610100900460ff1615620003d657600160c0820152600b5481525b600f5460ff1615620003fb57600160a0820152600e546001600160f81b031660608201525b8051600b556020810151600c556040810151600d55606081015160808201511515600160f81b026001600160f81b0390911617600e5560a0810151600f805460c09093015115156101000261ff00199215159290921661ffff1990931692909217179055565b6009546001600160a01b03163314620004ac5760405162461bcd60e51b81526020600482018190526024820152600080516020620055cc833981519152604482015260640162000264565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6009546001600160a01b03163314620005195760405162461bcd60e51b81526020600482018190526024820152600080516020620055cc833981519152604482015260640162000264565b601455565b6009546001600160a01b03163314620005695760405162461bcd60e51b81526020600482018190526024820152600080516020620055cc833981519152604482015260640162000264565b80516200057e906015906020840190620006f9565b5050565b600062000599836001600160a01b038416620006a7565b90505b92915050565b6127106001600160601b0382161115620006125760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840162000264565b6001600160a01b0382166200066a5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640162000264565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601655565b5490565b6000818152600183016020526040812054620006f0575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200059c565b5060006200059c565b828054620007079062000939565b90600052602060002090601f0160209004810192826200072b576000855562000776565b82601f106200074657805160ff191683800117855562000776565b8280016001018555821562000776579182015b828111156200077657825182559160200191906001019062000759565b506200078492915062000788565b5090565b5b8082111562000784576000815560010162000789565b6001600160a01b0381168114620007b557600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b600080600080600060a08688031215620007e757600080fd5b8551620007f4816200079f565b8095505060208087015162000809816200079f565b60408801519095506200081c816200079f565b60608801519094506200082f816200079f565b60808801519093506001600160401b03808211156200084d57600080fd5b818901915089601f8301126200086257600080fd5b815181811115620008775762000877620007b8565b604051601f8201601f19908116603f01168101908382118183101715620008a257620008a2620007b8565b816040528281528c86848701011115620008bb57600080fd5b600093505b82841015620008df5784840186015181850187015292850192620008c0565b82841115620008f15760008684830101525b8096505050505050509295509295909350565b60006001600160601b03838116806200092d57634e487b7160e01b600052601260045260246000fd5b92169190910492915050565b600181811c908216806200094e57607f821691505b602082108114156200097057634e487b7160e01b600052602260045260246000fd5b50919050565b614c4680620009866000396000f3fe60806040526004361061031a5760003560e01c806384f302f1116101ab578063bf62e21d116100f7578063eca15c7911610095578063f2fc31681161006f578063f2fc3168146109b4578063f2fde38b146109d4578063f584c6db146109f4578063f6651b0414610a0957600080fd5b8063eca15c7914610946578063f04180af14610974578063f212c9de1461099457600080fd5b8063c35d8769116100d1578063c35d8769146108cf578063c87b56dd146108f1578063d547cfb714610911578063e985e9c51461092657600080fd5b8063bf62e21d1461086f578063c12ca7b01461088f578063c32bfa34146108af57600080fd5b806395d89b4111610164578063a22cb4651161013e578063a22cb46514610784578063ab15a186146107a4578063b88d4fde146107c4578063bb69b7ef146107e457600080fd5b806395d89b41146107445780639c8a2bfd14610759578063a035b1fe1461076e57600080fd5b806384f302f1146106845780638ada6b0f146106a45780638da5cb5b146106c45780638f8c33ac146106e25780639106d7ba1461070f57806391b7f5ed1461072457600080fd5b8063338e8d881161026a5780634fddc979116102235780636352211e116101fd5780636352211e1461061a57806370a082311461063a578063715018a61461065a5780638456cb591461066f57600080fd5b80634fddc979146105ad57806356d3163d146105db5780635c975abb146105fb57600080fd5b8063338e8d88146104f857806338af3eed146105185780633a8aae1c146105385780633ec02e14146105585780633f4ba83a1461057857806342842e0e1461058d57600080fd5b806316755b57116102d757806323b872dd116102b157806323b872dd146104595780632a55205a146104795780632f274bd4146104b857806330176e13146104d857600080fd5b806316755b571461040357806318160ddd146104165780631c31f7101461043957600080fd5b806301ffc9a71461031f57806304634d8d1461035457806306fdde031461037657806307adbdee14610398578063081812fc146103ab578063095ea7b3146103e3575b600080fd5b34801561032b57600080fd5b5061033f61033a366004613cc4565b610a36565b60405190151581526020015b60405180910390f35b34801561036057600080fd5b5061037461036f366004613cf6565b610a47565b005b34801561038257600080fd5b5061038b610a88565b60405161034b9190613d93565b6103746103a6366004613e0d565b610b1a565b3480156103b757600080fd5b506103cb6103c6366004613ebc565b610d22565b6040516001600160a01b03909116815260200161034b565b3480156103ef57600080fd5b506103746103fe366004613ed5565b610d66565b610374610411366004613f01565b610df4565b34801561042257600080fd5b50600154600054035b60405190815260200161034b565b34801561044557600080fd5b50610374610454366004613f1c565b610e41565b34801561046557600080fd5b50610374610474366004613f39565b610e8d565b34801561048557600080fd5b50610499610494366004613f7a565b610e98565b604080516001600160a01b03909316835260208301919091520161034b565b3480156104c457600080fd5b506103746104d3366004614045565b610f46565b3480156104e457600080fd5b506103746104f3366004614135565b611134565b34801561050457600080fd5b5061037461051336600461417d565b611171565b34801561052457600080fd5b506010546103cb906001600160a01b031681565b34801561054457600080fd5b50610374610553366004614198565b6111c8565b34801561056457600080fd5b5061042b610573366004613f7a565b611217565b34801561058457600080fd5b5061037461122e565b34801561059957600080fd5b506103746105a8366004613f39565b611262565b3480156105b957600080fd5b50601e546105ce90600160a81b900460ff1681565b60405161034b91906141cf565b3480156105e757600080fd5b506103746105f6366004613f1c565b61127d565b34801561060757600080fd5b50600954600160a01b900460ff1661033f565b34801561062657600080fd5b506103cb610635366004613ebc565b6112f4565b34801561064657600080fd5b5061042b610655366004613f1c565b611306565b34801561066657600080fd5b50610374611354565b34801561067b57600080fd5b50610374611388565b34801561069057600080fd5b5061037461069f366004613f7a565b6113ba565b3480156106b057600080fd5b50601e546103cb906001600160a01b031681565b3480156106d057600080fd5b506009546001600160a01b03166103cb565b3480156106ee57600080fd5b5061042b6106fd366004613ebc565b601c6020526000908152604090205481565b34801561071b57600080fd5b5061042b6113ef565b34801561073057600080fd5b5061037461073f366004613ebc565b6113ff565b34801561075057600080fd5b5061038b61142e565b34801561076557600080fd5b5061037461143d565b34801561077a57600080fd5b5061042b60145481565b34801561079057600080fd5b5061037461079f3660046141e9565b61147c565b3480156107b057600080fd5b506103746107bf366004614217565b611542565b3480156107d057600080fd5b506103746107df366004614234565b61158a565b3480156107f057600080fd5b50600b54600c54600d54600e54600f5461082c949392916001600160f81b0381169160ff600160f81b9092048216918181169161010090041687565b604080519788526020880196909652948601939093526001600160f81b03909116606085015215156080840152151560a0830152151560c082015260e00161034b565b34801561087b57600080fd5b5061037461088a366004613ed5565b6115db565b34801561089b57600080fd5b506103746108aa3660046142f7565b611750565b3480156108bb57600080fd5b506103746108ca3660046142f7565b611788565b3480156108db57600080fd5b506108e46117c0565b60405161034b9190614362565b3480156108fd57600080fd5b5061038b61090c366004613ebc565b6117cc565b34801561091d57600080fd5b5061038b6118d5565b34801561093257600080fd5b5061033f6109413660046143af565b611963565b34801561095257600080fd5b50601e5461096790600160b01b900460ff1681565b60405161034b91906143dd565b34801561098057600080fd5b5061037461098f3660046143f1565b6119da565b3480156109a057600080fd5b506103746109af36600461444b565b611b69565b3480156109c057600080fd5b5061033f6109cf366004613ebc565b611c01565b3480156109e057600080fd5b506103746109ef366004613f1c565b611c3f565b348015610a0057600080fd5b506108e4611cda565b348015610a1557600080fd5b50610a29610a24366004613ebc565b611ce6565b60405161034b91906144d2565b6000610a4182611e1d565b92915050565b6009546001600160a01b03163314610a7a5760405162461bcd60e51b8152600401610a7190614536565b60405180910390fd5b610a848282611e42565b5050565b606060028054610a979061456b565b80601f0160208091040260200160405190810160405280929190818152602001828054610ac39061456b565b8015610b105780601f10610ae557610100808354040283529160200191610b10565b820191906000526020600020905b815481529060010190602001808311610af357829003601f168201915b5050505050905090565b6001600581601e54600160a81b900460ff166005811115610b3d57610b3d6141b9565b1080610b765750601e54600160a81b900460ff166005811115610b6257610b626141b9565b816005811115610b7457610b746141b9565b105b15610b945760405163502f1a5d60e11b815260040160405180910390fd5b6040805160e081018252600b548152600c80546020830152600d805493830193909352600e546001600160f81b038116606084015260ff600160f81b909104811615156080840152600f54808216151560a0850152610100900416151560c083015260009283905591909155896005811115610c1257610c126141b9565b601e54600160a81b900460ff166005811115610c3057610c306141b9565b1015610c4f5760405163502f1a5d60e11b815260040160405180910390fd5b6000610c81308c8c8b8b604051602001610c6d9594939291906145a0565b604051602081830303815290604052611f3f565b6000818152601c602052604090205490915061ffff808a1691610ca5918c16614622565b1115610cc45760405163342e754760e21b815260040160405180910390fd5b610cd16018828888611f4a565b6000818152601c60205260408120805461ffff8c169290610cf3908490614622565b90915550610d0790508a61ffff8b16611fae565b506040810151600d5560200151600c55505050505050505050565b6000610d2d82611fba565b610d4a576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610d71826112f4565b9050806001600160a01b0316836001600160a01b03161415610da65760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614801590610dc65750610dc48133611963565b155b15610de4576040516367d9dca160e11b815260040160405180910390fd5b610def838383611fe5565b505050565b600580601e54600160a81b900460ff166005811115610e1557610e156141b9565b14610e335760405163502f1a5d60e11b815260040160405180910390fd5b610a84338361ffff16611fae565b6009546001600160a01b03163314610e6b5760405162461bcd60e51b8152600401610a7190614536565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b610def838383612041565b60008281526017602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610f0d5750604080518082019091526016546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610f2c906001600160601b03168761463a565b610f36919061466f565b91519350909150505b9250929050565b6009546001600160a01b03163314610f705760405162461bcd60e51b8152600401610a7190614536565b80606001516001600160f81b031681600001511015610fd15760405162461bcd60e51b815260206004820152601c60248201527f53656c6c65723a2065786365737369766520667265652071756f7461000000006044820152606401610a71565b601154815110156110245760405162461bcd60e51b815260206004820181905260248201527f53656c6c65723a20696e76656e746f7279203c20616c726561647920736f6c646044820152606401610a71565b60135481606001516001600160f81b0316101561108d5760405162461bcd60e51b815260206004820152602160248201527f53656c6c65723a20667265652071756f7461203c20616c7265616479207573656044820152601960fa1b6064820152608401610a71565b600f54610100900460ff16156110aa57600160c0820152600b5481525b600f5460ff16156110ce57600160a0820152600e546001600160f81b031660608201525b8051600b556020810151600c556040810151600d55606081015160808201511515600160f81b026001600160f81b0390911617600e5560a0810151600f805460c09093015115156101000261ff00199215159290921661ffff1990931692909217179055565b6009546001600160a01b0316331461115e5760405162461bcd60e51b8152600401610a7190614536565b8051610a84906015906020840190613c15565b6009546001600160a01b0316331461119b5760405162461bcd60e51b8152600401610a7190614536565b601e805482919060ff60a81b1916600160a81b8360058111156111c0576111c06141b9565b021790555050565b6009546001600160a01b031633146111f25760405162461bcd60e51b8152600401610a7190614536565b601e805482919060ff60b01b1916600160b01b8360028111156111c0576111c06141b9565b600060145483611227919061463a565b9392505050565b6009546001600160a01b031633146112585760405162461bcd60e51b8152600401610a7190614536565b61126061223c565b565b610def8383836040518060200160405280600081525061158a565b6009546001600160a01b031633146112a75760405162461bcd60e51b8152600401610a7190614536565b601e54600160a01b900460ff16156112d257604051634a7b75a160e01b815260040160405180910390fd5b601e80546001600160a01b0319166001600160a01b0392909216919091179055565b60006112ff826122d9565b5192915050565b60006001600160a01b03821661132f576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6009546001600160a01b0316331461137e5760405162461bcd60e51b8152600401610a7190614536565b61126060006123f3565b6009546001600160a01b031633146113b25760405162461bcd60e51b8152600401610a7190614536565b611260612445565b6009546001600160a01b031633146113e45760405162461bcd60e51b8152600401610a7190614536565b600c91909155600d55565b60006113fa60115490565b905090565b6009546001600160a01b031633146114295760405162461bcd60e51b8152600401610a7190614536565b601455565b606060038054610a979061456b565b6009546001600160a01b031633146114675760405162461bcd60e51b8152600401610a7190614536565b601e805460ff60a01b1916600160a01b179055565b33611486816124aa565b6001600160a01b0316836001600160a01b0316141561153857816114ab5760016114ae565b60005b6001600160a01b0382166000908152600860205260409020805460ff1916600183818111156114df576114df6141b9565b0217905550826001600160a01b0316816001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318460405161152b911515815260200190565b60405180910390a3505050565b610def8383612609565b6009546001600160a01b0316331461156c5760405162461bcd60e51b8152600401610a7190614536565b601e8054911515600160b81b0260ff60b81b19909216919091179055565b611595848484612041565b6001600160a01b0383163b151580156115b757506115b58484848461269f565b155b156115d5576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6009546001600160a01b031633146116055760405162461bcd60e51b8152600401610a7190614536565b600954600160a01b900460ff161561162f5760405162461bcd60e51b8152600401610a7190614683565b600e546001600160f81b03166116578261164860135490565b61165290846146ad565b612787565b9150600082116116a95760405162461bcd60e51b815260206004820152601b60248201527f53656c6c65723a20467265652071756f746120657863656564656400000000006044820152606401610a71565b600b546116b98361164860115490565b9250600083116116fe5760405162461bcd60e51b815260206004820152601060248201526f14d95b1b195c8e8814dbdb19081bdd5d60821b6044820152606401610a71565b61170a8484600161279d565b6117156011846127a7565b6117206013846127a7565b8061172a60115490565b1115611738576117386146c4565b8161174260135490565b11156115d5576115d56146c4565b6009546001600160a01b0316331461177a5760405162461bcd60e51b8152600401610a7190614536565b6115d56018858585856127c4565b6009546001600160a01b031633146117b25760405162461bcd60e51b8152600401610a7190614536565b6115d5601a858585856127c4565b60606113fa601861285f565b6060816117d881611fba565b6117f45760405162461bcd60e51b8152600401610a71906146da565b6000838152601d60205260408120549061180c61290b565b905060006002601e54600160b01b900460ff166002811115611830576118306141b9565b601e54911491506001600160a01b031663c59e31fc878561184f612984565b601e5460405160e086901b6001600160e01b03191681526118849493929189918991600160b81b900460ff1690600401614757565b600060405180830381865afa1580156118a1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118c991908101906147a3565b94505050505b50919050565b601580546118e29061456b565b80601f016020809104026020016040519081016040528092919081815260200182805461190e9061456b565b801561195b5780601f106119305761010080835404028352916020019161195b565b820191906000526020600020905b81548152906001019060200180831161193e57829003601f168201915b505050505081565b6001600160a01b03808316600090815260076020908152604080832093851683529290529081205460ff161561199b57506001610a41565b6001600160a01b03831660009081526008602052604081205460ff1660018111156119c8576119c86141b9565b1480156112275750611227838361298e565b6001601e54600160b01b900460ff1660028111156119fa576119fa6141b9565b14611a185760405163502f1a5d60e11b815260040160405180910390fd5b8333611a23826122d9565b516001600160a01b03161480611a49575033611a3e82610d22565b6001600160a01b0316145b611aa35760405162461bcd60e51b815260206004820152602560248201527f45524337323141436f6d6d6f6e3a204e6f7420617070726f766564206e6f722060448201526437bbb732b960d91b6064820152608401610a71565b6000858152601d602052604090205415611ad057604051637495c9b960e11b815260040160405180910390fd5b6000611b3a3087611ae4602089018961481f565b611af460408a0160208b0161481f565b611b0460608b0160408c0161481f565b611b1460808c0160608d0161481f565b611b2460a08d0160808e01614849565b604051602001610c6d9796959493929190614866565b9050611b49601a828686611f4a565b611b6186611b5c368890038801886148d9565b6129cc565b505050505050565b6009546001600160a01b03163314611b935760405162461bcd60e51b8152600401610a7190614536565b806000611ba36001546000540390565b9050611baf85836115db565b60005b82811015611b6157611be682868684818110611bd057611bd0614983565b905060c00201803603810190611b5c91906148d9565b611bef82614999565b9150611bfa81614999565b9050611bb2565b600081611c0d81611fba565b611c295760405162461bcd60e51b8152600401610a71906146da565b50506000908152601d6020526040902054151590565b6009546001600160a01b03163314611c695760405162461bcd60e51b8152600401610a7190614536565b6001600160a01b038116611cce5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a71565b611cd7816123f3565b50565b60606113fa601a61285f565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915281611d2281611fba565b611d3e5760405162461bcd60e51b8152600401610a71906146da565b6000838152601d602052604081205490611d5661290b565b905060006002601e54600160b01b900460ff166002811115611d7a57611d7a6141b9565b601e5460405163ae91a56b60e01b81529190921492506000916001600160a01b03169063ae91a56b90611db7908a908890889088906004016149b4565b60e060405180830381865afa158015611dd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611df891906149f1565b50979650505050505050565b6000611227836001600160a01b0384166129fb565b5490565b60006001600160e01b0319821663152a902d60e11b1480610a415750610a4182612a4a565b6127106001600160601b0382161115611eb05760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610a71565b6001600160a01b038216611f065760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610a71565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601655565b6000610a4182612a55565b611f5684848484612a90565b6115d55760405162461bcd60e51b815260206004820152602360248201527f5369676e6174757265436865636b65723a20496e76616c6964207369676e617460448201526275726560e81b6064820152608401610a71565b610a8482826000612ae5565b6000805482108015610a41575050600090815260046020526040902054600160e01b900460ff161590565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600061204c826122d9565b9050836001600160a01b031681600001516001600160a01b0316146120835760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b03861614806120a157506120a18533611963565b806120bc5750336120b184610d22565b6001600160a01b0316145b9050806120dc57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03841661210357604051633a954ecd60e21b815260040160405180910390fd5b6121108585856001612fc3565b61211c60008487611fe5565b6001600160a01b038581166000908152600560209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600490945282852080546001600160e01b031916909417600160a01b429092169190910217835587018084529220805491939091166121f05760005482146121f057805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b5050505050565b600954600160a01b900460ff1661228c5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a71565b6009805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6040805160608101825260008082526020820181905291810191909152816000548110156123da57600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff161515918101829052906123d85780516001600160a01b03161561236f579392505050565b5060001901600081815260046020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff16151592810192909252156123d3579392505050565b61236f565b505b604051636f96cda160e11b815260040160405180910390fd5b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600954600160a01b900460ff161561246f5760405162461bcd60e51b8152600401610a7190614683565b6009805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586122bc3390565b6000804680600181146124df57608981146124fb57600481146125175762013881811461253357610539811461254f57612567565b73a5409ec958c83c3f309868babaca7c86dcb077c19250612567565b7358807bad0b376efc12f5ad86aac70e78ed67deae9250612567565b73f57b2c51ded3a29e6891aba85459d600256cf3179250612567565b73ff7ca10af37178bdd056628ef42fd7f799fac77c9250612567565b73e1a2bbc877b29adbc56d2659dbcb0ae14ee6207192505b506001600160a01b038216158061257e5750806089145b8061258b57508062013881145b15612597575092915050565b60405163c455279160e01b81526001600160a01b03858116600483015283169063c455279190602401602060405180830381865afa1580156125dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126019190614a9f565b949350505050565b6001600160a01b0382163314156126335760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906126d4903390899088908890600401614abc565b6020604051808303816000875af192505050801561270f575060408051601f3d908101601f1916820190925261270c91810190614af9565b60015b61276a573d80801561273d576040519150601f19603f3d011682016040523d82523d6000602084013e612742565b606091505b508051612762576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b60008183106127965781611227565b5090919050565b610def8383613021565b808260000160008282546127bb9190614622565b90915550505050565b60005b83811015612811576128008585838181106127e4576127e4614983565b90506020020160208101906127f99190613f1c565b879061303b565b5061280a81614999565b90506127c7565b5060005b81811015611b615761284e83838381811061283257612832614983565b90506020020160208101906128479190613f1c565b8790611e04565b5061285881614999565b9050612815565b6060600061286c83613050565b90506000816001600160401b0381111561288857612888613f9c565b6040519080825280602002602001820160405280156128b1578160200160208202803683370190505b50905060005b82811015612903576128c9858261305a565b8282815181106128db576128db614983565b6001600160a01b03909216602092830291909101909101526128fc81614999565b90506128b7565b509392505050565b60408051610bb88082526201772082019092526060916000919060208201620177008036833701905050905060005b610bb88110156118cf576000818152601d6020526040902054825183908390811061296757612967614983565b60209081029190910101528061297c81614999565b91505061293a565b60606113fa613066565b60008061299a846124aa565b90506001600160a01b038116158015906126015750826001600160a01b0316816001600160a01b031614949350505050565b811560a08201526129dc81613075565b6129e581613150565b6000928352601d60205260409092209190915550565b6000818152600183016020526040812054612a4257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a41565b506000610a41565b6000610a41826131e8565b6000612a618251613238565b82604051602001612a73929190614b16565b604051602081830303815290604052805190602001209050919050565b6000612adc612ad58585858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061333592505050565b8690613351565b95945050505050565b6002600a541415612b385760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a71565b6002600a55600954600160a01b900460ff1615612b675760405162461bcd60e51b8152600401610a7190614683565b6040805160e081018252600b548152600c546020820152600d54918101829052600e546001600160f81b038116606083015260ff600160f81b909104811615156080830152600f54808216151560a0840152610100900416151560c08201529060009015612be257612bdd848360400151612787565b612be4565b835b9050600080836080015115612c2c5760608401518451612c0d916001600160f81b0316906146ad565b9150612c1860135490565b601154612c2591906146ad565b9050612c3c565b83519150612c3960115490565b90505b612c4a8361165283856146ad565b925060008311612c8f5760405162461bcd60e51b815260206004820152601060248201526f14d95b1b195c8e8814dbdb19081bdd5d60821b6044820152606401610a71565b602084015115612deb57336001600160a01b038816811415906000903214801590612cc35750326001600160a01b038a1614155b9050612cf3858a6040518060400160405280600b81526020016a109d5e595c881b1a5b5a5d60aa1b815250613373565b94508115612d2d57612d2a85336040518060400160405280600c81526020016b14d95b99195c881b1a5b5a5d60a21b815250613373565b94505b8015612d6557612d6285326040518060400160405280600c81526020016b13dc9a59da5b881b1a5b5a5d60a21b815250613373565b94505b6001600160a01b03891660009081526012602052604081208054879290612d8d908490614622565b90915550508115612dbd573360009081526012602052604081208054879290612db7908490614622565b90915550505b8015612de8573260009081526012602052604081208054879290612de2908490614622565b90915550505b50505b6000612df78487611217565b905080341015612e4d57612e17612e12633b9aca008361466f565b613238565b604051602001612e279190614b71565b60408051601f198184030181529082905262461bcd60e51b8252610a7191600401613d93565b612e598885600061279d565b612e646011856127a7565b84516011541115612e7757612e776146c4565b8015612edc57601054612e93906001600160a01b0316826133bc565b60105460408051868152602081018490526001600160a01b03909216917f01f51b99bd1c3cca301836178e5dee13aadfe44eff06dc3ddcbf3c9d058454f8910160405180910390a25b80341115612fb457336000612ef183346146ad565b9050600080836001600160a01b03168360405160006040518083038185875af1925050503d8060008114612f41576040519150601f19603f3d011682016040523d82523d6000602084013e612f46565b606091505b5091509150818190612f6b5760405162461bcd60e51b8152600401610a719190613d93565b50836001600160a01b03167fbb28353e4598c3b9199101a66e0989549b659a59a54d2c27fbb183f1932c8e6d84604051612fa791815260200190565b60405180910390a2505050505b50506001600a55505050505050565b600954600160a01b900460ff16156130155760405162461bcd60e51b8152602060048201526015602482015274115490cdcc8c5050dbdb5b5bdb8e881c185d5cd959605a1b6044820152606401610a71565b6115d5848484846134d5565b610a848282604051806020016040528060008152506135c9565b6000611227836001600160a01b0384166135d6565b6000610a41825490565b600061122783836136c9565b606060158054610a979061456b565b805160ff161580159061308f57506000816020015160ff16115b80156130a257506000816040015160ff16115b80156130b557506000816060015160ff16115b80156130c857508051600d60ff90911611155b80156130df5750602460ff16816020015160ff1611155b80156130f65750602360ff16816040015160ff1611155b801561310d5750602d60ff16816060015160ff1611155b801561312f575060038160800151600381111561312c5761312c6141b9565b11155b156131375750565b60405163c7f6ee9b60e01b815260040160405180910390fd5b80516020820151604083015160608401516080850151600094600890811b61ff001660ff95861601811b66ffffffffffff0090811694861694909401811b84169490921693909301901b169060038111156131ad576131ad6141b9565b60ff168101905060088165ffffffffffff16901b90508260a001516131d35760006131d6565b60015b60ff160165ffffffffffff1692915050565b60006001600160e01b031982166380ac58cd60e01b148061321957506001600160e01b03198216635b5e139f60e01b145b80610a4157506301ffc9a760e01b6001600160e01b0319831614610a41565b60608161325c5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613286578061327081614999565b915061327f9050600a8361466f565b9150613260565b6000816001600160401b038111156132a0576132a0613f9c565b6040519080825280601f01601f1916602001820160405280156132ca576020820181803683370190505b5090505b8415612601576132df6001836146ad565b91506132ec600a86614bb6565b6132f7906030614622565b60f81b81838151811061330c5761330c614983565b60200101906001600160f81b031916908160001a90535061332e600a8661466f565b94506132ce565b600080600061334485856136f3565b9150915061290381613760565b6001600160a01b03811660009081526001830160205260408120541515611227565b6001600160a01b038216600090815260126020526040812054600c54829161339a916146ad565b9050806133b25782604051602001612e279190614bca565b612adc8582612787565b8047101561340c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610a71565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613459576040519150601f19603f3d011682016040523d82523d6000602084013e61345e565b606091505b5050905080610def5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610a71565b6001600160a01b0383161580613517575060016001600160a01b03841660009081526008602052604090205460ff166001811115613515576135156141b9565b145b15613521576115d5565b600061352c846124aa565b90506001600160a01b03811661356557506001600160a01b0383166000908152600860205260409020805460ff191660011790556115d5565b61356e84611306565b61223557806001600160a01b0316846001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160016040516135ba911515815260200190565b60405180910390a35050505050565b610def838383600161391b565b600081815260018301602052604081205480156136bf5760006135fa6001836146ad565b855490915060009061360e906001906146ad565b905081811461367357600086600001828154811061362e5761362e614983565b906000526020600020015490508087600001848154811061365157613651614983565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061368457613684614bfa565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a41565b6000915050610a41565b60008260000182815481106136e0576136e0614983565b9060005260206000200154905092915050565b60008082516041141561372a5760208301516040840151606085015160001a61371e87828585613aef565b94509450505050610f3f565b8251604014156137545760208301516040840151613749868383613bdc565b935093505050610f3f565b50600090506002610f3f565b6000816004811115613774576137746141b9565b141561377d5750565b6001816004811115613791576137916141b9565b14156137df5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610a71565b60028160048111156137f3576137f36141b9565b14156138415760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610a71565b6003816004811115613855576138556141b9565b14156138ae5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610a71565b60048160048111156138c2576138c26141b9565b1415611cd75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610a71565b6000546001600160a01b03851661394457604051622e076360e81b815260040160405180910390fd5b836139625760405163b562e8dd60e01b815260040160405180910390fd5b61396f6000868387612fc3565b6001600160a01b038516600081815260056020908152604080832080546001600160801b031981166001600160401b038083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c01811690920217909155858452600490925290912080546001600160e01b031916909217600160a01b429092169190910217905580808501838015613a1757506001600160a01b0387163b15155b15613aa0575b60405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4613a68600088848060010195508861269f565b613a85576040516368d2bf6b60e11b815260040160405180910390fd5b80821415613a1d578260005414613a9b57600080fd5b613ae6565b5b6040516001830192906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480821415613aa1575b50600055612235565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613b265750600090506003613bd3565b8460ff16601b14158015613b3e57508460ff16601c14155b15613b4f5750600090506004613bd3565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613ba3573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613bcc57600060019250925050613bd3565b9150600090505b94509492505050565b6000806001600160ff1b03831681613bf960ff86901c601b614622565b9050613c0787828885613aef565b935093505050935093915050565b828054613c219061456b565b90600052602060002090601f016020900481019282613c435760008555613c89565b82601f10613c5c57805160ff1916838001178555613c89565b82800160010185558215613c89579182015b82811115613c89578251825591602001919060010190613c6e565b50613c95929150613c99565b5090565b5b80821115613c955760008155600101613c9a565b6001600160e01b031981168114611cd757600080fd5b600060208284031215613cd657600080fd5b813561122781613cae565b6001600160a01b0381168114611cd757600080fd5b60008060408385031215613d0957600080fd5b8235613d1481613ce1565b915060208301356001600160601b0381168114613d3057600080fd5b809150509250929050565b60005b83811015613d56578181015183820152602001613d3e565b838111156115d55750506000910152565b60008151808452613d7f816020860160208601613d3b565b601f01601f19169290920160200192915050565b6020815260006112276020830184613d67565b803560068110613db557600080fd5b919050565b803561ffff81168114613db557600080fd5b60008083601f840112613dde57600080fd5b5081356001600160401b03811115613df557600080fd5b602083019150836020828501011115610f3f57600080fd5b600080600080600080600060c0888a031215613e2857600080fd5b613e3188613da6565b96506020880135613e4181613ce1565b9550613e4f60408901613dba565b9450613e5d60608901613dba565b935060808801356fffffffffffffffffffffffffffffffff81168114613e8257600080fd5b925060a08801356001600160401b03811115613e9d57600080fd5b613ea98a828b01613dcc565b989b979a50959850939692959293505050565b600060208284031215613ece57600080fd5b5035919050565b60008060408385031215613ee857600080fd5b8235613ef381613ce1565b946020939093013593505050565b600060208284031215613f1357600080fd5b61122782613dba565b600060208284031215613f2e57600080fd5b813561122781613ce1565b600080600060608486031215613f4e57600080fd5b8335613f5981613ce1565b92506020840135613f6981613ce1565b929592945050506040919091013590565b60008060408385031215613f8d57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715613fd457613fd4613f9c565b60405290565b60405160c081016001600160401b0381118282101715613fd457613fd4613f9c565b604051601f8201601f191681016001600160401b038111828210171561402457614024613f9c565b604052919050565b8015158114611cd757600080fd5b8035613db58161402c565b600060e0828403121561405757600080fd5b61405f613fb2565b82358152602080840135908201526040808401359082015260608301356001600160f81b038116811461409157600080fd5b60608201526140a26080840161403a565b60808201526140b360a0840161403a565b60a08201526140c460c0840161403a565b60c08201529392505050565b60006001600160401b038211156140e9576140e9613f9c565b50601f01601f191660200190565b600061410a614105846140d0565b613ffc565b905082815283838301111561411e57600080fd5b828260208301376000602084830101529392505050565b60006020828403121561414757600080fd5b81356001600160401b0381111561415d57600080fd5b8201601f8101841361416e57600080fd5b612601848235602084016140f7565b60006020828403121561418f57600080fd5b61122782613da6565b6000602082840312156141aa57600080fd5b81356003811061122757600080fd5b634e487b7160e01b600052602160045260246000fd5b60208101600683106141e3576141e36141b9565b91905290565b600080604083850312156141fc57600080fd5b823561420781613ce1565b91506020830135613d308161402c565b60006020828403121561422957600080fd5b81356112278161402c565b6000806000806080858703121561424a57600080fd5b843561425581613ce1565b9350602085013561426581613ce1565b92506040850135915060608501356001600160401b0381111561428757600080fd5b8501601f8101871361429857600080fd5b6142a7878235602084016140f7565b91505092959194509250565b60008083601f8401126142c557600080fd5b5081356001600160401b038111156142dc57600080fd5b6020830191508360208260051b8501011115610f3f57600080fd5b6000806000806040858703121561430d57600080fd5b84356001600160401b038082111561432457600080fd5b614330888389016142b3565b9096509450602087013591508082111561434957600080fd5b50614356878288016142b3565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156143a35783516001600160a01b03168352928401929184019160010161437e565b50909695505050505050565b600080604083850312156143c257600080fd5b82356143cd81613ce1565b91506020830135613d3081613ce1565b60208101600383106141e3576141e36141b9565b60008060008084860361010081121561440957600080fd5b8535945060c0601f198201121561441f57600080fd5b5060208501925060e08501356001600160401b0381111561443f57600080fd5b61435687828801613dcc565b60008060006040848603121561446057600080fd5b833561446b81613ce1565b925060208401356001600160401b038082111561448757600080fd5b818601915086601f83011261449b57600080fd5b8135818111156144aa57600080fd5b87602060c0830285010111156144bf57600080fd5b6020830194508093505050509250925092565b600060c08201905060ff835116825260ff602084015116602083015260ff604084015116604083015260ff606084015116606083015260808301516004811061451d5761451d6141b9565b8060808401525060a0830151151560a083015292915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c9082168061457f57607f821691505b602082108114156118cf57634e487b7160e01b600052602260045260246000fd5b60006001600160601b0319808860601b168352600687106145c3576145c36141b9565b60f89690961b60148301525060609390931b909316601583015260f01b6001600160f01b031916602982015260809190911b6001600160801b031916602b820152603b01919050565b634e487b7160e01b600052601160045260246000fd5b600082198211156146355761463561460c565b500190565b60008160001904831182151516156146545761465461460c565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261467e5761467e614659565b500490565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6000828210156146bf576146bf61460c565b500390565b634e487b7160e01b600052600160045260246000fd5b60208082526022908201527f45524337323141436f6d6d6f6e3a20546f6b656e20646f65736e2774206578696040820152611cdd60f21b606082015260800190565b600081518084526020808501945080840160005b8381101561474c57815187529582019590820190600101614730565b509495945050505050565b86815285602082015260c06040820152600061477660c0830187613d67565b8281036060840152614788818761471c565b9415156080840152505090151560a090910152949350505050565b6000602082840312156147b557600080fd5b81516001600160401b038111156147cb57600080fd5b8201601f810184136147dc57600080fd5b80516147ea614105826140d0565b8181528560208385010111156147ff57600080fd5b612adc826020830160208601613d3b565b60ff81168114611cd757600080fd5b60006020828403121561483157600080fd5b813561122781614810565b60048110611cd757600080fd5b60006020828403121561485b57600080fd5b81356112278161483c565b6001600160601b03198860601b168152866014820152600060ff60f81b808860f81b166034840152808760f81b166035840152808660f81b166036840152808560f81b16603784015250600483106148c0576148c06141b9565b5060f89190911b60388201526039019695505050505050565b600060c082840312156148eb57600080fd5b60405160c081018181106001600160401b038211171561490d5761490d613f9c565b604052823561491b81614810565b8152602083013561492b81614810565b6020820152604083013561493e81614810565b6040820152606083013561495181614810565b606082015260808301356149648161483c565b608082015260a08301356149778161402c565b60a08201529392505050565b634e487b7160e01b600052603260045260246000fd5b60006000198214156149ad576149ad61460c565b5060010190565b8481528360208201526080604082015260006149d3608083018561471c565b9050821515606083015295945050505050565b8051613db58161402c565b60008082840360e0811215614a0557600080fd5b60c0811215614a1357600080fd5b50614a1c613fda565b8351614a2781614810565b81526020840151614a3781614810565b60208201526040840151614a4a81614810565b60408201526060840151614a5d81614810565b60608201526080840151614a708161483c565b608082015260a0840151614a838161402c565b60a08201529150614a9660c084016149e6565b90509250929050565b600060208284031215614ab157600080fd5b815161122781613ce1565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614aef90830184613d67565b9695505050505050565b600060208284031215614b0b57600080fd5b815161122781613cae565b7f19457468657265756d205369676e6564204d6573736167653a0a000000000000815260008351614b4e81601a850160208801613d3b565b835190830190614b6581601a840160208801613d3b565b01601a01949350505050565b6d029b2b63632b91d1021b7b9ba39960951b815260008251614b9a81600e850160208701613d3b565b64204757656960d81b600e939091019283015250601301919050565b600082614bc557614bc5614659565b500690565b67029b2b63632b91d160c51b815260008251614bed816008850160208701613d3b565b9190910160080192915050565b634e487b7160e01b600052603160045260246000fdfea26469706673582212203826df72e51052fd16f5144fac928953078c2e53aaff306e38a8974e17c4c45664736f6c634300080b00334f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572000000000000000000000000565e8eec4cd6193f8c28c40a3dad811bb6a09351000000000000000000000000565e8eec4cd6193f8c28c40a3dad811bb6a0935100000000000000000000000028064de690fcee72a5dd2d3b05c11c83868d87d20000000000000000000000003ba0ae134e9ac6e8e0f454ec6933f6313f2c76fc00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000004368747470733a2f2f696d6167696e6172792d667269656e642d6261636b656e642d70726f642d3274796e6b6b643633712d75632e612e72756e2e6170702f746f6b656e0000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x60806040526004361061031a5760003560e01c806384f302f1116101ab578063bf62e21d116100f7578063eca15c7911610095578063f2fc31681161006f578063f2fc3168146109b4578063f2fde38b146109d4578063f584c6db146109f4578063f6651b0414610a0957600080fd5b8063eca15c7914610946578063f04180af14610974578063f212c9de1461099457600080fd5b8063c35d8769116100d1578063c35d8769146108cf578063c87b56dd146108f1578063d547cfb714610911578063e985e9c51461092657600080fd5b8063bf62e21d1461086f578063c12ca7b01461088f578063c32bfa34146108af57600080fd5b806395d89b4111610164578063a22cb4651161013e578063a22cb46514610784578063ab15a186146107a4578063b88d4fde146107c4578063bb69b7ef146107e457600080fd5b806395d89b41146107445780639c8a2bfd14610759578063a035b1fe1461076e57600080fd5b806384f302f1146106845780638ada6b0f146106a45780638da5cb5b146106c45780638f8c33ac146106e25780639106d7ba1461070f57806391b7f5ed1461072457600080fd5b8063338e8d881161026a5780634fddc979116102235780636352211e116101fd5780636352211e1461061a57806370a082311461063a578063715018a61461065a5780638456cb591461066f57600080fd5b80634fddc979146105ad57806356d3163d146105db5780635c975abb146105fb57600080fd5b8063338e8d88146104f857806338af3eed146105185780633a8aae1c146105385780633ec02e14146105585780633f4ba83a1461057857806342842e0e1461058d57600080fd5b806316755b57116102d757806323b872dd116102b157806323b872dd146104595780632a55205a146104795780632f274bd4146104b857806330176e13146104d857600080fd5b806316755b571461040357806318160ddd146104165780631c31f7101461043957600080fd5b806301ffc9a71461031f57806304634d8d1461035457806306fdde031461037657806307adbdee14610398578063081812fc146103ab578063095ea7b3146103e3575b600080fd5b34801561032b57600080fd5b5061033f61033a366004613cc4565b610a36565b60405190151581526020015b60405180910390f35b34801561036057600080fd5b5061037461036f366004613cf6565b610a47565b005b34801561038257600080fd5b5061038b610a88565b60405161034b9190613d93565b6103746103a6366004613e0d565b610b1a565b3480156103b757600080fd5b506103cb6103c6366004613ebc565b610d22565b6040516001600160a01b03909116815260200161034b565b3480156103ef57600080fd5b506103746103fe366004613ed5565b610d66565b610374610411366004613f01565b610df4565b34801561042257600080fd5b50600154600054035b60405190815260200161034b565b34801561044557600080fd5b50610374610454366004613f1c565b610e41565b34801561046557600080fd5b50610374610474366004613f39565b610e8d565b34801561048557600080fd5b50610499610494366004613f7a565b610e98565b604080516001600160a01b03909316835260208301919091520161034b565b3480156104c457600080fd5b506103746104d3366004614045565b610f46565b3480156104e457600080fd5b506103746104f3366004614135565b611134565b34801561050457600080fd5b5061037461051336600461417d565b611171565b34801561052457600080fd5b506010546103cb906001600160a01b031681565b34801561054457600080fd5b50610374610553366004614198565b6111c8565b34801561056457600080fd5b5061042b610573366004613f7a565b611217565b34801561058457600080fd5b5061037461122e565b34801561059957600080fd5b506103746105a8366004613f39565b611262565b3480156105b957600080fd5b50601e546105ce90600160a81b900460ff1681565b60405161034b91906141cf565b3480156105e757600080fd5b506103746105f6366004613f1c565b61127d565b34801561060757600080fd5b50600954600160a01b900460ff1661033f565b34801561062657600080fd5b506103cb610635366004613ebc565b6112f4565b34801561064657600080fd5b5061042b610655366004613f1c565b611306565b34801561066657600080fd5b50610374611354565b34801561067b57600080fd5b50610374611388565b34801561069057600080fd5b5061037461069f366004613f7a565b6113ba565b3480156106b057600080fd5b50601e546103cb906001600160a01b031681565b3480156106d057600080fd5b506009546001600160a01b03166103cb565b3480156106ee57600080fd5b5061042b6106fd366004613ebc565b601c6020526000908152604090205481565b34801561071b57600080fd5b5061042b6113ef565b34801561073057600080fd5b5061037461073f366004613ebc565b6113ff565b34801561075057600080fd5b5061038b61142e565b34801561076557600080fd5b5061037461143d565b34801561077a57600080fd5b5061042b60145481565b34801561079057600080fd5b5061037461079f3660046141e9565b61147c565b3480156107b057600080fd5b506103746107bf366004614217565b611542565b3480156107d057600080fd5b506103746107df366004614234565b61158a565b3480156107f057600080fd5b50600b54600c54600d54600e54600f5461082c949392916001600160f81b0381169160ff600160f81b9092048216918181169161010090041687565b604080519788526020880196909652948601939093526001600160f81b03909116606085015215156080840152151560a0830152151560c082015260e00161034b565b34801561087b57600080fd5b5061037461088a366004613ed5565b6115db565b34801561089b57600080fd5b506103746108aa3660046142f7565b611750565b3480156108bb57600080fd5b506103746108ca3660046142f7565b611788565b3480156108db57600080fd5b506108e46117c0565b60405161034b9190614362565b3480156108fd57600080fd5b5061038b61090c366004613ebc565b6117cc565b34801561091d57600080fd5b5061038b6118d5565b34801561093257600080fd5b5061033f6109413660046143af565b611963565b34801561095257600080fd5b50601e5461096790600160b01b900460ff1681565b60405161034b91906143dd565b34801561098057600080fd5b5061037461098f3660046143f1565b6119da565b3480156109a057600080fd5b506103746109af36600461444b565b611b69565b3480156109c057600080fd5b5061033f6109cf366004613ebc565b611c01565b3480156109e057600080fd5b506103746109ef366004613f1c565b611c3f565b348015610a0057600080fd5b506108e4611cda565b348015610a1557600080fd5b50610a29610a24366004613ebc565b611ce6565b60405161034b91906144d2565b6000610a4182611e1d565b92915050565b6009546001600160a01b03163314610a7a5760405162461bcd60e51b8152600401610a7190614536565b60405180910390fd5b610a848282611e42565b5050565b606060028054610a979061456b565b80601f0160208091040260200160405190810160405280929190818152602001828054610ac39061456b565b8015610b105780601f10610ae557610100808354040283529160200191610b10565b820191906000526020600020905b815481529060010190602001808311610af357829003601f168201915b5050505050905090565b6001600581601e54600160a81b900460ff166005811115610b3d57610b3d6141b9565b1080610b765750601e54600160a81b900460ff166005811115610b6257610b626141b9565b816005811115610b7457610b746141b9565b105b15610b945760405163502f1a5d60e11b815260040160405180910390fd5b6040805160e081018252600b548152600c80546020830152600d805493830193909352600e546001600160f81b038116606084015260ff600160f81b909104811615156080840152600f54808216151560a0850152610100900416151560c083015260009283905591909155896005811115610c1257610c126141b9565b601e54600160a81b900460ff166005811115610c3057610c306141b9565b1015610c4f5760405163502f1a5d60e11b815260040160405180910390fd5b6000610c81308c8c8b8b604051602001610c6d9594939291906145a0565b604051602081830303815290604052611f3f565b6000818152601c602052604090205490915061ffff808a1691610ca5918c16614622565b1115610cc45760405163342e754760e21b815260040160405180910390fd5b610cd16018828888611f4a565b6000818152601c60205260408120805461ffff8c169290610cf3908490614622565b90915550610d0790508a61ffff8b16611fae565b506040810151600d5560200151600c55505050505050505050565b6000610d2d82611fba565b610d4a576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610d71826112f4565b9050806001600160a01b0316836001600160a01b03161415610da65760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614801590610dc65750610dc48133611963565b155b15610de4576040516367d9dca160e11b815260040160405180910390fd5b610def838383611fe5565b505050565b600580601e54600160a81b900460ff166005811115610e1557610e156141b9565b14610e335760405163502f1a5d60e11b815260040160405180910390fd5b610a84338361ffff16611fae565b6009546001600160a01b03163314610e6b5760405162461bcd60e51b8152600401610a7190614536565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b610def838383612041565b60008281526017602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610f0d5750604080518082019091526016546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610f2c906001600160601b03168761463a565b610f36919061466f565b91519350909150505b9250929050565b6009546001600160a01b03163314610f705760405162461bcd60e51b8152600401610a7190614536565b80606001516001600160f81b031681600001511015610fd15760405162461bcd60e51b815260206004820152601c60248201527f53656c6c65723a2065786365737369766520667265652071756f7461000000006044820152606401610a71565b601154815110156110245760405162461bcd60e51b815260206004820181905260248201527f53656c6c65723a20696e76656e746f7279203c20616c726561647920736f6c646044820152606401610a71565b60135481606001516001600160f81b0316101561108d5760405162461bcd60e51b815260206004820152602160248201527f53656c6c65723a20667265652071756f7461203c20616c7265616479207573656044820152601960fa1b6064820152608401610a71565b600f54610100900460ff16156110aa57600160c0820152600b5481525b600f5460ff16156110ce57600160a0820152600e546001600160f81b031660608201525b8051600b556020810151600c556040810151600d55606081015160808201511515600160f81b026001600160f81b0390911617600e5560a0810151600f805460c09093015115156101000261ff00199215159290921661ffff1990931692909217179055565b6009546001600160a01b0316331461115e5760405162461bcd60e51b8152600401610a7190614536565b8051610a84906015906020840190613c15565b6009546001600160a01b0316331461119b5760405162461bcd60e51b8152600401610a7190614536565b601e805482919060ff60a81b1916600160a81b8360058111156111c0576111c06141b9565b021790555050565b6009546001600160a01b031633146111f25760405162461bcd60e51b8152600401610a7190614536565b601e805482919060ff60b01b1916600160b01b8360028111156111c0576111c06141b9565b600060145483611227919061463a565b9392505050565b6009546001600160a01b031633146112585760405162461bcd60e51b8152600401610a7190614536565b61126061223c565b565b610def8383836040518060200160405280600081525061158a565b6009546001600160a01b031633146112a75760405162461bcd60e51b8152600401610a7190614536565b601e54600160a01b900460ff16156112d257604051634a7b75a160e01b815260040160405180910390fd5b601e80546001600160a01b0319166001600160a01b0392909216919091179055565b60006112ff826122d9565b5192915050565b60006001600160a01b03821661132f576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6009546001600160a01b0316331461137e5760405162461bcd60e51b8152600401610a7190614536565b61126060006123f3565b6009546001600160a01b031633146113b25760405162461bcd60e51b8152600401610a7190614536565b611260612445565b6009546001600160a01b031633146113e45760405162461bcd60e51b8152600401610a7190614536565b600c91909155600d55565b60006113fa60115490565b905090565b6009546001600160a01b031633146114295760405162461bcd60e51b8152600401610a7190614536565b601455565b606060038054610a979061456b565b6009546001600160a01b031633146114675760405162461bcd60e51b8152600401610a7190614536565b601e805460ff60a01b1916600160a01b179055565b33611486816124aa565b6001600160a01b0316836001600160a01b0316141561153857816114ab5760016114ae565b60005b6001600160a01b0382166000908152600860205260409020805460ff1916600183818111156114df576114df6141b9565b0217905550826001600160a01b0316816001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318460405161152b911515815260200190565b60405180910390a3505050565b610def8383612609565b6009546001600160a01b0316331461156c5760405162461bcd60e51b8152600401610a7190614536565b601e8054911515600160b81b0260ff60b81b19909216919091179055565b611595848484612041565b6001600160a01b0383163b151580156115b757506115b58484848461269f565b155b156115d5576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6009546001600160a01b031633146116055760405162461bcd60e51b8152600401610a7190614536565b600954600160a01b900460ff161561162f5760405162461bcd60e51b8152600401610a7190614683565b600e546001600160f81b03166116578261164860135490565b61165290846146ad565b612787565b9150600082116116a95760405162461bcd60e51b815260206004820152601b60248201527f53656c6c65723a20467265652071756f746120657863656564656400000000006044820152606401610a71565b600b546116b98361164860115490565b9250600083116116fe5760405162461bcd60e51b815260206004820152601060248201526f14d95b1b195c8e8814dbdb19081bdd5d60821b6044820152606401610a71565b61170a8484600161279d565b6117156011846127a7565b6117206013846127a7565b8061172a60115490565b1115611738576117386146c4565b8161174260135490565b11156115d5576115d56146c4565b6009546001600160a01b0316331461177a5760405162461bcd60e51b8152600401610a7190614536565b6115d56018858585856127c4565b6009546001600160a01b031633146117b25760405162461bcd60e51b8152600401610a7190614536565b6115d5601a858585856127c4565b60606113fa601861285f565b6060816117d881611fba565b6117f45760405162461bcd60e51b8152600401610a71906146da565b6000838152601d60205260408120549061180c61290b565b905060006002601e54600160b01b900460ff166002811115611830576118306141b9565b601e54911491506001600160a01b031663c59e31fc878561184f612984565b601e5460405160e086901b6001600160e01b03191681526118849493929189918991600160b81b900460ff1690600401614757565b600060405180830381865afa1580156118a1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118c991908101906147a3565b94505050505b50919050565b601580546118e29061456b565b80601f016020809104026020016040519081016040528092919081815260200182805461190e9061456b565b801561195b5780601f106119305761010080835404028352916020019161195b565b820191906000526020600020905b81548152906001019060200180831161193e57829003601f168201915b505050505081565b6001600160a01b03808316600090815260076020908152604080832093851683529290529081205460ff161561199b57506001610a41565b6001600160a01b03831660009081526008602052604081205460ff1660018111156119c8576119c86141b9565b1480156112275750611227838361298e565b6001601e54600160b01b900460ff1660028111156119fa576119fa6141b9565b14611a185760405163502f1a5d60e11b815260040160405180910390fd5b8333611a23826122d9565b516001600160a01b03161480611a49575033611a3e82610d22565b6001600160a01b0316145b611aa35760405162461bcd60e51b815260206004820152602560248201527f45524337323141436f6d6d6f6e3a204e6f7420617070726f766564206e6f722060448201526437bbb732b960d91b6064820152608401610a71565b6000858152601d602052604090205415611ad057604051637495c9b960e11b815260040160405180910390fd5b6000611b3a3087611ae4602089018961481f565b611af460408a0160208b0161481f565b611b0460608b0160408c0161481f565b611b1460808c0160608d0161481f565b611b2460a08d0160808e01614849565b604051602001610c6d9796959493929190614866565b9050611b49601a828686611f4a565b611b6186611b5c368890038801886148d9565b6129cc565b505050505050565b6009546001600160a01b03163314611b935760405162461bcd60e51b8152600401610a7190614536565b806000611ba36001546000540390565b9050611baf85836115db565b60005b82811015611b6157611be682868684818110611bd057611bd0614983565b905060c00201803603810190611b5c91906148d9565b611bef82614999565b9150611bfa81614999565b9050611bb2565b600081611c0d81611fba565b611c295760405162461bcd60e51b8152600401610a71906146da565b50506000908152601d6020526040902054151590565b6009546001600160a01b03163314611c695760405162461bcd60e51b8152600401610a7190614536565b6001600160a01b038116611cce5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a71565b611cd7816123f3565b50565b60606113fa601a61285f565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a081019190915281611d2281611fba565b611d3e5760405162461bcd60e51b8152600401610a71906146da565b6000838152601d602052604081205490611d5661290b565b905060006002601e54600160b01b900460ff166002811115611d7a57611d7a6141b9565b601e5460405163ae91a56b60e01b81529190921492506000916001600160a01b03169063ae91a56b90611db7908a908890889088906004016149b4565b60e060405180830381865afa158015611dd4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611df891906149f1565b50979650505050505050565b6000611227836001600160a01b0384166129fb565b5490565b60006001600160e01b0319821663152a902d60e11b1480610a415750610a4182612a4a565b6127106001600160601b0382161115611eb05760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610a71565b6001600160a01b038216611f065760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610a71565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217601655565b6000610a4182612a55565b611f5684848484612a90565b6115d55760405162461bcd60e51b815260206004820152602360248201527f5369676e6174757265436865636b65723a20496e76616c6964207369676e617460448201526275726560e81b6064820152608401610a71565b610a8482826000612ae5565b6000805482108015610a41575050600090815260046020526040902054600160e01b900460ff161590565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600061204c826122d9565b9050836001600160a01b031681600001516001600160a01b0316146120835760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b03861614806120a157506120a18533611963565b806120bc5750336120b184610d22565b6001600160a01b0316145b9050806120dc57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03841661210357604051633a954ecd60e21b815260040160405180910390fd5b6121108585856001612fc3565b61211c60008487611fe5565b6001600160a01b038581166000908152600560209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600490945282852080546001600160e01b031916909417600160a01b429092169190910217835587018084529220805491939091166121f05760005482146121f057805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b5050505050565b600954600160a01b900460ff1661228c5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a71565b6009805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6040805160608101825260008082526020820181905291810191909152816000548110156123da57600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff161515918101829052906123d85780516001600160a01b03161561236f579392505050565b5060001901600081815260046020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff16151592810192909252156123d3579392505050565b61236f565b505b604051636f96cda160e11b815260040160405180910390fd5b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600954600160a01b900460ff161561246f5760405162461bcd60e51b8152600401610a7190614683565b6009805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586122bc3390565b6000804680600181146124df57608981146124fb57600481146125175762013881811461253357610539811461254f57612567565b73a5409ec958c83c3f309868babaca7c86dcb077c19250612567565b7358807bad0b376efc12f5ad86aac70e78ed67deae9250612567565b73f57b2c51ded3a29e6891aba85459d600256cf3179250612567565b73ff7ca10af37178bdd056628ef42fd7f799fac77c9250612567565b73e1a2bbc877b29adbc56d2659dbcb0ae14ee6207192505b506001600160a01b038216158061257e5750806089145b8061258b57508062013881145b15612597575092915050565b60405163c455279160e01b81526001600160a01b03858116600483015283169063c455279190602401602060405180830381865afa1580156125dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126019190614a9f565b949350505050565b6001600160a01b0382163314156126335760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906126d4903390899088908890600401614abc565b6020604051808303816000875af192505050801561270f575060408051601f3d908101601f1916820190925261270c91810190614af9565b60015b61276a573d80801561273d576040519150601f19603f3d011682016040523d82523d6000602084013e612742565b606091505b508051612762576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b60008183106127965781611227565b5090919050565b610def8383613021565b808260000160008282546127bb9190614622565b90915550505050565b60005b83811015612811576128008585838181106127e4576127e4614983565b90506020020160208101906127f99190613f1c565b879061303b565b5061280a81614999565b90506127c7565b5060005b81811015611b615761284e83838381811061283257612832614983565b90506020020160208101906128479190613f1c565b8790611e04565b5061285881614999565b9050612815565b6060600061286c83613050565b90506000816001600160401b0381111561288857612888613f9c565b6040519080825280602002602001820160405280156128b1578160200160208202803683370190505b50905060005b82811015612903576128c9858261305a565b8282815181106128db576128db614983565b6001600160a01b03909216602092830291909101909101526128fc81614999565b90506128b7565b509392505050565b60408051610bb88082526201772082019092526060916000919060208201620177008036833701905050905060005b610bb88110156118cf576000818152601d6020526040902054825183908390811061296757612967614983565b60209081029190910101528061297c81614999565b91505061293a565b60606113fa613066565b60008061299a846124aa565b90506001600160a01b038116158015906126015750826001600160a01b0316816001600160a01b031614949350505050565b811560a08201526129dc81613075565b6129e581613150565b6000928352601d60205260409092209190915550565b6000818152600183016020526040812054612a4257508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a41565b506000610a41565b6000610a41826131e8565b6000612a618251613238565b82604051602001612a73929190614b16565b604051602081830303815290604052805190602001209050919050565b6000612adc612ad58585858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061333592505050565b8690613351565b95945050505050565b6002600a541415612b385760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a71565b6002600a55600954600160a01b900460ff1615612b675760405162461bcd60e51b8152600401610a7190614683565b6040805160e081018252600b548152600c546020820152600d54918101829052600e546001600160f81b038116606083015260ff600160f81b909104811615156080830152600f54808216151560a0840152610100900416151560c08201529060009015612be257612bdd848360400151612787565b612be4565b835b9050600080836080015115612c2c5760608401518451612c0d916001600160f81b0316906146ad565b9150612c1860135490565b601154612c2591906146ad565b9050612c3c565b83519150612c3960115490565b90505b612c4a8361165283856146ad565b925060008311612c8f5760405162461bcd60e51b815260206004820152601060248201526f14d95b1b195c8e8814dbdb19081bdd5d60821b6044820152606401610a71565b602084015115612deb57336001600160a01b038816811415906000903214801590612cc35750326001600160a01b038a1614155b9050612cf3858a6040518060400160405280600b81526020016a109d5e595c881b1a5b5a5d60aa1b815250613373565b94508115612d2d57612d2a85336040518060400160405280600c81526020016b14d95b99195c881b1a5b5a5d60a21b815250613373565b94505b8015612d6557612d6285326040518060400160405280600c81526020016b13dc9a59da5b881b1a5b5a5d60a21b815250613373565b94505b6001600160a01b03891660009081526012602052604081208054879290612d8d908490614622565b90915550508115612dbd573360009081526012602052604081208054879290612db7908490614622565b90915550505b8015612de8573260009081526012602052604081208054879290612de2908490614622565b90915550505b50505b6000612df78487611217565b905080341015612e4d57612e17612e12633b9aca008361466f565b613238565b604051602001612e279190614b71565b60408051601f198184030181529082905262461bcd60e51b8252610a7191600401613d93565b612e598885600061279d565b612e646011856127a7565b84516011541115612e7757612e776146c4565b8015612edc57601054612e93906001600160a01b0316826133bc565b60105460408051868152602081018490526001600160a01b03909216917f01f51b99bd1c3cca301836178e5dee13aadfe44eff06dc3ddcbf3c9d058454f8910160405180910390a25b80341115612fb457336000612ef183346146ad565b9050600080836001600160a01b03168360405160006040518083038185875af1925050503d8060008114612f41576040519150601f19603f3d011682016040523d82523d6000602084013e612f46565b606091505b5091509150818190612f6b5760405162461bcd60e51b8152600401610a719190613d93565b50836001600160a01b03167fbb28353e4598c3b9199101a66e0989549b659a59a54d2c27fbb183f1932c8e6d84604051612fa791815260200190565b60405180910390a2505050505b50506001600a55505050505050565b600954600160a01b900460ff16156130155760405162461bcd60e51b8152602060048201526015602482015274115490cdcc8c5050dbdb5b5bdb8e881c185d5cd959605a1b6044820152606401610a71565b6115d5848484846134d5565b610a848282604051806020016040528060008152506135c9565b6000611227836001600160a01b0384166135d6565b6000610a41825490565b600061122783836136c9565b606060158054610a979061456b565b805160ff161580159061308f57506000816020015160ff16115b80156130a257506000816040015160ff16115b80156130b557506000816060015160ff16115b80156130c857508051600d60ff90911611155b80156130df5750602460ff16816020015160ff1611155b80156130f65750602360ff16816040015160ff1611155b801561310d5750602d60ff16816060015160ff1611155b801561312f575060038160800151600381111561312c5761312c6141b9565b11155b156131375750565b60405163c7f6ee9b60e01b815260040160405180910390fd5b80516020820151604083015160608401516080850151600094600890811b61ff001660ff95861601811b66ffffffffffff0090811694861694909401811b84169490921693909301901b169060038111156131ad576131ad6141b9565b60ff168101905060088165ffffffffffff16901b90508260a001516131d35760006131d6565b60015b60ff160165ffffffffffff1692915050565b60006001600160e01b031982166380ac58cd60e01b148061321957506001600160e01b03198216635b5e139f60e01b145b80610a4157506301ffc9a760e01b6001600160e01b0319831614610a41565b60608161325c5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613286578061327081614999565b915061327f9050600a8361466f565b9150613260565b6000816001600160401b038111156132a0576132a0613f9c565b6040519080825280601f01601f1916602001820160405280156132ca576020820181803683370190505b5090505b8415612601576132df6001836146ad565b91506132ec600a86614bb6565b6132f7906030614622565b60f81b81838151811061330c5761330c614983565b60200101906001600160f81b031916908160001a90535061332e600a8661466f565b94506132ce565b600080600061334485856136f3565b9150915061290381613760565b6001600160a01b03811660009081526001830160205260408120541515611227565b6001600160a01b038216600090815260126020526040812054600c54829161339a916146ad565b9050806133b25782604051602001612e279190614bca565b612adc8582612787565b8047101561340c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610a71565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613459576040519150601f19603f3d011682016040523d82523d6000602084013e61345e565b606091505b5050905080610def5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610a71565b6001600160a01b0383161580613517575060016001600160a01b03841660009081526008602052604090205460ff166001811115613515576135156141b9565b145b15613521576115d5565b600061352c846124aa565b90506001600160a01b03811661356557506001600160a01b0383166000908152600860205260409020805460ff191660011790556115d5565b61356e84611306565b61223557806001600160a01b0316846001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160016040516135ba911515815260200190565b60405180910390a35050505050565b610def838383600161391b565b600081815260018301602052604081205480156136bf5760006135fa6001836146ad565b855490915060009061360e906001906146ad565b905081811461367357600086600001828154811061362e5761362e614983565b906000526020600020015490508087600001848154811061365157613651614983565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061368457613684614bfa565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a41565b6000915050610a41565b60008260000182815481106136e0576136e0614983565b9060005260206000200154905092915050565b60008082516041141561372a5760208301516040840151606085015160001a61371e87828585613aef565b94509450505050610f3f565b8251604014156137545760208301516040840151613749868383613bdc565b935093505050610f3f565b50600090506002610f3f565b6000816004811115613774576137746141b9565b141561377d5750565b6001816004811115613791576137916141b9565b14156137df5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610a71565b60028160048111156137f3576137f36141b9565b14156138415760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610a71565b6003816004811115613855576138556141b9565b14156138ae5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610a71565b60048160048111156138c2576138c26141b9565b1415611cd75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610a71565b6000546001600160a01b03851661394457604051622e076360e81b815260040160405180910390fd5b836139625760405163b562e8dd60e01b815260040160405180910390fd5b61396f6000868387612fc3565b6001600160a01b038516600081815260056020908152604080832080546001600160801b031981166001600160401b038083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c01811690920217909155858452600490925290912080546001600160e01b031916909217600160a01b429092169190910217905580808501838015613a1757506001600160a01b0387163b15155b15613aa0575b60405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4613a68600088848060010195508861269f565b613a85576040516368d2bf6b60e11b815260040160405180910390fd5b80821415613a1d578260005414613a9b57600080fd5b613ae6565b5b6040516001830192906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480821415613aa1575b50600055612235565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613b265750600090506003613bd3565b8460ff16601b14158015613b3e57508460ff16601c14155b15613b4f5750600090506004613bd3565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613ba3573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613bcc57600060019250925050613bd3565b9150600090505b94509492505050565b6000806001600160ff1b03831681613bf960ff86901c601b614622565b9050613c0787828885613aef565b935093505050935093915050565b828054613c219061456b565b90600052602060002090601f016020900481019282613c435760008555613c89565b82601f10613c5c57805160ff1916838001178555613c89565b82800160010185558215613c89579182015b82811115613c89578251825591602001919060010190613c6e565b50613c95929150613c99565b5090565b5b80821115613c955760008155600101613c9a565b6001600160e01b031981168114611cd757600080fd5b600060208284031215613cd657600080fd5b813561122781613cae565b6001600160a01b0381168114611cd757600080fd5b60008060408385031215613d0957600080fd5b8235613d1481613ce1565b915060208301356001600160601b0381168114613d3057600080fd5b809150509250929050565b60005b83811015613d56578181015183820152602001613d3e565b838111156115d55750506000910152565b60008151808452613d7f816020860160208601613d3b565b601f01601f19169290920160200192915050565b6020815260006112276020830184613d67565b803560068110613db557600080fd5b919050565b803561ffff81168114613db557600080fd5b60008083601f840112613dde57600080fd5b5081356001600160401b03811115613df557600080fd5b602083019150836020828501011115610f3f57600080fd5b600080600080600080600060c0888a031215613e2857600080fd5b613e3188613da6565b96506020880135613e4181613ce1565b9550613e4f60408901613dba565b9450613e5d60608901613dba565b935060808801356fffffffffffffffffffffffffffffffff81168114613e8257600080fd5b925060a08801356001600160401b03811115613e9d57600080fd5b613ea98a828b01613dcc565b989b979a50959850939692959293505050565b600060208284031215613ece57600080fd5b5035919050565b60008060408385031215613ee857600080fd5b8235613ef381613ce1565b946020939093013593505050565b600060208284031215613f1357600080fd5b61122782613dba565b600060208284031215613f2e57600080fd5b813561122781613ce1565b600080600060608486031215613f4e57600080fd5b8335613f5981613ce1565b92506020840135613f6981613ce1565b929592945050506040919091013590565b60008060408385031215613f8d57600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715613fd457613fd4613f9c565b60405290565b60405160c081016001600160401b0381118282101715613fd457613fd4613f9c565b604051601f8201601f191681016001600160401b038111828210171561402457614024613f9c565b604052919050565b8015158114611cd757600080fd5b8035613db58161402c565b600060e0828403121561405757600080fd5b61405f613fb2565b82358152602080840135908201526040808401359082015260608301356001600160f81b038116811461409157600080fd5b60608201526140a26080840161403a565b60808201526140b360a0840161403a565b60a08201526140c460c0840161403a565b60c08201529392505050565b60006001600160401b038211156140e9576140e9613f9c565b50601f01601f191660200190565b600061410a614105846140d0565b613ffc565b905082815283838301111561411e57600080fd5b828260208301376000602084830101529392505050565b60006020828403121561414757600080fd5b81356001600160401b0381111561415d57600080fd5b8201601f8101841361416e57600080fd5b612601848235602084016140f7565b60006020828403121561418f57600080fd5b61122782613da6565b6000602082840312156141aa57600080fd5b81356003811061122757600080fd5b634e487b7160e01b600052602160045260246000fd5b60208101600683106141e3576141e36141b9565b91905290565b600080604083850312156141fc57600080fd5b823561420781613ce1565b91506020830135613d308161402c565b60006020828403121561422957600080fd5b81356112278161402c565b6000806000806080858703121561424a57600080fd5b843561425581613ce1565b9350602085013561426581613ce1565b92506040850135915060608501356001600160401b0381111561428757600080fd5b8501601f8101871361429857600080fd5b6142a7878235602084016140f7565b91505092959194509250565b60008083601f8401126142c557600080fd5b5081356001600160401b038111156142dc57600080fd5b6020830191508360208260051b8501011115610f3f57600080fd5b6000806000806040858703121561430d57600080fd5b84356001600160401b038082111561432457600080fd5b614330888389016142b3565b9096509450602087013591508082111561434957600080fd5b50614356878288016142b3565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b818110156143a35783516001600160a01b03168352928401929184019160010161437e565b50909695505050505050565b600080604083850312156143c257600080fd5b82356143cd81613ce1565b91506020830135613d3081613ce1565b60208101600383106141e3576141e36141b9565b60008060008084860361010081121561440957600080fd5b8535945060c0601f198201121561441f57600080fd5b5060208501925060e08501356001600160401b0381111561443f57600080fd5b61435687828801613dcc565b60008060006040848603121561446057600080fd5b833561446b81613ce1565b925060208401356001600160401b038082111561448757600080fd5b818601915086601f83011261449b57600080fd5b8135818111156144aa57600080fd5b87602060c0830285010111156144bf57600080fd5b6020830194508093505050509250925092565b600060c08201905060ff835116825260ff602084015116602083015260ff604084015116604083015260ff606084015116606083015260808301516004811061451d5761451d6141b9565b8060808401525060a0830151151560a083015292915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c9082168061457f57607f821691505b602082108114156118cf57634e487b7160e01b600052602260045260246000fd5b60006001600160601b0319808860601b168352600687106145c3576145c36141b9565b60f89690961b60148301525060609390931b909316601583015260f01b6001600160f01b031916602982015260809190911b6001600160801b031916602b820152603b01919050565b634e487b7160e01b600052601160045260246000fd5b600082198211156146355761463561460c565b500190565b60008160001904831182151516156146545761465461460c565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261467e5761467e614659565b500490565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6000828210156146bf576146bf61460c565b500390565b634e487b7160e01b600052600160045260246000fd5b60208082526022908201527f45524337323141436f6d6d6f6e3a20546f6b656e20646f65736e2774206578696040820152611cdd60f21b606082015260800190565b600081518084526020808501945080840160005b8381101561474c57815187529582019590820190600101614730565b509495945050505050565b86815285602082015260c06040820152600061477660c0830187613d67565b8281036060840152614788818761471c565b9415156080840152505090151560a090910152949350505050565b6000602082840312156147b557600080fd5b81516001600160401b038111156147cb57600080fd5b8201601f810184136147dc57600080fd5b80516147ea614105826140d0565b8181528560208385010111156147ff57600080fd5b612adc826020830160208601613d3b565b60ff81168114611cd757600080fd5b60006020828403121561483157600080fd5b813561122781614810565b60048110611cd757600080fd5b60006020828403121561485b57600080fd5b81356112278161483c565b6001600160601b03198860601b168152866014820152600060ff60f81b808860f81b166034840152808760f81b166035840152808660f81b166036840152808560f81b16603784015250600483106148c0576148c06141b9565b5060f89190911b60388201526039019695505050505050565b600060c082840312156148eb57600080fd5b60405160c081018181106001600160401b038211171561490d5761490d613f9c565b604052823561491b81614810565b8152602083013561492b81614810565b6020820152604083013561493e81614810565b6040820152606083013561495181614810565b606082015260808301356149648161483c565b608082015260a08301356149778161402c565b60a08201529392505050565b634e487b7160e01b600052603260045260246000fd5b60006000198214156149ad576149ad61460c565b5060010190565b8481528360208201526080604082015260006149d3608083018561471c565b9050821515606083015295945050505050565b8051613db58161402c565b60008082840360e0811215614a0557600080fd5b60c0811215614a1357600080fd5b50614a1c613fda565b8351614a2781614810565b81526020840151614a3781614810565b60208201526040840151614a4a81614810565b60408201526060840151614a5d81614810565b60608201526080840151614a708161483c565b608082015260a0840151614a838161402c565b60a08201529150614a9660c084016149e6565b90509250929050565b600060208284031215614ab157600080fd5b815161122781613ce1565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614aef90830184613d67565b9695505050505050565b600060208284031215614b0b57600080fd5b815161122781613cae565b7f19457468657265756d205369676e6564204d6573736167653a0a000000000000815260008351614b4e81601a850160208801613d3b565b835190830190614b6581601a840160208801613d3b565b01601a01949350505050565b6d029b2b63632b91d1021b7b9ba39960951b815260008251614b9a81600e850160208701613d3b565b64204757656960d81b600e939091019283015250601301919050565b600082614bc557614bc5614659565b500690565b67029b2b63632b91d160c51b815260008251614bed816008850160208701613d3b565b9190910160080192915050565b634e487b7160e01b600052603160045260246000fdfea26469706673582212203826df72e51052fd16f5144fac928953078c2e53aaff306e38a8974e17c4c45664736f6c634300080b0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000565e8eec4cd6193f8c28c40a3dad811bb6a09351000000000000000000000000565e8eec4cd6193f8c28c40a3dad811bb6a0935100000000000000000000000028064de690fcee72a5dd2d3b05c11c83868d87d20000000000000000000000003ba0ae134e9ac6e8e0f454ec6933f6313f2c76fc00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000004368747470733a2f2f696d6167696e6172792d667269656e642d6261636b656e642d70726f642d3274796e6b6b643633712d75632e612e72756e2e6170702f746f6b656e0000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : signerEarlyAccess (address): 0x565E8EEc4cd6193f8C28C40A3DAD811BB6a09351
Arg [1] : signerQuiz (address): 0x565E8EEc4cd6193f8C28C40A3DAD811BB6a09351
Arg [2] : paymentSplitter (address): 0x28064de690fCeE72A5dd2d3B05C11C83868d87d2
Arg [3] : royaltyReceiver (address): 0x3ba0ae134e9Ac6e8E0f454eC6933F6313f2c76fC
Arg [4] : baseURI (string): https://imaginary-friend-backend-prod-2tynkkd63q-uc.a.run.app/token

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 000000000000000000000000565e8eec4cd6193f8c28c40a3dad811bb6a09351
Arg [1] : 000000000000000000000000565e8eec4cd6193f8c28c40a3dad811bb6a09351
Arg [2] : 00000000000000000000000028064de690fcee72a5dd2d3b05c11c83868d87d2
Arg [3] : 0000000000000000000000003ba0ae134e9ac6e8e0f454ec6933f6313f2c76fc
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000043
Arg [6] : 68747470733a2f2f696d6167696e6172792d667269656e642d6261636b656e64
Arg [7] : 2d70726f642d3274796e6b6b643633712d75632e612e72756e2e6170702f746f
Arg [8] : 6b656e0000000000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

A collection of 3000 Imaginary Friends (IFs) released by Kai.Holders of an Imaginary Pass will transform their pass into their very own personalized IF.Rarity is determined by the community after all IFs have transformed.

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ 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.