ETH Price: $3,397.34 (-1.04%)

Contract

0x4A5aD53ed70357961e58Faf304CCfd06180D2C30
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040168339762023-03-15 14:46:35622 days ago1678891595IN
 Create: FairXYZDeployer
0 ETH0.2415138146.01494669

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FairXYZDeployer

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 140 runs

Other Settings:
default evmVersion, MIT license
File 1 of 25 : FairXYZDeployer.sol
// SPDX-License-Identifier: MIT

// @author: Fair.xyz dev

pragma solidity 0.8.17;

import "ERC721xyzUpgradeable.sol";
import "FairXYZDeployerErrorsAndEvents.sol";
import "IFairXYZWallets.sol";

import "AccessControlUpgradeable.sol";
import "OwnableUpgradeable.sol";
import "ReentrancyGuardUpgradeable.sol";
import "ECDSAUpgradeable.sol";
import "MerkleProofUpgradeable.sol";
import "MulticallUpgradeable.sol";

contract FairXYZDeployer is
    ERC721xyzUpgradeable,
    AccessControlUpgradeable,
    MulticallUpgradeable,
    ReentrancyGuardUpgradeable,
    OwnableUpgradeable,
    FairXYZDeployerErrorsAndEvents
{
    using ECDSAUpgradeable for bytes32;
    using StringsUpgradeable for uint256;

    struct TokensAvailableToMint {
        /// @dev Max number of tokens on sale across the whole collection
        uint128 maxTokens;
        /// @dev The creator can enforce a max mints per wallet at a global level, i.e. across all stages
        uint128 globalMintsPerWallet;
    }

    TokensAvailableToMint public tokensAvailable;

    /// @dev URI information
    string internal baseURI;
    string internal pathURI;
    string internal preRevealURI;
    string internal _overrideURI;
    bool public lockURI;

    /// @dev Bool to allow signature-less minting, in case the seller/creator wants to liberate themselves
    // from being bound to a signature generated on the Fair.xyz back-end
    bool public signatureReleased;

    /// @dev Interface into FairXYZWallets. This provides the wallet address to which the Fair.xyz fee is sent to
    address public interfaceAddress;

    /// @dev Burnable token bool
    bool public burnable;

    /// @dev Sale information - this tells the contract where the proceeds from the primary sale should go to
    address internal _primarySaleReceiver;

    /// @dev Tightly pack the parameters that define a sale stage
    struct StageData {
        uint40 startTime;
        uint40 endTime;
        uint32 mintsPerWallet;
        uint32 phaseLimit;
        uint112 price;
        bytes32 merkleRoot;
    }

    /// @dev Mapping a stage ID to its corresponding StageData struct
    mapping(uint256 => StageData) internal stageMap;

    /// @dev Mapping to keep track of the number of mints a given wallet has done on a specific stage
    mapping(uint256 => mapping(address => uint256)) public stageMints;

    /// @dev Total number of sale stages
    uint256 public totalStages;

    /// @dev Pre-defined roles for AccessControl
    bytes32 public constant SECOND_ADMIN_ROLE = keccak256("T2A");
    bytes32 public constant MINTER_ROLE = keccak256("MINTER");

    uint256 internal constant stageLengthLimit = 20;

    uint256 constant FairxyzMintFee = 0.00087 ether;

    /// @dev Fair.xyz fee recipient address
    address internal constant FairxyzReceiverAddress =
        0xC5A2f45fF2d4CA27e167600b5225C7E6E187d8C0;

    /// @dev Fair.xyz address required for verifying signatures in the contract
    address internal constant FairxyzSignerAddress =
        0x7A6F5866f97034Bb7153829bdAaC1FFCb8Facb71;

    address constant DEFAULT_OPERATOR_FILTER_REGISTRY =
        0x000000000000AAeB6D7670E522A718067333cd4E;
    address constant DEFAULT_OPERATOR_FILTER_SUBSCRIPTION =
        0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;

    /// @dev EIP-712 signatures
    bytes32 constant EIP712_NAME_HASH = keccak256("Fair.xyz");
    bytes32 constant EIP712_VERSION_HASH = keccak256("1.0.0");
    bytes32 constant EIP712_DOMAIN_TYPE_HASH =
        keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
    bytes32 constant EIP712_MINT_TYPE_HASH =
        keccak256(
            "Mint(address recipient,uint256 quantity,uint256 nonce,uint256 maxMintsPerWallet)"
        );
    bytes32 constant EIP712_URICHANGE_TYPE_HASH =
        keccak256("URIChange(address sender,string newPathURI,string newURI)");

    event NewStagesSet(StageData[] stages, uint256 startIndex);

    /*///////////////////////////////////////////////////////////////
                            Initialisation
    //////////////////////////////////////////////////////////////*/

    constructor() {
        _disableInitializers();
    }

    /**
     * @dev Initialise a new Creator contract by setting variables and initialising
     * inherited contracts
     */
    function _initialize(
        uint128 maxTokens_,
        string memory name_,
        string memory symbol_,
        address interfaceAddress_,
        string[] memory URIs_,
        uint96 royaltyPercentage_,
        uint128 globalMintsPerWallet_,
        address[] memory royaltyReceivers,
        address ownerOfContract,
        StageData[] calldata stages,
        bool isSBT
    ) external initializer {
        if (interfaceAddress_ == address(0)) revert ZeroAddress();
        require(URIs_.length == 3);
        require(royaltyReceivers.length == 2);
        __ERC721_init(name_, symbol_);
        __AccessControl_init();
        __Multicall_init();
        __OperatorFilterer_init(
            DEFAULT_OPERATOR_FILTER_REGISTRY,
            DEFAULT_OPERATOR_FILTER_SUBSCRIPTION,
            true
        );
        _transferOwnership(ownerOfContract);
        tokensAvailable = TokensAvailableToMint(
            maxTokens_,
            globalMintsPerWallet_
        );
        interfaceAddress = interfaceAddress_;
        preRevealURI = URIs_[0];
        baseURI = URIs_[1];
        pathURI = URIs_[2];
        isSoulBound = isSBT;
        _primarySaleReceiver = royaltyReceivers[0];
        _setDefaultRoyalty(royaltyReceivers[1], royaltyPercentage_);
        _grantRole(DEFAULT_ADMIN_ROLE, ownerOfContract);
        _grantRole(SECOND_ADMIN_ROLE, ownerOfContract);
        if (stages.length > 0) {
            _setStages(stages, 0);
        }
    }

    /*///////////////////////////////////////////////////////////////
                            Sale stages logic
    //////////////////////////////////////////////////////////////*/

    /**
     * @dev View sale parameters corresponding to a given stage
     */
    function viewStageMap(
        uint256 stageId
    ) external view returns (StageData memory) {
        if (stageId >= totalStages) revert StageDoesNotExist();

        return stageMap[stageId];
    }

    /**
     * @dev View the current active sale stage for a sale based on being within the
     * time bounds for the start time and end time for the considered stage
     */
    function viewCurrentStage() public view returns (uint256) {
        for (uint256 i = totalStages; i > 0; ) {
            unchecked {
                --i;
            }

            if (
                block.timestamp >= stageMap[i].startTime &&
                block.timestamp <= stageMap[i].endTime
            ) {
                return i;
            }
        }

        revert SaleNotActive();
    }

    /**
     * @dev Get the price for the current active sale stage
     * reverts if there is no current active stage
     */
    function viewCurrentPrice() public view returns (uint256) {
        return stageMap[viewCurrentStage()].price + FairxyzMintFee;
    }

    /**
     * @dev Returns the earliest stage which has not closed yet
     */
    function viewLatestStage() public view returns (uint256) {
        for (uint256 i = totalStages; i > 0; ) {
            unchecked {
                --i;
            }

            if (block.timestamp > stageMap[i].endTime) {
                return i + 1;
            }
        }

        return 0;
    }

    /**
     * @dev See _setStages
     */
    function setStages(StageData[] calldata stages, uint256 startId) external {
        if (!hasRole(SECOND_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
        _setStages(stages, startId);
    }

    /**
     * @dev Set the parameters for a list of sale stages, starting from startId onwards
     */
    function _setStages(
        StageData[] calldata stages,
        uint256 startId
    ) internal returns (uint256) {
        uint256 stagesLength = stages.length;

        uint256 latestStage = viewLatestStage();

        // Cannot set more than the stage length limit stages per transaction
        if (stagesLength > stageLengthLimit) revert StageLimitPerTx();

        uint256 currentTotalStages = totalStages;

        // Check that the stage the user is overriding from onwards is not a closed stage
        if (currentTotalStages > 0 && startId < latestStage)
            revert CannotEditPastStages();

        // The startId cannot be an arbitrary number, it must follow a sequential order based on the current number of stages
        if (startId > currentTotalStages) revert IncorrectIndex();

        // There can be no more than 20 sale stages (stageLengthLimit) between the most recent active stage and the last possible stage
        if (startId + stagesLength > latestStage + stageLengthLimit)
            revert TooManyStagesInTheFuture();

        uint256 initialStageStartTime = stageMap[startId].startTime;

        // In order to delete a stage, calldata of length 0 must be provided. The stage referenced by the startIndex
        // and all stages after that will no longer be considered for the drop
        if (stagesLength == 0) {
            // The stage cannot have started at any point for it to be deleted
            if (initialStageStartTime <= block.timestamp)
                revert CannotDeleteOngoingStage();

            // The new length of total stages is startId, as everything from there onwards is now disregarded
            totalStages = startId;
            emit NewStagesSet(stages, startId);
            return startId;
        }

        StageData memory newStage = stages[0];

        if (newStage.phaseLimit < _mintedTokens)
            revert TokenCountExceedsPhaseLimit();

        if (
            initialStageStartTime <= block.timestamp &&
            initialStageStartTime != 0 &&
            startId < totalStages
        ) {
            // If the start time of the stage being replaced is in the past and exists
            // the new stage start time must match it
            if (initialStageStartTime != newStage.startTime)
                revert InvalidStartTime();

            // The end time for a stage cannot be in the past
            if (newStage.endTime <= block.timestamp) revert EndTimeInThePast();
        } else {
            // the start time of the stage being replaced is in the future or doesn't exist
            // the new stage start time can't be in the past
            if (newStage.startTime <= block.timestamp)
                revert StartTimeInThePast();
        }

        unchecked {
            uint256 i = startId;
            uint256 stageCount = startId + stagesLength;

            do {
                if (i != startId) {
                    newStage = stages[i - startId];
                }

                // The number of tokens the user can mint up to in a stage cannot exceed the total supply available
                if (newStage.phaseLimit > tokensAvailable.maxTokens)
                    revert PhaseLimitExceedsTokenCount();

                // The end time cannot be less than the start time for a sale
                if (newStage.endTime <= newStage.startTime)
                    revert EndTimeLessThanStartTime();

                if (i > 0) {
                    uint256 previousStageEndTime = stageMap[i - 1].endTime;
                    // The number of total NFTs on sale cannot decrease below the total for a stage which has not ended
                    if (newStage.phaseLimit < stageMap[i - 1].phaseLimit) {
                        if (previousStageEndTime >= block.timestamp)
                            revert LessNFTsOnSaleThanBefore();
                    }

                    // A sale can only start after the previous one has closed
                    if (newStage.startTime <= previousStageEndTime)
                        revert PhaseStartsBeforePriorPhaseEnd();
                }

                // Update the variables in a given stage's stageMap with the correct indexing within the stages function input
                stageMap[i] = newStage;

                ++i;
            } while (i < stageCount);

            // The total number of stages is updated to be the startId + the length of stages added from there onwards
            totalStages = stageCount;

            emit NewStagesSet(stages, startId);
            return stageCount;
        }
    }

    /*///////////////////////////////////////////////////////////////
                    Sale proceeds & royalties
    //////////////////////////////////////////////////////////////*/

    /**
     * @dev Override primary sale receiver
     */
    function changePrimarySaleReceiver(
        address newPrimarySaleReceiver
    ) external {
        if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
        if (newPrimarySaleReceiver == address(0)) revert ZeroAddress();
        _primarySaleReceiver = newPrimarySaleReceiver;
        emit NewPrimarySaleReceiver(_primarySaleReceiver);
    }

    /**
     * @dev Override secondary royalty receiver and royalty percentage fee
     */
    function changeSecondaryRoyaltyReceiver(
        address newSecondaryRoyaltyReceiver,
        uint96 newRoyaltyValue
    ) external {
        if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
        _setDefaultRoyalty(newSecondaryRoyaltyReceiver, newRoyaltyValue);
        emit NewSecondaryRoyalties(
            newSecondaryRoyaltyReceiver,
            newRoyaltyValue
        );
    }

    /**
     * @dev Transfers the contract balance to the primary sale receiver
     */
    function withdraw() external payable onlyRole(DEFAULT_ADMIN_ROLE) {
        (bool sent_, ) = _primarySaleReceiver.call{
            value: address(this).balance
        }("");
        if (!sent_) revert ETHSendFail();
    }

    /*///////////////////////////////////////////////////////////////
                            Token metadata
    //////////////////////////////////////////////////////////////*/

    /**
     * @dev Return the Base URI, used when there is no expected reveal experience
     */
    function _baseURI() public view returns (string memory) {
        return baseURI;
    }

    /**
     * @dev Return the path URI - used for reveal experience
     */
    function _pathURI() public view returns (string memory) {
        if (bytes(_overrideURI).length == 0) {
            return IFairXYZWallets(interfaceAddress).viewPathURI(pathURI);
        } else {
            return _overrideURI;
        }
    }

    /**
     * @dev Return the pre-reveal URI, which is used when there is a reveal experience
     * and the reveal metadata has not been set yet.
     */
    function _preRevealURI() public view returns (string memory) {
        return preRevealURI;
    }

    /**
     * @dev Combines path URI, base URI and pre-reveal URI for the full metadata journey on Fair.xyz
     */
    function tokenURI(
        uint256 tokenId
    ) public view virtual override returns (string memory) {
        if (!_exists(tokenId)) revert TokenDoesNotExist();

        string memory pathURI_ = _pathURI();
        string memory baseURI_ = _baseURI();
        string memory preRevealURI_ = _preRevealURI();

        if (bytes(pathURI_).length == 0) {
            return preRevealURI_;
        } else {
            return
                string(
                    abi.encodePacked(pathURI_, baseURI_, tokenId.toString())
                );
        }
    }

    /**
     * @dev Lock the token metadata forever. This action is non reversible.
     */
    function lockURIforever() external {
        if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
        if (lockURI) revert AlreadyLockedURI();
        lockURI = true;
        emit URILocked();
    }

    /**
     * @dev Hash the variables to be modified for URI changes.
     */
    function hashURIChange(
        address sender,
        string memory newPathURI,
        string memory newURI
    ) private view returns (bytes32) {
        bytes32 digest = _hashTypedDataV4(
            keccak256(
                abi.encode(
                    EIP712_URICHANGE_TYPE_HASH,
                    sender,
                    keccak256(bytes(newPathURI)),
                    keccak256(bytes(newURI))
                )
            )
        );
        return digest;
    }

    /**
     * @dev Change values for the URIs. New Path URI implies a new reveal date being used.
     * newURI acts as an override for all priorly defined URIs). If lockURI() has been
     * executed, then this function will fail, as the data will have been locked forever.
     */
    function changeURI(
        bytes memory signature,
        string memory newPathURI,
        string memory newURI
    ) external {
        if (!hasRole(SECOND_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();

        // URI cannot be modified if it has been locked
        if (lockURI) revert AlreadyLockedURI();

        bytes32 messageHash = hashURIChange(msg.sender, newPathURI, newURI);

        if (messageHash.recover(signature) != FairxyzSignerAddress)
            revert UnrecognizableHash();

        if (bytes(newPathURI).length != 0) {
            pathURI = newPathURI;
            emit NewPathURI(pathURI);
        }
        if (bytes(newURI).length != 0) {
            _overrideURI = newURI;
            baseURI = "";
            emit NewTokenURI(_overrideURI);
        }
    }

    /*///////////////////////////////////////////////////////////////
                            Burning
    //////////////////////////////////////////////////////////////*/

    /**
     * @dev Toggle the burn state for NFTs in the contract
     */
    function toggleBurnable() external {
        if (!hasRole(SECOND_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
        burnable = !burnable;
        emit BurnableSet(burnable);
    }

    /**
     * @dev Burn a token. Requires being an approved operator or the owner of an NFT
     */
    function burn(uint256 tokenId) external returns (uint256) {
        if (!burnable) revert BurningOff();
        if (
            !(isApprovedForAll(ownerOf(tokenId), msg.sender) ||
                msg.sender == ownerOf(tokenId) ||
                getApproved(tokenId) == msg.sender)
        ) revert BurnerIsNotApproved();
        _burn(tokenId);
        return tokenId;
    }

    /*///////////////////////////////////////////////////////////////
                        Minting + airdrop logic
    //////////////////////////////////////////////////////////////*/

    /**
     * @dev Set global max mints per wallet
     */
    function setGlobalMaxMints(uint128 newGlobalMaxMintsPerWallet) external {
        if (!hasRole(SECOND_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
        tokensAvailable.globalMintsPerWallet = newGlobalMaxMintsPerWallet;
        emit NewMaxMintsPerWalletSet(newGlobalMaxMintsPerWallet);
    }

    /**
     * @dev Allow for signature-less minting on public sales
     */
    function releaseSignature() external {
        if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert UnauthorisedUser();
        require(!signatureReleased);
        signatureReleased = true;
        emit SignatureReleased();
    }

    /**
     * @dev Hash transaction data for minting
     */
    function hashMintParams(
        address recipient,
        uint256 quantity,
        uint256 nonce,
        uint256 maxMintsPerWallet
    ) private view returns (bytes32) {
        bytes32 digest = _hashTypedDataV4(
            keccak256(
                abi.encode(
                    EIP712_MINT_TYPE_HASH,
                    recipient,
                    quantity,
                    nonce,
                    maxMintsPerWallet
                )
            )
        );
        return digest;
    }

    /**
     * @dev Handle excess NFTs being minted in a transaction based on the different stage and sale limits
     */
    function handleReimbursement(
        address recipient,
        uint256 presentStage,
        uint256 numberOfTokens,
        uint256 currentMintedTokens,
        StageData memory dropData,
        uint256 maxMintsPerWallet
    ) internal returns (uint256) {
        // Load the total number of NFTs the user has minted across all stages
        uint256 mintsPerWallet = uint256(mintData[recipient].mintsPerWallet);

        // Load the number of NFTs the user has minted solely on the active stage
        uint256 stageMintsPerWallet = stageMints[presentStage][recipient];

        unchecked {
            // A value of 0 means there is no limit as to how many mints a wallet can do in this stage
            if (dropData.mintsPerWallet > 0) {
                // Check that the user has not reached the minting limit per wallet for this stage
                if (stageMintsPerWallet >= dropData.mintsPerWallet)
                    revert ExceedsMintsPerWallet();

                // Cap the number of tokens the user can mint so that it does not exceed the limit
                // per wallet for this stage
                if (
                    stageMintsPerWallet + numberOfTokens >
                    dropData.mintsPerWallet
                ) {
                    numberOfTokens =
                        dropData.mintsPerWallet -
                        stageMintsPerWallet;
                }
            }

            uint256 _globalMintsPerWallet = tokensAvailable
                .globalMintsPerWallet;

            // A value of 0 means there is no limit as to how many mints a wallet can do across all stages
            if (_globalMintsPerWallet > 0) {
                // Check that the user has not reached the minting limit per wallet across the whole contract
                if (mintsPerWallet >= _globalMintsPerWallet)
                    revert ExceedsMintsPerWallet();

                // Cap the number of tokens the user can mint so that it does not exceed the minting limit
                // per wallet across the whole contract
                if (mintsPerWallet + numberOfTokens > _globalMintsPerWallet) {
                    numberOfTokens = _globalMintsPerWallet - mintsPerWallet;
                }
            }

            // Cap the number of tokens the user can mint so that it does not exceed the minting limit
            // of tokens on sale for this stage
            if (currentMintedTokens + numberOfTokens > dropData.phaseLimit) {
                numberOfTokens = dropData.phaseLimit - currentMintedTokens;
            }

            // A value of 0 means there is no limit as to how many mints a wallet has been authorised to mint.
            // This form of mint authorisation is managed through pre-generated signatures - if the contract has
            // been released from signature minting then this check is omitted
            if (maxMintsPerWallet > 0 && !signatureReleased) {
                // Check that the user has not reached the minting limit per wallet they have been allowlisted for
                if (stageMintsPerWallet >= maxMintsPerWallet)
                    revert ExceedsMintsPerWallet();

                // Cap the number of tokens the user can mint so that it does not exceed the limit
                // of mints the wallet has been allowlisted for
                if (stageMintsPerWallet + numberOfTokens > maxMintsPerWallet) {
                    numberOfTokens = maxMintsPerWallet - stageMintsPerWallet;
                }
            }

            // Update the total number mints the recipient has done for this stage
            stageMintsPerWallet += numberOfTokens;
            stageMints[presentStage][recipient] = stageMintsPerWallet;

            return (numberOfTokens);
        }
    }

    /**
     * @dev Mint token(s) for public sales
     */
    function mint(
        bytes memory signature,
        uint256 nonce,
        uint256 numberOfTokens,
        uint256 maxMintsPerWallet,
        address recipient
    ) external payable {
        // At least 1 and no more than 20 tokens can be minted per transaction
        if (!((0 < numberOfTokens) && (numberOfTokens <= 20)))
            revert TokenLimitPerTx();

        // Check the active stage - reverts if no stage is active
        uint256 presentStage = viewCurrentStage();

        // Load the minting parameters for this stage
        StageData memory dropData = stageMap[presentStage];

        // Check that enough ETH is sent for the minting quantity
        uint256 costPerToken = dropData.price + FairxyzMintFee;
        if (msg.value != costPerToken * numberOfTokens) revert NotEnoughETH();

        // Nonce = 0 is reserved for airdrop mints, to distinguish them from other mints in the
        // _mint function on ERC721xyzUpgradeable
        if (nonce == 0) revert InvalidNonce();

        uint256 currentMintedTokens = _mintedTokens;

        // The number of minted tokens cannot exceed the number of NFTs on sale for this stage
        if (currentMintedTokens >= dropData.phaseLimit) revert PhaseLimitEnd();

        // If a Merkle Root is defined for the stage, then this is an allowlist stage. Thus the function merkleMint
        // must be used instead
        if (dropData.merkleRoot != bytes32(0)) revert MerkleStage();

        // If the contract is released from signature minting, skips this signature verification
        if (!signatureReleased) {
            // Hash the variables
            bytes32 messageHash = hashMintParams(
                recipient,
                numberOfTokens,
                nonce,
                maxMintsPerWallet
            );

            // Ensure the recovered address from the signature is the Fair.xyz signer address
            if (messageHash.recover(signature) != FairxyzSignerAddress)
                revert UnrecognizableHash();

            // mintData[recipient].blockNumber is the last block (nonce) that was used to mint from the given address.
            // Nonces can only increase in number in each transaction, and are part of the signature. This ensures
            // that past signatures are not reused
            if (mintData[recipient].blockNumber >= nonce) revert ReusedHash();

            // Set a time limit of 40 blocks for the signature
            if (block.number > nonce + 40) revert TimeLimit();
        }

        uint256 adjustedNumberOfTokens = handleReimbursement(
            recipient,
            presentStage,
            numberOfTokens,
            currentMintedTokens,
            dropData,
            maxMintsPerWallet
        );

        // Mint the NFTs
        _safeMint(recipient, adjustedNumberOfTokens, nonce);

        (bool feeSent, ) = FairxyzReceiverAddress.call{
            value: (FairxyzMintFee * adjustedNumberOfTokens)
        }("");
        if (!feeSent) revert ETHSendFail();

        // If the value for numberOfTokens is less than the origMintCount, then there is reimbursement
        // to be done
        if (adjustedNumberOfTokens < numberOfTokens) {
            uint256 reimbursementPrice = (numberOfTokens -
                adjustedNumberOfTokens) * costPerToken;
            (bool sent, ) = msg.sender.call{value: reimbursementPrice}("");
            if (!sent) revert ETHSendFail();
        }

        emit Mint(recipient, presentStage, adjustedNumberOfTokens);
    }

    /**
     * @notice Verify merkle proof for address and address minting limit
     */
    function verifyMerkleAddress(
        bytes32[] calldata merkleProof,
        bytes32 _merkleRoot,
        address minterAddress,
        uint256 walletLimit
    ) private pure returns (bool) {
        return
            MerkleProofUpgradeable.verify(
                merkleProof,
                _merkleRoot,
                keccak256(abi.encodePacked(minterAddress, walletLimit))
            );
    }

    /**
     * @dev Mint token(s) for allowlist sales
     */
    function merkleMint(
        bytes32[] calldata _merkleProof,
        uint256 numberOfTokens,
        uint256 maxMintsPerWallet,
        address recipient
    ) external payable {
        // At least 1 and no more than 20 tokens can be minted per transaction
        if (!((0 < numberOfTokens) && (numberOfTokens <= 20)))
            revert TokenLimitPerTx();

        // Check the active stage - reverts if no stage is active
        uint256 presentStage = viewCurrentStage();

        // Load the minting parameters for this stage
        StageData memory dropData = stageMap[presentStage];

        // Check that enough ETH is sent for the minting quantity
        uint256 costPerToken = dropData.price + FairxyzMintFee;
        if (msg.value != costPerToken * numberOfTokens) revert NotEnoughETH();

        // If a Merkle Root is not defined for the stage, then this is an public sale stage. Thus the function mint()
        // must be used instead
        if (dropData.merkleRoot == bytes32(0)) revert PublicStage();

        uint256 currentMintedTokens = _mintedTokens;

        // The number of minted tokens cannot exceed the number of NFTs on sale for this stage
        if (currentMintedTokens >= dropData.phaseLimit) revert PhaseLimitEnd();

        // Verify the Merkle Proof for the recipient address and the maximum number of mints the wallet has been assigned
        // on the allowlist
        if (
            !(
                verifyMerkleAddress(
                    _merkleProof,
                    dropData.merkleRoot,
                    recipient,
                    maxMintsPerWallet
                )
            )
        ) revert MerkleProofFail();

        uint256 adjustedNumberOfTokens = handleReimbursement(
            recipient,
            presentStage,
            numberOfTokens,
            currentMintedTokens,
            dropData,
            maxMintsPerWallet
        );

        // Mint NFTs
        _safeMint(recipient, adjustedNumberOfTokens, block.number);
        (bool feeSent, ) = FairxyzReceiverAddress.call{
            value: (FairxyzMintFee * adjustedNumberOfTokens)
        }("");
        if (!feeSent) revert ETHSendFail();

        // If the value for numberOfTokens is less than the origMintCount, then there is reimbursement
        // to be done
        if (adjustedNumberOfTokens < numberOfTokens) {
            uint256 reimbursementPrice = (numberOfTokens -
                adjustedNumberOfTokens) * costPerToken;
            (bool sent, ) = msg.sender.call{value: reimbursementPrice}("");
            if (!sent) revert ETHSendFail();
        }

        emit Mint(recipient, presentStage, adjustedNumberOfTokens);
    }

    /**
     * @dev See the total mints across all stages for a wallet
     */
    function totalWalletMints(
        address minterAddress
    ) external view returns (uint256) {
        return mintData[minterAddress].mintsPerWallet;
    }

    /**
     * @dev Airdrop tokens to a list of addresses
     */
    function airdrop(
        address[] memory address_,
        uint256 tokenCount
    ) external returns (uint256) {
        if (tokenCount > 20) revert TokenLimitPerTx();

        if (tokenCount == 0) revert TokenLimitPerTx();

        if (address_.length > 20) revert AddressLimitPerTx();

        if (address_.length == 0) revert AddressLimitPerTx();

        if (
            !hasRole(SECOND_ADMIN_ROLE, msg.sender) &&
            !hasRole(MINTER_ROLE, msg.sender)
        ) revert UnauthorisedUser();

        uint256 newTotal = _mintedTokens + address_.length * tokenCount;
        unchecked {
            if (newTotal > tokensAvailable.maxTokens)
                revert ExceedsNFTsOnSale();

            for (uint256 i; i < address_.length; ) {
                _safeMint(address_[i], tokenCount, 0);
                ++i;
            }

            emit Airdrop(tokenCount, newTotal, address_);
            return newTotal;
        }
    }

    /*///////////////////////////////////////////////////////////////
                            Miscellanous
    //////////////////////////////////////////////////////////////*/

    function supportsInterface(
        bytes4 interfaceId
    )
        public
        view
        virtual
        override(AccessControlUpgradeable, ERC721xyzUpgradeable)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

    /**
     * @dev overrides {UpdatableOperatorFilterUpgradeable} function to determine the role of operator filter admin
     */
    function _isOperatorFilterAdmin(
        address operator
    ) internal view override returns (bool) {
        return hasRole(DEFAULT_ADMIN_ROLE, operator);
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     */
    function _hashTypedDataV4(
        bytes32 structHash
    ) internal view virtual returns (bytes32) {
        bytes32 domainSeparator = keccak256(
            abi.encode(
                EIP712_DOMAIN_TYPE_HASH,
                EIP712_NAME_HASH,
                EIP712_VERSION_HASH,
                block.chainid,
                address(this)
            )
        );

        return ECDSAUpgradeable.toTypedDataHash(domainSeparator, structHash);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 2 of 25 : ERC721xyzUpgradeable.sol
// SPDX-License-Identifier: MIT

// @ Fair.xyz dev

pragma solidity 0.8.17;

import "IERC721Upgradeable.sol";
import "IERC721ReceiverUpgradeable.sol";
import "IERC721MetadataUpgradeable.sol";
import "AddressUpgradeable.sol";
import "ContextUpgradeable.sol";
import "StringsUpgradeable.sol";
import "ERC165Upgradeable.sol";
import "ERC2981Upgradeable.sol";
import "Initializable.sol";

import "OperatorFiltererUpgradeable.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, with modifications by the Fair.xyz team, thus setting the ERC721xyz standard
 */
abstract contract ERC721xyzUpgradeable is
    ContextUpgradeable,
    ERC165Upgradeable,
    IERC721Upgradeable,
    ERC2981Upgradeable,
    IERC721MetadataUpgradeable,
    OperatorFiltererUpgradeable
{
    using AddressUpgradeable for address;
    using StringsUpgradeable for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Token mint count
    uint256 public _mintedTokens;

    // Token burnt count
    uint256 internal _burntTokensCount;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping from token ID to original owner address
    mapping(uint256 => address) private _origOwners;

    // Burnt tokens
    mapping(uint256 => bool) private _tokenIsBurnt;

    // 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;

    // Mint information per wallet
    struct minterData {
        uint96 balance;
        uint96 mintsPerWallet;
        uint64 blockNumber;
    }

    mapping(address => minterData) internal mintData;

    bool public isSoulBound;

    error TokenIsSoulBound(); 

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    function __ERC721_init(string memory name_, string memory symbol_)
        internal
        onlyInitializing
    {
        __ERC721_init_unchained(name_, symbol_);
    }

    function __ERC721_init_unchained(string memory name_, string memory symbol_)
        internal
        onlyInitializing
    {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC2981Upgradeable, ERC165Upgradeable, IERC165Upgradeable)
        returns (bool)
    {
        return
            interfaceId == type(IERC2981Upgradeable).interfaceId ||
            interfaceId == type(IERC721Upgradeable).interfaceId ||
            interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner)
        public
        view
        virtual
        override
        returns (uint256)
    {
        require(
            owner != address(0),
            "ERC721: balance query for the zero address"
        );
        return mintData[owner].balance;
    }

    /**
     * @dev Returns number of minted Tokens
     */
    function viewMinted() public view virtual returns (uint256) {
        return _mintedTokens;
    }

    // return all tokens
    function totalSupply() public view virtual returns (uint256) {
        return _mintedTokens - _burntTokensCount;
    }

    /**
     * @dev Mints a batch of `tokenIds` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * In order to employ tight-packing, we use uint96 for the user balance and mints per wallet,
     * and uint64 for the nonce. This is suitable because uint96 supports up to 2**96 - 2 = 7.92*10**28
     * individual tokens being minted. Anything higher than this will cause an overflow. Similarly, the 
     * nonce stores block timestamps, in UNIX time, for which uint64 is more than sufficient.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     *
     * Emits {Transfer} events.
     */
    function _mint(
        address to,
        uint256 numberOfTokens,
        uint256 nonce
    ) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");

        _beforeTokenTransfer(address(0), to, _mintedTokens);

        uint256 orig_count = _mintedTokens;

        unchecked {
            uint256 new_count = orig_count + numberOfTokens;
            _mintedTokens = new_count;

            mintData[to].balance += uint96(numberOfTokens);

            // Nonce = 0 is for airdrop mints, which do not count towards wallet minting
            // limits or signature nonce updates
            if (nonce != 0) {
                mintData[to].mintsPerWallet += uint96(numberOfTokens);
                mintData[to].blockNumber = uint64(nonce);
            }

            _origOwners[new_count] = to;

            uint256 i = orig_count + 1;
            uint256 loop_ = new_count + 1;

            do {
                emit Transfer(address(0), to, i);
                ++i;
            } while (i < loop_);
        }

        _afterTokenTransfer(address(0), to, _mintedTokens);
    }

    /**
     * @dev Returns owner of token ID.
     */
    function ownerOf(uint256 tokenId)
        public
        view
        virtual
        override
        returns (address)
    {
        require(_exists(tokenId), "ERC721xyz: Query for non existent token!");

        uint256 counter = tokenId;

        address _owner = _owners[tokenId];

        if (_owner == address(0)) {
            while (true) {
                _owner = _origOwners[counter];
                if (_owner != address(0)) {
                    return _owner;
                }
                unchecked {
                    ++counter;
                }
            }
        }

        return _owner;
    }

    /**
     * @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 {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId)
        public
        virtual
        override
        onlyAllowedOperatorApproval(to)
    {
        address owner = ERC721xyzUpgradeable.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId)
        public
        view
        virtual
        override
        returns (address)
    {
        require(
            _exists(tokenId),
            "ERC721: approved query for nonexistent token"
        );

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved)
        public
        virtual
        override
        onlyAllowedOperatorApproval(operator)
    {
        _setApprovalForAll(_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 onlyAllowedOperator(from) {
        //solhint-disable-next-line max-line-length
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "ERC721: transfer caller is not owner nor approved"
        );

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override onlyAllowedOperator(from) {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override onlyAllowedOperator(from) {
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "ERC721: transfer caller is not owner nor approved"
        );
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @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.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(
            _checkOnERC721Received(from, to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @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`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        if (_tokenIsBurnt[tokenId]) return false;

        return (0 < tokenId && tokenId <= _mintedTokens);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId)
        internal
        view
        virtual
        returns (bool)
    {
        require(
            _exists(tokenId),
            "ERC721: operator query for nonexistent token"
        );
        address owner = ERC721xyzUpgradeable.ownerOf(tokenId);
        return (spender == owner ||
            getApproved(tokenId) == spender ||
            isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(
        address to,
        uint256 tokenCount,
        uint256 nonce
    ) internal virtual {
        _safeMint(to, tokenCount, "", nonce);
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenCount,
        bytes memory _data,
        uint256 nonce
    ) internal virtual {
        _mint(to, tokenCount, nonce);
        require(
            _checkOnERC721Received(address(0), to, _mintedTokens, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        require(_exists(tokenId), "ERC721xyz: Query for nonexistent token!");
        address owner = ERC721xyzUpgradeable.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        unchecked {
            mintData[owner].balance -= 1;
            _tokenIsBurnt[tokenId] = true;
            _burntTokensCount += 1;
        }

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * 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
    ) internal virtual {
        require(
            ERC721xyzUpgradeable.ownerOf(tokenId) == from,
            "ERC721: transfer from incorrect owner"
        );
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        unchecked {
            mintData[from].balance -= 1;
            mintData[to].balance += 1;
            _owners[tokenId] = to;
        }

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        address _approved = _tokenApprovals[tokenId];
        if (_approved != to) {
            _tokenApprovals[tokenId] = to;
            emit Approval(ERC721xyzUpgradeable.ownerOf(tokenId), to, tokenId);
        }
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a 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 _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try
                IERC721ReceiverUpgradeable(to).onERC721Received(
                    _msgSender(),
                    from,
                    tokenId,
                    _data
                )
            returns (bytes4 retval) {
                return
                    retval ==
                    IERC721ReceiverUpgradeable.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert(
                        "ERC721: transfer to non ERC721Receiver implementer"
                    );
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * 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, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal {
        if (from != address(0) && to != address(0)) {
            if (isSoulBound) revert TokenIsSoulBound();
        }
    }

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[43] private __gap;
}

File 3 of 25 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "IERC165Upgradeable.sol";

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

File 4 of 25 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 5 of 25 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721ReceiverUpgradeable {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

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

pragma solidity ^0.8.0;

import "IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 7 of 25 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 8 of 25 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 9 of 25 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initialized`
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initializing`
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 10 of 25 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "MathUpgradeable.sol";

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = MathUpgradeable.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, MathUpgradeable.log256(value) + 1);
        }
    }

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

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 11 of 25 : MathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library MathUpgradeable {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 12 of 25 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "IERC165Upgradeable.sol";
import "Initializable.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 13 of 25 : ERC2981Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.0;

import "IERC2981Upgradeable.sol";
import "ERC165Upgradeable.sol";
import "Initializable.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 ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable {
    function __ERC2981_init() internal onlyInitializing {
    }

    function __ERC2981_init_unchained() internal onlyInitializing {
    }
    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(IERC165Upgradeable, ERC165Upgradeable) returns (bool) {
        return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId);
    }

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

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

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

        return (royalty.receiver, royaltyAmount);
    }

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

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

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

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

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[48] private __gap;
}

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

pragma solidity ^0.8.0;

import "IERC165Upgradeable.sol";

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

File 15 of 25 : OperatorFiltererUpgradeable.sol
// SPDX-License-Identifier: MIT

// @author: Fair.xyz dev

pragma solidity 0.8.17;

import {IOperatorFilterRegistry} from "IOperatorFilterRegistry.sol";
import {Initializable} from "Initializable.sol";

abstract contract OperatorFiltererUpgradeable is Initializable {
    error OnlyAdmin();
    error OperatorNotAllowed(address operator);
    error RegistryInvalid();

    event OperatorFilterDisabled(bool disabled);

    bool public operatorFilterDisabled;

    IOperatorFilterRegistry public operatorFilterRegistry;

    function __OperatorFilterer_init(
        address registry_,
        address subscriptionOrRegistrantToCopy,
        bool subscribe
    ) internal onlyInitializing {
        if (address(registry_).code.length > 0) {
            IOperatorFilterRegistry registry = IOperatorFilterRegistry(
                registry_
            );
            _registerAndSubscribe(
                registry,
                subscriptionOrRegistrantToCopy,
                subscribe
            );
            operatorFilterRegistry = registry;
        }
    }

    // * MODIFIERS * //

    modifier onlyAllowedOperator(address from) virtual {
        // Check registry code length to facilitate testing in environments without a deployed registry.
        if (
            !operatorFilterDisabled &&
            address(operatorFilterRegistry).code.length > 0
        ) {
            // Allow spending tokens from addresses with balance
            // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
            // from an EOA.
            if (from == msg.sender) {
                _;
                return;
            }
            if (
                !operatorFilterRegistry.isOperatorAllowed(
                    address(this),
                    msg.sender
                )
            ) {
                revert OperatorNotAllowed(msg.sender);
            }
        }
        _;
    }

    modifier onlyAllowedOperatorApproval(address operator) virtual {
        // Check registry code length to facilitate testing in environments without a deployed registry.
        if (
            !operatorFilterDisabled &&
            address(operatorFilterRegistry).code.length > 0
        ) {
            if (
                !operatorFilterRegistry.isOperatorAllowed(
                    address(this),
                    operator
                )
            ) {
                revert OperatorNotAllowed(operator);
            }
        }
        _;
    }

    modifier onlyOperatorFilterAdmin() {
        if (!_isOperatorFilterAdmin(msg.sender)) {
            revert OnlyAdmin();
        }
        _;
    }

    // * ADMIN * //

    /**
     * @notice Enable/Disable Operator Filter
     */
    function toggleOperatorFilterDisabled()
        public
        virtual
        onlyOperatorFilterAdmin
        returns (bool)
    {
        bool disabled = !operatorFilterDisabled;
        operatorFilterDisabled = disabled;
        emit OperatorFilterDisabled(disabled);
        return disabled;
    }

    /**
     * @notice Update Operator Filter Registry and optionally subscribe to registrant (if supplied)
     */
    function updateOperatorFilterRegistry(
        address newRegistry,
        address subscriptionOrRegistrantToCopy,
        bool subscribe
    ) public virtual onlyOperatorFilterAdmin {
        IOperatorFilterRegistry registry = IOperatorFilterRegistry(newRegistry);
        if (address(registry).code.length == 0) revert RegistryInvalid();

        // it is technically possible that the owner has already registered the contract with the registry directly
        // so we check before attempting to subscribe, otherwise it might revert without saving the address here
        if (!registry.isRegistered(address(this))) {
            _registerAndSubscribe(
                registry,
                subscriptionOrRegistrantToCopy,
                subscribe
            );
        }
        operatorFilterRegistry = registry;
    }

    /**
     * @notice Update Subcription at the current Operator Filter Registry
     */
    function updateRegistrySubscription(
        address subscriptionOrRegistrantToCopy,
        bool subscribe,
        bool copyEntries
    ) public virtual onlyOperatorFilterAdmin {
        IOperatorFilterRegistry registry = operatorFilterRegistry;
        if (address(registry).code.length == 0) revert RegistryInvalid();
        if (subscriptionOrRegistrantToCopy == address(0)) {
            registry.unsubscribe(address(this), copyEntries);
        } else {
            _registerAndSubscribe(
                registry,
                subscriptionOrRegistrantToCopy,
                subscribe
            );
        }
    }

    // * INTERNAL * //

    /**
     * @dev Inheriting contract is responsible for implementation
     */
    function _isOperatorFilterAdmin(address operator)
        internal
        view
        virtual
        returns (bool);

    /**
     * @dev Register and/or subscribe to/copy entries of registrant at the given registry
     */
    function _registerAndSubscribe(
        IOperatorFilterRegistry registry,
        address subscriptionOrRegistrantToCopy,
        bool subscribe
    ) internal virtual {
        if (registry.isRegistered(address(this))) {
            if (subscribe) {
                registry.subscribe(
                    address(this),
                    subscriptionOrRegistrantToCopy
                );
            } else {
                registry.copyEntriesOf(
                    address(this),
                    subscriptionOrRegistrantToCopy
                );
            }
        } else {
            if (subscribe) {
                registry.registerAndSubscribe(
                    address(this),
                    subscriptionOrRegistrantToCopy
                );
            } else {
                if (subscriptionOrRegistrantToCopy != address(0)) {
                    registry.registerAndCopyEntries(
                        address(this),
                        subscriptionOrRegistrantToCopy
                    );
                } else {
                    registry.register(address(this));
                }
            }
        }
    }

    uint256[50] private __gap;
}

File 16 of 25 : IOperatorFilterRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

interface IOperatorFilterRegistry {
    function isOperatorAllowed(address registrant, address operator)
        external
        view
        returns (bool);

    function register(address registrant) external;

    function registerAndSubscribe(address registrant, address subscription)
        external;

    function registerAndCopyEntries(
        address registrant,
        address registrantToCopy
    ) external;

    function unregister(address addr) external;

    function updateOperator(
        address registrant,
        address operator,
        bool filtered
    ) external;

    function updateOperators(
        address registrant,
        address[] calldata operators,
        bool filtered
    ) external;

    function updateCodeHash(
        address registrant,
        bytes32 codehash,
        bool filtered
    ) external;

    function updateCodeHashes(
        address registrant,
        bytes32[] calldata codeHashes,
        bool filtered
    ) external;

    function subscribe(address registrant, address registrantToSubscribe)
        external;

    function unsubscribe(address registrant, bool copyExistingEntries) external;

    function subscriptionOf(address addr) external returns (address registrant);

    function subscribers(address registrant)
        external
        returns (address[] memory);

    function subscriberAt(address registrant, uint256 index)
        external
        returns (address);

    function copyEntriesOf(address registrant, address registrantToCopy)
        external;

    function isOperatorFiltered(address registrant, address operator)
        external
        returns (bool);

    function isCodeHashOfFiltered(address registrant, address operatorWithCode)
        external
        returns (bool);

    function isCodeHashFiltered(address registrant, bytes32 codeHash)
        external
        returns (bool);

    function filteredOperators(address addr)
        external
        returns (address[] memory);

    function filteredCodeHashes(address addr)
        external
        returns (bytes32[] memory);

    function filteredOperatorAt(address registrant, uint256 index)
        external
        returns (address);

    function filteredCodeHashAt(address registrant, uint256 index)
        external
        returns (bytes32);

    function isRegistered(address addr) external returns (bool);

    function codeHashOf(address addr) external returns (bytes32);
}

File 17 of 25 : FairXYZDeployerErrorsAndEvents.sol
// SPDX-License-Identifier: MIT

// @author: Fair.xyz dev

pragma solidity 0.8.17;

contract FairXYZDeployerErrorsAndEvents{

    /// @dev Events
    event Airdrop(uint256 tokenCount, uint256 newTotal, address[] recipients);
    event BurnableSet(bool burnState);
    event SignatureReleased();
    event NewMaxMintsPerWalletSet(uint128 newGlobalMintsPerWallet);
    event NewPathURI(string newPathURI);
    event NewPrimarySaleReceiver(address newPrimaryReceiver);
    event NewSecondaryRoyalties(
        address newSecondaryReceiver,
        uint96 newRoyalty
    );
    event NewTokenURI(string newTokenURI);
    event Mint(address minterAddress, uint256 stage, uint256 mintCount);
    event URILocked();

    /// @dev Errors
    error AddressLimitPerTx();
    error AlreadyLockedURI();
    error BurnerIsNotApproved();
    error BurningOff();
    error CannotDeleteOngoingStage();
    error CannotEditPastStages();
    error ETHSendFail();
    error EndTimeInThePast();
    error EndTimeLessThanStartTime();
    error ExceedsMintsPerWallet();
    error ExceedsNFTsOnSale();
    error IncorrectIndex();
    error InvalidNonce();
    error InvalidStartTime();
    error LessNFTsOnSaleThanBefore();
    error MerkleProofFail();
    error MerkleStage();
    error NotEnoughETH();
    error PhaseLimitEnd();
    error PhaseLimitExceedsTokenCount();
    error PhaseStartsBeforePriorPhaseEnd();
    error PublicStage();
    error ReusedHash();
    error SaleEnd();
    error SaleNotActive();
    error StageDoesNotExist();
    error StageLimitPerTx();
    error StartTimeInThePast();
    error TimeLimit();
    error TokenCountExceedsPhaseLimit();
    error TokenDoesNotExist();
    error TokenLimitPerTx();
    error TooManyStagesInTheFuture();
    error UnauthorisedUser();
    error UnrecognizableHash();
    error ZeroAddress();

}

File 18 of 25 : IFairXYZWallets.sol
// SPDX-License-Identifier: MIT

// @ Fair.xyz dev

pragma solidity 0.8.17;

interface IFairXYZWallets {
    function viewWithdraw() external view returns (address);

    function viewPathURI(string memory pathURI_)
        external
        view
        returns (string memory);
}

File 19 of 25 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "IAccessControlUpgradeable.sol";
import "ContextUpgradeable.sol";
import "StringsUpgradeable.sol";
import "ERC165Upgradeable.sol";
import "Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(account),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 20 of 25 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 21 of 25 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "ContextUpgradeable.sol";
import "Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 22 of 25 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "Initializable.sol";

/**
 * @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 ReentrancyGuardUpgradeable is Initializable {
    // 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;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 23 of 25 : ECDSAUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "StringsUpgradeable.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 ECDSAUpgradeable {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

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

    /**
     * @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) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            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 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", StringsUpgradeable.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 24 of 25 : MerkleProofUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The tree and the proofs can be generated using our
 * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
 * You will find a quickstart guide in the readme.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 * OpenZeppelin's JavaScript library generates merkle trees that are safe
 * against this attack out of the box.
 */
library MerkleProofUpgradeable {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Calldata version of {verify}
     *
     * _Available since v4.7._
     */
    function verifyCalldata(
        bytes32[] calldata proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Calldata version of {processProof}
     *
     * _Available since v4.7._
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     *
     * _Available since v4.7._
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Calldata version of {processMultiProof}.
     *
     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * _Available since v4.7._
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

File 25 of 25 : MulticallUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)

pragma solidity ^0.8.0;

import "AddressUpgradeable.sol";
import "Initializable.sol";

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * _Available since v4.1._
 */
abstract contract MulticallUpgradeable is Initializable {
    function __Multicall_init() internal onlyInitializing {
    }

    function __Multicall_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Receives and executes a batch of function calls on this contract.
     */
    function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = _functionDelegateCall(address(this), data[i]);
        }
        return results;
    }

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed");
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

Settings
{
  "evmVersion": "istanbul",
  "optimizer": {
    "enabled": true,
    "runs": 140
  },
  "libraries": {
    "FairXYZDeployer.sol": {}
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressLimitPerTx","type":"error"},{"inputs":[],"name":"AlreadyLockedURI","type":"error"},{"inputs":[],"name":"BurnerIsNotApproved","type":"error"},{"inputs":[],"name":"BurningOff","type":"error"},{"inputs":[],"name":"CannotDeleteOngoingStage","type":"error"},{"inputs":[],"name":"CannotEditPastStages","type":"error"},{"inputs":[],"name":"ETHSendFail","type":"error"},{"inputs":[],"name":"EndTimeInThePast","type":"error"},{"inputs":[],"name":"EndTimeLessThanStartTime","type":"error"},{"inputs":[],"name":"ExceedsMintsPerWallet","type":"error"},{"inputs":[],"name":"ExceedsNFTsOnSale","type":"error"},{"inputs":[],"name":"IncorrectIndex","type":"error"},{"inputs":[],"name":"InvalidNonce","type":"error"},{"inputs":[],"name":"InvalidStartTime","type":"error"},{"inputs":[],"name":"LessNFTsOnSaleThanBefore","type":"error"},{"inputs":[],"name":"MerkleProofFail","type":"error"},{"inputs":[],"name":"MerkleStage","type":"error"},{"inputs":[],"name":"NotEnoughETH","type":"error"},{"inputs":[],"name":"OnlyAdmin","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"PhaseLimitEnd","type":"error"},{"inputs":[],"name":"PhaseLimitExceedsTokenCount","type":"error"},{"inputs":[],"name":"PhaseStartsBeforePriorPhaseEnd","type":"error"},{"inputs":[],"name":"PublicStage","type":"error"},{"inputs":[],"name":"RegistryInvalid","type":"error"},{"inputs":[],"name":"ReusedHash","type":"error"},{"inputs":[],"name":"SaleEnd","type":"error"},{"inputs":[],"name":"SaleNotActive","type":"error"},{"inputs":[],"name":"StageDoesNotExist","type":"error"},{"inputs":[],"name":"StageLimitPerTx","type":"error"},{"inputs":[],"name":"StartTimeInThePast","type":"error"},{"inputs":[],"name":"TimeLimit","type":"error"},{"inputs":[],"name":"TokenCountExceedsPhaseLimit","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"TokenIsSoulBound","type":"error"},{"inputs":[],"name":"TokenLimitPerTx","type":"error"},{"inputs":[],"name":"TooManyStagesInTheFuture","type":"error"},{"inputs":[],"name":"UnauthorisedUser","type":"error"},{"inputs":[],"name":"UnrecognizableHash","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenCount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTotal","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"recipients","type":"address[]"}],"name":"Airdrop","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"burnState","type":"bool"}],"name":"BurnableSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minterAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"stage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintCount","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint128","name":"newGlobalMintsPerWallet","type":"uint128"}],"name":"NewMaxMintsPerWalletSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newPathURI","type":"string"}],"name":"NewPathURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newPrimaryReceiver","type":"address"}],"name":"NewPrimarySaleReceiver","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newSecondaryReceiver","type":"address"},{"indexed":false,"internalType":"uint96","name":"newRoyalty","type":"uint96"}],"name":"NewSecondaryRoyalties","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"uint32","name":"mintsPerWallet","type":"uint32"},{"internalType":"uint32","name":"phaseLimit","type":"uint32"},{"internalType":"uint112","name":"price","type":"uint112"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"indexed":false,"internalType":"struct FairXYZDeployer.StageData[]","name":"stages","type":"tuple[]"},{"indexed":false,"internalType":"uint256","name":"startIndex","type":"uint256"}],"name":"NewStagesSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newTokenURI","type":"string"}],"name":"NewTokenURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"disabled","type":"bool"}],"name":"OperatorFilterDisabled","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":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[],"name":"SignatureReleased","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":[],"name":"URILocked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SECOND_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"maxTokens_","type":"uint128"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"interfaceAddress_","type":"address"},{"internalType":"string[]","name":"URIs_","type":"string[]"},{"internalType":"uint96","name":"royaltyPercentage_","type":"uint96"},{"internalType":"uint128","name":"globalMintsPerWallet_","type":"uint128"},{"internalType":"address[]","name":"royaltyReceivers","type":"address[]"},{"internalType":"address","name":"ownerOfContract","type":"address"},{"components":[{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"uint32","name":"mintsPerWallet","type":"uint32"},{"internalType":"uint32","name":"phaseLimit","type":"uint32"},{"internalType":"uint112","name":"price","type":"uint112"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"internalType":"struct FairXYZDeployer.StageData[]","name":"stages","type":"tuple[]"},{"internalType":"bool","name":"isSBT","type":"bool"}],"name":"_initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"_mintedTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_pathURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_preRevealURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"address_","type":"address[]"},{"internalType":"uint256","name":"tokenCount","type":"uint256"}],"name":"airdrop","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"burnable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newPrimarySaleReceiver","type":"address"}],"name":"changePrimarySaleReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSecondaryRoyaltyReceiver","type":"address"},{"internalType":"uint96","name":"newRoyaltyValue","type":"uint96"}],"name":"changeSecondaryRoyaltyReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"string","name":"newPathURI","type":"string"},{"internalType":"string","name":"newURI","type":"string"}],"name":"changeURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"interfaceAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"isSoulBound","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockURI","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockURIforever","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"},{"internalType":"uint256","name":"numberOfTokens","type":"uint256"},{"internalType":"uint256","name":"maxMintsPerWallet","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"merkleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"numberOfTokens","type":"uint256"},{"internalType":"uint256","name":"maxMintsPerWallet","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorFilterDisabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorFilterRegistry","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"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":"releaseSignature","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"newGlobalMaxMintsPerWallet","type":"uint128"}],"name":"setGlobalMaxMints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"uint32","name":"mintsPerWallet","type":"uint32"},{"internalType":"uint32","name":"phaseLimit","type":"uint32"},{"internalType":"uint112","name":"price","type":"uint112"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"internalType":"struct FairXYZDeployer.StageData[]","name":"stages","type":"tuple[]"},{"internalType":"uint256","name":"startId","type":"uint256"}],"name":"setStages","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signatureReleased","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"stageMints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleBurnable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleOperatorFilterDisabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensAvailable","outputs":[{"internalType":"uint128","name":"maxTokens","type":"uint128"},{"internalType":"uint128","name":"globalMintsPerWallet","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStages","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":"minterAddress","type":"address"}],"name":"totalWalletMints","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":[{"internalType":"address","name":"newRegistry","type":"address"},{"internalType":"address","name":"subscriptionOrRegistrantToCopy","type":"address"},{"internalType":"bool","name":"subscribe","type":"bool"}],"name":"updateOperatorFilterRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"subscriptionOrRegistrantToCopy","type":"address"},{"internalType":"bool","name":"subscribe","type":"bool"},{"internalType":"bool","name":"copyEntries","type":"bool"}],"name":"updateRegistrySubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"viewCurrentPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"viewCurrentStage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"viewLatestStage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"viewMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"stageId","type":"uint256"}],"name":"viewStageMap","outputs":[{"components":[{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"uint32","name":"mintsPerWallet","type":"uint32"},{"internalType":"uint32","name":"phaseLimit","type":"uint32"},{"internalType":"uint112","name":"price","type":"uint112"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"internalType":"struct FairXYZDeployer.StageData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]

