ETH Price: $3,336.99 (-2.59%)

Contract

0x64690d175e48038D220713d0BdDdD5FD9096b2cC
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040161938972022-12-16 1:12:47711 days ago1671153167IN
 Create: CreatorBlueprintsOwnershipTransferred
0 ETH0.0616211911.8723782

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CreatorBlueprintsOwnershipTransferred

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion
File 1 of 23 : CreatorBlueprintsOwnershipTransferred.sol
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.4;

import "../../abstract/HasSecondarySaleFees.sol";
import "../../common/IBlueprintTypes.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IOperatorFilterRegistry} from "../OperatorFilterer/operatorFilterRegistry/IOperatorFilterRegistry.sol";

/**
 * @dev Async Art Blueprint NFT contract with true creator provenance
 * @author Async Art, Ohimire Labs 
 */
contract CreatorBlueprintsOwnershipTransferred is
    ERC721Upgradeable,
    HasSecondarySaleFees,
    AccessControlEnumerableUpgradeable,
    ReentrancyGuard
{
    using StringsUpgradeable for uint256;

    /**
     * @dev Default fee given to platform on primary sales
     */
    uint32 public defaultPlatformPrimaryFeePercentage;    

    /**
     * @dev First token ID of the next Blueprint to be prepared
     */ 
    uint64 public latestErc721TokenIndex;

    /**
     * @dev Platform account receiving fees from primary sales
     */
    address public asyncSaleFeesRecipient;

    /**
     * @dev Account representing platform 
     */
    address public platform;

    /**
     * @dev Account able to perform actions restricted to MINTER_ROLE holder
     */
    address public minterAddress;

    /**
     * @dev Blueprint artist 
     */
    address public artist;
    
    /**
     * @dev Tracks failed transfers of native gas token 
     */
    mapping(address => uint256) failedTransferCredits;

    /**
     * @dev Blueprint, core object of contract
     */
    Blueprints public blueprint;

    /**
     * @dev Royalty config 
     */
    RoyaltyParameters public royaltyParameters;

    /**
     * @dev Contract-level metadata 
     */
    string public contractURI; 

    /**
     * @dev Holders of this role are given minter privileges 
     */
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

    /*  
     * @dev A mapping from whitelisted addresses to amout of pre-sale blueprints purchased
     * @dev This is seperate from the Blueprint struct because it was introduced as part of an upgrade, and needs to be placed at the end of storage to avoid overwriting.
     */
     mapping(address => uint32) whitelistedPurchases;
    
    /**
     * @dev A registry to check for blacklisted operator addresses. Used to only permit marketplaces enforcing creator royalites if desired
     */
    IOperatorFilterRegistry public operatorFilterRegistry;

    /**
     * @dev Tracks state of Blueprint sale
     */
    enum SaleState {
        not_prepared,
        not_started,
        started,
        paused
    }

    /**
     * @dev Object holding royalty data
     * @param split Royalty splitter receiving royalties
     * @param royaltyCutBPS Total percentage of token sales sent to split, in basis points 
     */
    struct RoyaltyParameters {
        address split;
        uint32 royaltyCutBPS;
    }

    /**
     * @dev Blueprint
     * @param mintAmountArtist Amount of NFTs of Blueprint mintable by artist
     * @param mintAmountPlatform Amount of NFTs of Blueprint mintable by platform 
     * @param capacity Number of NFTs in Blueprint 
     * @param erc721TokenIndex First token ID of the next Blueprint to be prepared
     * @param maxPurchaseAmount Max number of NFTs purchasable in a single transaction
     * @param saleEndTimestamp Timestamp when the sale ends 
     * @param price Price per NFT in Blueprint
     * @param tokenUriLocked If the token metadata isn't updatable 
     * @param ERC20Token Address of ERC20 currency required to buy NFTs, can be zero address if expected currency is native gas token 
     * @param baseTokenUri Base URI for token, resultant uri for each token is base uri concatenated with token id
     * @param merkleroot Root of Merkle tree holding whitelisted accounts 
     * @param saleState State of sale
     * @param feeRecipientInfo Object containing primary and secondary fee configuration
     */ 
    struct Blueprints {
        uint32 mintAmountArtist;
        uint32 mintAmountPlatform;
        uint64 capacity;
        uint64 erc721TokenIndex;
        uint64 maxPurchaseAmount;
        uint128 saleEndTimestamp;
        uint128 price;
        bool tokenUriLocked;        
        address ERC20Token;
        string baseTokenUri;
        bytes32 merkleroot;
        SaleState saleState;    
        IBlueprintTypes.PrimaryFees feeRecipientInfo;
    }

    /**
     * @dev Creator config of contract
     * @param name Contract name
     * @param symbol Contract symbol
     * @param contractURI Contract-level metadata 
     * @param artist Blueprint artist
     */
    struct CreatorBlueprintsInput {
        string name;
        string symbol;
        string contractURI;
        address artist;
    }

    /**
     * @dev Emitted when blueprint seed is revealed
     * @param randomSeed Revealed seed
     */
    event BlueprintSeed(string randomSeed);

    /**
     * @dev Emitted when NFTs of blueprint are minted
     * @param artist Blueprint artist
     * @param purchaser Purchaser of NFTs
     * @param tokenId NFT minted
     * @param newCapacity New capacity of tokens left in blueprint 
     * @param seedPrefix Seed prefix hash
     */
    event BlueprintMinted(
        address artist,
        address purchaser,
        uint128 tokenId,
        uint64 newCapacity,
        bytes32 seedPrefix
    );

    /**
     * @dev Emitted when blueprint is prepared
     * @param artist Blueprint artist
     * @param capacity Number of NFTs in blueprint
     * @param blueprintMetaData Blueprint metadata uri
     * @param baseTokenUri Blueprint's base token uri. Token uris are a result of the base uri concatenated with token id 
     */ 
    event BlueprintPrepared(
        address artist,
        uint64 capacity,
        string blueprintMetaData,
        string baseTokenUri
    );

    /**
     * @dev Emitted when blueprint sale is started
     */
    event SaleStarted();

    /**
     * @dev Emitted when blueprint sale is paused
     */
    event SalePaused();

    /**
     * @dev Emitted when blueprint sale is unpaused
     */
    event SaleUnpaused();

    /**
     * @dev Emitted when blueprint token uri is updated 
     * @param newBaseTokenUri New base uri 
     */
    event BlueprintTokenUriUpdated(string newBaseTokenUri);

    /**
     * @dev Emitted on initialize for OpenSea to index ownership of the contract
     * @param owner The owner() of this contract (Async Art platform)
     */
    event OwnershipTransferred(address indexed owner);

    /**
     * @dev Checks blueprint sale state
     */
    modifier isBlueprintPrepared() {
        require(
            blueprint.saleState != SaleState.not_prepared,
            "!prepared"
        );
        _;
    }

    /**
     * @dev Checks if blueprint sale is ongoing
     */
    modifier isSaleOngoing() {
        require(_isSaleOngoing(), "!ongoing");
        _;
    }

    /**
     * @dev Checks if quantity of NFTs is available for purchase in blueprint
     * @param _quantity Quantity of NFTs being checked 
     */ 
    modifier isQuantityAvailableForPurchase(
        uint32 _quantity
    ) {
        require(
            blueprint.capacity >= _quantity,
            "quantity >"
        );
        _;
    }

    /**
     * @dev Checks if sale is still valid, given the sale end timestamp 
     * @param _saleEndTimestamp Sale end timestamp 
     */ 
    modifier isSaleEndTimestampCurrentlyValid(
        uint128 _saleEndTimestamp
    ) {
        require(_isSaleEndTimestampCurrentlyValid(_saleEndTimestamp), "ended");
        _;
    }

    /**
     * @dev Validates royalty parameters. Allow null-equivalent values for certain use-cases
     * @param _royaltyParameters Royalty parameters 
     */
    modifier validRoyaltyParameters(
        RoyaltyParameters calldata _royaltyParameters
    ) {
        require(_royaltyParameters.royaltyCutBPS <= 10000);
        _;
    }

    /**
     * @dev Iniitalize the implementation 
     * @param creatorBlueprintsInput Core parameters for contract initialization 
     * @param creatorBlueprintsAdmins Administrative accounts 
     * @param _royaltyParameters Initial royalty settings 
     * @param extraMinter Additional address to give minter role
     */
    function initialize(
        CreatorBlueprintsInput calldata creatorBlueprintsInput,
        IBlueprintTypes.Admins calldata creatorBlueprintsAdmins,
        RoyaltyParameters calldata _royaltyParameters,
        address extraMinter
    ) public initializer validRoyaltyParameters(_royaltyParameters) {
        // Intialize parent contracts
        ERC721Upgradeable.__ERC721_init(creatorBlueprintsInput.name, creatorBlueprintsInput.symbol);
        HasSecondarySaleFees._initialize();
        AccessControlUpgradeable.__AccessControl_init();

        _setupRole(DEFAULT_ADMIN_ROLE, creatorBlueprintsAdmins.platform);
        _setupRole(MINTER_ROLE, creatorBlueprintsAdmins.minter);
        if (extraMinter != address(0)) {
            _setupRole(MINTER_ROLE, extraMinter);
        }

        platform = creatorBlueprintsAdmins.platform;
        minterAddress = creatorBlueprintsAdmins.minter;
        artist = creatorBlueprintsInput.artist;

        defaultPlatformPrimaryFeePercentage = 2000; // 20%

        asyncSaleFeesRecipient = creatorBlueprintsAdmins.asyncSaleFeesRecipient;
        contractURI = creatorBlueprintsInput.contractURI; 
        royaltyParameters = _royaltyParameters;

        operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);
        operatorFilterRegistry.registerAndSubscribe(address(this), 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);

        emit OwnershipTransferred(owner());
    }

    /**
     * @dev Validates that sale is still ongoing
     */
    function _isSaleOngoing()
        internal
        view
        returns (bool)
    {
        return blueprint.saleState == SaleState.started && _isSaleEndTimestampCurrentlyValid(blueprint.saleEndTimestamp);
    }

    /**
     * @dev Checks if user whitelisted for presale purchase
     * @param _whitelistedQuantity Purchaser's requested quantity. Validated against merkle tree
     * @param proof Corresponding proof for purchaser in merkle tree 
     */ 
    function _isWhitelistedAndPresale(
        uint32 _whitelistedQuantity,
        bytes32[] calldata proof
    )
        internal
        view
        returns (bool)
    {
        return (_isBlueprintPreparedAndNotStarted() && proof.length != 0 && _verify(_leaf(msg.sender, uint256(_whitelistedQuantity)), blueprint.merkleroot, proof));
    }
 
    /**
     * @dev Checks if sale is still valid, given the sale end timestamp 
     * @param _saleEndTimestamp Sale end timestamp 
     */  
    function _isSaleEndTimestampCurrentlyValid(uint128 _saleEndTimestamp)
        internal
        view
        returns (bool)
    {
        return _saleEndTimestamp > block.timestamp || _saleEndTimestamp == 0;
    }

    /**
     * @dev Checks that blueprint is prepared but sale for it hasn't started 
     */
    function _isBlueprintPreparedAndNotStarted()
        internal
        view
        returns (bool)
    {
        return blueprint.saleState == SaleState.not_started;
    }

    /**
     * @dev Checks that the recipients and allocations arrays of royalties are valid  
     * @param _feeRecipients Fee recipients
     * @param _feeBPS Allocations in percentages for fee recipients (basis points)
     */ 
    function feeArrayDataValid(
        address[] memory _feeRecipients,
        uint32[] memory _feeBPS
    ) internal pure returns (bool) {
        require(
            _feeRecipients.length == _feeBPS.length,
            "invalid"
        );
        uint32 totalPercent;
        for (uint256 i; i < _feeBPS.length; i++) {
            totalPercent = totalPercent + _feeBPS[i];
        }
        require(totalPercent <= 10000, "bps >");
        return true;
    }

    /**
     * @dev Sets values after blueprint preparation
     * @param _blueprintMetaData Blueprint metadata uri 
     */
    function setBlueprintPrepared(
        string memory _blueprintMetaData
    ) internal {
        blueprint.saleState = SaleState.not_started;
        //assign the erc721 token index to the blueprint
        blueprint.erc721TokenIndex = latestErc721TokenIndex;
        uint64 _capacity = blueprint.capacity;
        latestErc721TokenIndex += _capacity;

        emit BlueprintPrepared(
            artist,
            _capacity,
            _blueprintMetaData,
            blueprint.baseTokenUri
        );
    }

    /**
     * @dev Sets the ERC20 token value of a blueprint
     * @param _erc20Token ERC20 token being set
     */ 
    function setErc20Token(address _erc20Token) internal {
        if (_erc20Token != address(0)) {
            blueprint.ERC20Token = _erc20Token;
        }
    }

    /**
     * @dev Sets up most blueprint parameters 
     * @param _erc20Token ERC20 currency 
     * @param _baseTokenUri Base token uri for blueprint
     * @param _merkleroot Root of merkle tree allowlist
     * @param _mintAmountArtist Amount that artist can mint of blueprint
     * @param _mintAmountPlatform Amount that platform can mint of blueprint 
     * @param _maxPurchaseAmount Max amount of NFTs purchasable in one transaction
     * @param _saleEndTimestamp When the sale ends
     */
    function _setupBlueprint(
        address _erc20Token,
        string memory _baseTokenUri,
        bytes32 _merkleroot,
        uint32 _mintAmountArtist,
        uint32 _mintAmountPlatform,
        uint64 _maxPurchaseAmount,
        uint128 _saleEndTimestamp
    )   internal 
        isSaleEndTimestampCurrentlyValid(_saleEndTimestamp)
    {
        setErc20Token(_erc20Token);

        blueprint.baseTokenUri = _baseTokenUri;

        if (_merkleroot != 0) {
            blueprint.merkleroot = _merkleroot;
        }

        blueprint.mintAmountArtist = _mintAmountArtist;
        blueprint.mintAmountPlatform = _mintAmountPlatform;

        if (_maxPurchaseAmount != 0) {
            blueprint.maxPurchaseAmount = _maxPurchaseAmount;
        }
        
        if (_saleEndTimestamp != 0) {
            blueprint.saleEndTimestamp = _saleEndTimestamp;
        }
    }

    /** 
     * @dev Prepare the blueprint (this is the core operation to set up a blueprint)
     * @param config Object containing values required to prepare blueprint
     * @param _feeRecipientInfo Primary and secondary fees config
     */  
    function prepareBlueprint(
        IBlueprintTypes.BlueprintPreparationConfig calldata config,
        IBlueprintTypes.PrimaryFees calldata _feeRecipientInfo
    )   external 
        onlyRole(MINTER_ROLE)
    {
        require(blueprint.saleState == SaleState.not_prepared, "already prepared");
        blueprint.capacity = config._capacity;
        blueprint.price = config._price;

        _setupBlueprint(
            config._erc20Token,
            config._baseTokenUri,
            config._merkleroot,
            config._mintAmountArtist,
            config._mintAmountPlatform,
            config._maxPurchaseAmount,
            config._saleEndTimestamp
        );

        setBlueprintPrepared(config._blueprintMetaData);
        setFeeRecipients(_feeRecipientInfo);
    }

    /**
     * @dev Update a blueprint's artist
     * @param _newArtist New artist
     */
    function updateBlueprintArtist (
        address _newArtist
    ) external onlyRole(MINTER_ROLE) {
        artist = _newArtist;
    }

    /**
     * @dev Update a blueprint's merkleroot
     * @param _newMerkleroot New merkleroot
     */
    function updateBlueprintMerkleroot (
        bytes32 _newMerkleroot
    ) external onlyRole(MINTER_ROLE) {
        blueprint.merkleroot = _newMerkleroot;
    }

    /**
     * @dev Update a blueprint's capacity 
     * @param _newCapacity New capacity
     * @param _newLatestErc721TokenIndex Newly adjusted last ERC721 token id 
     */
    function updateBlueprintCapacity (
        uint64 _newCapacity,
        uint64 _newLatestErc721TokenIndex
    ) external onlyRole(MINTER_ROLE) {
        require(blueprint.capacity > _newCapacity, "New cap too large");

        blueprint.capacity = _newCapacity;

        latestErc721TokenIndex = _newLatestErc721TokenIndex;
    }

    /**
     * @dev Set the primary fees config of blueprint
     * @param _feeRecipientInfo Fees config 
     */
    function setFeeRecipients(
        IBlueprintTypes.PrimaryFees memory _feeRecipientInfo
    ) public onlyRole(MINTER_ROLE) {
        require(
            blueprint.saleState != SaleState.not_prepared,
            "never prepared"
        );
        if (feeArrayDataValid(_feeRecipientInfo.primaryFeeRecipients, _feeRecipientInfo.primaryFeeBPS)) {
            blueprint.feeRecipientInfo = _feeRecipientInfo;
        }
    }

    /**
     * @dev Begin blueprint's sale
     */
    function beginSale()
        external
        onlyRole(MINTER_ROLE)
        isSaleEndTimestampCurrentlyValid(blueprint.saleEndTimestamp) 
    {
        require(
            blueprint.saleState == SaleState.not_started,
            "sale started or not prepared"
        );
        blueprint.saleState = SaleState.started;
        emit SaleStarted();
    }

    /**
     * @dev Pause blueprint's sale
     */
    function pauseSale()
        external
        onlyRole(MINTER_ROLE)
        isSaleOngoing()
    {
        blueprint.saleState = SaleState.paused;
        emit SalePaused();
    }

    /**
     * @dev Unpause blueprint's sale
     */
    function unpauseSale() external onlyRole(MINTER_ROLE) isSaleEndTimestampCurrentlyValid(blueprint.saleEndTimestamp) {
        require(
            blueprint.saleState == SaleState.paused,
            "!paused"
        );
        blueprint.saleState = SaleState.started;
        emit SaleUnpaused();
    }

    /**
     * @dev Purchase NFTs of blueprint to a recipient address
     * @param purchaseQuantity How many NFTs to purchase 
     * @param whitelistedQuantity How many NFTS are whitelisted for the blueprint 
     * @param tokenAmount Payment amount 
     * @param proof Merkle tree proof 
     * @param nftRecipient Recipient of minted NFTs
     */
    function purchaseBlueprintsTo(
        uint32 purchaseQuantity,
        uint32 whitelistedQuantity,
        uint256 tokenAmount,
        bytes32[] calldata proof,
        address nftRecipient
    )
        external
        payable
        nonReentrant
        isQuantityAvailableForPurchase(purchaseQuantity)
    {
        if (_isWhitelistedAndPresale(whitelistedQuantity, proof)) {
            require(whitelistedPurchases[msg.sender] + purchaseQuantity <= whitelistedQuantity, "> whitelisted amount");
            whitelistedPurchases[msg.sender] += purchaseQuantity;
        } else {
            require(_isSaleOngoing(), "unavailable");
        }

        require(
            blueprint.maxPurchaseAmount == 0 ||
                purchaseQuantity <= blueprint.maxPurchaseAmount,
            "cannot buy > maxPurchaseAmount in one tx"
        );

        _confirmPaymentAmountAndSettleSale(
            purchaseQuantity,
            tokenAmount,
            artist
        );
        _mintQuantity(purchaseQuantity, nftRecipient);
    }

    /**
     * @dev Purchase NFTs of blueprint to the sender
     * @param purchaseQuantity How many NFTs to purchase 
     * @param whitelistedQuantity How many NFTS are whitelisted for the blueprint 
     * @param tokenAmount Payment amount 
     * @param proof Merkle tree proof 
     */ 
    function purchaseBlueprints(
        uint32 purchaseQuantity,
        uint32 whitelistedQuantity,
        uint256 tokenAmount,
        bytes32[] calldata proof
    )
        external
        payable
        nonReentrant
        isQuantityAvailableForPurchase(purchaseQuantity)
    {
        if (_isWhitelistedAndPresale(whitelistedQuantity, proof)) {
            require(whitelistedPurchases[msg.sender] + purchaseQuantity <= whitelistedQuantity, "> whitelisted amount");
            whitelistedPurchases[msg.sender] += purchaseQuantity;
        } else {
            require(_isSaleOngoing(), "unavailable");
        }

        require(
            blueprint.maxPurchaseAmount == 0 ||
                purchaseQuantity <= blueprint.maxPurchaseAmount,
            "cannot buy > maxPurchaseAmount in one tx"
        );

        _confirmPaymentAmountAndSettleSale(
            purchaseQuantity,
            tokenAmount,
            artist
        );

        _mintQuantity(purchaseQuantity, msg.sender);
    }

    /**
     * @dev Lets the artist mint NFTs of the blueprint
     * @param quantity How many NFTs to mint
     */
    function artistMint(
        uint32 quantity
    )
        external
        nonReentrant 
    {
        address _artist = artist; // cache
        require(
            _isBlueprintPreparedAndNotStarted() || _isSaleOngoing(),
            "not pre/public sale"
        );
        require(
            minterAddress == msg.sender ||
                _artist == msg.sender,
            "unauthorized"
        );

        if (minterAddress == msg.sender) {
            require(
                quantity <= blueprint.mintAmountPlatform,
                "quantity >"
            );
            blueprint.mintAmountPlatform -= quantity;
        } else if (_artist == msg.sender) {
            require(
                quantity <= blueprint.mintAmountArtist,
                "quantity >"
            );
            blueprint.mintAmountArtist -= quantity;
        }
        _mintQuantity(quantity, msg.sender);
    }

    /**
     * @dev Mint a quantity of NFTs of blueprint to a recipient 
     * @param _quantity Quantity to mint
     * @param _nftRecipient Recipient of minted NFTs
     */
    function _mintQuantity(uint32 _quantity, address _nftRecipient) private {
        uint128 newTokenId = blueprint.erc721TokenIndex;
        uint64 newCap = blueprint.capacity;
        for (uint16 i; i < _quantity; i++) {
            require(newCap > 0, "quantity > cap");
            
            _mint(_nftRecipient, newTokenId + i);

            bytes32 prefixHash = keccak256(
                abi.encodePacked(
                    block.number,
                    block.timestamp,
                    block.coinbase,
                    newCap
                )
            );
            emit BlueprintMinted(
                artist,
                _nftRecipient,
                newTokenId + i,
                newCap,
                prefixHash
            );
            --newCap;
        }

        blueprint.erc721TokenIndex += _quantity;
        blueprint.capacity = newCap;
    }

    /**
     * @dev Pay for minting NFTs 
     * @param _quantity Quantity of NFTs to purchase
     * @param _tokenAmount Payment amount provided
     * @param _artist Artist of blueprint
     */
    function _confirmPaymentAmountAndSettleSale(
        uint32 _quantity,
        uint256 _tokenAmount,
        address _artist
    ) internal {
        address _erc20Token = blueprint.ERC20Token;
        uint128 _price = blueprint.price;
        if (_erc20Token == address(0)) {
            require(_tokenAmount == 0, "tokenAmount != 0");
            require(
                msg.value == _quantity * _price,
                "$ != expected"
            );
            _payFeesAndArtist(_erc20Token, msg.value, _artist);
        } else {
            require(msg.value == 0, "eth value != 0");
            require(
                _tokenAmount == _quantity * _price,
                "$ != expected"
            );

            IERC20(_erc20Token).transferFrom(
                msg.sender,
                address(this),
                _tokenAmount
            );
            _payFeesAndArtist(_erc20Token, _tokenAmount, _artist);
        }
    }

    ////////////////////////////////////
    ////// MERKLEROOT FUNCTIONS ////////
    ////////////////////////////////////

    /**
     * Create a merkle tree with address: quantity pairs as the leaves.
     * The msg.sender will be verified if it has a corresponding quantity value in the merkletree
     */

    /**
     * @dev Create a merkle tree with address: quantity pairs as the leaves.
     *      The msg.sender will be verified if it has a corresponding quantity value in the merkletree
     * @param account Minting account being verified
     * @param quantity Quantity to mint, being verified
     */ 
    function _leaf(address account, uint256 quantity)
        internal
        pure
        returns (bytes32)
    {
        return keccak256(abi.encodePacked(account, quantity));
    }

    /**
     * @dev Verify a leaf's inclusion in a merkle tree with its root and corresponding proof
     * @param leaf Leaf to verify
     * @param merkleroot Merkle tree's root
     * @param proof Corresponding proof for leaf
     */ 
    function _verify(
        bytes32 leaf,
        bytes32 merkleroot,
        bytes32[] memory proof
    ) internal pure returns (bool) {
        return MerkleProof.verify(proof, merkleroot, leaf);
    }

    ////////////////////////////
    /// ONLY ADMIN functions ///
    ////////////////////////////

    /**
     * @dev Update blueprint's token uri
     * @param newBaseTokenUri New base token uri to update to
     */ 
    function updateBlueprintTokenUri(
        string memory newBaseTokenUri
    ) external onlyRole(MINTER_ROLE) isBlueprintPrepared() {
        require(
            !blueprint.tokenUriLocked,
            "URI locked"
        );

        blueprint.baseTokenUri = newBaseTokenUri;

        emit BlueprintTokenUriUpdated(newBaseTokenUri);
    }

    /**
     * @dev Lock blueprint's token uri (from changing)
     */  
    function lockBlueprintTokenUri()
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
        isBlueprintPrepared()
    {
        require(
            !blueprint.tokenUriLocked,
            "URI locked"
        );

        blueprint.tokenUriLocked = true;
    }

    /**
     * @dev Return token's uri
     * @param tokenId ID of token to return uri for
     * @return Token uri, constructed by taking base uri of blueprint, and concatenating token id
     */ 
    function tokenURI(uint256 tokenId)
        public
        view
        virtual
        override
        returns (string memory)
    {
        require(
            _exists(tokenId),
            "URI query for nonexistent token"
        );

        string memory baseURI = blueprint.baseTokenUri;
        return
            bytes(baseURI).length > 0
                ? string(
                    abi.encodePacked(
                        baseURI,
                        "/",
                        tokenId.toString(),
                        "/",
                        "token.json"
                    )
                )
                : "";
    }

    /**
     * @dev Reveal blueprint's seed by emitting public event 
     * @param randomSeed Revealed seed 
     */
    function revealBlueprintSeed(string memory randomSeed)
        external
        onlyRole(MINTER_ROLE)
        isBlueprintPrepared()
    {
        emit BlueprintSeed(randomSeed);
    }

    /**
     * @dev Set the contract-wide recipient of primary sale feess
     * @param _asyncSaleFeesRecipient New async sale fees recipient 
     */
    function setAsyncFeeRecipient(address _asyncSaleFeesRecipient)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        asyncSaleFeesRecipient = _asyncSaleFeesRecipient;
    }

    /**
     * @dev Change the default percentage of primary sales sent to platform
     * @param _basisPoints New default platform primary fee percentage (in basis points)
     */   
    function changeDefaultPlatformPrimaryFeePercentage(uint32 _basisPoints)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(_basisPoints <= 10000);
        defaultPlatformPrimaryFeePercentage = _basisPoints;
    }

    /**
     * @dev Update royalty config
     * @param _royaltyParameters New royalty parameters
     */  
    function updateRoyaltyParameters(RoyaltyParameters calldata _royaltyParameters) 
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
        validRoyaltyParameters(_royaltyParameters)
    {
        royaltyParameters = _royaltyParameters; 
    }

    /**
     * @dev Update contract-wide platform address, and DEFAULT_ADMIN role ownership
     * @param _platform New platform address
     */   
    function updatePlatformAddress(address _platform)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        grantRole(DEFAULT_ADMIN_ROLE, _platform);

        revokeRole(DEFAULT_ADMIN_ROLE, platform);
        platform = _platform;
    }

    /**
     * @dev Update contract-wide minter address, and MINTER_ROLE role ownership
     * @param newMinterAddress New minter address
     */ 
    function updateMinterAddress(address newMinterAddress)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        grantRole(MINTER_ROLE, newMinterAddress);

        revokeRole(MINTER_ROLE, minterAddress);
        minterAddress = newMinterAddress;
    }

    ////////////////////////////////////
    /// Secondary Fees implementation //
    ////////////////////////////////////

    /**
     * @dev Pay primary fees owed to primary fee recipients
     * @param _erc20Token ERC20 token used for payment (if used)
     * @param _amount Payment amount 
     * @param _artist Artist being paid
     */
    function _payFeesAndArtist(
        address _erc20Token,
        uint256 _amount,
        address _artist
    ) internal {
        address[] memory _primaryFeeRecipients = getPrimaryFeeRecipients();
        uint32[] memory _primaryFeeBPS = getPrimaryFeeBps();
        uint256 feesPaid;

        for (uint256 i; i < _primaryFeeRecipients.length; i++) {
            uint256 fee = (_amount * _primaryFeeBPS[i])/10000;
            feesPaid = feesPaid + fee;
            _payout(_primaryFeeRecipients[i], _erc20Token, fee);
        }
        if (_amount - feesPaid > 0) {
            _payout(_artist, _erc20Token, (_amount - feesPaid));
        }
    }

    /**
     * @dev Simple payment function to pay an amount of currency to a recipient
     * @param _recipient Recipient of payment 
     * @param _erc20Token ERC20 token used for payment (if used)
     * @param _amount Payment amount 
     */
    function _payout(
        address _recipient,
        address _erc20Token,
        uint256 _amount
    ) internal {
        if (_erc20Token != address(0)) {
            IERC20(_erc20Token).transfer(_recipient, _amount);
        } else {
            // attempt to send the funds to the recipient
            (bool success, ) = payable(_recipient).call{
                value: _amount,
                gas: 20000
            }("");
            // if it failed, update their credit balance so they can pull it later
            if (!success) {
                failedTransferCredits[_recipient] =
                    failedTransferCredits[_recipient] +
                    _amount;
            }
        }
    }

    /**
     * @dev When a native gas token payment fails, credits are stored so that the would-be recipient can withdraw them later.
     *      Withdraw failed credits for a recipient
     * @param recipient Recipient owed some amount of native gas token   
     */
    function withdrawAllFailedCredits(address payable recipient) external {
        uint256 amount = failedTransferCredits[msg.sender];

        require(amount != 0, "no credits to withdraw");

        failedTransferCredits[msg.sender] = 0;

        (bool successfulWithdraw, ) = recipient.call{value: amount, gas: 20000}(
            ""
        );
        require(successfulWithdraw, "withdraw failed");
    }

    /**
     * @dev Get primary fee recipients of blueprint 
     */ 
    function getPrimaryFeeRecipients()
        public
        view
        returns (address[] memory)
    {
        if (blueprint.feeRecipientInfo.primaryFeeRecipients.length == 0) {
            address[] memory primaryFeeRecipients = new address[](1);
            primaryFeeRecipients[0] = (asyncSaleFeesRecipient);
            return primaryFeeRecipients;
        } else {
            return blueprint.feeRecipientInfo.primaryFeeRecipients;
        }
    }

    /**
     * @dev Get primary fee bps (allocations) of blueprint 
     */
    function getPrimaryFeeBps()
        public
        view
        returns (uint32[] memory)
    {
        if (blueprint.feeRecipientInfo.primaryFeeBPS.length == 0) {
            uint32[] memory primaryFeeBPS = new uint32[](1);
            primaryFeeBPS[0] = defaultPlatformPrimaryFeePercentage;

            return primaryFeeBPS;
        } else {
            return blueprint.feeRecipientInfo.primaryFeeBPS;
        }
    }

    /**
     * @dev Get secondary fee recipients of a token 
     * @param tokenId Token ID
     */
    function getFeeRecipients(uint256 tokenId)
        public
        view
        override
        returns (address[] memory)
    {
        address[] memory feeRecipients = new address[](1);
        feeRecipients[0] = royaltyParameters.split;
        return feeRecipients;
    }

    /**
     * @dev Get secondary fee bps (allocations) of a token 
     * @param tokenId Token ID
     */
    function getFeeBps(uint256 tokenId)
        public
        view
        override
        returns (uint32[] memory)
    {
        uint32[] memory feeBps = new uint32[](1);
        feeBps[0] = royaltyParameters.royaltyCutBPS;
        return feeBps;
    }

    /**
     * @dev Support ERC-2981
     * @param _tokenId ID of token to return royalty for
     * @param _salePrice Price that NFT was sold at
     * @return receiver Royalty split
     * @return royaltyAmount Amount to send to royalty split
     */
    function royaltyInfo(
        uint256 _tokenId,
        uint256 _salePrice
    ) external view returns (
        address receiver,
        uint256 royaltyAmount
    ) {
        receiver = royaltyParameters.split;
        royaltyAmount = _salePrice * royaltyParameters.royaltyCutBPS / 10000;
    }

    /**
     * @dev Used for interoperability purposes
     * @return Returns platform address as owner of contract 
     */
    function owner() public view virtual returns (address) {
        return platform;
    }

    ////////////////////////////////////
    /// Required function overide //////
    ////////////////////////////////////

    /**
     * @dev Override isApprovedForAll to also let the DEFAULT_ADMIN_ROLE move tokens
     * @param account Account holding tokens being moved
     * @param operator Operator moving tokens
     */
    function isApprovedForAll(address account, address operator)
        public
        view
        override
        returns (bool)
    {
        return
            super.isApprovedForAll(account, operator) ||
            hasRole(DEFAULT_ADMIN_ROLE, operator);
    }

    /**
     * @dev ERC165 - Validate that the contract supports a interface
     * @param interfaceId ID of interface being validated 
     * @return Returns true if contract supports interface
     */
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(
            ERC721Upgradeable,
            ERC165StorageUpgradeable,
            AccessControlEnumerableUpgradeable
        )
        returns (bool)
    {
        return
            interfaceId == type(HasSecondarySaleFees).interfaceId ||
            ERC721Upgradeable.supportsInterface(interfaceId) ||
            ERC165StorageUpgradeable.supportsInterface(interfaceId) ||
            AccessControlEnumerableUpgradeable.supportsInterface(interfaceId);
    }

    /////////////////////////////////////////////////
    /// Required for OpenSea Operator Registry //////
    /////////////////////////////////////////////////

    // Custom Error Type For Operator Registry Methods
    error OperatorNotAllowed(address operator);

    /**
     * @dev Restrict operators who are allowed to transfer these tokens
     */
    modifier onlyAllowedOperator(address from) {
        if (from != msg.sender) {
            _checkFilterOperator(msg.sender);
        }
        _;
    }

    /**
     * @dev Restrict operators who are allowed to approve transfer delegates
     */
    modifier onlyAllowedOperatorApproval(address operator) {
        _checkFilterOperator(operator);
        _;
    }

    /**
     * @notice Register this contract with the OpenSea operator registry. Subscribe to OpenSea's operator blacklist.
     */
    function registerWithOpenSeaOperatorRegistry() public {
        require(
            owner() == msg.sender || artist == msg.sender,
            "unauthorized"
        );
        IOperatorFilterRegistry registry = operatorFilterRegistry;
        require(address(registry) != address(0), "attempt register to zero addr");
        registry.registerAndSubscribe(address(this), 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);
    }

    /**
     * @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
     *         address, checks will be bypassed.
     */
    function updateOperatorFilterRegistryAddress(address newRegistry) public {
        require(
            owner() == msg.sender || artist == msg.sender,
            "unauthorized"
        );
        operatorFilterRegistry = IOperatorFilterRegistry(newRegistry);
    }

    /**
     * @notice Update the address that the contract will make OperatorFilter checks against. Also register this contract with that registry.
     */
    function updateOperatorFilterAndRegister(address newRegistry) public {
        updateOperatorFilterRegistryAddress(newRegistry);
        registerWithOpenSeaOperatorRegistry();
    }

    /**
     * @dev Check if operator can perform an action
     */
    function _checkFilterOperator(address operator) internal view {
        IOperatorFilterRegistry registry = operatorFilterRegistry;
        // Check registry code length to facilitate testing in environments without a deployed registry.
        if (address(registry) != address(0) && address(registry).code.length > 0) {
            if (!registry.isOperatorAllowed(address(this), operator)) {
                revert OperatorNotAllowed(operator);
            }
        }
    }

    // Override 721 Methods to restrict non-royalty enforcing operators
    function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
        super.setApprovalForAll(operator, approved);
    }

    function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {
        super.approve(operator, tokenId);
    }

    function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) {
        super.transferFrom(from, to, tokenId);
    }

    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
        public
        override
        onlyAllowedOperator(from)
    {
        super.safeTransferFrom(from, to, tokenId, data);
    }
}