60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b615d7c80620000f46000396000f3fe6080604052600436106103435760003560e01c8063869d3bde116101b2578063b0fde7fb116100ed578063d539139311610090578063d539139314610a4c578063d547741f14610a80578063d7818e2814610aa0578063dedd76e714610ac0578063e985e9c514610b4c578063effcf2b714610b6c578063f2fde38b14610b81578063f86a352914610ba157600080fd5b8063b0fde7fb1461097b578063b3cc59db14610995578063b88d4fde146109aa578063bdc769eb146109ca578063c0dad79b146109dd578063c204642c146109f7578063c87b56dd14610a17578063ce4c61aa14610a3757600080fd5b806395d89b411161015557806395d89b411461088057806397f5cdcf14610895578063a07c7ce4146108ab578063a217fddf146108cd578063a22cb465146108e2578063aa8a675414610902578063ac9650d814610929578063b0ccc31e1461095657600080fd5b8063869d3bde1461075d5780638c8ea8e6146107725780638cd90c32146107b85780638da5cb5b146107f15780638e021c061461081057806390411aca1461082b57806391d148541461084057806394b08a4b1461086057600080fd5b806342842e0e11610282578063659b8b2a11610225578063659b8b2a146106895780636e49aa0a146106a957806370a08231146106c9578063715018a6146106e957806372c06f5a146106fe578063743976a0146107135780637f1fea5914610728578063804207361461074857600080fd5b806342842e0e1461056857806342966c68146105885780634e0b9df2146105a857806351e85af6146105c8578063548e7682146105dd578063577199fd146105fd57806360659a921461061d5780636352211e1461066957600080fd5b80632955a21d116102ea5780632955a21d146104775780632a55205a1461048a5780632f2ff15d146104c95780633540558a146104e957806336568abe1461050b5780633ccfd60b1461052b5780633f52af3c1461053357806341dfed3a1461055357600080fd5b806301ffc9a7146103485780630293741b1461037d57806306fdde031461039f578063081812fc146103b4578063095ea7b3146103e157806318160ddd1461040357806323b872dd14610426578063248a9ca314610446575b600080fd5b34801561035457600080fd5b50610368610363366004614bde565b610bb8565b60405190151581526020015b60405180910390f35b34801561038957600080fd5b50610392610bc9565b6040516103749190614c4b565b3480156103ab57600080fd5b50610392610c5c565b3480156103c057600080fd5b506103d46103cf366004614c5e565b610c6b565b6040516103749190614c77565b3480156103ed57600080fd5b506104016103fc366004614ca7565b610cf8565b005b34801561040f57600080fd5b50610418610ec9565b604051908152602001610374565b34801561043257600080fd5b50610401610441366004614cd1565b610ee0565b34801561045257600080fd5b50610418610461366004614c5e565b6000908152610100602052604090206001015490565b610401610485366004614dd0565b611017565b34801561049657600080fd5b506104aa6104a5366004614e3a565b6113e5565b604080516001600160a01b039093168352602083019190915201610374565b3480156104d557600080fd5b506104016104e4366004614e5c565b611493565b3480156104f557600080fd5b50610418600080516020615d2783398151915281565b34801561051757600080fd5b50610401610526366004614e5c565b6114be565b61040161153c565b34801561053f57600080fd5b5061040161054e366004614e9f565b6115bc565b34801561055f57600080fd5b5061041861163c565b34801561057457600080fd5b50610401610583366004614cd1565b61167e565b34801561059457600080fd5b506104186105a3366004614c5e565b611784565b3480156105b457600080fd5b506104016105c3366004614f0d565b61182c565b3480156105d457600080fd5b5061040161186c565b3480156105e957600080fd5b506104016105f8366004614f6f565b6118f2565b34801561060957600080fd5b50610401610618366004614fa3565b61197d565b34801561062957600080fd5b506101c854610649906001600160801b0380821691600160801b90041682565b604080516001600160801b03938416815292909116602083015201610374565b34801561067557600080fd5b506103d4610684366004614c5e565b611a78565b34801561069557600080fd5b506101cd5461036890610100900460ff1681565b3480156106b557600080fd5b506104016106c43660046150f9565b611b38565b3480156106d557600080fd5b506104186106e4366004615256565b611e60565b3480156106f557600080fd5b50610401611ef0565b34801561070a57600080fd5b50610368611f04565b34801561071f57600080fd5b50610392611f78565b34801561073457600080fd5b50610401610743366004615256565b611f88565b34801561075457600080fd5b50610401612024565b34801561076957600080fd5b5061041861209d565b34801561077e57600080fd5b5061041861078d366004615256565b6001600160a01b0316600090815260d36020526040902054600160601b90046001600160601b031690565b3480156107c457600080fd5b506104186107d3366004614e5c565b6101d060209081526000928352604080842090915290825290205481565b3480156107fd57600080fd5b50610196546001600160a01b03166103d4565b34801561081c57600080fd5b506101cd546103689060ff1681565b34801561083757600080fd5b5060cc54610418565b34801561084c57600080fd5b5061036861085b366004614e5c565b61211b565b34801561086c57600080fd5b5061040161087b366004615271565b612147565b34801561088c57600080fd5b5061039261221f565b3480156108a157600080fd5b5061041860cc5481565b3480156108b757600080fd5b506101cd5461036890600160b01b900460ff1681565b3480156108d957600080fd5b50610418600081565b3480156108ee57600080fd5b506104016108fd36600461529f565b61222e565b34801561090e57600080fd5b506101cd546103d4906201000090046001600160a01b031681565b34801561093557600080fd5b5061094961094436600461531a565b6122f9565b604051610374919061535b565b34801561096257600080fd5b506097546103d49061010090046001600160a01b031681565b34801561098757600080fd5b5060d4546103689060ff1681565b3480156109a157600080fd5b506104016123ed565b3480156109b657600080fd5b506104016109c53660046153bd565b612489565b6104016109d8366004615424565b6125c9565b3480156109e957600080fd5b506097546103689060ff1681565b348015610a0357600080fd5b50610418610a1236600461547e565b612758565b348015610a2357600080fd5b50610392610a32366004614c5e565b612914565b348015610a4357600080fd5b506104186129a7565b348015610a5857600080fd5b506104187ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b348015610a8c57600080fd5b50610401610a9b366004614e5c565b6129fc565b348015610aac57600080fd5b50610401610abb3660046154c2565b612a22565b348015610acc57600080fd5b50610ae0610adb366004614c5e565b612b92565b6040516103749190600060c08201905064ffffffffff80845116835280602085015116602084015250604083015163ffffffff808216604085015280606086015116606085015250506001600160701b03608084015116608083015260a083015160a083015292915050565b348015610b5857600080fd5b50610368610b67366004615549565b612c66565b348015610b7857600080fd5b50610392612c94565b348015610b8d57600080fd5b50610401610b9c366004615256565b612d38565b348015610bad57600080fd5b506104186101d15481565b6000610bc382612db1565b92915050565b60606101cb8054610bd990615573565b80601f0160208091040260200160405190810160405280929190818152602001828054610c0590615573565b8015610c525780601f10610c2757610100808354040283529160200191610c52565b820191906000526020600020905b815481529060010190602001808311610c3557829003601f168201915b5050505050905090565b606060ca8054610bd990615573565b6000610c7682612dd6565b610cdc5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b50600090815260d160205260409020546001600160a01b031690565b609754829060ff16158015610d1d575060975461010090046001600160a01b03163b15155b15610db857609754604051633185c44d60e21b81526101009091046001600160a01b03169063c617113490610d5890309085906004016155ad565b602060405180830381865afa158015610d75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9991906155c7565b610db85780604051633b79c77360e21b8152600401610cd39190614c77565b6000610dc383611a78565b9050806001600160a01b0316846001600160a01b031603610e305760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610cd3565b336001600160a01b0382161480610e4c5750610e4c8133612c66565b610eb95760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610cd3565b610ec38484612e09565b50505050565b600060cd5460cc54610edb91906155fa565b905090565b609754839060ff16158015610f05575060975461010090046001600160a01b03163b15155b15610fe757336001600160a01b03821603610f5157610f25335b83612e9b565b610f415760405162461bcd60e51b8152600401610cd39061560d565b610f4c848484612f65565b610ec3565b609754604051633185c44d60e21b81526101009091046001600160a01b03169063c617113490610f8790309033906004016155ad565b602060405180830381865afa158015610fa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc891906155c7565b610fe75733604051633b79c77360e21b8152600401610cd39190614c77565b610ff033610f1f565b61100c5760405162461bcd60e51b8152600401610cd39061560d565b610ec3848484612f65565b826000108015611028575060148311155b611045576040516332b4cb2160e21b815260040160405180910390fd5b600061104f61209d565b60008181526101cf60209081526040808320815160c081018352815464ffffffffff8082168352600160281b82041694820194909452600160501b840463ffffffff90811693820193909352600160701b84049092166060830152600160901b9092046001600160701b03166080820181905260019092015460a08201529293506110e29066031742a8f460009061565e565b90506110ee8682615671565b341461110d57604051632c1d501360e11b815260040160405180910390fd5b8660000361112e57604051633ab3447f60e11b815260040160405180910390fd5b60cc54606083015163ffffffff16811061115a5760405162491a1760e81b815260040160405180910390fd5b60a08301511561117d57604051630268975d60e51b815260040160405180910390fd5b6101cd54610100900460ff1661125857600061119b86898b8a6130f9565b9050737a6f5866f97034bb7153829bdaac1ffcb8facb716111bc828c61317b565b6001600160a01b0316146111e3576040516332c3ce2560e11b815260040160405180910390fd5b6001600160a01b038616600090815260d36020526040902054600160c01b90046001600160401b0316891161122b5760405163dc5a682560e01b815260040160405180910390fd5b61123689602861565e565b43111561125657604051639e8c142f60e01b815260040160405180910390fd5b505b600061126886868a85888c61319f565b905061127586828b613334565b600073c5a2f45ff2d4ca27e167600b5225c7e6e187d8c061129d8366031742a8f46000615671565b604051600081818185875af1925050503d80600081146112d9576040519150601f19603f3d011682016040523d82523d6000602084013e6112de565b606091505b505090508061130057604051635579a42f60e11b815260040160405180910390fd5b8882101561138e57600084611315848c6155fa565b61131f9190615671565b604051909150600090339083908381818185875af1925050503d8060008114611364576040519150601f19603f3d011682016040523d82523d6000602084013e611369565b606091505b505090508061138b57604051635579a42f60e11b815260040160405180910390fd5b50505b604080516001600160a01b0389168152602081018890529081018390527f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f9060600160405180910390a15050505050505050505050565b60008281526066602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b031692820192909252829161145a5750604080518082019091526065546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090611479906001600160601b031687615671565b6114839190615688565b91519350909150505b9250929050565b600082815261010060205260409020600101546114af8161334f565b6114b98383613359565b505050565b6001600160a01b038116331461152e5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610cd3565b61153882826133e0565b5050565b60006115478161334f565b6101ce546040516000916001600160a01b03169047908381818185875af1925050503d8060008114611595576040519150601f19603f3d011682016040523d82523d6000602084013e61159a565b606091505b505090508061153857604051635579a42f60e11b815260040160405180910390fd5b6115c760003361211b565b6115e457604051634e8df0bf60e01b815260040160405180910390fd5b6115ee8282613448565b604080516001600160a01b03841681526001600160601b03831660208201527fef5955f7902e6696c028804c62be1c24a0f98d9d30de5c31c83fa7f8b5c15c6f910160405180910390a15050565b600066031742a8f460006101cf600061165361209d565b8152602081019190915260400160002054610edb9190600160901b90046001600160701b031661565e565b609754839060ff161580156116a3575060975461010090046001600160a01b03163b15155b1561176957336001600160a01b038216036116d357610f4c84848460405180602001604052806000815250612489565b609754604051633185c44d60e21b81526101009091046001600160a01b03169063c61711349061170990309033906004016155ad565b602060405180830381865afa158015611726573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174a91906155c7565b6117695733604051633b79c77360e21b8152600401610cd39190614c77565b610ec384848460405180602001604052806000815250612489565b6101cd54600090600160b01b900460ff166117b25760405163c7c39e4f60e01b815260040160405180910390fd5b6117c46117be83611a78565b33612c66565b806117e857506117d382611a78565b6001600160a01b0316336001600160a01b0316145b806118035750336117f883610c6b565b6001600160a01b0316145b61181f5760405162ccfedb60e31b815260040160405180910390fd5b61182882613545565b5090565b611844600080516020615d278339815191523361211b565b61186157604051634e8df0bf60e01b815260040160405180910390fd5b610ec383838361365a565b61187760003361211b565b61189457604051634e8df0bf60e01b815260040160405180910390fd5b6101cd5460ff16156118b95760405163ddff29e960e01b815260040160405180910390fd5b6101cd805460ff191660011790556040517f31d1c0a3af6e15844ff9c1bf6201a5cf123137eb2fb3eeb96861a436d49cd25f90600090a1565b61190a600080516020615d278339815191523361211b565b61192757604051634e8df0bf60e01b815260040160405180910390fd5b6101c880546001600160801b03908116600160801b918416918202179091556040519081527f8c8298dd23c82a4aa45d27f480c6ce0aa2588e13df0b2fe2c827ca4a6836a5f8906020015b60405180910390a150565b61198633613ae9565b6119a357604051634755657960e01b815260040160405180910390fd5b826001600160a01b0381163b6000036119cf57604051630458607f60e41b815260040160405180910390fd5b60405163c3c5a54760e01b81526001600160a01b0382169063c3c5a547906119fb903090600401614c77565b6020604051808303816000875af1158015611a1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3e91906155c7565b611a4d57611a4d818484613af5565b609780546001600160a01b0390921661010002610100600160a81b0319909216919091179055505050565b6000611a8382612dd6565b611ae05760405162461bcd60e51b815260206004820152602860248201527f45524337323178797a3a20517565727920666f72206e6f6e206578697374656e6044820152677420746f6b656e2160c01b6064820152608401610cd3565b600082815260ce602052604090205482906001600160a01b031680611b31575b50600081815260cf60205260409020546001600160a01b03168015611b26579392505050565b816001019150611b00565b9392505050565b600054610100900460ff1615808015611b585750600054600160ff909116105b80611b725750303b158015611b72575060005460ff166001145b611bd55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610cd3565b6000805460ff191660011790558015611bf8576000805461ff0019166101001790555b6001600160a01b038a16611c1f5760405163d92e233d60e01b815260040160405180910390fd5b8851600314611c2d57600080fd5b8551600214611c3b57600080fd5b611c458c8c613c9f565b611c4d613cd0565b611c55613cd0565b611c836daaeb6d7670e522a718067333cd4e733cc6cdda760b79bafa08df41ecfa224f810dceb66001613cf7565b611c8c85613d3a565b604080518082019091526001600160801b038e81168083529089166020909201829052600160801b909102176101c8556101cd805462010000600160b01b031916620100006001600160a01b038d160217905588518990600090611cf257611cf26156aa565b60200260200101516101cb9081611d09919061570e565b5088600181518110611d1d57611d1d6156aa565b60200260200101516101c99081611d34919061570e565b5088600281518110611d4857611d486156aa565b60200260200101516101ca9081611d5f919061570e565b5060d4805460ff191683151517905585518690600090611d8157611d816156aa565b60200260200101516101ce60006101000a8154816001600160a01b0302191690836001600160a01b03160217905550611dd486600181518110611dc657611dc66156aa565b602002602001015189613448565b611ddf600086613359565b611df7600080516020615d2783398151915286613359565b8215611e0b57611e098484600061365a565b505b8015611e51576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b60006001600160a01b038216611ecb5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610cd3565b506001600160a01b0316600090815260d360205260409020546001600160601b031690565b611ef8613d8d565b611f026000613d3a565b565b6000611f0f33613ae9565b611f2c57604051634755657960e01b815260040160405180910390fd5b6097805460ff81161560ff1990911681179091556040518181527fd8c469bcb7a4be6d69103a5fdb65991249a95423350dc583495ccf5e7c28a88d9060200160405180910390a1905090565b60606101c98054610bd990615573565b611f9360003361211b565b611fb057604051634e8df0bf60e01b815260040160405180910390fd5b6001600160a01b038116611fd75760405163d92e233d60e01b815260040160405180910390fd5b6101ce80546001600160a01b0319166001600160a01b0383169081179091556040517fd45e158b56e768c1167267f8516bcf96348071775faded3c9216b60855d873de9161197291614c77565b61202f60003361211b565b61204c57604051634e8df0bf60e01b815260040160405180910390fd5b6101cd54610100900460ff161561206257600080fd5b6101cd805461ff0019166101001790556040517ffbbcc58867e8fad1d9f72f1b991660f5ec5e4e068374aa442b8604eef182b63990600090a1565b6101d1546000905b8015612101576000190160008181526101cf602052604090205464ffffffffff1642108015906120f2575060008181526101cf6020526040902054600160281b900464ffffffffff164211155b156120fc57919050565b6120a5565b5060405163b7b2409760e01b815260040160405180910390fd5b6000918252610100602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61215033613ae9565b61216d57604051634755657960e01b815260040160405180910390fd5b60975461010090046001600160a01b0316803b6000036121a057604051630458607f60e41b815260040160405180910390fd5b6001600160a01b0384166122145760405163034a0dc160e41b815230600482015282151560248201526001600160a01b038216906334a0dc1090604401600060405180830381600087803b1580156121f757600080fd5b505af115801561220b573d6000803e3d6000fd5b50505050610ec3565b610ec3818585613af5565b606060cb8054610bd990615573565b609754829060ff16158015612253575060975461010090046001600160a01b03163b15155b156122ee57609754604051633185c44d60e21b81526101009091046001600160a01b03169063c61711349061228e90309085906004016155ad565b602060405180830381865afa1580156122ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122cf91906155c7565b6122ee5780604051633b79c77360e21b8152600401610cd39190614c77565b6114b9338484613de8565b6060816001600160401b0381111561231357612313614d0d565b60405190808252806020026020018201604052801561234657816020015b60608152602001906001900390816123315790505b50905060005b828110156123e6576123b63085858481811061236a5761236a6156aa565b905060200281019061237c91906157cd565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613eb692505050565b8282815181106123c8576123c86156aa565b602002602001018190525080806123de90615813565b91505061234c565b5092915050565b612405600080516020615d278339815191523361211b565b61242257604051634e8df0bf60e01b815260040160405180910390fd5b6101cd805460ff600160b01b808304821615810260ff60b01b1990931692909217928390556040517f6ae3331a8bd1998bb8fd9d3d02b720f4862fb43e7586d302ba44e3923cea922d9361247f9390049091161515815260200190565b60405180910390a1565b609754849060ff161580156124ae575060975461010090046001600160a01b03163b15155b1561259157336001600160a01b038216036124fb576124ce335b84612e9b565b6124ea5760405162461bcd60e51b8152600401610cd39061560d565b6124f685858585613faa565b6125c2565b609754604051633185c44d60e21b81526101009091046001600160a01b03169063c61711349061253190309033906004016155ad565b602060405180830381865afa15801561254e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257291906155c7565b6125915733604051633b79c77360e21b8152600401610cd39190614c77565b61259a336124c8565b6125b65760405162461bcd60e51b8152600401610cd39061560d565b6125c285858585613faa565b5050505050565b8260001080156125da575060148311155b6125f7576040516332b4cb2160e21b815260040160405180910390fd5b600061260161209d565b60008181526101cf60209081526040808320815160c081018352815464ffffffffff8082168352600160281b82041694820194909452600160501b840463ffffffff90811693820193909352600160701b84049092166060830152600160901b9092046001600160701b03166080820181905260019092015460a08201529293506126949066031742a8f460009061565e565b90506126a08682615671565b34146126bf57604051632c1d501360e11b815260040160405180910390fd5b60a08201516126e157604051637904b60360e11b815260040160405180910390fd5b60cc54606083015163ffffffff16811061270d5760405162491a1760e81b815260040160405180910390fd5b61271e89898560a00151888a613fdd565b61273b576040516334ce9a3d60e11b815260040160405180910390fd5b600061274b86868a85888c61319f565b9050611275868243613334565b6000601482111561277c576040516332b4cb2160e21b815260040160405180910390fd5b8160000361279d576040516332b4cb2160e21b815260040160405180910390fd5b6014835111156127c0576040516349a3ec1560e11b815260040160405180910390fd5b82516000036127e2576040516349a3ec1560e11b815260040160405180910390fd5b6127fa600080516020615d278339815191523361211b565b15801561282e575061282c7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc93361211b565b155b1561284c57604051634e8df0bf60e01b815260040160405180910390fd5b600082845161285b9190615671565b60cc54612868919061565e565b6101c8549091506001600160801b03168111156128985760405163a67c036160e01b815260040160405180910390fd5b60005b84518110156128d1576128c98582815181106128b9576128b96156aa565b6020026020010151856000613334565b60010161289b565b507f74074e463a8efcb02859ade8892e3934bd28eb75c9d1e6085a40c474088e2bfe8382866040516129059392919061582c565b60405180910390a19392505050565b606061291f82612dd6565b61293c5760405163677510db60e11b815260040160405180910390fd5b6000612946612c94565b90506000612952611f78565b9050600061295e610bc9565b9050825160000361297157949350505050565b828261297c87614054565b60405160200161298e9392919061588a565b6040516020818303038152906040529350505050919050565b6101d1546000905b80156129f4576000190160008181526101cf6020526040902054600160281b900464ffffffffff164211156129ef576129e981600161565e565b91505090565b6129af565b506000905090565b60008281526101006020526040902060010154612a188161334f565b6114b983836133e0565b612a3a600080516020615d278339815191523361211b565b612a5757604051634e8df0bf60e01b815260040160405180910390fd5b6101cd5460ff1615612a7c5760405163ddff29e960e01b815260040160405180910390fd5b6000612a893384846140e6565b9050737a6f5866f97034bb7153829bdaac1ffcb8facb71612aaa828661317b565b6001600160a01b031614612ad1576040516332c3ce2560e11b815260040160405180910390fd5b825115612b20576101ca612ae5848261570e565b507ff5e721c51327df71720f204c71b46bc26bcafb44db5012739c85814c7862f6c06101ca604051612b1791906158cd565b60405180910390a15b815115610ec3576101cc612b34838261570e565b506040805160208101909152600081526101c990612b52908261570e565b507f8eca6ea708f9bc34439b72366aa672afc86bb8b1294f1ba9637945c5dab8ea746101cc604051612b8491906158cd565b60405180910390a150505050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101919091526101d1548210612be7576040516327e7ab7d60e11b815260040160405180910390fd5b5060009081526101cf6020908152604091829020825160c081018452815464ffffffffff8082168352600160281b82041693820193909352600160501b830463ffffffff90811694820194909452600160701b83049093166060840152600160901b9091046001600160701b031660808301526001015460a082015290565b6001600160a01b03918216600090815260d26020908152604080832093909416825291909152205460ff1690565b60606101cc8054612ca490615573565b9050600003612d2a576101cd5460405163511113e560e01b8152620100009091046001600160a01b03169063511113e590612ce5906101ca906004016158cd565b600060405180830381865afa158015612d02573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610edb9190810190615958565b6101cc8054610bd990615573565b612d40613d8d565b6001600160a01b038116612da55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610cd3565b612dae81613d3a565b50565b60006001600160e01b03198216637965db0b60e01b1480610bc35750610bc382614150565b600081815260d0602052604081205460ff1615612df557506000919050565b816000108015610bc357505060cc54101590565b600081815260d160205260409020546001600160a01b0390811690831681146114b957600082815260d16020526040902080546001600160a01b0319166001600160a01b0385169081179091558290612e6182611a78565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000612ea682612dd6565b612f075760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610cd3565b6000612f1283611a78565b9050806001600160a01b0316846001600160a01b03161480612f4d5750836001600160a01b0316612f4284610c6b565b6001600160a01b0316145b80612f5d5750612f5d8185612c66565b949350505050565b826001600160a01b0316612f7882611a78565b6001600160a01b031614612fdc5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610cd3565b6001600160a01b03821661303e5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610cd3565b6130498383836141ab565b613054600082612e09565b6001600160a01b03838116600081815260d36020908152604080832080546001600160601b03198082166001600160601b039283166000190183161790925595881680855282852080549283169288166001019097169190911790955585835260ce90915280822080546001600160a01b0319168517905551849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b604080517f5b174e00b853ebb074ee5cb5d23ca67a264896e5670f923ac103fccad5232b5560208201526001600160a01b03861691810191909152606081018490526080810183905260a0810182905260009081906131719060c0015b604051602081830303815290604052805190602001206141f4565b9695505050505050565b600080600061318a85856142cf565b9150915061319781614311565b509392505050565b6001600160a01b038616600081815260d360209081526040808320548984526101d083528184209484529390915280822054908501519192600160601b90046001600160601b03169163ffffffff161561324157846040015163ffffffff16811061321d57604051632f18066d60e01b815260040160405180910390fd5b846040015163ffffffff1687820111156132415780856040015163ffffffff160396505b6101c854600160801b90046001600160801b0316801561328b5780831061327b57604051632f18066d60e01b815260040160405180910390fd5b80888401111561328b5782810397505b856060015163ffffffff1688880111156132af5786866060015163ffffffff160397505b6000851180156132c857506101cd54610100900460ff16155b156132fd578482106132ed57604051632f18066d60e01b815260040160405180910390fd5b8488830111156132fd5781850397505b5060008881526101d0602090815260408083206001600160a01b038d16845290915290209087019055508490509695505050505050565b6114b983836040518060200160405280600081525084614456565b612dae8133614470565b613363828261211b565b611538576000828152610100602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561339c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6133ea828261211b565b15611538576000828152610100602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6127106001600160601b03821611156134b65760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610cd3565b6001600160a01b03821661350c5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610cd3565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217606555565b61354e81612dd6565b6135aa5760405162461bcd60e51b815260206004820152602760248201527f45524337323178797a3a20517565727920666f72206e6f6e6578697374656e7460448201526620746f6b656e2160c81b6064820152608401610cd3565b60006135b582611a78565b90506135c3816000846141ab565b6135ce600083612e09565b6001600160a01b038116600081815260d36020908152604080832080546001600160601b031981166001600160601b039182166000190190911617905585835260d0909152808220805460ff1916600190811790915560cd80549091019055518492907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600082816136666129a7565b9050601482111561368a576040516373c2b52560e11b815260040160405180910390fd5b6101d154801580159061369c57508185105b156136ba576040516344ca163560e11b815260040160405180910390fd5b808511156136db576040516307cc4d8f60e01b815260040160405180910390fd5b6136e660148361565e565b6136f0848761565e565b111561370f5760405163c1eae7bb60e01b815260040160405180910390fd5b60008581526101cf602052604081205464ffffffffff169084900361379c5742811161374e5760405163bf4a806960e01b815260040160405180910390fd5b6101d18690556040517f842cd1905522b3731a39e0d2fb9d3757bc29b4e57e9253b230d437bf10505e9b90613788908a908a908a90615a05565b60405180910390a185945050505050611b31565b6000888860008181106137b1576137b16156aa565b905060c002018036038101906137c79190615ac0565b905060cc54816060015163ffffffff1610156137f657604051630e93fda160e21b815260040160405180910390fd5b42821115801561380557508115155b801561381357506101d15487105b1561387057805164ffffffffff16821461384057604051632ca4094f60e21b815260040160405180910390fd5b42816020015164ffffffffff161161386b5760405163804491f960e01b815260040160405180910390fd5b61389b565b42816000015164ffffffffff161161389b5760405163667e606760e11b815260040160405180910390fd5b868581015b8882146138d4578a8a8a84038181106138bb576138bb6156aa565b905060c002018036038101906138d19190615ac0565b92505b6101c85460608401516001600160801b0390911663ffffffff909116111561390f5760405163bccc7e2360e01b815260040160405180910390fd5b826000015164ffffffffff16836020015164ffffffffff161161394557604051631131dc6b60e11b815260040160405180910390fd5b81156139d557600019820160009081526101cf6020526040902054606084015164ffffffffff600160281b8304169163ffffffff600160701b9091048116911610156139ab574281106139ab576040516357be1d0d60e01b815260040160405180910390fd5b835164ffffffffff1681106139d35760405163064f2b0760e31b815260040160405180910390fd5b505b60008281526101cf60209081526040918290208551815492870151938701516060880151608089015164ffffffffff93841669ffffffffffffffffffff1990961695909517600160281b93909616929092029490941767ffffffffffffffff60501b1916600160501b63ffffffff9586160263ffffffff60701b191617600160701b9490911693909302929092176001600160901b0316600160901b6001600160701b039092169190910217815560a0840151600191820155909101908082106138a0576101d18190556040517f842cd1905522b3731a39e0d2fb9d3757bc29b4e57e9253b230d437bf10505e9b90613ad3908d908d908d90615a05565b60405180910390a19a9950505050505050505050565b6000610bc3818361211b565b60405163c3c5a54760e01b81526001600160a01b0384169063c3c5a54790613b21903090600401614c77565b6020604051808303816000875af1158015613b40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b6491906155c7565b15613c02578015613bd457604051632cc5350560e21b81526001600160a01b0384169063b314d41490613b9d90309086906004016155ad565b600060405180830381600087803b158015613bb757600080fd5b505af1158015613bcb573d6000803e3d6000fd5b50505050505050565b604051630781ad2d60e21b81526001600160a01b03841690631e06b4b490613b9d90309086906004016155ad565b8015613c3657604051633e9f1edf60e11b81526001600160a01b03841690637d3e3dbe90613b9d90309086906004016155ad565b6001600160a01b03821615613c735760405163a0af290360e01b81526001600160a01b0384169063a0af290390613b9d90309086906004016155ad565b604051632210724360e11b81526001600160a01b03841690634420e48690613b9d903090600401614c77565b600054610100900460ff16613cc65760405162461bcd60e51b8152600401610cd390615b5a565b61153882826144c9565b600054610100900460ff16611f025760405162461bcd60e51b8152600401610cd390615b5a565b600054610100900460ff16613d1e5760405162461bcd60e51b8152600401610cd390615b5a565b6001600160a01b0383163b156114b95782611a4d818484613af5565b61019680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610196546001600160a01b03163314611f025760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cd3565b816001600160a01b0316836001600160a01b031603613e495760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610cd3565b6001600160a01b03838116600081815260d26020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60606001600160a01b0383163b613f1e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610cd3565b600080846001600160a01b031684604051613f399190615ba5565b600060405180830381855af49150503d8060008114613f74576040519150601f19603f3d011682016040523d82523d6000602084013e613f79565b606091505b5091509150613fa18282604051806060016040528060278152602001615d0060279139614509565b95945050505050565b613fb5848484612f65565b613fc184848484614522565b610ec35760405162461bcd60e51b8152600401610cd390615bc1565b6000613171868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040516001600160601b0319606089901b16602082015260348101879052889250605401905060405160208183030381529060405280519060200120614620565b6060600061406183614636565b60010190506000816001600160401b0381111561408057614080614d0d565b6040519080825280601f01601f1916602001820160405280156140aa576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846140b457509392505050565b600080613fa17f35fa4dcabfcae3f1b6e0c4c1ac43df02ba9cb39e2dcdc3d3f1b92a38118e3354868680519060200120868051906020012060405160200161315694939291909384526001600160a01b039290921660208401526040830152606082015260800190565b60006001600160e01b0319821663152a902d60e11b148061418157506001600160e01b031982166380ac58cd60e01b145b8061419c57506001600160e01b03198216635b5e139f60e01b145b80610bc35750610bc38261470e565b6001600160a01b038316158015906141cb57506001600160a01b03821615155b156114b95760d45460ff16156114b9576040516328f11eb160e21b815260040160405180910390fd5b604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f36cb08f6aafe2399767bf40e9642429d7535f40e61bd81428cad09095c5d337d828401527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608301524660808301523060a0808401919091528351808403909101815260c08301845280519082012061190160f01b60e084015260e2830181905261010280840186905284518085039091018152610122909301909352815191012060009190611b31565b60008082516041036143055760208301516040840151606085015160001a6142f987828585614743565b9450945050505061148c565b5060009050600261148c565b600081600481111561432557614325615c13565b0361432d5750565b600181600481111561434157614341615c13565b036143895760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610cd3565b600281600481111561439d5761439d615c13565b036143ea5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610cd3565b60038160048111156143fe576143fe615c13565b03612dae5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610cd3565b6144618484836147fd565b613fc160008560cc5485614522565b61447a828261211b565b611538576144878161497d565b61449283602061498f565b6040516020016144a3929190615c29565b60408051601f198184030181529082905262461bcd60e51b8252610cd391600401614c4b565b600054610100900460ff166144f05760405162461bcd60e51b8152600401610cd390615b5a565b60ca6144fc838261570e565b5060cb6114b9828261570e565b60608315614518575081611b31565b611b318383614b2a565b60006001600160a01b0384163b1561461857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614566903390899088908890600401615c98565b6020604051808303816000875af19250505080156145a1575060408051601f3d908101601f1916820190925261459e91810190615ccb565b60015b6145fe573d8080156145cf576040519150601f19603f3d011682016040523d82523d6000602084013e6145d4565b606091505b5080516000036145f65760405162461bcd60e51b8152600401610cd390615bc1565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612f5d565b506001612f5d565b60008261462d8584614b54565b14949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106146755772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106146a1576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106146bf57662386f26fc10000830492506010015b6305f5e10083106146d7576305f5e100830492506008015b61271083106146eb57612710830492506004015b606483106146fd576064830492506002015b600a8310610bc35760010192915050565b60006001600160e01b0319821663152a902d60e11b1480610bc357506301ffc9a760e01b6001600160e01b0319831614610bc3565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b0383111561477057506000905060036147f4565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156147c4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166147ed576000600192509250506147f4565b9150600090505b94509492505050565b6001600160a01b0383166148535760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610cd3565b61486160008460cc546141ab565b60cc8054838101918290556001600160a01b038516600090815260d36020526040902080546001600160601b038082168701166001600160601b0319909116179055908215614900576001600160a01b038516600090815260d36020526040902080546001600160601b03808216600160601b92839004821688019091169091026001600160c01b031617600160c01b6001600160401b038616021790555b600081815260cf6020526040902080546001600160a01b0319166001600160a01b03871617905560018281019082015b60405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a481600101915080821061493057505050610ec3565b6060610bc36001600160a01b03831660145b6060600061499e836002615671565b6149a990600261565e565b6001600160401b038111156149c0576149c0614d0d565b6040519080825280601f01601f1916602001820160405280156149ea576020820181803683370190505b509050600360fc1b81600081518110614a0557614a056156aa565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614a3457614a346156aa565b60200101906001600160f81b031916908160001a9053506000614a58846002615671565b614a6390600161565e565b90505b6001811115614adb576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614a9757614a976156aa565b1a60f81b828281518110614aad57614aad6156aa565b60200101906001600160f81b031916908160001a90535060049490941c93614ad481615ce8565b9050614a66565b508315611b315760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610cd3565b815115614b3a5781518083602001fd5b8060405162461bcd60e51b8152600401610cd39190614c4b565b600081815b845181101561319757614b8582868381518110614b7857614b786156aa565b6020026020010151614b99565b915080614b9181615813565b915050614b59565b6000818310614bb5576000828152602084905260409020611b31565b6000838152602083905260409020611b31565b6001600160e01b031981168114612dae57600080fd5b600060208284031215614bf057600080fd5b8135611b3181614bc8565b60005b83811015614c16578181015183820152602001614bfe565b50506000910152565b60008151808452614c37816020860160208601614bfb565b601f01601f19169290920160200192915050565b602081526000611b316020830184614c1f565b600060208284031215614c7057600080fd5b5035919050565b6001600160a01b0391909116815260200190565b80356001600160a01b0381168114614ca257600080fd5b919050565b60008060408385031215614cba57600080fd5b614cc383614c8b565b946020939093013593505050565b600080600060608486031215614ce657600080fd5b614cef84614c8b565b9250614cfd60208501614c8b565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614d4b57614d4b614d0d565b604052919050565b60006001600160401b03821115614d6c57614d6c614d0d565b50601f01601f191660200190565b600082601f830112614d8b57600080fd5b8135614d9e614d9982614d53565b614d23565b818152846020838601011115614db357600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a08688031215614de857600080fd5b85356001600160401b03811115614dfe57600080fd5b614e0a88828901614d7a565b955050602086013593506040860135925060608601359150614e2e60808701614c8b565b90509295509295909350565b60008060408385031215614e4d57600080fd5b50508035926020909101359150565b60008060408385031215614e6f57600080fd5b82359150614e7f60208401614c8b565b90509250929050565b80356001600160601b0381168114614ca257600080fd5b60008060408385031215614eb257600080fd5b614ebb83614c8b565b9150614e7f60208401614e88565b60008083601f840112614edb57600080fd5b5081356001600160401b03811115614ef257600080fd5b60208301915083602060c08302850101111561148c57600080fd5b600080600060408486031215614f2257600080fd5b83356001600160401b03811115614f3857600080fd5b614f4486828701614ec9565b909790965060209590950135949350505050565b80356001600160801b0381168114614ca257600080fd5b600060208284031215614f8157600080fd5b611b3182614f58565b8015158114612dae57600080fd5b8035614ca281614f8a565b600080600060608486031215614fb857600080fd5b614fc184614c8b565b9250614fcf60208501614c8b565b91506040840135614fdf81614f8a565b809150509250925092565b60006001600160401b0382111561500357615003614d0d565b5060051b60200190565b600082601f83011261501e57600080fd5b8135602061502e614d9983614fea565b82815260059290921b8401810191818101908684111561504d57600080fd5b8286015b8481101561508c5780356001600160401b038111156150705760008081fd5b61507e8986838b0101614d7a565b845250918301918301615051565b509695505050505050565b600082601f8301126150a857600080fd5b813560206150b8614d9983614fea565b82815260059290921b840181019181810190868411156150d757600080fd5b8286015b8481101561508c576150ec81614c8b565b83529183019183016150db565b6000806000806000806000806000806000806101608d8f03121561511c57600080fd5b6151258d614f58565b9b506001600160401b0360208e0135111561513f57600080fd5b61514f8e60208f01358f01614d7a565b9a506001600160401b0360408e0135111561516957600080fd5b6151798e60408f01358f01614d7a565b995061518760608e01614c8b565b98506001600160401b0360808e013511156151a157600080fd5b6151b18e60808f01358f0161500d565b97506151bf60a08e01614e88565b96506151cd60c08e01614f58565b95506001600160401b0360e08e013511156151e757600080fd5b6151f78e60e08f01358f01615097565b94506152066101008e01614c8b565b93506001600160401b036101208e0135111561522157600080fd5b6152328e6101208f01358f01614ec9565b90935091506152446101408e01614f98565b90509295989b509295989b509295989b565b60006020828403121561526857600080fd5b611b3182614c8b565b60008060006060848603121561528657600080fd5b61528f84614c8b565b92506020840135614fcf81614f8a565b600080604083850312156152b257600080fd5b6152bb83614c8b565b915060208301356152cb81614f8a565b809150509250929050565b60008083601f8401126152e857600080fd5b5081356001600160401b038111156152ff57600080fd5b6020830191508360208260051b850101111561148c57600080fd5b6000806020838503121561532d57600080fd5b82356001600160401b0381111561534357600080fd5b61534f858286016152d6565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156153b057603f1988860301845261539e858351614c1f565b94509285019290850190600101615382565b5092979650505050505050565b600080600080608085870312156153d357600080fd5b6153dc85614c8b565b93506153ea60208601614c8b565b92506040850135915060608501356001600160401b0381111561540c57600080fd5b61541887828801614d7a565b91505092959194509250565b60008060008060006080868803121561543c57600080fd5b85356001600160401b0381111561545257600080fd5b61545e888289016152d6565b9096509450506020860135925060408601359150614e2e60608701614c8b565b6000806040838503121561549157600080fd5b82356001600160401b038111156154a757600080fd5b6154b385828601615097565b95602094909401359450505050565b6000806000606084860312156154d757600080fd5b83356001600160401b03808211156154ee57600080fd5b6154fa87838801614d7a565b9450602086013591508082111561551057600080fd5b61551c87838801614d7a565b9350604086013591508082111561553257600080fd5b5061553f86828701614d7a565b9150509250925092565b6000806040838503121561555c57600080fd5b61556583614c8b565b9150614e7f60208401614c8b565b600181811c9082168061558757607f821691505b6020821081036155a757634e487b7160e01b600052602260045260246000fd5b50919050565b6001600160a01b0392831681529116602082015260400190565b6000602082840312156155d957600080fd5b8151611b3181614f8a565b634e487b7160e01b600052601160045260246000fd5b81810381811115610bc357610bc36155e4565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b80820180821115610bc357610bc36155e4565b8082028115828204841417610bc357610bc36155e4565b6000826156a557634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b601f8211156114b957600081815260208120601f850160051c810160208610156156e75750805b601f850160051c820191505b81811015615706578281556001016156f3565b505050505050565b81516001600160401b0381111561572757615727614d0d565b61573b816157358454615573565b846156c0565b602080601f83116001811461577057600084156157585750858301515b600019600386901b1c1916600185901b178555615706565b600085815260208120601f198616915b8281101561579f57888601518255948401946001909101908401615780565b50858210156157bd5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808335601e198436030181126157e457600080fd5b8301803591506001600160401b038211156157fe57600080fd5b60200191503681900382131561148c57600080fd5b600060018201615825576158256155e4565b5060010190565b6000606082018583526020858185015260606040850152818551808452608086019150828701935060005b8181101561587c5784516001600160a01b031683529383019391830191600101615857565b509098975050505050505050565b6000845161589c818460208901614bfb565b8451908301906158b0818360208901614bfb565b84519101906158c3818360208801614bfb565b0195945050505050565b60006020808352600084546158e181615573565b80848701526040600180841660008114615902576001811461591c5761594a565b60ff1985168984015283151560051b89018301955061594a565b896000528660002060005b858110156159425781548b8201860152908301908801615927565b8a0184019650505b509398975050505050505050565b60006020828403121561596a57600080fd5b81516001600160401b0381111561598057600080fd5b8201601f8101841361599157600080fd5b805161599f614d9982614d53565b8181528560208385010111156159b457600080fd5b613fa1826020830160208601614bfb565b803564ffffffffff81168114614ca257600080fd5b803563ffffffff81168114614ca257600080fd5b80356001600160701b0381168114614ca257600080fd5b6040808252818101849052600090606080840187845b88811015615aaa5764ffffffffff80615a33846159c5565b168452602081615a448286016159c5565b169085015250615a558286016159da565b63ffffffff8082168786015280615a6d8786016159da565b1686860152505060806001600160701b03615a898285016159ee565b169084015260a0828101359084015260c09283019290910190600101615a1b565b5050809350505050826020830152949350505050565b600060c08284031215615ad257600080fd5b60405160c081018181106001600160401b0382111715615af457615af4614d0d565b604052615b00836159c5565b8152615b0e602084016159c5565b6020820152615b1f604084016159da565b6040820152615b30606084016159da565b6060820152615b41608084016159ee565b608082015260a083013560a08201528091505092915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251615bb7818460208701614bfb565b9190910192915050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615c5b816017850160208801614bfb565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615c8c816028840160208801614bfb565b01602801949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061317190830184614c1f565b600060208284031215615cdd57600080fd5b8151611b3181614bc8565b600081615cf757615cf76155e4565b50600019019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564fd63b67fde00b77f1f54f050135a475665b815acd10a8e7fd785ba074846734aa2646970667358221220119614ab4e6ed915f0c6022362309e25b77ce25eefc9ab7523f386274d32a1d364736f6c63430008110033