File 2 of 23 : HasSecondarySaleFees.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165StorageUpgradeable.sol";

abstract contract HasSecondarySaleFees is ERC165StorageUpgradeable {
    event SecondarySaleFees(
        uint256 tokenId,
        address[] recipients,
        uint256[] bps
    );

    /*
     * bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f
     * bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb
     *
     * => 0x0ebd4c7f ^ 0xb9c4d9fb == 0xb7799584
     */
    bytes4 private constant _INTERFACE_ID_FEES = 0xb7799584;

    function _initialize() public initializer {
        _registerInterface(_INTERFACE_ID_FEES);
    }

    function getFeeRecipients(uint256 id)
        public
        view
        virtual
        returns (address[] memory);

    function getFeeBps(uint256 id)
        public
        view
        virtual
        returns (uint32[] memory);
}

File 3 of 23 : IBlueprintTypes.sol
//SPDX-License-Identifier: Unlicense
pragma solidity 0.8.4; 

/**
 * @dev Interface used to share common types between AsyncArt Blueprints contracts
 * @author Ohimire Labs
 */
interface IBlueprintTypes {
    /**
     * @dev Core administrative accounts 
     * @param platform Platform, holder of DEFAULT_ADMIN role
     * @param minter Minter, holder of MINTER_ROLE
     * @param asyncSaleFeesRecipient Recipient of primary sale fees going to platform
     */
    struct Admins {
        address platform;
        address minter;
        address asyncSaleFeesRecipient;
    } 

    /**
     * @dev Object passed in when preparing blueprint 
     * @param _capacity Number of NFTs in Blueprint 
     * @param _price Price per NFT in Blueprint
     * @param _erc20Token Address of ERC20 currency required to buy NFTs, can be zero address if expected currency is native gas token 
     * @param _blueprintMetaData Blueprint metadata uri
     * @param _baseTokenUri Base URI for token, resultant uri for each token is base uri concatenated with token id
     * @param _merkleroot Root of Merkle tree holding whitelisted accounts 
     * @param _mintAmountArtist Amount of NFTs of Blueprint mintable by artist
     * @param _mintAmountPlatform Amount of NFTs of Blueprint mintable by platform 
     * @param _maxPurchaseAmount Max number of NFTs purchasable in a single transaction
     * @param _saleEndTimestamp Timestamp when the sale ends 
     */ 
    struct BlueprintPreparationConfig {
        uint64 _capacity;
        uint128 _price;
        address _erc20Token;
        string _blueprintMetaData;
        string _baseTokenUri;
        bytes32 _merkleroot;
        uint32 _mintAmountArtist;
        uint32 _mintAmountPlatform;
        uint64 _maxPurchaseAmount;
        uint128 _saleEndTimestamp;
    }

    /**
     * @dev Object holding primary fee data
     * @param primaryFeeBPS Primary fee percentage allocations, in basis points
     * @param primaryFeeRecipients Primary fee recipients 
     */
    struct PrimaryFees {
        uint32[] primaryFeeBPS;
        address[] primaryFeeRecipients;
    }
}

File 4 of 23 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC721Upgradeable.sol";
import "./IERC721ReceiverUpgradeable.sol";
import "./extensions/IERC721MetadataUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/StringsUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
    using AddressUpgradeable for address;
    using StringsUpgradeable for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

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

    /**
     * @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 initializer {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __ERC721_init_unchained(name_, symbol_);
    }

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

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

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

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        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 {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721Upgradeable.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 {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //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 {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        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) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @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 = ERC721Upgradeable.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 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @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 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

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

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @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 {
        address owner = ERC721Upgradeable.ownerOf(tokenId);

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

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

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(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(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

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

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

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

    /**
     * @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 virtual {}
    uint256[44] private __gap;
}

File 5 of 23 : AccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {
    function __AccessControlEnumerable_init() internal initializer {
        __Context_init_unchained();
        __ERC165_init_unchained();
        __AccessControl_init_unchained();
        __AccessControlEnumerable_init_unchained();
    }

    function __AccessControlEnumerable_init_unchained() internal initializer {
    }
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;

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

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {grantRole} to track enumerable memberships
     */
    function grantRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) {
        super.grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {revokeRole} to track enumerable memberships
     */
    function revokeRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) {
        super.revokeRole(role, account);
        _roleMembers[role].remove(account);
    }

    /**
     * @dev Overload {renounceRole} to track enumerable memberships
     */
    function renounceRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) {
        super.renounceRole(role, account);
        _roleMembers[role].remove(account);
    }

    /**
     * @dev Overload {_setupRole} to track enumerable memberships
     */
    function _setupRole(bytes32 role, address account) internal virtual override {
        super._setupRole(role, account);
        _roleMembers[role].add(account);
    }
    uint256[49] private __gap;
}

File 6 of 23 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 7 of 23 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 *
 * 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.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        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 proved to be a part of a Merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * _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}
     *
     * _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 the sibling nodes in `proof`,
     * consuming from one or the other at each step according to the instructions given by
     * `proofFlags`.
     *
     * _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}
     *
     * _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 8 of 23 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 9 of 23 : IOperatorFilterRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;

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 10 of 23 : ERC165StorageUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Storage based implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165StorageUpgradeable is Initializable, ERC165Upgradeable {
    function __ERC165Storage_init() internal initializer {
        __ERC165_init_unchained();
        __ERC165Storage_init_unchained();
    }

    function __ERC165Storage_init_unchained() internal initializer {
    }
    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

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

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
    uint256[49] private __gap;
}

File 11 of 23 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

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

    function __ERC165_init_unchained() internal initializer {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }
    uint256[50] private __gap;
}