Deployed Bytecode

0x6080604052600436106103435760003560e01c8063869d3bde116101b2578063b0fde7fb116100ed578063d539139311610090578063d539139314610a4c578063d547741f14610a80578063d7818e2814610aa0578063dedd76e714610ac0578063e985e9c514610b4c578063effcf2b714610b6c578063f2fde38b14610b81578063f86a352914610ba157600080fd5b8063b0fde7fb1461097b578063b3cc59db14610995578063b88d4fde146109aa578063bdc769eb146109ca578063c0dad79b146109dd578063c204642c146109f7578063c87b56dd14610a17578063ce4c61aa14610a3757600080fd5b806395d89b411161015557806395d89b411461088057806397f5cdcf14610895578063a07c7ce4146108ab578063a217fddf146108cd578063a22cb465146108e2578063aa8a675414610902578063ac9650d814610929578063b0ccc31e1461095657600080fd5b8063869d3bde1461075d5780638c8ea8e6146107725780638cd90c32146107b85780638da5cb5b146107f15780638e021c061461081057806390411aca1461082b57806391d148541461084057806394b08a4b1461086057600080fd5b806342842e0e11610282578063659b8b2a11610225578063659b8b2a146106895780636e49aa0a146106a957806370a08231146106c9578063715018a6146106e957806372c06f5a146106fe578063743976a0146107135780637f1fea5914610728578063804207361461074857600080fd5b806342842e0e1461056857806342966c68146105885780634e0b9df2146105a857806351e85af6146105c8578063548e7682146105dd578063577199fd146105fd57806360659a921461061d5780636352211e1461066957600080fd5b80632955a21d116102ea5780632955a21d146104775780632a55205a1461048a5780632f2ff15d146104c95780633540558a146104e957806336568abe1461050b5780633ccfd60b1461052b5780633f52af3c1461053357806341dfed3a1461055357600080fd5b806301ffc9a7146103485780630293741b1461037d57806306fdde031461039f578063081812fc146103b4578063095ea7b3146103e157806318160ddd1461040357806323b872dd14610426578063248a9ca314610446575b600080fd5b34801561035457600080fd5b50610368610363366004614bde565b610bb8565b60405190151581526020015b60405180910390f35b34801561038957600080fd5b50610392610bc9565b6040516103749190614c4b565b3480156103ab57600080fd5b50610392610c5c565b3480156103c057600080fd5b506103d46103cf366004614c5e565b610c6b565b6040516103749190614c77565b3480156103ed57600080fd5b506104016103fc366004614ca7565b610cf8565b005b34801561040f57600080fd5b50610418610ec9565b604051908152602001610374565b34801561043257600080fd5b50610401610441366004614cd1565b610ee0565b34801561045257600080fd5b50610418610461366004614c5e565b6000908152610100602052604090206001015490565b610401610485366004614dd0565b611017565b34801561049657600080fd5b506104aa6104a5366004614e3a565b6113e5565b604080516001600160a01b039093168352602083019190915201610374565b3480156104d557600080fd5b506104016104e4366004614e5c565b611493565b3480156104f557600080fd5b50610418600080516020615d2783398151915281565b34801561051757600080fd5b50610401610526366004614e5c565b6114be565b61040161153c565b34801561053f57600080fd5b5061040161054e366004614e9f565b6115bc565b34801561055f57600080fd5b5061041861163c565b34801561057457600080fd5b50610401610583366004614cd1565b61167e565b34801561059457600080fd5b506104186105a3366004614c5e565b611784565b3480156105b457600080fd5b506104016105c3366004614f0d565b61182c565b3480156105d457600080fd5b5061040161186c565b3480156105e957600080fd5b506104016105f8366004614f6f565b6118f2565b34801561060957600080fd5b50610401610618366004614fa3565b61197d565b34801561062957600080fd5b506101c854610649906001600160801b0380821691600160801b90041682565b604080516001600160801b03938416815292909116602083015201610374565b34801561067557600080fd5b506103d4610684366004614c5e565b611a78565b34801561069557600080fd5b506101cd5461036890610100900460ff1681565b3480156106b557600080fd5b506104016106c43660046150f9565b611b38565b3480156106d557600080fd5b506104186106e4366004615256565b611e60565b3480156106f557600080fd5b50610401611ef0565b34801561070a57600080fd5b50610368611f04565b34801561071f57600080fd5b50610392611f78565b34801561073457600080fd5b50610401610743366004615256565b611f88565b34801561075457600080fd5b50610401612024565b34801561076957600080fd5b5061041861209d565b34801561077e57600080fd5b5061041861078d366004615256565b6001600160a01b0316600090815260d36020526040902054600160601b90046001600160601b031690565b3480156107c457600080fd5b506104186107d3366004614e5c565b6101d060209081526000928352604080842090915290825290205481565b3480156107fd57600080fd5b50610196546001600160a01b03166103d4565b34801561081c57600080fd5b506101cd546103689060ff1681565b34801561083757600080fd5b5060cc54610418565b34801561084c57600080fd5b5061036861085b366004614e5c565b61211b565b34801561086c57600080fd5b5061040161087b366004615271565b612147565b34801561088c57600080fd5b5061039261221f565b3480156108a157600080fd5b5061041860cc5481565b3480156108b757600080fd5b506101cd5461036890600160b01b900460ff1681565b3480156108d957600080fd5b50610418600081565b3480156108ee57600080fd5b506104016108fd36600461529f565b61222e565b34801561090e57600080fd5b506101cd546103d4906201000090046001600160a01b031681565b34801561093557600080fd5b5061094961094436600461531a565b6122f9565b604051610374919061535b565b34801561096257600080fd5b506097546103d49061010090046001600160a01b031681565b34801561098757600080fd5b5060d4546103689060ff1681565b3480156109a157600080fd5b506104016123ed565b3480156109b657600080fd5b506104016109c53660046153bd565b612489565b6104016109d8366004615424565b6125c9565b3480156109e957600080fd5b506097546103689060ff1681565b348015610a0357600080fd5b50610418610a1236600461547e565b612758565b348015610a2357600080fd5b50610392610a32366004614c5e565b612914565b348015610a4357600080fd5b506104186129a7565b348015610a5857600080fd5b506104187ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc981565b348015610a8c57600080fd5b50610401610a9b366004614e5c565b6129fc565b348015610aac57600080fd5b50610401610abb3660046154c2565b612a22565b348015610acc57600080fd5b50610ae0610adb366004614c5e565b612b92565b6040516103749190600060c08201905064ffffffffff80845116835280602085015116602084015250604083015163ffffffff808216604085015280606086015116606085015250506001600160701b03608084015116608083015260a083015160a083015292915050565b348015610b5857600080fd5b50610368610b67366004615549565b612c66565b348015610b7857600080fd5b50610392612c94565b348015610b8d57600080fd5b50610401610b9c366004615256565b612d38565b348015610bad57600080fd5b506104186101d15481565b6000610bc382612db1565b92915050565b60606101cb8054610bd990615573565b80601f0160208091040260200160405190810160405280929190818152602001828054610c0590615573565b8015610c525780601f10610c2757610100808354040283529160200191610c52565b820191906000526020600020905b815481529060010190602001808311610c3557829003601f168201915b5050505050905090565b606060ca8054610bd990615573565b6000610c7682612dd6565b610cdc5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b50600090815260d160205260409020546001600160a01b031690565b609754829060ff16158015610d1d575060975461010090046001600160a01b03163b15155b15610db857609754604051633185c44d60e21b81526101009091046001600160a01b03169063c617113490610d5890309085906004016155ad565b602060405180830381865afa158015610d75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9991906155c7565b610db85780604051633b79c77360e21b8152600401610cd39190614c77565b6000610dc383611a78565b9050806001600160a01b0316846001600160a01b031603610e305760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610cd3565b336001600160a01b0382161480610e4c5750610e4c8133612c66565b610eb95760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610cd3565b610ec38484612e09565b50505050565b600060cd5460cc54610edb91906155fa565b905090565b609754839060ff16158015610f05575060975461010090046001600160a01b03163b15155b15610fe757336001600160a01b03821603610f5157610f25335b83612e9b565b610f415760405162461bcd60e51b8152600401610cd39061560d565b610f4c848484612f65565b610ec3565b609754604051633185c44d60e21b81526101009091046001600160a01b03169063c617113490610f8790309033906004016155ad565b602060405180830381865afa158015610fa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc891906155c7565b610fe75733604051633b79c77360e21b8152600401610cd39190614c77565b610ff033610f1f565b61100c5760405162461bcd60e51b8152600401610cd39061560d565b610ec3848484612f65565b826000108015611028575060148311155b611045576040516332b4cb2160e21b815260040160405180910390fd5b600061104f61209d565b60008181526101cf60209081526040808320815160c081018352815464ffffffffff8082168352600160281b82041694820194909452600160501b840463ffffffff90811693820193909352600160701b84049092166060830152600160901b9092046001600160701b03166080820181905260019092015460a08201529293506110e29066031742a8f460009061565e565b90506110ee8682615671565b341461110d57604051632c1d501360e11b815260040160405180910390fd5b8660000361112e57604051633ab3447f60e11b815260040160405180910390fd5b60cc54606083015163ffffffff16811061115a5760405162491a1760e81b815260040160405180910390fd5b60a08301511561117d57604051630268975d60e51b815260040160405180910390fd5b6101cd54610100900460ff1661125857600061119b86898b8a6130f9565b9050737a6f5866f97034bb7153829bdaac1ffcb8facb716111bc828c61317b565b6001600160a01b0316146111e3576040516332c3ce2560e11b815260040160405180910390fd5b6001600160a01b038616600090815260d36020526040902054600160c01b90046001600160401b0316891161122b5760405163dc5a682560e01b815260040160405180910390fd5b61123689602861565e565b43111561125657604051639e8c142f60e01b815260040160405180910390fd5b505b600061126886868a85888c61319f565b905061127586828b613334565b600073c5a2f45ff2d4ca27e167600b5225c7e6e187d8c061129d8366031742a8f46000615671565b604051600081818185875af1925050503d80600081146112d9576040519150601f19603f3d011682016040523d82523d6000602084013e6112de565b606091505b505090508061130057604051635579a42f60e11b815260040160405180910390fd5b8882101561138e57600084611315848c6155fa565b61131f9190615671565b604051909150600090339083908381818185875af1925050503d8060008114611364576040519150601f19603f3d011682016040523d82523d6000602084013e611369565b606091505b505090508061138b57604051635579a42f60e11b815260040160405180910390fd5b50505b604080516001600160a01b0389168152602081018890529081018390527f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f9060600160405180910390a15050505050505050505050565b60008281526066602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b031692820192909252829161145a5750604080518082019091526065546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090611479906001600160601b031687615671565b6114839190615688565b91519350909150505b9250929050565b600082815261010060205260409020600101546114af8161334f565b6114b98383613359565b505050565b6001600160a01b038116331461152e5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610cd3565b61153882826133e0565b5050565b60006115478161334f565b6101ce546040516000916001600160a01b03169047908381818185875af1925050503d8060008114611595576040519150601f19603f3d011682016040523d82523d6000602084013e61159a565b606091505b505090508061153857604051635579a42f60e11b815260040160405180910390fd5b6115c760003361211b565b6115e457604051634e8df0bf60e01b815260040160405180910390fd5b6115ee8282613448565b604080516001600160a01b03841681526001600160601b03831660208201527fef5955f7902e6696c028804c62be1c24a0f98d9d30de5c31c83fa7f8b5c15c6f910160405180910390a15050565b600066031742a8f460006101cf600061165361209d565b8152602081019190915260400160002054610edb9190600160901b90046001600160701b031661565e565b609754839060ff161580156116a3575060975461010090046001600160a01b03163b15155b1561176957336001600160a01b038216036116d357610f4c84848460405180602001604052806000815250612489565b609754604051633185c44d60e21b81526101009091046001600160a01b03169063c61711349061170990309033906004016155ad565b602060405180830381865afa158015611726573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174a91906155c7565b6117695733604051633b79c77360e21b8152600401610cd39190614c77565b610ec384848460405180602001604052806000815250612489565b6101cd54600090600160b01b900460ff166117b25760405163c7c39e4f60e01b815260040160405180910390fd5b6117c46117be83611a78565b33612c66565b806117e857506117d382611a78565b6001600160a01b0316336001600160a01b0316145b806118035750336117f883610c6b565b6001600160a01b0316145b61181f5760405162ccfedb60e31b815260040160405180910390fd5b61182882613545565b5090565b611844600080516020615d278339815191523361211b565b61186157604051634e8df0bf60e01b815260040160405180910390fd5b610ec383838361365a565b61187760003361211b565b61189457604051634e8df0bf60e01b815260040160405180910390fd5b6101cd5460ff16156118b95760405163ddff29e960e01b815260040160405180910390fd5b6101cd805460ff191660011790556040517f31d1c0a3af6e15844ff9c1bf6201a5cf123137eb2fb3eeb96861a436d49cd25f90600090a1565b61190a600080516020615d278339815191523361211b565b61192757604051634e8df0bf60e01b815260040160405180910390fd5b6101c880546001600160801b03908116600160801b918416918202179091556040519081527f8c8298dd23c82a4aa45d27f480c6ce0aa2588e13df0b2fe2c827ca4a6836a5f8906020015b60405180910390a150565b61198633613ae9565b6119a357604051634755657960e01b815260040160405180910390fd5b826001600160a01b0381163b6000036119cf57604051630458607f60e41b815260040160405180910390fd5b60405163c3c5a54760e01b81526001600160a01b0382169063c3c5a547906119fb903090600401614c77565b6020604051808303816000875af1158015611a1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3e91906155c7565b611a4d57611a4d818484613af5565b609780546001600160a01b0390921661010002610100600160a81b0319909216919091179055505050565b6000611a8382612dd6565b611ae05760405162461bcd60e51b815260206004820152602860248201527f45524337323178797a3a20517565727920666f72206e6f6e206578697374656e6044820152677420746f6b656e2160c01b6064820152608401610cd3565b600082815260ce602052604090205482906001600160a01b031680611b31575b50600081815260cf60205260409020546001600160a01b03168015611b26579392505050565b816001019150611b00565b9392505050565b600054610100900460ff1615808015611b585750600054600160ff909116105b80611b725750303b158015611b72575060005460ff166001145b611bd55760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610cd3565b6000805460ff191660011790558015611bf8576000805461ff0019166101001790555b6001600160a01b038a16611c1f5760405163d92e233d60e01b815260040160405180910390fd5b8851600314611c2d57600080fd5b8551600214611c3b57600080fd5b611c458c8c613c9f565b611c4d613cd0565b611c55613cd0565b611c836daaeb6d7670e522a718067333cd4e733cc6cdda760b79bafa08df41ecfa224f810dceb66001613cf7565b611c8c85613d3a565b604080518082019091526001600160801b038e81168083529089166020909201829052600160801b909102176101c8556101cd805462010000600160b01b031916620100006001600160a01b038d160217905588518990600090611cf257611cf26156aa565b60200260200101516101cb9081611d09919061570e565b5088600181518110611d1d57611d1d6156aa565b60200260200101516101c99081611d34919061570e565b5088600281518110611d4857611d486156aa565b60200260200101516101ca9081611d5f919061570e565b5060d4805460ff191683151517905585518690600090611d8157611d816156aa565b60200260200101516101ce60006101000a8154816001600160a01b0302191690836001600160a01b03160217905550611dd486600181518110611dc657611dc66156aa565b602002602001015189613448565b611ddf600086613359565b611df7600080516020615d2783398151915286613359565b8215611e0b57611e098484600061365a565b505b8015611e51576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b60006001600160a01b038216611ecb5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610cd3565b506001600160a01b0316600090815260d360205260409020546001600160601b031690565b611ef8613d8d565b611f026000613d3a565b565b6000611f0f33613ae9565b611f2c57604051634755657960e01b815260040160405180910390fd5b6097805460ff81161560ff1990911681179091556040518181527fd8c469bcb7a4be6d69103a5fdb65991249a95423350dc583495ccf5e7c28a88d9060200160405180910390a1905090565b60606101c98054610bd990615573565b611f9360003361211b565b611fb057604051634e8df0bf60e01b815260040160405180910390fd5b6001600160a01b038116611fd75760405163d92e233d60e01b815260040160405180910390fd5b6101ce80546001600160a01b0319166001600160a01b0383169081179091556040517fd45e158b56e768c1167267f8516bcf96348071775faded3c9216b60855d873de9161197291614c77565b61202f60003361211b565b61204c57604051634e8df0bf60e01b815260040160405180910390fd5b6101cd54610100900460ff161561206257600080fd5b6101cd805461ff0019166101001790556040517ffbbcc58867e8fad1d9f72f1b991660f5ec5e4e068374aa442b8604eef182b63990600090a1565b6101d1546000905b8015612101576000190160008181526101cf602052604090205464ffffffffff1642108015906120f2575060008181526101cf6020526040902054600160281b900464ffffffffff164211155b156120fc57919050565b6120a5565b5060405163b7b2409760e01b815260040160405180910390fd5b6000918252610100602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61215033613ae9565b61216d57604051634755657960e01b815260040160405180910390fd5b60975461010090046001600160a01b0316803b6000036121a057604051630458607f60e41b815260040160405180910390fd5b6001600160a01b0384166122145760405163034a0dc160e41b815230600482015282151560248201526001600160a01b038216906334a0dc1090604401600060405180830381600087803b1580156121f757600080fd5b505af115801561220b573d6000803e3d6000fd5b50505050610ec3565b610ec3818585613af5565b606060cb8054610bd990615573565b609754829060ff16158015612253575060975461010090046001600160a01b03163b15155b156122ee57609754604051633185c44d60e21b81526101009091046001600160a01b03169063c61711349061228e90309085906004016155ad565b602060405180830381865afa1580156122ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122cf91906155c7565b6122ee5780604051633b79c77360e21b8152600401610cd39190614c77565b6114b9338484613de8565b6060816001600160401b0381111561231357612313614d0d565b60405190808252806020026020018201604052801561234657816020015b60608152602001906001900390816123315790505b50905060005b828110156123e6576123b63085858481811061236a5761236a6156aa565b905060200281019061237c91906157cd565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250613eb692505050565b8282815181106123c8576123c86156aa565b602002602001018190525080806123de90615813565b91505061234c565b5092915050565b612405600080516020615d278339815191523361211b565b61242257604051634e8df0bf60e01b815260040160405180910390fd5b6101cd805460ff600160b01b808304821615810260ff60b01b1990931692909217928390556040517f6ae3331a8bd1998bb8fd9d3d02b720f4862fb43e7586d302ba44e3923cea922d9361247f9390049091161515815260200190565b60405180910390a1565b609754849060ff161580156124ae575060975461010090046001600160a01b03163b15155b1561259157336001600160a01b038216036124fb576124ce335b84612e9b565b6124ea5760405162461bcd60e51b8152600401610cd39061560d565b6124f685858585613faa565b6125c2565b609754604051633185c44d60e21b81526101009091046001600160a01b03169063c61711349061253190309033906004016155ad565b602060405180830381865afa15801561254e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257291906155c7565b6125915733604051633b79c77360e21b8152600401610cd39190614c77565b61259a336124c8565b6125b65760405162461bcd60e51b8152600401610cd39061560d565b6125c285858585613faa565b5050505050565b8260001080156125da575060148311155b6125f7576040516332b4cb2160e21b815260040160405180910390fd5b600061260161209d565b60008181526101cf60209081526040808320815160c081018352815464ffffffffff8082168352600160281b82041694820194909452600160501b840463ffffffff90811693820193909352600160701b84049092166060830152600160901b9092046001600160701b03166080820181905260019092015460a08201529293506126949066031742a8f460009061565e565b90506126a08682615671565b34146126bf57604051632c1d501360e11b815260040160405180910390fd5b60a08201516126e157604051637904b60360e11b815260040160405180910390fd5b60cc54606083015163ffffffff16811061270d5760405162491a1760e81b815260040160405180910390fd5b61271e89898560a00151888a613fdd565b61273b576040516334ce9a3d60e11b815260040160405180910390fd5b600061274b86868a85888c61319f565b9050611275868243613334565b6000601482111561277c576040516332b4cb2160e21b815260040160405180910390fd5b8160000361279d576040516332b4cb2160e21b815260040160405180910390fd5b6014835111156127c0576040516349a3ec1560e11b815260040160405180910390fd5b82516000036127e2576040516349a3ec1560e11b815260040160405180910390fd5b6127fa600080516020615d278339815191523361211b565b15801561282e575061282c7ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc93361211b565b155b1561284c57604051634e8df0bf60e01b815260040160405180910390fd5b600082845161285b9190615671565b60cc54612868919061565e565b6101c8549091506001600160801b03168111156128985760405163a67c036160e01b815260040160405180910390fd5b60005b84518110156128d1576128c98582815181106128b9576128b96156aa565b6020026020010151856000613334565b60010161289b565b507f74074e463a8efcb02859ade8892e3934bd28eb75c9d1e6085a40c474088e2bfe8382866040516129059392919061582c565b60405180910390a19392505050565b606061291f82612dd6565b61293c5760405163677510db60e11b815260040160405180910390fd5b6000612946612c94565b90506000612952611f78565b9050600061295e610bc9565b9050825160000361297157949350505050565b828261297c87614054565b60405160200161298e9392919061588a565b6040516020818303038152906040529350505050919050565b6101d1546000905b80156129f4576000190160008181526101cf6020526040902054600160281b900464ffffffffff164211156129ef576129e981600161565e565b91505090565b6129af565b506000905090565b60008281526101006020526040902060010154612a188161334f565b6114b983836133e0565b612a3a600080516020615d278339815191523361211b565b612a5757604051634e8df0bf60e01b815260040160405180910390fd5b6101cd5460ff1615612a7c5760405163ddff29e960e01b815260040160405180910390fd5b6000612a893384846140e6565b9050737a6f5866f97034bb7153829bdaac1ffcb8facb71612aaa828661317b565b6001600160a01b031614612ad1576040516332c3ce2560e11b815260040160405180910390fd5b825115612b20576101ca612ae5848261570e565b507ff5e721c51327df71720f204c71b46bc26bcafb44db5012739c85814c7862f6c06101ca604051612b1791906158cd565b60405180910390a15b815115610ec3576101cc612b34838261570e565b506040805160208101909152600081526101c990612b52908261570e565b507f8eca6ea708f9bc34439b72366aa672afc86bb8b1294f1ba9637945c5dab8ea746101cc604051612b8491906158cd565b60405180910390a150505050565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101919091526101d1548210612be7576040516327e7ab7d60e11b815260040160405180910390fd5b5060009081526101cf6020908152604091829020825160c081018452815464ffffffffff8082168352600160281b82041693820193909352600160501b830463ffffffff90811694820194909452600160701b83049093166060840152600160901b9091046001600160701b031660808301526001015460a082015290565b6001600160a01b03918216600090815260d26020908152604080832093909416825291909152205460ff1690565b60606101cc8054612ca490615573565b9050600003612d2a576101cd5460405163511113e560e01b8152620100009091046001600160a01b03169063511113e590612ce5906101ca906004016158cd565b600060405180830381865afa158015612d02573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610edb9190810190615958565b6101cc8054610bd990615573565b612d40613d8d565b6001600160a01b038116612da55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610cd3565b612dae81613d3a565b50565b60006001600160e01b03198216637965db0b60e01b1480610bc35750610bc382614150565b600081815260d0602052604081205460ff1615612df557506000919050565b816000108015610bc357505060cc54101590565b600081815260d160205260409020546001600160a01b0390811690831681146114b957600082815260d16020526040902080546001600160a01b0319166001600160a01b0385169081179091558290612e6182611a78565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a4505050565b6000612ea682612dd6565b612f075760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610cd3565b6000612f1283611a78565b9050806001600160a01b0316846001600160a01b03161480612f4d5750836001600160a01b0316612f4284610c6b565b6001600160a01b0316145b80612f5d5750612f5d8185612c66565b949350505050565b826001600160a01b0316612f7882611a78565b6001600160a01b031614612fdc5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610cd3565b6001600160a01b03821661303e5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610cd3565b6130498383836141ab565b613054600082612e09565b6001600160a01b03838116600081815260d36020908152604080832080546001600160601b03198082166001600160601b039283166000190183161790925595881680855282852080549283169288166001019097169190911790955585835260ce90915280822080546001600160a01b0319168517905551849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b604080517f5b174e00b853ebb074ee5cb5d23ca67a264896e5670f923ac103fccad5232b5560208201526001600160a01b03861691810191909152606081018490526080810183905260a0810182905260009081906131719060c0015b604051602081830303815290604052805190602001206141f4565b9695505050505050565b600080600061318a85856142cf565b9150915061319781614311565b509392505050565b6001600160a01b038616600081815260d360209081526040808320548984526101d083528184209484529390915280822054908501519192600160601b90046001600160601b03169163ffffffff161561324157846040015163ffffffff16811061321d57604051632f18066d60e01b815260040160405180910390fd5b846040015163ffffffff1687820111156132415780856040015163ffffffff160396505b6101c854600160801b90046001600160801b0316801561328b5780831061327b57604051632f18066d60e01b815260040160405180910390fd5b80888401111561328b5782810397505b856060015163ffffffff1688880111156132af5786866060015163ffffffff160397505b6000851180156132c857506101cd54610100900460ff16155b156132fd578482106132ed57604051632f18066d60e01b815260040160405180910390fd5b8488830111156132fd5781850397505b5060008881526101d0602090815260408083206001600160a01b038d16845290915290209087019055508490509695505050505050565b6114b983836040518060200160405280600081525084614456565b612dae8133614470565b613363828261211b565b611538576000828152610100602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561339c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6133ea828261211b565b15611538576000828152610100602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6127106001600160601b03821611156134b65760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610cd3565b6001600160a01b03821661350c5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610cd3565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217606555565b61354e81612dd6565b6135aa5760405162461bcd60e51b815260206004820152602760248201527f45524337323178797a3a20517565727920666f72206e6f6e6578697374656e7460448201526620746f6b656e2160c81b6064820152608401610cd3565b60006135b582611a78565b90506135c3816000846141ab565b6135ce600083612e09565b6001600160a01b038116600081815260d36020908152604080832080546001600160601b031981166001600160601b039182166000190190911617905585835260d0909152808220805460ff1916600190811790915560cd80549091019055518492907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600082816136666129a7565b9050601482111561368a576040516373c2b52560e11b815260040160405180910390fd5b6101d154801580159061369c57508185105b156136ba576040516344ca163560e11b815260040160405180910390fd5b808511156136db576040516307cc4d8f60e01b815260040160405180910390fd5b6136e660148361565e565b6136f0848761565e565b111561370f5760405163c1eae7bb60e01b815260040160405180910390fd5b60008581526101cf602052604081205464ffffffffff169084900361379c5742811161374e5760405163bf4a806960e01b815260040160405180910390fd5b6101d18690556040517f842cd1905522b3731a39e0d2fb9d3757bc29b4e57e9253b230d437bf10505e9b90613788908a908a908a90615a05565b60405180910390a185945050505050611b31565b6000888860008181106137b1576137b16156aa565b905060c002018036038101906137c79190615ac0565b905060cc54816060015163ffffffff1610156137f657604051630e93fda160e21b815260040160405180910390fd5b42821115801561380557508115155b801561381357506101d15487105b1561387057805164ffffffffff16821461384057604051632ca4094f60e21b815260040160405180910390fd5b42816020015164ffffffffff161161386b5760405163804491f960e01b815260040160405180910390fd5b61389b565b42816000015164ffffffffff161161389b5760405163667e606760e11b815260040160405180910390fd5b868581015b8882146138d4578a8a8a84038181106138bb576138bb6156aa565b905060c002018036038101906138d19190615ac0565b92505b6101c85460608401516001600160801b0390911663ffffffff909116111561390f5760405163bccc7e2360e01b815260040160405180910390fd5b826000015164ffffffffff16836020015164ffffffffff161161394557604051631131dc6b60e11b815260040160405180910390fd5b81156139d557600019820160009081526101cf6020526040902054606084015164ffffffffff600160281b8304169163ffffffff600160701b9091048116911610156139ab574281106139ab576040516357be1d0d60e01b815260040160405180910390fd5b835164ffffffffff1681106139d35760405163064f2b0760e31b815260040160405180910390fd5b505b60008281526101cf60209081526040918290208551815492870151938701516060880151608089015164ffffffffff93841669ffffffffffffffffffff1990961695909517600160281b93909616929092029490941767ffffffffffffffff60501b1916600160501b63ffffffff9586160263ffffffff60701b191617600160701b9490911693909302929092176001600160901b0316600160901b6001600160701b039092169190910217815560a0840151600191820155909101908082106138a0576101d18190556040517f842cd1905522b3731a39e0d2fb9d3757bc29b4e57e9253b230d437bf10505e9b90613ad3908d908d908d90615a05565b60405180910390a19a9950505050505050505050565b6000610bc3818361211b565b60405163c3c5a54760e01b81526001600160a01b0384169063c3c5a54790613b21903090600401614c77565b6020604051808303816000875af1158015613b40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b6491906155c7565b15613c02578015613bd457604051632cc5350560e21b81526001600160a01b0384169063b314d41490613b9d90309086906004016155ad565b600060405180830381600087803b158015613bb757600080fd5b505af1158015613bcb573d6000803e3d6000fd5b50505050505050565b604051630781ad2d60e21b81526001600160a01b03841690631e06b4b490613b9d90309086906004016155ad565b8015613c3657604051633e9f1edf60e11b81526001600160a01b03841690637d3e3dbe90613b9d90309086906004016155ad565b6001600160a01b03821615613c735760405163a0af290360e01b81526001600160a01b0384169063a0af290390613b9d90309086906004016155ad565b604051632210724360e11b81526001600160a01b03841690634420e48690613b9d903090600401614c77565b600054610100900460ff16613cc65760405162461bcd60e51b8152600401610cd390615b5a565b61153882826144c9565b600054610100900460ff16611f025760405162461bcd60e51b8152600401610cd390615b5a565b600054610100900460ff16613d1e5760405162461bcd60e51b8152600401610cd390615b5a565b6001600160a01b0383163b156114b95782611a4d818484613af5565b61019680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610196546001600160a01b03163314611f025760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610cd3565b816001600160a01b0316836001600160a01b031603613e495760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610cd3565b6001600160a01b03838116600081815260d26020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60606001600160a01b0383163b613f1e5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610cd3565b600080846001600160a01b031684604051613f399190615ba5565b600060405180830381855af49150503d8060008114613f74576040519150601f19603f3d011682016040523d82523d6000602084013e613f79565b606091505b5091509150613fa18282604051806060016040528060278152602001615d0060279139614509565b95945050505050565b613fb5848484612f65565b613fc184848484614522565b610ec35760405162461bcd60e51b8152600401610cd390615bc1565b6000613171868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040516001600160601b0319606089901b16602082015260348101879052889250605401905060405160208183030381529060405280519060200120614620565b6060600061406183614636565b60010190506000816001600160401b0381111561408057614080614d0d565b6040519080825280601f01601f1916602001820160405280156140aa576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846140b457509392505050565b600080613fa17f35fa4dcabfcae3f1b6e0c4c1ac43df02ba9cb39e2dcdc3d3f1b92a38118e3354868680519060200120868051906020012060405160200161315694939291909384526001600160a01b039290921660208401526040830152606082015260800190565b60006001600160e01b0319821663152a902d60e11b148061418157506001600160e01b031982166380ac58cd60e01b145b8061419c57506001600160e01b03198216635b5e139f60e01b145b80610bc35750610bc38261470e565b6001600160a01b038316158015906141cb57506001600160a01b03821615155b156114b95760d45460ff16156114b9576040516328f11eb160e21b815260040160405180910390fd5b604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f36cb08f6aafe2399767bf40e9642429d7535f40e61bd81428cad09095c5d337d828401527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608301524660808301523060a0808401919091528351808403909101815260c08301845280519082012061190160f01b60e084015260e2830181905261010280840186905284518085039091018152610122909301909352815191012060009190611b31565b60008082516041036143055760208301516040840151606085015160001a6142f987828585614743565b9450945050505061148c565b5060009050600261148c565b600081600481111561432557614325615c13565b0361432d5750565b600181600481111561434157614341615c13565b036143895760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610cd3565b600281600481111561439d5761439d615c13565b036143ea5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610cd3565b60038160048111156143fe576143fe615c13565b03612dae5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610cd3565b6144618484836147fd565b613fc160008560cc5485614522565b61447a828261211b565b611538576144878161497d565b61449283602061498f565b6040516020016144a3929190615c29565b60408051601f198184030181529082905262461bcd60e51b8252610cd391600401614c4b565b600054610100900460ff166144f05760405162461bcd60e51b8152600401610cd390615b5a565b60ca6144fc838261570e565b5060cb6114b9828261570e565b60608315614518575081611b31565b611b318383614b2a565b60006001600160a01b0384163b1561461857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614566903390899088908890600401615c98565b6020604051808303816000875af19250505080156145a1575060408051601f3d908101601f1916820190925261459e91810190615ccb565b60015b6145fe573d8080156145cf576040519150601f19603f3d011682016040523d82523d6000602084013e6145d4565b606091505b5080516000036145f65760405162461bcd60e51b8152600401610cd390615bc1565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612f5d565b506001612f5d565b60008261462d8584614b54565b14949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106146755772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106146a1576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106146bf57662386f26fc10000830492506010015b6305f5e10083106146d7576305f5e100830492506008015b61271083106146eb57612710830492506004015b606483106146fd576064830492506002015b600a8310610bc35760010192915050565b60006001600160e01b0319821663152a902d60e11b1480610bc357506301ffc9a760e01b6001600160e01b0319831614610bc3565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b0383111561477057506000905060036147f4565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156147c4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166147ed576000600192509250506147f4565b9150600090505b94509492505050565b6001600160a01b0383166148535760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610cd3565b61486160008460cc546141ab565b60cc8054838101918290556001600160a01b038516600090815260d36020526040902080546001600160601b038082168701166001600160601b0319909116179055908215614900576001600160a01b038516600090815260d36020526040902080546001600160601b03808216600160601b92839004821688019091169091026001600160c01b031617600160c01b6001600160401b038616021790555b600081815260cf6020526040902080546001600160a01b0319166001600160a01b03871617905560018281019082015b60405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a481600101915080821061493057505050610ec3565b6060610bc36001600160a01b03831660145b6060600061499e836002615671565b6149a990600261565e565b6001600160401b038111156149c0576149c0614d0d565b6040519080825280601f01601f1916602001820160405280156149ea576020820181803683370190505b509050600360fc1b81600081518110614a0557614a056156aa565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614a3457614a346156aa565b60200101906001600160f81b031916908160001a9053506000614a58846002615671565b614a6390600161565e565b90505b6001811115614adb576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110614a9757614a976156aa565b1a60f81b828281518110614aad57614aad6156aa565b60200101906001600160f81b031916908160001a90535060049490941c93614ad481615ce8565b9050614a66565b508315611b315760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610cd3565b815115614b3a5781518083602001fd5b8060405162461bcd60e51b8152600401610cd39190614c4b565b600081815b845181101561319757614b8582868381518110614b7857614b786156aa565b6020026020010151614b99565b915080614b9181615813565b915050614b59565b6000818310614bb5576000828152602084905260409020611b31565b6000838152602083905260409020611b31565b6001600160e01b031981168114612dae57600080fd5b600060208284031215614bf057600080fd5b8135611b3181614bc8565b60005b83811015614c16578181015183820152602001614bfe565b50506000910152565b60008151808452614c37816020860160208601614bfb565b601f01601f19169290920160200192915050565b602081526000611b316020830184614c1f565b600060208284031215614c7057600080fd5b5035919050565b6001600160a01b0391909116815260200190565b80356001600160a01b0381168114614ca257600080fd5b919050565b60008060408385031215614cba57600080fd5b614cc383614c8b565b946020939093013593505050565b600080600060608486031215614ce657600080fd5b614cef84614c8b565b9250614cfd60208501614c8b565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614d4b57614d4b614d0d565b604052919050565b60006001600160401b03821115614d6c57614d6c614d0d565b50601f01601f191660200190565b600082601f830112614d8b57600080fd5b8135614d9e614d9982614d53565b614d23565b818152846020838601011115614db357600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a08688031215614de857600080fd5b85356001600160401b03811115614dfe57600080fd5b614e0a88828901614d7a565b955050602086013593506040860135925060608601359150614e2e60808701614c8b565b90509295509295909350565b60008060408385031215614e4d57600080fd5b50508035926020909101359150565b60008060408385031215614e6f57600080fd5b82359150614e7f60208401614c8b565b90509250929050565b80356001600160601b0381168114614ca257600080fd5b60008060408385031215614eb257600080fd5b614ebb83614c8b565b9150614e7f60208401614e88565b60008083601f840112614edb57600080fd5b5081356001600160401b03811115614ef257600080fd5b60208301915083602060c08302850101111561148c57600080fd5b600080600060408486031215614f2257600080fd5b83356001600160401b03811115614f3857600080fd5b614f4486828701614ec9565b909790965060209590950135949350505050565b80356001600160801b0381168114614ca257600080fd5b600060208284031215614f8157600080fd5b611b3182614f58565b8015158114612dae57600080fd5b8035614ca281614f8a565b600080600060608486031215614fb857600080fd5b614fc184614c8b565b9250614fcf60208501614c8b565b91506040840135614fdf81614f8a565b809150509250925092565b60006001600160401b0382111561500357615003614d0d565b5060051b60200190565b600082601f83011261501e57600080fd5b8135602061502e614d9983614fea565b82815260059290921b8401810191818101908684111561504d57600080fd5b8286015b8481101561508c5780356001600160401b038111156150705760008081fd5b61507e8986838b0101614d7a565b845250918301918301615051565b509695505050505050565b600082601f8301126150a857600080fd5b813560206150b8614d9983614fea565b82815260059290921b840181019181810190868411156150d757600080fd5b8286015b8481101561508c576150ec81614c8b565b83529183019183016150db565b6000806000806000806000806000806000806101608d8f03121561511c57600080fd5b6151258d614f58565b9b506001600160401b0360208e0135111561513f57600080fd5b61514f8e60208f01358f01614d7a565b9a506001600160401b0360408e0135111561516957600080fd5b6151798e60408f01358f01614d7a565b995061518760608e01614c8b565b98506001600160401b0360808e013511156151a157600080fd5b6151b18e60808f01358f0161500d565b97506151bf60a08e01614e88565b96506151cd60c08e01614f58565b95506001600160401b0360e08e013511156151e757600080fd5b6151f78e60e08f01358f01615097565b94506152066101008e01614c8b565b93506001600160401b036101208e0135111561522157600080fd5b6152328e6101208f01358f01614ec9565b90935091506152446101408e01614f98565b90509295989b509295989b509295989b565b60006020828403121561526857600080fd5b611b3182614c8b565b60008060006060848603121561528657600080fd5b61528f84614c8b565b92506020840135614fcf81614f8a565b600080604083850312156152b257600080fd5b6152bb83614c8b565b915060208301356152cb81614f8a565b809150509250929050565b60008083601f8401126152e857600080fd5b5081356001600160401b038111156152ff57600080fd5b6020830191508360208260051b850101111561148c57600080fd5b6000806020838503121561532d57600080fd5b82356001600160401b0381111561534357600080fd5b61534f858286016152d6565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156153b057603f1988860301845261539e858351614c1f565b94509285019290850190600101615382565b5092979650505050505050565b600080600080608085870312156153d357600080fd5b6153dc85614c8b565b93506153ea60208601614c8b565b92506040850135915060608501356001600160401b0381111561540c57600080fd5b61541887828801614d7a565b91505092959194509250565b60008060008060006080868803121561543c57600080fd5b85356001600160401b0381111561545257600080fd5b61545e888289016152d6565b9096509450506020860135925060408601359150614e2e60608701614c8b565b6000806040838503121561549157600080fd5b82356001600160401b038111156154a757600080fd5b6154b385828601615097565b95602094909401359450505050565b6000806000606084860312156154d757600080fd5b83356001600160401b03808211156154ee57600080fd5b6154fa87838801614d7a565b9450602086013591508082111561551057600080fd5b61551c87838801614d7a565b9350604086013591508082111561553257600080fd5b5061553f86828701614d7a565b9150509250925092565b6000806040838503121561555c57600080fd5b61556583614c8b565b9150614e7f60208401614c8b565b600181811c9082168061558757607f821691505b6020821081036155a757634e487b7160e01b600052602260045260246000fd5b50919050565b6001600160a01b0392831681529116602082015260400190565b6000602082840312156155d957600080fd5b8151611b3181614f8a565b634e487b7160e01b600052601160045260246000fd5b81810381811115610bc357610bc36155e4565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b80820180821115610bc357610bc36155e4565b8082028115828204841417610bc357610bc36155e4565b6000826156a557634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b601f8211156114b957600081815260208120601f850160051c810160208610156156e75750805b601f850160051c820191505b81811015615706578281556001016156f3565b505050505050565b81516001600160401b0381111561572757615727614d0d565b61573b816157358454615573565b846156c0565b602080601f83116001811461577057600084156157585750858301515b600019600386901b1c1916600185901b178555615706565b600085815260208120601f198616915b8281101561579f57888601518255948401946001909101908401615780565b50858210156157bd5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000808335601e198436030181126157e457600080fd5b8301803591506001600160401b038211156157fe57600080fd5b60200191503681900382131561148c57600080fd5b600060018201615825576158256155e4565b5060010190565b6000606082018583526020858185015260606040850152818551808452608086019150828701935060005b8181101561587c5784516001600160a01b031683529383019391830191600101615857565b509098975050505050505050565b6000845161589c818460208901614bfb565b8451908301906158b0818360208901614bfb565b84519101906158c3818360208801614bfb565b0195945050505050565b60006020808352600084546158e181615573565b80848701526040600180841660008114615902576001811461591c5761594a565b60ff1985168984015283151560051b89018301955061594a565b896000528660002060005b858110156159425781548b8201860152908301908801615927565b8a0184019650505b509398975050505050505050565b60006020828403121561596a57600080fd5b81516001600160401b0381111561598057600080fd5b8201601f8101841361599157600080fd5b805161599f614d9982614d53565b8181528560208385010111156159b457600080fd5b613fa1826020830160208601614bfb565b803564ffffffffff81168114614ca257600080fd5b803563ffffffff81168114614ca257600080fd5b80356001600160701b0381168114614ca257600080fd5b6040808252818101849052600090606080840187845b88811015615aaa5764ffffffffff80615a33846159c5565b168452602081615a448286016159c5565b169085015250615a558286016159da565b63ffffffff8082168786015280615a6d8786016159da565b1686860152505060806001600160701b03615a898285016159ee565b169084015260a0828101359084015260c09283019290910190600101615a1b565b5050809350505050826020830152949350505050565b600060c08284031215615ad257600080fd5b60405160c081018181106001600160401b0382111715615af457615af4614d0d565b604052615b00836159c5565b8152615b0e602084016159c5565b6020820152615b1f604084016159da565b6040820152615b30606084016159da565b6060820152615b41608084016159ee565b608082015260a083013560a08201528091505092915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008251615bb7818460208701614bfb565b9190910192915050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615c5b816017850160208801614bfb565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615c8c816028840160208801614bfb565b01602801949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061317190830184614c1f565b600060208284031215615cdd57600080fd5b8151611b3181614bc8565b600081615cf757615cf76155e4565b50600019019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564fd63b67fde00b77f1f54f050135a475665b815acd10a8e7fd785ba074846734aa2646970667358221220119614ab4e6ed915f0c6022362309e25b77ce25eefc9ab7523f386274d32a1d364736f6c63430008110033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.