File 12 of 23 : Initializable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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 a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 13 of 23 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT

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 14 of 23 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 15 of 23 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT

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 `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 16 of 23 : IERC721MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT

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 17 of 23 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

File 18 of 23 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

File 19 of 23 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

File 20 of 23 : IAccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

File 21 of 23 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";

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

    function __AccessControl_init_unchained() internal initializer {
    }
    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, _msgSender());
        _;
    }

    /**
     * @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 override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @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 {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(uint160(account), 20),
                        " 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 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.
     */
    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.
     */
    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 granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    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.
     *
     * [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}.
     * ====
     */
    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);
    }

    function _grantRole(bytes32 role, address account) private {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
    uint256[49] private __gap;
}

File 22 of 23 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }
}

File 23 of 23 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT

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

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"artist","type":"address"},{"indexed":false,"internalType":"address","name":"purchaser","type":"address"},{"indexed":false,"internalType":"uint128","name":"tokenId","type":"uint128"},{"indexed":false,"internalType":"uint64","name":"newCapacity","type":"uint64"},{"indexed":false,"internalType":"bytes32","name":"seedPrefix","type":"bytes32"}],"name":"BlueprintMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"artist","type":"address"},{"indexed":false,"internalType":"uint64","name":"capacity","type":"uint64"},{"indexed":false,"internalType":"string","name":"blueprintMetaData","type":"string"},{"indexed":false,"internalType":"string","name":"baseTokenUri","type":"string"}],"name":"BlueprintPrepared","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"randomSeed","type":"string"}],"name":"BlueprintSeed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newBaseTokenUri","type":"string"}],"name":"BlueprintTokenUriUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","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":"SalePaused","type":"event"},{"anonymous":false,"inputs":[],"name":"SaleStarted","type":"event"},{"anonymous":false,"inputs":[],"name":"SaleUnpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"recipients","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"bps","type":"uint256[]"}],"name":"SecondarySaleFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"artist","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"quantity","type":"uint32"}],"name":"artistMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"asyncSaleFeesRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beginSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"blueprint","outputs":[{"internalType":"uint32","name":"mintAmountArtist","type":"uint32"},{"internalType":"uint32","name":"mintAmountPlatform","type":"uint32"},{"internalType":"uint64","name":"capacity","type":"uint64"},{"internalType":"uint64","name":"erc721TokenIndex","type":"uint64"},{"internalType":"uint64","name":"maxPurchaseAmount","type":"uint64"},{"internalType":"uint128","name":"saleEndTimestamp","type":"uint128"},{"internalType":"uint128","name":"price","type":"uint128"},{"internalType":"bool","name":"tokenUriLocked","type":"bool"},{"internalType":"address","name":"ERC20Token","type":"address"},{"internalType":"string","name":"baseTokenUri","type":"string"},{"internalType":"bytes32","name":"merkleroot","type":"bytes32"},{"internalType":"enum CreatorBlueprintsOwnershipTransferred.SaleState","name":"saleState","type":"uint8"},{"components":[{"internalType":"uint32[]","name":"primaryFeeBPS","type":"uint32[]"},{"internalType":"address[]","name":"primaryFeeRecipients","type":"address[]"}],"internalType":"struct IBlueprintTypes.PrimaryFees","name":"feeRecipientInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_basisPoints","type":"uint32"}],"name":"changeDefaultPlatformPrimaryFeePercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultPlatformPrimaryFeePercentage","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getFeeBps","outputs":[{"internalType":"uint32[]","name":"","type":"uint32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getFeeRecipients","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrimaryFeeBps","outputs":[{"internalType":"uint32[]","name":"","type":"uint32[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPrimaryFeeRecipients","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":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"contractURI","type":"string"},{"internalType":"address","name":"artist","type":"address"}],"internalType":"struct CreatorBlueprintsOwnershipTransferred.CreatorBlueprintsInput","name":"creatorBlueprintsInput","type":"tuple"},{"components":[{"internalType":"address","name":"platform","type":"address"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"address","name":"asyncSaleFeesRecipient","type":"address"}],"internalType":"struct IBlueprintTypes.Admins","name":"creatorBlueprintsAdmins","type":"tuple"},{"components":[{"internalType":"address","name":"split","type":"address"},{"internalType":"uint32","name":"royaltyCutBPS","type":"uint32"}],"internalType":"struct CreatorBlueprintsOwnershipTransferred.RoyaltyParameters","name":"_royaltyParameters","type":"tuple"},{"internalType":"address","name":"extraMinter","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestErc721TokenIndex","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockBlueprintTokenUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minterAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"pauseSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"platform","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"_capacity","type":"uint64"},{"internalType":"uint128","name":"_price","type":"uint128"},{"internalType":"address","name":"_erc20Token","type":"address"},{"internalType":"string","name":"_blueprintMetaData","type":"string"},{"internalType":"string","name":"_baseTokenUri","type":"string"},{"internalType":"bytes32","name":"_merkleroot","type":"bytes32"},{"internalType":"uint32","name":"_mintAmountArtist","type":"uint32"},{"internalType":"uint32","name":"_mintAmountPlatform","type":"uint32"},{"internalType":"uint64","name":"_maxPurchaseAmount","type":"uint64"},{"internalType":"uint128","name":"_saleEndTimestamp","type":"uint128"}],"internalType":"struct IBlueprintTypes.BlueprintPreparationConfig","name":"config","type":"tuple"},{"components":[{"internalType":"uint32[]","name":"primaryFeeBPS","type":"uint32[]"},{"internalType":"address[]","name":"primaryFeeRecipients","type":"address[]"}],"internalType":"struct IBlueprintTypes.PrimaryFees","name":"_feeRecipientInfo","type":"tuple"}],"name":"prepareBlueprint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"purchaseQuantity","type":"uint32"},{"internalType":"uint32","name":"whitelistedQuantity","type":"uint32"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"purchaseBlueprints","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint32","name":"purchaseQuantity","type":"uint32"},{"internalType":"uint32","name":"whitelistedQuantity","type":"uint32"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"address","name":"nftRecipient","type":"address"}],"name":"purchaseBlueprintsTo","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"registerWithOpenSeaOperatorRegistry","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":"string","name":"randomSeed","type":"string"}],"name":"revealBlueprintSeed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyParameters","outputs":[{"internalType":"address","name":"split","type":"address"},{"internalType":"uint32","name":"royaltyCutBPS","type":"uint32"}],"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":"address","name":"_asyncSaleFeesRecipient","type":"address"}],"name":"setAsyncFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32[]","name":"primaryFeeBPS","type":"uint32[]"},{"internalType":"address[]","name":"primaryFeeRecipients","type":"address[]"}],"internalType":"struct IBlueprintTypes.PrimaryFees","name":"_feeRecipientInfo","type":"tuple"}],"name":"setFeeRecipients","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newArtist","type":"address"}],"name":"updateBlueprintArtist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_newCapacity","type":"uint64"},{"internalType":"uint64","name":"_newLatestErc721TokenIndex","type":"uint64"}],"name":"updateBlueprintCapacity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_newMerkleroot","type":"bytes32"}],"name":"updateBlueprintMerkleroot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newBaseTokenUri","type":"string"}],"name":"updateBlueprintTokenUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newMinterAddress","type":"address"}],"name":"updateMinterAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newRegistry","type":"address"}],"name":"updateOperatorFilterAndRegister","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newRegistry","type":"address"}],"name":"updateOperatorFilterRegistryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_platform","type":"address"}],"name":"updatePlatformAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"split","type":"address"},{"internalType":"uint32","name":"royaltyCutBPS","type":"uint32"}],"internalType":"struct CreatorBlueprintsOwnershipTransferred.RoyaltyParameters","name":"_royaltyParameters","type":"tuple"}],"name":"updateRoyaltyParameters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"recipient","type":"address"}],"name":"withdrawAllFailedCredits","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50600161012d55615c8280620000276000396000f3fe6080604052600436106102c85760003560e01c806301ffc9a7146102cd57806306fdde0314610302578063081812fc14610324578063095ea7b3146103515780630ebd4c7f146103735780632210a6a1146103a057806322235d69146103c057806323b872dd146103f357806324297d5314610413578063248a9ca31461043357806324938096146104615780632a55205a146104765780632f2ff15d146104a45780632fcfb95a146104c457806334d722c9146104e457806336568abe146105055780633c33767e146105255780633f3174451461054557806342842e0e1461056557806343bc16121461058557806346830c4b146105a65780634bde38c8146105bb5780634d073a5a146105dc57806355367ba91461061c5780635868fbea146106315780636352211e1461064657806366d8a9f114610666578063672df8b01461068657806369956a11146106995780636f64388d146106b957806370a08231146106d95780637aee9dba146106f95780637cc35f771461071957806380ae4ebc1461072c5780638da5cb5b146107415780638f9f193f146107565780639010d07c1461077657806391d1485414610796578063936a6042146107b657806395d89b41146107d6578063a068deed146107eb578063a217fddf1461080d578063a22cb46514610822578063aec970b014610842578063af45abb614610862578063b0588541146108b6578063b0ccc31e146108cb578063b88d4fde146108ec578063b8d1e5321461090c578063b9c4d9fb1461092c578063bb33d7291461094c578063c05efa1514610961578063c87b56dd1461098f578063c90941b1146109af578063ca15c873146109cf578063d5391393146109ef578063d547741f14610a11578063deb9414814610a31578063e0781a0814610a59578063e8a3d48514610a79578063e985e9c514610a8e578063fce212f314610aae578063fe63e75714610ace575b600080fd5b3480156102d957600080fd5b506102ed6102e8366004614e5a565b610aee565b60405190151581526020015b60405180910390f35b34801561030e57600080fd5b50610317610b37565b6040516102f991906154de565b34801561033057600080fd5b5061034461033f366004614dfd565b610bc9565b6040516102f99190615353565b34801561035d57600080fd5b5061037161036c366004614db6565b610c56565b005b34801561037f57600080fd5b5061039361038e366004614dfd565b610c6f565b6040516102f991906154cb565b3480156103ac57600080fd5b506103716103bb366004614c79565b610ce4565b3480156103cc57600080fd5b5061012e546103de9063ffffffff1681565b60405163ffffffff90911681526020016102f9565b3480156103ff57600080fd5b5061037161040e366004614ccd565b610cf8565b34801561041f57600080fd5b5061037161042e366004614c79565b610d23565b34801561043f57600080fd5b5061045361044e366004614dfd565b610d60565b6040519081526020016102f9565b34801561046d57600080fd5b50610371610d75565b34801561048257600080fd5b50610496610491366004614e39565b610e6f565b6040516102f99291906153be565b3480156104b057600080fd5b506103716104bf366004614e15565b610eaf565b3480156104d057600080fd5b506103716104df366004614c79565b610ed1565b3480156104f057600080fd5b5061013054610344906001600160a01b031681565b34801561051157600080fd5b50610371610520366004614e15565b610f3f565b34801561053157600080fd5b50610371610540366004614fbd565b610f61565b34801561055157600080fd5b50610371610560366004615031565b611034565b34801561057157600080fd5b50610371610580366004614ccd565b61121c565b34801561059157600080fd5b5061013154610344906001600160a01b031681565b3480156105b257600080fd5b50610371611237565b3480156105c757600080fd5b5061012f54610344906001600160a01b031681565b3480156105e857600080fd5b5061012e5461060490600160201b90046001600160401b031681565b6040516001600160401b0390911681526020016102f9565b34801561062857600080fd5b50610371611346565b34801561063d57600080fd5b506103936113d8565b34801561065257600080fd5b50610344610661366004614dfd565b6114ca565b34801561067257600080fd5b50610371610681366004614fef565b611541565b61037161069436600461504d565b611580565b3480156106a557600080fd5b506103716106b4366004614e92565b611734565b3480156106c557600080fd5b506103716106d4366004614ed7565b6117ce565b3480156106e557600080fd5b506104536106f4366004614c79565b6119af565b34801561070557600080fd5b50610371610714366004614dfd565b611a36565b6103716107273660046150bd565b611a56565b34801561073857600080fd5b50610371611c0b565b34801561074d57600080fd5b50610344611c86565b34801561076257600080fd5b50610371610771366004614c79565b611c96565b34801561078257600080fd5b50610344610791366004614e39565b611cea565b3480156107a257600080fd5b506102ed6107b1366004614e15565b611d09565b3480156107c257600080fd5b506103716107d1366004614f3f565b611d34565b3480156107e257600080fd5b50610317612093565b3480156107f757600080fd5b506108006120a2565b6040516102f991906154b8565b34801561081957600080fd5b50610453600081565b34801561082e57600080fd5b5061037161083d366004614d89565b612181565b34801561084e57600080fd5b5061037161085d366004614c79565b612195565b34801561086e57600080fd5b5061013b54610892906001600160a01b03811690600160a01b900463ffffffff1682565b604080516001600160a01b03909316835263ffffffff9091166020830152016102f9565b3480156108c257600080fd5b506103716121cb565b3480156108d757600080fd5b5061013e54610344906001600160a01b031681565b3480156108f857600080fd5b50610371610907366004614d0d565b612252565b34801561091857600080fd5b50610371610927366004614c79565b612278565b34801561093857600080fd5b50610800610947366004614dfd565b6122e0565b34801561095857600080fd5b50610371612353565b34801561096d57600080fd5b50610976612438565b6040516102f99d9c9b9a9998979695949392919061578b565b34801561099b57600080fd5b506103176109aa366004614dfd565b61263d565b3480156109bb57600080fd5b506103716109ca366004614c79565b612776565b3480156109db57600080fd5b506104536109ea366004614dfd565b612874565b3480156109fb57600080fd5b50610453600080516020615c0d83398151915281565b348015610a1d57600080fd5b50610371610a2c366004614e15565b61288b565b348015610a3d57600080fd5b5061012e5461034490600160601b90046001600160a01b031681565b348015610a6557600080fd5b50610371610a74366004614e92565b612895565b348015610a8557600080fd5b5061031761295c565b348015610a9a57600080fd5b506102ed610aa9366004614c95565b6129eb565b348015610aba57600080fd5b50610371610ac9366004615031565b612a27565b348015610ada57600080fd5b50610371610ae9366004615159565b612a66565b60006001600160e01b031982166306fafb6760e31b1480610b135750610b1382612b24565b80610b225750610b2282612b74565b80610b315750610b3182612ba5565b92915050565b606060658054610b4690615a9d565b80601f0160208091040260200160405190810160405280929190818152602001828054610b7290615a9d565b8015610bbf5780601f10610b9457610100808354040283529160200191610bbf565b820191906000526020600020905b815481529060010190602001808311610ba257829003601f168201915b5050505050905090565b6000610bd482612bca565b610c3a5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152606960205260409020546001600160a01b031690565b81610c6081612be7565b610c6a8383612caf565b505050565b60408051600180825281830190925260609160009190602080830190803683370190505061013b548151919250600160a01b900463ffffffff16908290600090610cc957634e487b7160e01b600052603260045260246000fd5b63ffffffff9092166020928302919091019091015292915050565b610ced81612278565b610cf5611237565b50565b826001600160a01b0381163314610d1257610d1233612be7565b610d1d848484612dbb565b50505050565b600080516020615c0d833981519152610d3c8133612dec565b5061013180546001600160a01b0319166001600160a01b0392909216919091179055565b600090815260c9602052604090206001015490565b600080516020615c0d833981519152610d8e8133612dec565b610134546001600160801b0316610da481612e50565b610dc05760405162461bcd60e51b8152600401610c319061576c565b60016101385460ff166003811115610de857634e487b7160e01b600052602160045260246000fd5b14610e345760405162461bcd60e51b815260206004820152601c60248201527b1cd85b19481cdd185c9d1959081bdc881b9bdd081c1c995c185c995960221b6044820152606401610c31565b610138805460ff191660021790556040517f912ee23dde46ec889d6748212cce445d667f7041597691dc89e8549ad8bc0acb90600090a15050565b61013b546001600160a01b0381169060009061271090610e9c90600160a01b900463ffffffff16856159d0565b610ea6919061598d565b90509250929050565b610eb98282612e72565b600082815260fb60205260409020610c6a9082612e8f565b6000610edd8133612dec565b610ef5600080516020615c0d83398151915283610eaf565b61013054610f1b90600080516020615c0d833981519152906001600160a01b031661288b565b5061013080546001600160a01b0319166001600160a01b0392909216919091179055565b610f498282612ea4565b600082815260fb60205260409020610c6a9082612f1e565b600080516020615c0d833981519152610f7a8133612dec565b60006101385460ff166003811115610fa257634e487b7160e01b600052602160045260246000fd5b1415610fe15760405162461bcd60e51b815260206004820152600e60248201526d1b995d995c881c1c995c185c995960921b6044820152606401610c31565b610ff382602001518360000151612f33565b15611030578151805183916101399161101391839160209091019061485a565b50602082810151805161102c9260018501920190614909565b5050505b5050565b600261012d5414156110585760405162461bcd60e51b8152600401610c3190615735565b600261012d55610131546001600160a01b031661107361300f565b80611081575061108161303f565b6110c35760405162461bcd60e51b81526020600482015260136024820152726e6f74207072652f7075626c69632073616c6560681b6044820152606401610c31565b610130546001600160a01b03163314806110e557506001600160a01b03811633145b6111015760405162461bcd60e51b8152600401610c319061566c565b610130546001600160a01b031633141561118f576101335463ffffffff600160201b909104811690831611156111495760405162461bcd60e51b8152600401610c3190615711565b610133805483919060049061116c908490600160201b900463ffffffff16615a06565b92506101000a81548163ffffffff021916908363ffffffff160217905550611208565b6001600160a01b038116331415611208576101335463ffffffff90811690831611156111cd5760405162461bcd60e51b8152600401610c3190615711565b61013380548391906000906111e990849063ffffffff16615a06565b92506101000a81548163ffffffff021916908363ffffffff1602179055505b611212823361308c565b5050600161012d55565b610c6a83838360405180602001604052806000815250612252565b33611240611c86565b6001600160a01b031614806112605750610131546001600160a01b031633145b61127c5760405162461bcd60e51b8152600401610c319061566c565b61013e546001600160a01b0316806112d65760405162461bcd60e51b815260206004820152601d60248201527f617474656d707420726567697374657220746f207a65726f20616464720000006044820152606401610c31565b604051633e9f1edf60e11b81526001600160a01b03821690637d3e3dbe90611318903090733cc6cdda760b79bafa08df41ecfa224f810dceb690600401615367565b600060405180830381600087803b15801561133257600080fd5b505af115801561102c573d6000803e3d6000fd5b600080516020615c0d83398151915261135f8133612dec565b61136761303f565b61139e5760405162461bcd60e51b8152602060048201526008602482015267216f6e676f696e6760c01b6044820152606401610c31565b610138805460ff191660031790556040517f8a98cbd0cab14e33b8a5e5710b9b59bceec8af9a5b4b3bb32fb275cf04ea048d90600090a150565b6101395460609061144b5760408051600180825281830190925260009160208083019080368337505061012e54825192935063ffffffff169183915060009061143157634e487b7160e01b600052603260045260246000fd5b63ffffffff90921660209283029190910190910152919050565b610139805460408051602080840282018101909252828152929190830182828015610bbf57602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116114845790505050505050905090565b6000818152606760205260408120546001600160a01b031680610b315760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610c31565b600061154d8133612dec565b816127106115616040830160208401615031565b63ffffffff16111561157257600080fd5b8261013b61102c8282615b65565b600261012d5414156115a45760405162461bcd60e51b8152600401610c3190615735565b600261012d5561013354859063ffffffff8216600160401b9091046001600160401b031610156115e65760405162461bcd60e51b8152600401610c3190615711565b6115f18584846132b4565b156116895733600090815261013d602052604090205463ffffffff8087169161161c9189911661594c565b63ffffffff1611156116405760405162461bcd60e51b8152600401610c31906156e3565b33600090815261013d60205260408120805488929061166690849063ffffffff1661594c565b92506101000a81548163ffffffff021916908363ffffffff1602179055506116ad565b61169161303f565b6116ad5760405162461bcd60e51b8152600401610c31906155d2565b61013354600160c01b90046001600160401b031615806116e6575061013354600160c01b90046001600160401b031663ffffffff871611155b6117025760405162461bcd60e51b8152600401610c319061558a565b6101315461171c90879086906001600160a01b0316613368565b611726863361308c565b5050600161012d5550505050565b600080516020615c0d83398151915261174d8133612dec565b60006101385460ff16600381111561177557634e487b7160e01b600052602160045260246000fd5b14156117935760405162461bcd60e51b8152600401610c31906154f1565b7f35dbfe7897df4ba6ece8892d34d15a0ab1cab571a22f5c9bf3dd71440842fcc3826040516117c291906154de565b60405180910390a15050565b600080516020615c0d8339815191526117e78133612dec565b60006101385460ff16600381111561180f57634e487b7160e01b600052602160045260246000fd5b1461184f5760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c1c995c185c995960821b6044820152606401610c31565b61185c602084018461513f565b61013380546001600160401b0392909216600160401b02600160401b600160801b0319909216919091179055611898604084016020850161500a565b61013480546001600160801b03928316600160801b0292169190911790556119596118c96060850160408601614c79565b6118d6608086018661584a565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050505060a086013561191f60e0880160c08901615031565b611930610100890160e08a01615031565b6119426101208a016101008b0161513f565b6119546101408b016101208c0161500a565b613525565b6119a3611969606085018561584a565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061360392505050565b610c6a61054083615a2b565b60006001600160a01b038216611a1a5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610c31565b506001600160a01b031660009081526068602052604090205490565b600080516020615c0d833981519152611a4f8133612dec565b5061013755565b600261012d541415611a7a5760405162461bcd60e51b8152600401610c3190615735565b600261012d5561013354869063ffffffff8216600160401b9091046001600160401b03161015611abc5760405162461bcd60e51b8152600401610c3190615711565b611ac78685856132b4565b15611b5f5733600090815261013d602052604090205463ffffffff80881691611af2918a911661594c565b63ffffffff161115611b165760405162461bcd60e51b8152600401610c31906156e3565b33600090815261013d602052604081208054899290611b3c90849063ffffffff1661594c565b92506101000a81548163ffffffff021916908363ffffffff160217905550611b83565b611b6761303f565b611b835760405162461bcd60e51b8152600401610c31906155d2565b61013354600160c01b90046001600160401b03161580611bbc575061013354600160c01b90046001600160401b031663ffffffff881611155b611bd85760405162461bcd60e51b8152600401610c319061558a565b61013154611bf290889087906001600160a01b0316613368565b611bfc878361308c565b5050600161012d555050505050565b600054610100900460ff1680611c24575060005460ff16155b611c405760405162461bcd60e51b8152600401610c319061561e565b600054610100900460ff16158015611c62576000805461ffff19166101011790555b611c72632dde656160e21b6136da565b8015610cf5576000805461ff001916905550565b61012f546001600160a01b031690565b6000611ca28133612dec565b611cad600083610eaf565b61012f54611cc6906000906001600160a01b031661288b565b5061012f80546001600160a01b0319166001600160a01b0392909216919091179055565b600082815260fb60205260408120611d029083613758565b9392505050565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600054610100900460ff1680611d4d575060005460ff16155b611d695760405162461bcd60e51b8152600401610c319061561e565b600054610100900460ff16158015611d8b576000805461ffff19166101011790555b82612710611d9f6040830160208401615031565b63ffffffff161115611db057600080fd5b611e39611dbd878061584a565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611dff92505050602089018961584a565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061376492505050565b611e41611c0b565b611e496137eb565b611e606000611e5b6020880188614c79565b61385a565b611e82600080516020615c0d833981519152611e5b6040880160208901614c79565b6001600160a01b03831615611ea957611ea9600080516020615c0d8339815191528461385a565b611eb66020860186614c79565b61012f80546001600160a01b0319166001600160a01b0392909216919091179055611ee76040860160208701614c79565b61013080546001600160a01b0319166001600160a01b0392909216919091179055611f186080870160608801614c79565b61013180546001600160a01b03929092166001600160a01b031990921691909117905561012e805463ffffffff19166107d0179055611f5d6060860160408701614c79565b61012e80546001600160a01b0392909216600160601b026001600160601b03909216919091179055611f92604087018761584a565b611f9f9161013c9161495e565b508361013b611fae8282615b65565b505061013e80546001600160a01b0319166daaeb6d7670e522a718067333cd4e908117909155604051633e9f1edf60e11b8152637d3e3dbe9061200b903090733cc6cdda760b79bafa08df41ecfa224f810dceb690600401615367565b600060405180830381600087803b15801561202557600080fd5b505af1158015612039573d6000803e3d6000fd5b50505050612045611c86565b6001600160a01b03167f04dba622d284ed0014ee4b9a6a68386be1a4c08a4913ae272de89199cc68616360405160405180910390a250801561102c576000805461ff00191690555050505050565b606060668054610b4690615a9d565b61013a54606090612124576040805160018082528183019092526000916020808301908036833701905050905061012e600c9054906101000a90046001600160a01b03168160008151811061210757634e487b7160e01b600052603260045260246000fd5b6001600160a01b0390921660209283029190910190910152919050565b61013a805460408051602080840282018101909252828152929190830182828015610bbf57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161215a575050505050905090565b8161218b81612be7565b610c6a8383613864565b60006121a18133612dec565b5061012e80546001600160a01b03909216600160601b026001600160601b03909216919091179055565b60006121d78133612dec565b60006101385460ff1660038111156121ff57634e487b7160e01b600052602160045260246000fd5b141561221d5760405162461bcd60e51b8152600401610c31906154f1565b6101355460ff16156122415760405162461bcd60e51b8152600401610c3190615566565b50610135805460ff19166001179055565b836001600160a01b038116331461226c5761226c33612be7565b61102c85858585613925565b33612281611c86565b6001600160a01b031614806122a15750610131546001600160a01b031633145b6122bd5760405162461bcd60e51b8152600401610c319061566c565b61013e80546001600160a01b0319166001600160a01b0392909216919091179055565b6040805160018082528183019092526060916000919060208083019080368337505061013b5482519293506001600160a01b03169183915060009061233557634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015292915050565b600080516020615c0d83398151915261236c8133612dec565b610134546001600160801b031661238281612e50565b61239e5760405162461bcd60e51b8152600401610c319061576c565b60036101385460ff1660038111156123c657634e487b7160e01b600052602160045260246000fd5b146123fd5760405162461bcd60e51b8152602060048201526007602482015266085c185d5cd95960ca1b6044820152606401610c31565b610138805460ff191660021790556040517ffc5afa2a710e95f2fb260ade6fe6305d7ae901d23c06de6eb054d03c092a3bcd90600090a15050565b61013380546101345461013554610136805463ffffffff80861696600160201b8704909116956001600160401b03600160401b8204811696600160801b808404831697600160c01b909404909216956001600160801b0380831696939092049091169360ff8416936001600160a01b0361010090910416929091906124bc90615a9d565b80601f01602080910402602001604051908101604052809291908181526020018280546124e890615a9d565b80156125355780601f1061250a57610100808354040283529160200191612535565b820191906000526020600020905b81548152906001019060200180831161251857829003601f168201915b5050505060048301546005840154604080516006870180546060602082028401810185529383018181529798959760ff909516965091939092849284918401828280156125cd57602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116125905790505b505050505081526020016001820180548060200260200160405190810160405280929190818152602001828054801561262f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612611575b50505050508152505090508d565b606061264882612bca565b6126945760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e006044820152606401610c31565b600061013360030180546126a790615a9d565b80601f01602080910402602001604051908101604052809291908181526020018280546126d390615a9d565b80156127205780601f106126f557610100808354040283529160200191612720565b820191906000526020600020905b81548152906001019060200180831161270357829003601f168201915b5050505050905060008151116127455760405180602001604052806000815250611d02565b8061274f84613957565b60405160200161276092919061528c565b6040516020818303038152906040529392505050565b3360009081526101326020526040902054806127cd5760405162461bcd60e51b81526020600482015260166024820152756e6f206372656469747320746f20776974686472617760501b6044820152606401610c31565b3360009081526101326020526040808220829055516001600160a01b03841690614e2090849084818181858888f193505050503d806000811461282c576040519150601f19603f3d011682016040523d82523d6000602084013e612831565b606091505b5050905080610c6a5760405162461bcd60e51b815260206004820152600f60248201526e1dda5d1a191c985dc819985a5b1959608a1b6044820152606401610c31565b600081815260fb60205260408120610b3190613a70565b610f498282613a7a565b600080516020615c0d8339815191526128ae8133612dec565b60006101385460ff1660038111156128d657634e487b7160e01b600052602160045260246000fd5b14156128f45760405162461bcd60e51b8152600401610c31906154f1565b6101355460ff16156129185760405162461bcd60e51b8152600401610c3190615566565b815161292c906101369060208501906149d2565b507f57cafa311d6d28ea1d59c17aa93e87ca0d9aa0ef533ee169e7ee99f0f49afe1a826040516117c291906154de565b61013c805461296a90615a9d565b80601f016020809104026020016040519081016040528092919081815260200182805461299690615a9d565b80156129e35780601f106129b8576101008083540402835291602001916129e3565b820191906000526020600020905b8154815290600101906020018083116129c657829003601f168201915b505050505081565b6001600160a01b038083166000908152606a6020908152604080832093851683529290529081205460ff1680611d025750611d02600083611d09565b6000612a338133612dec565b6127108263ffffffff161115612a4857600080fd5b5061012e805463ffffffff191663ffffffff92909216919091179055565b600080516020615c0d833981519152612a7f8133612dec565b610133546001600160401b03808516600160401b9092041611612ad85760405162461bcd60e51b81526020600482015260116024820152704e65772063617020746f6f206c6172676560781b6044820152606401610c31565b5061013380546001600160401b03938416600160401b02600160401b600160801b031990911617905561012e805491909216600160201b02600160201b600160601b0319909116179055565b60006001600160e01b031982166380ac58cd60e01b1480612b5557506001600160e01b03198216635b5e139f60e01b145b80610b3157506301ffc9a760e01b6001600160e01b0319831614610b31565b6000612b7f82612b24565b80610b315750506001600160e01b03191660009081526097602052604090205460ff1690565b60006001600160e01b03198216635a05180f60e01b1480610b315750610b3182613a97565b6000908152606760205260409020546001600160a01b0316151590565b61013e546001600160a01b03168015801590612c0d57506000816001600160a01b03163b115b1561103057604051633185c44d60e21b81526001600160a01b0382169063c617113490612c409030908690600401615367565b60206040518083038186803b158015612c5857600080fd5b505afa158015612c6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c909190614de1565b6110305781604051633b79c77360e21b8152600401610c319190615353565b6000612cba826114ca565b9050806001600160a01b0316836001600160a01b03161415612d285760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c31565b336001600160a01b0382161480612d445750612d4481336129eb565b612db15760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610c31565b610c6a8383613abc565b612dc53382613b2a565b612de15760405162461bcd60e51b8152600401610c3190615692565b610c6a838383613bec565b612df68282611d09565b61103057612e0e816001600160a01b03166014613d7a565b612e19836020613d7a565b604051602001612e2a9291906152e4565b60408051601f198184030181529082905262461bcd60e51b8252610c31916004016154de565b600042826001600160801b03161180610b315750506001600160801b03161590565b612e7b82610d60565b612e858133612dec565b610c6a8383613f5b565b6000611d02836001600160a01b038416613fe1565b6001600160a01b0381163314612f145760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c31565b6110308282614030565b6000611d02836001600160a01b038416614097565b60008151835114612f705760405162461bcd60e51b81526020600482015260076024820152661a5b9d985b1a5960ca1b6044820152606401610c31565b6000805b8351811015612fc457838181518110612f9d57634e487b7160e01b600052603260045260246000fd5b602002602001015182612fb0919061594c565b915080612fbc81615af4565b915050612f74565b506127108163ffffffff1611156130055760405162461bcd60e51b8152602060048201526005602482015264313839901f60d91b6044820152606401610c31565b5060019392505050565b600060016101385460ff16600381111561303957634e487b7160e01b600052602160045260246000fd5b14905090565b600060026101385460ff16600381111561306957634e487b7160e01b600052602160045260246000fd5b148015613087575061013454613087906001600160801b0316612e50565b905090565b610133546001600160401b03600160801b8204811691600160401b90041660005b8463ffffffff168161ffff161015613232576000826001600160401b0316116131095760405162461bcd60e51b815260206004820152600e60248201526d07175616e74697479203e206361760941b6044820152606401610c31565b6131298461311b61ffff841686615909565b6001600160801b03166141b4565b6000434241856040516020016131729493929190938452602084019290925260601b6001600160601b031916604083015260c01b6001600160c01b0319166054820152605c0190565b60408051601f198184030181529190528051602090910120610131549091507f730694d60b9a9c8c5fa1acbe8e8ca7debca9124dc92acf55aa1024d2c9e43789906001600160a01b0316866131cb61ffff861688615909565b604080516001600160a01b0394851681529390921660208401526001600160801b0316908201526001600160401b03851660608201526080810183905260a00160405180910390a161321c83615a7a565b925050808061322a90615ad2565b9150506130ad565b50610133805463ffffffff8616919060109061325f908490600160801b90046001600160401b031661596b565b92506101000a8154816001600160401b0302191690836001600160401b031602179055508061013360000160086101000a8154816001600160401b0302191690836001600160401b0316021790555050505050565b60006132be61300f565b80156132c957508115155b80156133605750613360613320338663ffffffff166040516001600160601b0319606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b610133600401548585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506142d492505050565b949350505050565b61013554610134546101009091046001600160a01b031690600160801b90046001600160801b03168161341d5783156133d65760405162461bcd60e51b815260206004820152601060248201526f0746f6b656e416d6f756e7420213d20360841b6044820152606401610c31565b6133e68163ffffffff87166159a1565b6001600160801b0316341461340d5760405162461bcd60e51b8152600401610c31906155f7565b6134188234856142e1565b61102c565b341561345c5760405162461bcd60e51b815260206004820152600e60248201526d06574682076616c756520213d20360941b6044820152606401610c31565b61346c8163ffffffff87166159a1565b6001600160801b031684146134935760405162461bcd60e51b8152600401610c31906155f7565b6040516323b872dd60e01b8152336004820152306024820152604481018590526001600160a01b038316906323b872dd90606401602060405180830381600087803b1580156134e157600080fd5b505af11580156134f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135199190614de1565b5061102c8285856142e1565b8061352f81612e50565b61354b5760405162461bcd60e51b8152600401610c319061576c565b613554886143d0565b8651613568906101369060208a01906149d2565b508515613576576101378690555b610133805463ffffffff868116600160201b026001600160401b0319909216908816171790556001600160401b038316156135cd5761013380546001600160c01b0316600160c01b6001600160401b038616021790555b6001600160801b038216156135f95761013480546001600160801b0319166001600160801b0384161790555b5050505050505050565b6101388054600160ff1990911617905561012e80546101338054600160801b600160c01b031916600160201b9092046001600160401b03908116600160801b81029390931791829055600160401b9091041691829160049061366690849061596b565b92506101000a8154816001600160401b0302191690836001600160401b031602179055507feace9ffe7fa97ff7dbf4b23bcc99df5b088f5af2913bc589b0ad786a775f3cb961013160009054906101000a90046001600160a01b031682846101336003016040516117c294939291906153d7565b6001600160e01b031980821614156137335760405162461bcd60e51b815260206004820152601c60248201527b115490cc4d8d4e881a5b9d985b1a59081a5b9d195c999858d9481a5960221b6044820152606401610c31565b6001600160e01b0319166000908152609760205260409020805460ff19166001179055565b6000611d028383614405565b600054610100900460ff168061377d575060005460ff16155b6137995760405162461bcd60e51b8152600401610c319061561e565b600054610100900460ff161580156137bb576000805461ffff19166101011790555b6137c361443d565b6137cb61443d565b6137d583836144a7565b8015610c6a576000805461ff0019169055505050565b600054610100900460ff1680613804575060005460ff16155b6138205760405162461bcd60e51b8152600401610c319061561e565b600054610100900460ff16158015613842576000805461ffff19166101011790555b61384a61443d565b61385261443d565b611c7261443d565b610eb9828261453c565b6001600160a01b0382163314156138b95760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610c31565b336000818152606a602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61392f3383613b2a565b61394b5760405162461bcd60e51b8152600401610c3190615692565b610d1d84848484614546565b60608161397b5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156139a5578061398f81615af4565b915061399e9050600a8361598d565b915061397f565b6000816001600160401b038111156139cd57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156139f7576020820181803683370190505b5090505b841561336057613a0c6001836159ef565b9150613a19600a86615b0f565b613a24906030615934565b60f81b818381518110613a4757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350613a69600a8661598d565b94506139fb565b6000610b31825490565b613a8382610d60565b613a8d8133612dec565b610c6a8383614030565b60006001600160e01b03198216637965db0b60e01b1480610b315750610b3182612b74565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190613af1826114ca565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000613b3582612bca565b613b965760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c31565b6000613ba1836114ca565b9050806001600160a01b0316846001600160a01b03161480613bdc5750836001600160a01b0316613bd184610bc9565b6001600160a01b0316145b80613360575061336081856129eb565b826001600160a01b0316613bff826114ca565b6001600160a01b031614613c675760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610c31565b6001600160a01b038216613cc95760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c31565b613cd4600082613abc565b6001600160a01b0383166000908152606860205260408120805460019290613cfd9084906159ef565b90915550506001600160a01b0382166000908152606860205260408120805460019290613d2b908490615934565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020615c2d83398151915291a4505050565b60606000613d898360026159d0565b613d94906002615934565b6001600160401b03811115613db957634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613de3576020820181803683370190505b509050600360fc1b81600081518110613e0c57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613e4957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000613e6d8460026159d0565b613e78906001615934565b90505b6001811115613f0c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613eba57634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110613ede57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93613f0581615a63565b9050613e7b565b508315611d025760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c31565b613f658282611d09565b61103057600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff19166001179055613f9d3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600081815260018301602052604081205461402857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b31565b506000610b31565b61403a8282611d09565b1561103057600082815260c9602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600081815260018301602052604081205480156141aa5760006140bb6001836159ef565b85549091506000906140cf906001906159ef565b90508181146141505760008660000182815481106140fd57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508087600001848154811061412e57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061416f57634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610b31565b6000915050610b31565b6001600160a01b03821661420a5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c31565b61421381612bca565b1561425f5760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610c31565b6001600160a01b0382166000908152606860205260408120805460019290614288908490615934565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020615c2d833981519152908290a45050565b6000613360828486614579565b60006142eb6120a2565b905060006142f76113d8565b90506000805b83518110156143a157600061271084838151811061432b57634e487b7160e01b600052603260045260246000fd5b602002602001015163ffffffff168861434491906159d0565b61434e919061598d565b905061435a8184615934565b925061438e85838151811061437f57634e487b7160e01b600052603260045260246000fd5b6020026020010151898361458f565b508061439981615af4565b9150506142fd565b5060006143ae82876159ef565b11156143c8576143c884876143c384896159ef565b61458f565b505050505050565b6001600160a01b03811615610cf55761013580546001600160a01b03831661010002610100600160a81b031990911617905550565b600082600001828154811061442a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b600054610100900460ff1680614456575060005460ff16155b6144725760405162461bcd60e51b8152600401610c319061561e565b600054610100900460ff16158015611c72576000805461ffff19166101011790558015610cf5576000805461ff001916905550565b600054610100900460ff16806144c0575060005460ff16155b6144dc5760405162461bcd60e51b8152600401610c319061561e565b600054610100900460ff161580156144fe576000805461ffff19166101011790555b82516145119060659060208601906149d2565b5081516145259060669060208501906149d2565b508015610c6a576000805461ff0019169055505050565b6110308282613f5b565b614551848484613bec565b61455d848484846146c3565b610d1d5760405162461bcd60e51b8152600401610c3190615514565b60008261458685846147d0565b14949350505050565b6001600160a01b0382161561461e5760405163a9059cbb60e01b81526001600160a01b0383169063a9059cbb906145cc90869085906004016153be565b602060405180830381600087803b1580156145e657600080fd5b505af11580156145fa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1d9190614de1565b6000836001600160a01b031682614e2090604051600060405180830381858888f193505050503d8060008114614670576040519150601f19603f3d011682016040523d82523d6000602084013e614675565b606091505b5050905080610d1d576001600160a01b038416600090815261013260205260409020546146a3908390615934565b6001600160a01b0385166000908152610132602052604090205550505050565b60006001600160a01b0384163b156147c557604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614707903390899088908890600401615381565b602060405180830381600087803b15801561472157600080fd5b505af1925050508015614751575060408051601f3d908101601f1916820190925261474e91810190614e76565b60015b6147ab573d80801561477f576040519150601f19603f3d011682016040523d82523d6000602084013e614784565b606091505b5080516147a35760405162461bcd60e51b8152600401610c3190615514565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613360565b506001949350505050565b600081815b84518110156148235761480f8286838151811061480257634e487b7160e01b600052603260045260246000fd5b602002602001015161482b565b91508061481b81615af4565b9150506147d5565b509392505050565b6000818310614847576000828152602084905260409020611d02565b6000838152602083905260409020611d02565b828054828255906000526020600020906007016008900481019282156148f95791602002820160005b838211156148c757835183826101000a81548163ffffffff021916908363ffffffff1602179055509260200192600401602081600301049283019260010302614883565b80156148f75782816101000a81549063ffffffff02191690556004016020816003010492830192600103026148c7565b505b50614905929150614a46565b5090565b8280548282559060005260206000209081019282156148f9579160200282015b828111156148f957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614929565b82805461496a90615a9d565b90600052602060002090601f01602090048101928261498c57600085556148f9565b82601f106149a55782800160ff198235161785556148f9565b828001600101855582156148f9579182015b828111156148f95782358255916020019190600101906149b7565b8280546149de90615a9d565b90600052602060002090601f016020900481019282614a0057600085556148f9565b82601f10614a1957805160ff19168380011785556148f9565b828001600101855582156148f9579182015b828111156148f9578251825591602001919060010190614a2b565b5b808211156149055760008155600101614a47565b60006001600160401b03831115614a7457614a74615b4f565b614a87601f8401601f19166020016158b6565b9050828152838383011115614a9b57600080fd5b828260208301376000602084830101529392505050565b600082601f830112614ac2578081fd5b81356020614ad7614ad2836158e6565b6158b6565b80838252828201915082860187848660051b8901011115614af6578586fd5b855b85811015614b1d578135614b0b81615bc1565b84529284019290840190600101614af8565b5090979650505050505050565b60008083601f840112614b3b578182fd5b5081356001600160401b03811115614b51578182fd5b6020830191508360208260051b8501011115614b6c57600080fd5b9250929050565b600060408284031215614b84578081fd5b50919050565b600060408284031215614b9b578081fd5b614ba361588e565b905081356001600160401b0380821115614bbc57600080fd5b818401915084601f830112614bd057600080fd5b81356020614be0614ad2836158e6565b80838252828201915082860189848660051b8901011115614c0057600080fd5b600096505b84871015614c2c578035614c1881615bfa565b835260019690960195918301918301614c05565b5086525085810135935082841115614c4357600080fd5b614c4f87858801614ab2565b818601525050505092915050565b80356001600160401b0381168114614c7457600080fd5b919050565b600060208284031215614c8a578081fd5b8135611d0281615bc1565b60008060408385031215614ca7578081fd5b8235614cb281615bc1565b91506020830135614cc281615bc1565b809150509250929050565b600080600060608486031215614ce1578081fd5b8335614cec81615bc1565b92506020840135614cfc81615bc1565b929592945050506040919091013590565b60008060008060808587031215614d22578182fd5b8435614d2d81615bc1565b93506020850135614d3d81615bc1565b92506040850135915060608501356001600160401b03811115614d5e578182fd5b8501601f81018713614d6e578182fd5b614d7d87823560208401614a5b565b91505092959194509250565b60008060408385031215614d9b578182fd5b8235614da681615bc1565b91506020830135614cc281615bd6565b60008060408385031215614dc8578182fd5b8235614dd381615bc1565b946020939093013593505050565b600060208284031215614df2578081fd5b8151611d0281615bd6565b600060208284031215614e0e578081fd5b5035919050565b60008060408385031215614e27578182fd5b823591506020830135614cc281615bc1565b60008060408385031215614e4b578182fd5b50508035926020909101359150565b600060208284031215614e6b578081fd5b8135611d0281615be4565b600060208284031215614e87578081fd5b8151611d0281615be4565b600060208284031215614ea3578081fd5b81356001600160401b03811115614eb8578182fd5b8201601f81018413614ec8578182fd5b61336084823560208401614a5b565b60008060408385031215614ee9578182fd5b82356001600160401b0380821115614eff578384fd5b908401906101408287031215614f13578384fd5b90925060208401359080821115614f28578283fd5b50614f3585828601614b73565b9150509250929050565b60008060008084860360e0811215614f55578283fd5b85356001600160401b03811115614f6a578384fd5b860160808189031215614f7b578384fd5b94506060601f1982011215614f8e578283fd5b50602085019250614fa28660808701614b73565b915060c0850135614fb281615bc1565b939692955090935050565b600060208284031215614fce578081fd5b81356001600160401b03811115614fe3578182fd5b61336084828501614b8a565b600060408284031215615000578081fd5b611d028383614b73565b60006020828403121561501b578081fd5b81356001600160801b0381168114611d02578182fd5b600060208284031215615042578081fd5b8135611d0281615bfa565b600080600080600060808688031215615064578283fd5b853561506f81615bfa565b9450602086013561507f81615bfa565b93506040860135925060608601356001600160401b038111156150a0578182fd5b6150ac88828901614b2a565b969995985093965092949392505050565b60008060008060008060a087890312156150d5578384fd5b86356150e081615bfa565b955060208701356150f081615bfa565b94506040870135935060608701356001600160401b03811115615111578182fd5b61511d89828a01614b2a565b909450925050608087013561513181615bc1565b809150509295509295509295565b600060208284031215615150578081fd5b611d0282614c5d565b6000806040838503121561516b578182fd5b61517483614c5d565b9150610ea660208401614c5d565b6000815180845260208085019450808401835b838110156151ba5781516001600160a01b031687529582019590820190600101615195565b509495945050505050565b6000815180845260208085019450808401835b838110156151ba57815163ffffffff16875295820195908201906001016151d8565b60008151808452615212816020860160208601615a37565b601f01601f19169290920160200192915050565b6004811061524457634e487b7160e01b600052602160045260246000fd5b9052565b600081516040845261525d60408501826151c5565b9050602083015184820360208601526152768282615182565b95945050505050565b6001600160801b03169052565b6000835161529e818460208801615a37565b8083019050602f60f81b80825284516152be816001850160208901615a37565b6001920191820152693a37b5b2b7173539b7b760b11b6002820152600c01949350505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615316816017850160208801615a37565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615347816028840160208801615a37565b01602801949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906153b4908301846151fa565b9695505050505050565b6001600160a01b03929092168252602082015260400190565b6001600160a01b03851681526001600160401b0384166020808301919091526080604083018190526000919061540f908401866151fa565b838103606085015284548390600181811c908083168061543057607f831692505b86831081141561544e57634e487b7160e01b88526022600452602488fd5b82865260208601955080801561546b576001811461547c576154a6565b60ff198516875287870195506154a6565b60008b815260209020895b858110156154a057815489820152908401908901615487565b88019650505b50939c9b505050505050505050505050565b602081526000611d026020830184615182565b602081526000611d0260208301846151c5565b602081526000611d0260208301846151fa565b602080825260099082015268085c1c995c185c995960ba1b604082015260600190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252600a9082015269155492481b1bd8dad95960b21b604082015260600190565b60208082526028908201527f63616e6e6f7420627579203e206d61785075726368617365416d6f756e7420696040820152670dc40dedcca40e8f60c31b606082015260800190565b6020808252600b908201526a756e617661696c61626c6560a81b604082015260600190565b6020808252600d908201526c0908084f48195e1c1958dd1959609a1b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600c908201526b1d5b985d5d1a1bdc9a5e995960a21b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252601490820152730f881dda1a5d195b1a5cdd195908185b5bdd5b9d60621b604082015260600190565b6020808252600a908201526938bab0b73a34ba3c901f60b11b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602080825260059082015264195b99195960da1b604082015260600190565b63ffffffff8e811682528d1660208201526001600160401b038c811660408301528b1660608201526001600160401b038a1660808201526157cf60a082018a61527f565b6157dc60c082018961527f565b86151560e08201526001600160a01b0386166101008201526101a0610120820152600061580d6101a08301876151fa565b85610140840152615822610160840186615226565b8281036101808401526158358185615248565b9150509e9d5050505050505050505050505050565b6000808335601e19843603018112615860578283fd5b8301803591506001600160401b03821115615879578283fd5b602001915036819003821315614b6c57600080fd5b604080519081016001600160401b03811182821017156158b0576158b0615b4f565b60405290565b604051601f8201601f191681016001600160401b03811182821017156158de576158de615b4f565b604052919050565b60006001600160401b038211156158ff576158ff615b4f565b5060051b60200190565b60006001600160801b0382811684821680830382111561592b5761592b615b23565b01949350505050565b6000821982111561594757615947615b23565b500190565b600063ffffffff80831681851680830382111561592b5761592b615b23565b60006001600160401b0382811684821680830382111561592b5761592b615b23565b60008261599c5761599c615b39565b500490565b60006001600160801b03828116848216811515828404821116156159c7576159c7615b23565b02949350505050565b60008160001904831182151516156159ea576159ea615b23565b500290565b600082821015615a0157615a01615b23565b500390565b600063ffffffff83811690831681811015615a2357615a23615b23565b039392505050565b6000610b313683614b8a565b60005b83811015615a52578181015183820152602001615a3a565b83811115610d1d5750506000910152565b600081615a7257615a72615b23565b506000190190565b60006001600160401b03821680615a9357615a93615b23565b6000190192915050565b600181811c90821680615ab157607f821691505b60208210811415614b8457634e487b7160e01b600052602260045260246000fd5b600061ffff80831681811415615aea57615aea615b23565b6001019392505050565b6000600019821415615b0857615b08615b23565b5060010190565b600082615b1e57615b1e615b39565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8135615b7081615bc1565b81546001600160a01b031981166001600160a01b039290921691821783556020840135615b9c81615bfa565b6001600160c01b03199190911690911760a09190911b63ffffffff60a01b1617905550565b6001600160a01b0381168114610cf557600080fd5b8015158114610cf557600080fd5b6001600160e01b031981168114610cf557600080fd5b63ffffffff81168114610cf557600080fdfe9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212204aa53d60ea57282824b5a81070a58025319f736c7a2bc4566bc5acd72f5cdd3364736f6c63430008040033

Deployed Bytecode

0x6080604052600436106102c85760003560e01c806301ffc9a7146102cd57806306fdde0314610302578063081812fc14610324578063095ea7b3146103515780630ebd4c7f146103735780632210a6a1146103a057806322235d69146103c057806323b872dd146103f357806324297d5314610413578063248a9ca31461043357806324938096146104615780632a55205a146104765780632f2ff15d146104a45780632fcfb95a146104c457806334d722c9146104e457806336568abe146105055780633c33767e146105255780633f3174451461054557806342842e0e1461056557806343bc16121461058557806346830c4b146105a65780634bde38c8146105bb5780634d073a5a146105dc57806355367ba91461061c5780635868fbea146106315780636352211e1461064657806366d8a9f114610666578063672df8b01461068657806369956a11146106995780636f64388d146106b957806370a08231146106d95780637aee9dba146106f95780637cc35f771461071957806380ae4ebc1461072c5780638da5cb5b146107415780638f9f193f146107565780639010d07c1461077657806391d1485414610796578063936a6042146107b657806395d89b41146107d6578063a068deed146107eb578063a217fddf1461080d578063a22cb46514610822578063aec970b014610842578063af45abb614610862578063b0588541146108b6578063b0ccc31e146108cb578063b88d4fde146108ec578063b8d1e5321461090c578063b9c4d9fb1461092c578063bb33d7291461094c578063c05efa1514610961578063c87b56dd1461098f578063c90941b1146109af578063ca15c873146109cf578063d5391393146109ef578063d547741f14610a11578063deb9414814610a31578063e0781a0814610a59578063e8a3d48514610a79578063e985e9c514610a8e578063fce212f314610aae578063fe63e75714610ace575b600080fd5b3480156102d957600080fd5b506102ed6102e8366004614e5a565b610aee565b60405190151581526020015b60405180910390f35b34801561030e57600080fd5b50610317610b37565b6040516102f991906154de565b34801561033057600080fd5b5061034461033f366004614dfd565b610bc9565b6040516102f99190615353565b34801561035d57600080fd5b5061037161036c366004614db6565b610c56565b005b34801561037f57600080fd5b5061039361038e366004614dfd565b610c6f565b6040516102f991906154cb565b3480156103ac57600080fd5b506103716103bb366004614c79565b610ce4565b3480156103cc57600080fd5b5061012e546103de9063ffffffff1681565b60405163ffffffff90911681526020016102f9565b3480156103ff57600080fd5b5061037161040e366004614ccd565b610cf8565b34801561041f57600080fd5b5061037161042e366004614c79565b610d23565b34801561043f57600080fd5b5061045361044e366004614dfd565b610d60565b6040519081526020016102f9565b34801561046d57600080fd5b50610371610d75565b34801561048257600080fd5b50610496610491366004614e39565b610e6f565b6040516102f99291906153be565b3480156104b057600080fd5b506103716104bf366004614e15565b610eaf565b3480156104d057600080fd5b506103716104df366004614c79565b610ed1565b3480156104f057600080fd5b5061013054610344906001600160a01b031681565b34801561051157600080fd5b50610371610520366004614e15565b610f3f565b34801561053157600080fd5b50610371610540366004614fbd565b610f61565b34801561055157600080fd5b50610371610560366004615031565b611034565b34801561057157600080fd5b50610371610580366004614ccd565b61121c565b34801561059157600080fd5b5061013154610344906001600160a01b031681565b3480156105b257600080fd5b50610371611237565b3480156105c757600080fd5b5061012f54610344906001600160a01b031681565b3480156105e857600080fd5b5061012e5461060490600160201b90046001600160401b031681565b6040516001600160401b0390911681526020016102f9565b34801561062857600080fd5b50610371611346565b34801561063d57600080fd5b506103936113d8565b34801561065257600080fd5b50610344610661366004614dfd565b6114ca565b34801561067257600080fd5b50610371610681366004614fef565b611541565b61037161069436600461504d565b611580565b3480156106a557600080fd5b506103716106b4366004614e92565b611734565b3480156106c557600080fd5b506103716106d4366004614ed7565b6117ce565b3480156106e557600080fd5b506104536106f4366004614c79565b6119af565b34801561070557600080fd5b50610371610714366004614dfd565b611a36565b6103716107273660046150bd565b611a56565b34801561073857600080fd5b50610371611c0b565b34801561074d57600080fd5b50610344611c86565b34801561076257600080fd5b50610371610771366004614c79565b611c96565b34801561078257600080fd5b50610344610791366004614e39565b611cea565b3480156107a257600080fd5b506102ed6107b1366004614e15565b611d09565b3480156107c257600080fd5b506103716107d1366004614f3f565b611d34565b3480156107e257600080fd5b50610317612093565b3480156107f757600080fd5b506108006120a2565b6040516102f991906154b8565b34801561081957600080fd5b50610453600081565b34801561082e57600080fd5b5061037161083d366004614d89565b612181565b34801561084e57600080fd5b5061037161085d366004614c79565b612195565b34801561086e57600080fd5b5061013b54610892906001600160a01b03811690600160a01b900463ffffffff1682565b604080516001600160a01b03909316835263ffffffff9091166020830152016102f9565b3480156108c257600080fd5b506103716121cb565b3480156108d757600080fd5b5061013e54610344906001600160a01b031681565b3480156108f857600080fd5b50610371610907366004614d0d565b612252565b34801561091857600080fd5b50610371610927366004614c79565b612278565b34801561093857600080fd5b50610800610947366004614dfd565b6122e0565b34801561095857600080fd5b50610371612353565b34801561096d57600080fd5b50610976612438565b6040516102f99d9c9b9a9998979695949392919061578b565b34801561099b57600080fd5b506103176109aa366004614dfd565b61263d565b3480156109bb57600080fd5b506103716109ca366004614c79565b612776565b3480156109db57600080fd5b506104536109ea366004614dfd565b612874565b3480156109fb57600080fd5b50610453600080516020615c0d83398151915281565b348015610a1d57600080fd5b50610371610a2c366004614e15565b61288b565b348015610a3d57600080fd5b5061012e5461034490600160601b90046001600160a01b031681565b348015610a6557600080fd5b50610371610a74366004614e92565b612895565b348015610a8557600080fd5b5061031761295c565b348015610a9a57600080fd5b506102ed610aa9366004614c95565b6129eb565b348015610aba57600080fd5b50610371610ac9366004615031565b612a27565b348015610ada57600080fd5b50610371610ae9366004615159565b612a66565b60006001600160e01b031982166306fafb6760e31b1480610b135750610b1382612b24565b80610b225750610b2282612b74565b80610b315750610b3182612ba5565b92915050565b606060658054610b4690615a9d565b80601f0160208091040260200160405190810160405280929190818152602001828054610b7290615a9d565b8015610bbf5780601f10610b9457610100808354040283529160200191610bbf565b820191906000526020600020905b815481529060010190602001808311610ba257829003601f168201915b5050505050905090565b6000610bd482612bca565b610c3a5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152606960205260409020546001600160a01b031690565b81610c6081612be7565b610c6a8383612caf565b505050565b60408051600180825281830190925260609160009190602080830190803683370190505061013b548151919250600160a01b900463ffffffff16908290600090610cc957634e487b7160e01b600052603260045260246000fd5b63ffffffff9092166020928302919091019091015292915050565b610ced81612278565b610cf5611237565b50565b826001600160a01b0381163314610d1257610d1233612be7565b610d1d848484612dbb565b50505050565b600080516020615c0d833981519152610d3c8133612dec565b5061013180546001600160a01b0319166001600160a01b0392909216919091179055565b600090815260c9602052604090206001015490565b600080516020615c0d833981519152610d8e8133612dec565b610134546001600160801b0316610da481612e50565b610dc05760405162461bcd60e51b8152600401610c319061576c565b60016101385460ff166003811115610de857634e487b7160e01b600052602160045260246000fd5b14610e345760405162461bcd60e51b815260206004820152601c60248201527b1cd85b19481cdd185c9d1959081bdc881b9bdd081c1c995c185c995960221b6044820152606401610c31565b610138805460ff191660021790556040517f912ee23dde46ec889d6748212cce445d667f7041597691dc89e8549ad8bc0acb90600090a15050565b61013b546001600160a01b0381169060009061271090610e9c90600160a01b900463ffffffff16856159d0565b610ea6919061598d565b90509250929050565b610eb98282612e72565b600082815260fb60205260409020610c6a9082612e8f565b6000610edd8133612dec565b610ef5600080516020615c0d83398151915283610eaf565b61013054610f1b90600080516020615c0d833981519152906001600160a01b031661288b565b5061013080546001600160a01b0319166001600160a01b0392909216919091179055565b610f498282612ea4565b600082815260fb60205260409020610c6a9082612f1e565b600080516020615c0d833981519152610f7a8133612dec565b60006101385460ff166003811115610fa257634e487b7160e01b600052602160045260246000fd5b1415610fe15760405162461bcd60e51b815260206004820152600e60248201526d1b995d995c881c1c995c185c995960921b6044820152606401610c31565b610ff382602001518360000151612f33565b15611030578151805183916101399161101391839160209091019061485a565b50602082810151805161102c9260018501920190614909565b5050505b5050565b600261012d5414156110585760405162461bcd60e51b8152600401610c3190615735565b600261012d55610131546001600160a01b031661107361300f565b80611081575061108161303f565b6110c35760405162461bcd60e51b81526020600482015260136024820152726e6f74207072652f7075626c69632073616c6560681b6044820152606401610c31565b610130546001600160a01b03163314806110e557506001600160a01b03811633145b6111015760405162461bcd60e51b8152600401610c319061566c565b610130546001600160a01b031633141561118f576101335463ffffffff600160201b909104811690831611156111495760405162461bcd60e51b8152600401610c3190615711565b610133805483919060049061116c908490600160201b900463ffffffff16615a06565b92506101000a81548163ffffffff021916908363ffffffff160217905550611208565b6001600160a01b038116331415611208576101335463ffffffff90811690831611156111cd5760405162461bcd60e51b8152600401610c3190615711565b61013380548391906000906111e990849063ffffffff16615a06565b92506101000a81548163ffffffff021916908363ffffffff1602179055505b611212823361308c565b5050600161012d55565b610c6a83838360405180602001604052806000815250612252565b33611240611c86565b6001600160a01b031614806112605750610131546001600160a01b031633145b61127c5760405162461bcd60e51b8152600401610c319061566c565b61013e546001600160a01b0316806112d65760405162461bcd60e51b815260206004820152601d60248201527f617474656d707420726567697374657220746f207a65726f20616464720000006044820152606401610c31565b604051633e9f1edf60e11b81526001600160a01b03821690637d3e3dbe90611318903090733cc6cdda760b79bafa08df41ecfa224f810dceb690600401615367565b600060405180830381600087803b15801561133257600080fd5b505af115801561102c573d6000803e3d6000fd5b600080516020615c0d83398151915261135f8133612dec565b61136761303f565b61139e5760405162461bcd60e51b8152602060048201526008602482015267216f6e676f696e6760c01b6044820152606401610c31565b610138805460ff191660031790556040517f8a98cbd0cab14e33b8a5e5710b9b59bceec8af9a5b4b3bb32fb275cf04ea048d90600090a150565b6101395460609061144b5760408051600180825281830190925260009160208083019080368337505061012e54825192935063ffffffff169183915060009061143157634e487b7160e01b600052603260045260246000fd5b63ffffffff90921660209283029190910190910152919050565b610139805460408051602080840282018101909252828152929190830182828015610bbf57602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116114845790505050505050905090565b6000818152606760205260408120546001600160a01b031680610b315760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610c31565b600061154d8133612dec565b816127106115616040830160208401615031565b63ffffffff16111561157257600080fd5b8261013b61102c8282615b65565b600261012d5414156115a45760405162461bcd60e51b8152600401610c3190615735565b600261012d5561013354859063ffffffff8216600160401b9091046001600160401b031610156115e65760405162461bcd60e51b8152600401610c3190615711565b6115f18584846132b4565b156116895733600090815261013d602052604090205463ffffffff8087169161161c9189911661594c565b63ffffffff1611156116405760405162461bcd60e51b8152600401610c31906156e3565b33600090815261013d60205260408120805488929061166690849063ffffffff1661594c565b92506101000a81548163ffffffff021916908363ffffffff1602179055506116ad565b61169161303f565b6116ad5760405162461bcd60e51b8152600401610c31906155d2565b61013354600160c01b90046001600160401b031615806116e6575061013354600160c01b90046001600160401b031663ffffffff871611155b6117025760405162461bcd60e51b8152600401610c319061558a565b6101315461171c90879086906001600160a01b0316613368565b611726863361308c565b5050600161012d5550505050565b600080516020615c0d83398151915261174d8133612dec565b60006101385460ff16600381111561177557634e487b7160e01b600052602160045260246000fd5b14156117935760405162461bcd60e51b8152600401610c31906154f1565b7f35dbfe7897df4ba6ece8892d34d15a0ab1cab571a22f5c9bf3dd71440842fcc3826040516117c291906154de565b60405180910390a15050565b600080516020615c0d8339815191526117e78133612dec565b60006101385460ff16600381111561180f57634e487b7160e01b600052602160045260246000fd5b1461184f5760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c1c995c185c995960821b6044820152606401610c31565b61185c602084018461513f565b61013380546001600160401b0392909216600160401b02600160401b600160801b0319909216919091179055611898604084016020850161500a565b61013480546001600160801b03928316600160801b0292169190911790556119596118c96060850160408601614c79565b6118d6608086018661584a565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050505060a086013561191f60e0880160c08901615031565b611930610100890160e08a01615031565b6119426101208a016101008b0161513f565b6119546101408b016101208c0161500a565b613525565b6119a3611969606085018561584a565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061360392505050565b610c6a61054083615a2b565b60006001600160a01b038216611a1a5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610c31565b506001600160a01b031660009081526068602052604090205490565b600080516020615c0d833981519152611a4f8133612dec565b5061013755565b600261012d541415611a7a5760405162461bcd60e51b8152600401610c3190615735565b600261012d5561013354869063ffffffff8216600160401b9091046001600160401b03161015611abc5760405162461bcd60e51b8152600401610c3190615711565b611ac78685856132b4565b15611b5f5733600090815261013d602052604090205463ffffffff80881691611af2918a911661594c565b63ffffffff161115611b165760405162461bcd60e51b8152600401610c31906156e3565b33600090815261013d602052604081208054899290611b3c90849063ffffffff1661594c565b92506101000a81548163ffffffff021916908363ffffffff160217905550611b83565b611b6761303f565b611b835760405162461bcd60e51b8152600401610c31906155d2565b61013354600160c01b90046001600160401b03161580611bbc575061013354600160c01b90046001600160401b031663ffffffff881611155b611bd85760405162461bcd60e51b8152600401610c319061558a565b61013154611bf290889087906001600160a01b0316613368565b611bfc878361308c565b5050600161012d555050505050565b600054610100900460ff1680611c24575060005460ff16155b611c405760405162461bcd60e51b8152600401610c319061561e565b600054610100900460ff16158015611c62576000805461ffff19166101011790555b611c72632dde656160e21b6136da565b8015610cf5576000805461ff001916905550565b61012f546001600160a01b031690565b6000611ca28133612dec565b611cad600083610eaf565b61012f54611cc6906000906001600160a01b031661288b565b5061012f80546001600160a01b0319166001600160a01b0392909216919091179055565b600082815260fb60205260408120611d029083613758565b9392505050565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600054610100900460ff1680611d4d575060005460ff16155b611d695760405162461bcd60e51b8152600401610c319061561e565b600054610100900460ff16158015611d8b576000805461ffff19166101011790555b82612710611d9f6040830160208401615031565b63ffffffff161115611db057600080fd5b611e39611dbd878061584a565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611dff92505050602089018961584a565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061376492505050565b611e41611c0b565b611e496137eb565b611e606000611e5b6020880188614c79565b61385a565b611e82600080516020615c0d833981519152611e5b6040880160208901614c79565b6001600160a01b03831615611ea957611ea9600080516020615c0d8339815191528461385a565b611eb66020860186614c79565b61012f80546001600160a01b0319166001600160a01b0392909216919091179055611ee76040860160208701614c79565b61013080546001600160a01b0319166001600160a01b0392909216919091179055611f186080870160608801614c79565b61013180546001600160a01b03929092166001600160a01b031990921691909117905561012e805463ffffffff19166107d0179055611f5d6060860160408701614c79565b61012e80546001600160a01b0392909216600160601b026001600160601b03909216919091179055611f92604087018761584a565b611f9f9161013c9161495e565b508361013b611fae8282615b65565b505061013e80546001600160a01b0319166daaeb6d7670e522a718067333cd4e908117909155604051633e9f1edf60e11b8152637d3e3dbe9061200b903090733cc6cdda760b79bafa08df41ecfa224f810dceb690600401615367565b600060405180830381600087803b15801561202557600080fd5b505af1158015612039573d6000803e3d6000fd5b50505050612045611c86565b6001600160a01b03167f04dba622d284ed0014ee4b9a6a68386be1a4c08a4913ae272de89199cc68616360405160405180910390a250801561102c576000805461ff00191690555050505050565b606060668054610b4690615a9d565b61013a54606090612124576040805160018082528183019092526000916020808301908036833701905050905061012e600c9054906101000a90046001600160a01b03168160008151811061210757634e487b7160e01b600052603260045260246000fd5b6001600160a01b0390921660209283029190910190910152919050565b61013a805460408051602080840282018101909252828152929190830182828015610bbf57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161215a575050505050905090565b8161218b81612be7565b610c6a8383613864565b60006121a18133612dec565b5061012e80546001600160a01b03909216600160601b026001600160601b03909216919091179055565b60006121d78133612dec565b60006101385460ff1660038111156121ff57634e487b7160e01b600052602160045260246000fd5b141561221d5760405162461bcd60e51b8152600401610c31906154f1565b6101355460ff16156122415760405162461bcd60e51b8152600401610c3190615566565b50610135805460ff19166001179055565b836001600160a01b038116331461226c5761226c33612be7565b61102c85858585613925565b33612281611c86565b6001600160a01b031614806122a15750610131546001600160a01b031633145b6122bd5760405162461bcd60e51b8152600401610c319061566c565b61013e80546001600160a01b0319166001600160a01b0392909216919091179055565b6040805160018082528183019092526060916000919060208083019080368337505061013b5482519293506001600160a01b03169183915060009061233557634e487b7160e01b600052603260045260246000fd5b6001600160a01b039092166020928302919091019091015292915050565b600080516020615c0d83398151915261236c8133612dec565b610134546001600160801b031661238281612e50565b61239e5760405162461bcd60e51b8152600401610c319061576c565b60036101385460ff1660038111156123c657634e487b7160e01b600052602160045260246000fd5b146123fd5760405162461bcd60e51b8152602060048201526007602482015266085c185d5cd95960ca1b6044820152606401610c31565b610138805460ff191660021790556040517ffc5afa2a710e95f2fb260ade6fe6305d7ae901d23c06de6eb054d03c092a3bcd90600090a15050565b61013380546101345461013554610136805463ffffffff80861696600160201b8704909116956001600160401b03600160401b8204811696600160801b808404831697600160c01b909404909216956001600160801b0380831696939092049091169360ff8416936001600160a01b0361010090910416929091906124bc90615a9d565b80601f01602080910402602001604051908101604052809291908181526020018280546124e890615a9d565b80156125355780601f1061250a57610100808354040283529160200191612535565b820191906000526020600020905b81548152906001019060200180831161251857829003601f168201915b5050505060048301546005840154604080516006870180546060602082028401810185529383018181529798959760ff909516965091939092849284918401828280156125cd57602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116125905790505b505050505081526020016001820180548060200260200160405190810160405280929190818152602001828054801561262f57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612611575b50505050508152505090508d565b606061264882612bca565b6126945760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e006044820152606401610c31565b600061013360030180546126a790615a9d565b80601f01602080910402602001604051908101604052809291908181526020018280546126d390615a9d565b80156127205780601f106126f557610100808354040283529160200191612720565b820191906000526020600020905b81548152906001019060200180831161270357829003601f168201915b5050505050905060008151116127455760405180602001604052806000815250611d02565b8061274f84613957565b60405160200161276092919061528c565b6040516020818303038152906040529392505050565b3360009081526101326020526040902054806127cd5760405162461bcd60e51b81526020600482015260166024820152756e6f206372656469747320746f20776974686472617760501b6044820152606401610c31565b3360009081526101326020526040808220829055516001600160a01b03841690614e2090849084818181858888f193505050503d806000811461282c576040519150601f19603f3d011682016040523d82523d6000602084013e612831565b606091505b5050905080610c6a5760405162461bcd60e51b815260206004820152600f60248201526e1dda5d1a191c985dc819985a5b1959608a1b6044820152606401610c31565b600081815260fb60205260408120610b3190613a70565b610f498282613a7a565b600080516020615c0d8339815191526128ae8133612dec565b60006101385460ff1660038111156128d657634e487b7160e01b600052602160045260246000fd5b14156128f45760405162461bcd60e51b8152600401610c31906154f1565b6101355460ff16156129185760405162461bcd60e51b8152600401610c3190615566565b815161292c906101369060208501906149d2565b507f57cafa311d6d28ea1d59c17aa93e87ca0d9aa0ef533ee169e7ee99f0f49afe1a826040516117c291906154de565b61013c805461296a90615a9d565b80601f016020809104026020016040519081016040528092919081815260200182805461299690615a9d565b80156129e35780601f106129b8576101008083540402835291602001916129e3565b820191906000526020600020905b8154815290600101906020018083116129c657829003601f168201915b505050505081565b6001600160a01b038083166000908152606a6020908152604080832093851683529290529081205460ff1680611d025750611d02600083611d09565b6000612a338133612dec565b6127108263ffffffff161115612a4857600080fd5b5061012e805463ffffffff191663ffffffff92909216919091179055565b600080516020615c0d833981519152612a7f8133612dec565b610133546001600160401b03808516600160401b9092041611612ad85760405162461bcd60e51b81526020600482015260116024820152704e65772063617020746f6f206c6172676560781b6044820152606401610c31565b5061013380546001600160401b03938416600160401b02600160401b600160801b031990911617905561012e805491909216600160201b02600160201b600160601b0319909116179055565b60006001600160e01b031982166380ac58cd60e01b1480612b5557506001600160e01b03198216635b5e139f60e01b145b80610b3157506301ffc9a760e01b6001600160e01b0319831614610b31565b6000612b7f82612b24565b80610b315750506001600160e01b03191660009081526097602052604090205460ff1690565b60006001600160e01b03198216635a05180f60e01b1480610b315750610b3182613a97565b6000908152606760205260409020546001600160a01b0316151590565b61013e546001600160a01b03168015801590612c0d57506000816001600160a01b03163b115b1561103057604051633185c44d60e21b81526001600160a01b0382169063c617113490612c409030908690600401615367565b60206040518083038186803b158015612c5857600080fd5b505afa158015612c6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c909190614de1565b6110305781604051633b79c77360e21b8152600401610c319190615353565b6000612cba826114ca565b9050806001600160a01b0316836001600160a01b03161415612d285760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c31565b336001600160a01b0382161480612d445750612d4481336129eb565b612db15760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610c31565b610c6a8383613abc565b612dc53382613b2a565b612de15760405162461bcd60e51b8152600401610c3190615692565b610c6a838383613bec565b612df68282611d09565b61103057612e0e816001600160a01b03166014613d7a565b612e19836020613d7a565b604051602001612e2a9291906152e4565b60408051601f198184030181529082905262461bcd60e51b8252610c31916004016154de565b600042826001600160801b03161180610b315750506001600160801b03161590565b612e7b82610d60565b612e858133612dec565b610c6a8383613f5b565b6000611d02836001600160a01b038416613fe1565b6001600160a01b0381163314612f145760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c31565b6110308282614030565b6000611d02836001600160a01b038416614097565b60008151835114612f705760405162461bcd60e51b81526020600482015260076024820152661a5b9d985b1a5960ca1b6044820152606401610c31565b6000805b8351811015612fc457838181518110612f9d57634e487b7160e01b600052603260045260246000fd5b602002602001015182612fb0919061594c565b915080612fbc81615af4565b915050612f74565b506127108163ffffffff1611156130055760405162461bcd60e51b8152602060048201526005602482015264313839901f60d91b6044820152606401610c31565b5060019392505050565b600060016101385460ff16600381111561303957634e487b7160e01b600052602160045260246000fd5b14905090565b600060026101385460ff16600381111561306957634e487b7160e01b600052602160045260246000fd5b148015613087575061013454613087906001600160801b0316612e50565b905090565b610133546001600160401b03600160801b8204811691600160401b90041660005b8463ffffffff168161ffff161015613232576000826001600160401b0316116131095760405162461bcd60e51b815260206004820152600e60248201526d07175616e74697479203e206361760941b6044820152606401610c31565b6131298461311b61ffff841686615909565b6001600160801b03166141b4565b6000434241856040516020016131729493929190938452602084019290925260601b6001600160601b031916604083015260c01b6001600160c01b0319166054820152605c0190565b60408051601f198184030181529190528051602090910120610131549091507f730694d60b9a9c8c5fa1acbe8e8ca7debca9124dc92acf55aa1024d2c9e43789906001600160a01b0316866131cb61ffff861688615909565b604080516001600160a01b0394851681529390921660208401526001600160801b0316908201526001600160401b03851660608201526080810183905260a00160405180910390a161321c83615a7a565b925050808061322a90615ad2565b9150506130ad565b50610133805463ffffffff8616919060109061325f908490600160801b90046001600160401b031661596b565b92506101000a8154816001600160401b0302191690836001600160401b031602179055508061013360000160086101000a8154816001600160401b0302191690836001600160401b0316021790555050505050565b60006132be61300f565b80156132c957508115155b80156133605750613360613320338663ffffffff166040516001600160601b0319606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b610133600401548585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506142d492505050565b949350505050565b61013554610134546101009091046001600160a01b031690600160801b90046001600160801b03168161341d5783156133d65760405162461bcd60e51b815260206004820152601060248201526f0746f6b656e416d6f756e7420213d20360841b6044820152606401610c31565b6133e68163ffffffff87166159a1565b6001600160801b0316341461340d5760405162461bcd60e51b8152600401610c31906155f7565b6134188234856142e1565b61102c565b341561345c5760405162461bcd60e51b815260206004820152600e60248201526d06574682076616c756520213d20360941b6044820152606401610c31565b61346c8163ffffffff87166159a1565b6001600160801b031684146134935760405162461bcd60e51b8152600401610c31906155f7565b6040516323b872dd60e01b8152336004820152306024820152604481018590526001600160a01b038316906323b872dd90606401602060405180830381600087803b1580156134e157600080fd5b505af11580156134f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135199190614de1565b5061102c8285856142e1565b8061352f81612e50565b61354b5760405162461bcd60e51b8152600401610c319061576c565b613554886143d0565b8651613568906101369060208a01906149d2565b508515613576576101378690555b610133805463ffffffff868116600160201b026001600160401b0319909216908816171790556001600160401b038316156135cd5761013380546001600160c01b0316600160c01b6001600160401b038616021790555b6001600160801b038216156135f95761013480546001600160801b0319166001600160801b0384161790555b5050505050505050565b6101388054600160ff1990911617905561012e80546101338054600160801b600160c01b031916600160201b9092046001600160401b03908116600160801b81029390931791829055600160401b9091041691829160049061366690849061596b565b92506101000a8154816001600160401b0302191690836001600160401b031602179055507feace9ffe7fa97ff7dbf4b23bcc99df5b088f5af2913bc589b0ad786a775f3cb961013160009054906101000a90046001600160a01b031682846101336003016040516117c294939291906153d7565b6001600160e01b031980821614156137335760405162461bcd60e51b815260206004820152601c60248201527b115490cc4d8d4e881a5b9d985b1a59081a5b9d195c999858d9481a5960221b6044820152606401610c31565b6001600160e01b0319166000908152609760205260409020805460ff19166001179055565b6000611d028383614405565b600054610100900460ff168061377d575060005460ff16155b6137995760405162461bcd60e51b8152600401610c319061561e565b600054610100900460ff161580156137bb576000805461ffff19166101011790555b6137c361443d565b6137cb61443d565b6137d583836144a7565b8015610c6a576000805461ff0019169055505050565b600054610100900460ff1680613804575060005460ff16155b6138205760405162461bcd60e51b8152600401610c319061561e565b600054610100900460ff16158015613842576000805461ffff19166101011790555b61384a61443d565b61385261443d565b611c7261443d565b610eb9828261453c565b6001600160a01b0382163314156138b95760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610c31565b336000818152606a602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61392f3383613b2a565b61394b5760405162461bcd60e51b8152600401610c3190615692565b610d1d84848484614546565b60608161397b5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156139a5578061398f81615af4565b915061399e9050600a8361598d565b915061397f565b6000816001600160401b038111156139cd57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156139f7576020820181803683370190505b5090505b841561336057613a0c6001836159ef565b9150613a19600a86615b0f565b613a24906030615934565b60f81b818381518110613a4757634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350613a69600a8661598d565b94506139fb565b6000610b31825490565b613a8382610d60565b613a8d8133612dec565b610c6a8383614030565b60006001600160e01b03198216637965db0b60e01b1480610b315750610b3182612b74565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190613af1826114ca565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000613b3582612bca565b613b965760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c31565b6000613ba1836114ca565b9050806001600160a01b0316846001600160a01b03161480613bdc5750836001600160a01b0316613bd184610bc9565b6001600160a01b0316145b80613360575061336081856129eb565b826001600160a01b0316613bff826114ca565b6001600160a01b031614613c675760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610c31565b6001600160a01b038216613cc95760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c31565b613cd4600082613abc565b6001600160a01b0383166000908152606860205260408120805460019290613cfd9084906159ef565b90915550506001600160a01b0382166000908152606860205260408120805460019290613d2b908490615934565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020615c2d83398151915291a4505050565b60606000613d898360026159d0565b613d94906002615934565b6001600160401b03811115613db957634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613de3576020820181803683370190505b509050600360fc1b81600081518110613e0c57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613e4957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000613e6d8460026159d0565b613e78906001615934565b90505b6001811115613f0c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613eba57634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110613ede57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93613f0581615a63565b9050613e7b565b508315611d025760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c31565b613f658282611d09565b61103057600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff19166001179055613f9d3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600081815260018301602052604081205461402857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b31565b506000610b31565b61403a8282611d09565b1561103057600082815260c9602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600081815260018301602052604081205480156141aa5760006140bb6001836159ef565b85549091506000906140cf906001906159ef565b90508181146141505760008660000182815481106140fd57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490508087600001848154811061412e57634e487b7160e01b600052603260045260246000fd5b6000918252602080832090910192909255918252600188019052604090208390555b855486908061416f57634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610b31565b6000915050610b31565b6001600160a01b03821661420a5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c31565b61421381612bca565b1561425f5760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610c31565b6001600160a01b0382166000908152606860205260408120805460019290614288908490615934565b909155505060008181526067602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020615c2d833981519152908290a45050565b6000613360828486614579565b60006142eb6120a2565b905060006142f76113d8565b90506000805b83518110156143a157600061271084838151811061432b57634e487b7160e01b600052603260045260246000fd5b602002602001015163ffffffff168861434491906159d0565b61434e919061598d565b905061435a8184615934565b925061438e85838151811061437f57634e487b7160e01b600052603260045260246000fd5b6020026020010151898361458f565b508061439981615af4565b9150506142fd565b5060006143ae82876159ef565b11156143c8576143c884876143c384896159ef565b61458f565b505050505050565b6001600160a01b03811615610cf55761013580546001600160a01b03831661010002610100600160a81b031990911617905550565b600082600001828154811061442a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b600054610100900460ff1680614456575060005460ff16155b6144725760405162461bcd60e51b8152600401610c319061561e565b600054610100900460ff16158015611c72576000805461ffff19166101011790558015610cf5576000805461ff001916905550565b600054610100900460ff16806144c0575060005460ff16155b6144dc5760405162461bcd60e51b8152600401610c319061561e565b600054610100900460ff161580156144fe576000805461ffff19166101011790555b82516145119060659060208601906149d2565b5081516145259060669060208501906149d2565b508015610c6a576000805461ff0019169055505050565b6110308282613f5b565b614551848484613bec565b61455d848484846146c3565b610d1d5760405162461bcd60e51b8152600401610c3190615514565b60008261458685846147d0565b14949350505050565b6001600160a01b0382161561461e5760405163a9059cbb60e01b81526001600160a01b0383169063a9059cbb906145cc90869085906004016153be565b602060405180830381600087803b1580156145e657600080fd5b505af11580156145fa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1d9190614de1565b6000836001600160a01b031682614e2090604051600060405180830381858888f193505050503d8060008114614670576040519150601f19603f3d011682016040523d82523d6000602084013e614675565b606091505b5050905080610d1d576001600160a01b038416600090815261013260205260409020546146a3908390615934565b6001600160a01b0385166000908152610132602052604090205550505050565b60006001600160a01b0384163b156147c557604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614707903390899088908890600401615381565b602060405180830381600087803b15801561472157600080fd5b505af1925050508015614751575060408051601f3d908101601f1916820190925261474e91810190614e76565b60015b6147ab573d80801561477f576040519150601f19603f3d011682016040523d82523d6000602084013e614784565b606091505b5080516147a35760405162461bcd60e51b8152600401610c3190615514565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050613360565b506001949350505050565b600081815b84518110156148235761480f8286838151811061480257634e487b7160e01b600052603260045260246000fd5b602002602001015161482b565b91508061481b81615af4565b9150506147d5565b509392505050565b6000818310614847576000828152602084905260409020611d02565b6000838152602083905260409020611d02565b828054828255906000526020600020906007016008900481019282156148f95791602002820160005b838211156148c757835183826101000a81548163ffffffff021916908363ffffffff1602179055509260200192600401602081600301049283019260010302614883565b80156148f75782816101000a81549063ffffffff02191690556004016020816003010492830192600103026148c7565b505b50614905929150614a46565b5090565b8280548282559060005260206000209081019282156148f9579160200282015b828111156148f957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614929565b82805461496a90615a9d565b90600052602060002090601f01602090048101928261498c57600085556148f9565b82601f106149a55782800160ff198235161785556148f9565b828001600101855582156148f9579182015b828111156148f95782358255916020019190600101906149b7565b8280546149de90615a9d565b90600052602060002090601f016020900481019282614a0057600085556148f9565b82601f10614a1957805160ff19168380011785556148f9565b828001600101855582156148f9579182015b828111156148f9578251825591602001919060010190614a2b565b5b808211156149055760008155600101614a47565b60006001600160401b03831115614a7457614a74615b4f565b614a87601f8401601f19166020016158b6565b9050828152838383011115614a9b57600080fd5b828260208301376000602084830101529392505050565b600082601f830112614ac2578081fd5b81356020614ad7614ad2836158e6565b6158b6565b80838252828201915082860187848660051b8901011115614af6578586fd5b855b85811015614b1d578135614b0b81615bc1565b84529284019290840190600101614af8565b5090979650505050505050565b60008083601f840112614b3b578182fd5b5081356001600160401b03811115614b51578182fd5b6020830191508360208260051b8501011115614b6c57600080fd5b9250929050565b600060408284031215614b84578081fd5b50919050565b600060408284031215614b9b578081fd5b614ba361588e565b905081356001600160401b0380821115614bbc57600080fd5b818401915084601f830112614bd057600080fd5b81356020614be0614ad2836158e6565b80838252828201915082860189848660051b8901011115614c0057600080fd5b600096505b84871015614c2c578035614c1881615bfa565b835260019690960195918301918301614c05565b5086525085810135935082841115614c4357600080fd5b614c4f87858801614ab2565b818601525050505092915050565b80356001600160401b0381168114614c7457600080fd5b919050565b600060208284031215614c8a578081fd5b8135611d0281615bc1565b60008060408385031215614ca7578081fd5b8235614cb281615bc1565b91506020830135614cc281615bc1565b809150509250929050565b600080600060608486031215614ce1578081fd5b8335614cec81615bc1565b92506020840135614cfc81615bc1565b929592945050506040919091013590565b60008060008060808587031215614d22578182fd5b8435614d2d81615bc1565b93506020850135614d3d81615bc1565b92506040850135915060608501356001600160401b03811115614d5e578182fd5b8501601f81018713614d6e578182fd5b614d7d87823560208401614a5b565b91505092959194509250565b60008060408385031215614d9b578182fd5b8235614da681615bc1565b91506020830135614cc281615bd6565b60008060408385031215614dc8578182fd5b8235614dd381615bc1565b946020939093013593505050565b600060208284031215614df2578081fd5b8151611d0281615bd6565b600060208284031215614e0e578081fd5b5035919050565b60008060408385031215614e27578182fd5b823591506020830135614cc281615bc1565b60008060408385031215614e4b578182fd5b50508035926020909101359150565b600060208284031215614e6b578081fd5b8135611d0281615be4565b600060208284031215614e87578081fd5b8151611d0281615be4565b600060208284031215614ea3578081fd5b81356001600160401b03811115614eb8578182fd5b8201601f81018413614ec8578182fd5b61336084823560208401614a5b565b60008060408385031215614ee9578182fd5b82356001600160401b0380821115614eff578384fd5b908401906101408287031215614f13578384fd5b90925060208401359080821115614f28578283fd5b50614f3585828601614b73565b9150509250929050565b60008060008084860360e0811215614f55578283fd5b85356001600160401b03811115614f6a578384fd5b860160808189031215614f7b578384fd5b94506060601f1982011215614f8e578283fd5b50602085019250614fa28660808701614b73565b915060c0850135614fb281615bc1565b939692955090935050565b600060208284031215614fce578081fd5b81356001600160401b03811115614fe3578182fd5b61336084828501614b8a565b600060408284031215615000578081fd5b611d028383614b73565b60006020828403121561501b578081fd5b81356001600160801b0381168114611d02578182fd5b600060208284031215615042578081fd5b8135611d0281615bfa565b600080600080600060808688031215615064578283fd5b853561506f81615bfa565b9450602086013561507f81615bfa565b93506040860135925060608601356001600160401b038111156150a0578182fd5b6150ac88828901614b2a565b969995985093965092949392505050565b60008060008060008060a087890312156150d5578384fd5b86356150e081615bfa565b955060208701356150f081615bfa565b94506040870135935060608701356001600160401b03811115615111578182fd5b61511d89828a01614b2a565b909450925050608087013561513181615bc1565b809150509295509295509295565b600060208284031215615150578081fd5b611d0282614c5d565b6000806040838503121561516b578182fd5b61517483614c5d565b9150610ea660208401614c5d565b6000815180845260208085019450808401835b838110156151ba5781516001600160a01b031687529582019590820190600101615195565b509495945050505050565b6000815180845260208085019450808401835b838110156151ba57815163ffffffff16875295820195908201906001016151d8565b60008151808452615212816020860160208601615a37565b601f01601f19169290920160200192915050565b6004811061524457634e487b7160e01b600052602160045260246000fd5b9052565b600081516040845261525d60408501826151c5565b9050602083015184820360208601526152768282615182565b95945050505050565b6001600160801b03169052565b6000835161529e818460208801615a37565b8083019050602f60f81b80825284516152be816001850160208901615a37565b6001920191820152693a37b5b2b7173539b7b760b11b6002820152600c01949350505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615316816017850160208801615a37565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615347816028840160208801615a37565b01602801949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906153b4908301846151fa565b9695505050505050565b6001600160a01b03929092168252602082015260400190565b6001600160a01b03851681526001600160401b0384166020808301919091526080604083018190526000919061540f908401866151fa565b838103606085015284548390600181811c908083168061543057607f831692505b86831081141561544e57634e487b7160e01b88526022600452602488fd5b82865260208601955080801561546b576001811461547c576154a6565b60ff198516875287870195506154a6565b60008b815260209020895b858110156154a057815489820152908401908901615487565b88019650505b50939c9b505050505050505050505050565b602081526000611d026020830184615182565b602081526000611d0260208301846151c5565b602081526000611d0260208301846151fa565b602080825260099082015268085c1c995c185c995960ba1b604082015260600190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252600a9082015269155492481b1bd8dad95960b21b604082015260600190565b60208082526028908201527f63616e6e6f7420627579203e206d61785075726368617365416d6f756e7420696040820152670dc40dedcca40e8f60c31b606082015260800190565b6020808252600b908201526a756e617661696c61626c6560a81b604082015260600190565b6020808252600d908201526c0908084f48195e1c1958dd1959609a1b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600c908201526b1d5b985d5d1a1bdc9a5e995960a21b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252601490820152730f881dda1a5d195b1a5cdd195908185b5bdd5b9d60621b604082015260600190565b6020808252600a908201526938bab0b73a34ba3c901f60b11b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602080825260059082015264195b99195960da1b604082015260600190565b63ffffffff8e811682528d1660208201526001600160401b038c811660408301528b1660608201526001600160401b038a1660808201526157cf60a082018a61527f565b6157dc60c082018961527f565b86151560e08201526001600160a01b0386166101008201526101a0610120820152600061580d6101a08301876151fa565b85610140840152615822610160840186615226565b8281036101808401526158358185615248565b9150509e9d5050505050505050505050505050565b6000808335601e19843603018112615860578283fd5b8301803591506001600160401b03821115615879578283fd5b602001915036819003821315614b6c57600080fd5b604080519081016001600160401b03811182821017156158b0576158b0615b4f565b60405290565b604051601f8201601f191681016001600160401b03811182821017156158de576158de615b4f565b604052919050565b60006001600160401b038211156158ff576158ff615b4f565b5060051b60200190565b60006001600160801b0382811684821680830382111561592b5761592b615b23565b01949350505050565b6000821982111561594757615947615b23565b500190565b600063ffffffff80831681851680830382111561592b5761592b615b23565b60006001600160401b0382811684821680830382111561592b5761592b615b23565b60008261599c5761599c615b39565b500490565b60006001600160801b03828116848216811515828404821116156159c7576159c7615b23565b02949350505050565b60008160001904831182151516156159ea576159ea615b23565b500290565b600082821015615a0157615a01615b23565b500390565b600063ffffffff83811690831681811015615a2357615a23615b23565b039392505050565b6000610b313683614b8a565b60005b83811015615a52578181015183820152602001615a3a565b83811115610d1d5750506000910152565b600081615a7257615a72615b23565b506000190190565b60006001600160401b03821680615a9357615a93615b23565b6000190192915050565b600181811c90821680615ab157607f821691505b60208210811415614b8457634e487b7160e01b600052602260045260246000fd5b600061ffff80831681811415615aea57615aea615b23565b6001019392505050565b6000600019821415615b0857615b08615b23565b5060010190565b600082615b1e57615b1e615b39565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8135615b7081615bc1565b81546001600160a01b031981166001600160a01b039290921691821783556020840135615b9c81615bfa565b6001600160c01b03199190911690911760a09190911b63ffffffff60a01b1617905550565b6001600160a01b0381168114610cf557600080fd5b8015158114610cf557600080fd5b6001600160e01b031981168114610cf557600080fd5b63ffffffff81168114610cf557600080fdfe9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212204aa53d60ea57282824b5a81070a58025319f736c7a2bc4566bc5acd72f5cdd3364736f6c63430008040033

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.