ETH Price: $2,392.34 (-3.45%)

Contract

0x206FdE31CF2CB30702414BacFCf51e2796aB08cB
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
168346212023-03-15 16:56:35567 days ago1678899395  Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DynamicBlueprint

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 1 runs

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

import "../abstract/HasSecondarySaleFees.sol";
import "../common/IRoyalty.sol";
import "../common/IOperatorFilterer.sol";
import "../common/Royalty.sol";
import "./interfaces/IDynamicBlueprint.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import { IOperatorFilterRegistry } from "../operatorFilter/IOperatorFilterRegistry.sol";

/**
 * @notice Async Art Dynamic Blueprint NFT contract with true creator provenance
 * @author Async Art, Ohimire Labs
 */
contract DynamicBlueprint is
    ERC721Upgradeable,
    HasSecondarySaleFees,
    AccessControlEnumerableUpgradeable,
    ReentrancyGuard,
    Royalty,
    IDynamicBlueprint
{
    using StringsUpgradeable for uint256;

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

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

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

    /**
     * @notice Blueprint artist
     */
    address public artist;

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

    /**
     * @notice Token Ids to custom, per-token, overriding token URIs
     */
    mapping(uint256 => DynamicBlueprintTokenURI) public tokenIdsToURI;

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

    /**
     * @notice Broadcast contract
     */
    address public broadcast;

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

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

    /**
     * @notice A registry to check for blacklisted operator addresses.
     *      Used to only permit marketplaces enforcing creator royalites if desired
     */
    IOperatorFilterRegistry public operatorFilterRegistry;

    /**
     * @notice Royalty config
     */
    Royalty private _royalty;

    /**
     * @notice Emitted when NFTs of blueprint are minted
     * @param tokenId NFT minted
     * @param newMintedCount New amount of tokens minted
     * @param recipient Recipent of minted NFTs
     */
    event BlueprintMinted(uint128 indexed tokenId, uint64 newMintedCount, address recipient);

    /**
     * @notice 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 (unless overriden)
     */
    event BlueprintPrepared(address indexed artist, uint64 capacity, string blueprintMetaData, string baseTokenUri);

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

    /**
     * @notice Checks if blueprint is prepared
     */
    modifier isBlueprintPrepared() {
        require(blueprint.prepared, "!prepared");
        _;
    }

    /**
     * @notice Check if token is not soulbound. Revert if it is
     * @param tokenId ID of token being checked
     */
    modifier isNotSoulbound(uint256 tokenId) {
        require(!blueprint.isSoulbound, "is soulbound");
        _;
    }

    /////////////////////////////////////////////////
    /// Required for CORI Operator Registry //////
    /////////////////////////////////////////////////

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

    /**
     * @notice Restrict operators who are allowed to transfer these tokens
     * @param from Account that token is being transferred out of
     */
    modifier onlyAllowedOperator(address from) {
        if (from != msg.sender) {
            _checkFilterOperator(msg.sender);
        }
        _;
    }

    /**
     * @notice Restrict operators who are allowed to approve transfer delegates
     * @param operator Operator that is attempting to move tokens
     */
    modifier onlyAllowedOperatorApproval(address operator) {
        _checkFilterOperator(operator);
        _;
    }

    /**
     * @notice Initialize the instance
     * @param dynamicBlueprintsInput Core parameters for contract initialization
     * @param _platform Platform admin account
     * @param _minter Minter admin account
     * @param _royaltyParameters Initial royalty settings
     * @param storefrontMinters Addresses to be given STOREFRONT_MINTER_ROLE
     * @param _broadcast Broadcast contract that intents are emitted from
     * @param operatorFiltererInputs OpenSea operator filterer addresses
     */
    function initialize(
        DynamicBlueprintsInput calldata dynamicBlueprintsInput,
        address _platform,
        address _minter,
        Royalty calldata _royaltyParameters,
        address[] calldata storefrontMinters,
        address _broadcast,
        IOperatorFilterer.OperatorFiltererInputs calldata operatorFiltererInputs
    ) external initializer royaltyValid(_royaltyParameters) {
        // Intialize parent contracts
        ERC721Upgradeable.__ERC721_init(dynamicBlueprintsInput.name, dynamicBlueprintsInput.symbol);
        HasSecondarySaleFees._initialize();
        AccessControlUpgradeable.__AccessControl_init();

        _setupRole(DEFAULT_ADMIN_ROLE, _platform);
        _setupRole(MINTER_ROLE, _minter);

        for (uint256 i = 0; i < storefrontMinters.length; i++) {
            _setupRole(STOREFRONT_MINTER_ROLE, storefrontMinters[i]);
        }

        platform = _platform;
        minterAddress = _minter;
        artist = dynamicBlueprintsInput.artist;

        contractURI = dynamicBlueprintsInput.contractURI;
        _royalty = _royaltyParameters;

        broadcast = _broadcast;

        // Store OpenSea's operator filter registry, (passed as parameter to constructor for dependency injection)
        // On mainnet the filter registry will be: 0x000000000000AAeB6D7670E522A718067333cd4E
        operatorFilterRegistry = IOperatorFilterRegistry(operatorFiltererInputs.operatorFilterRegistryAddress);

        // Register contract address with the registry and subscribe to
        // CORI canonical filter-list (passed via constructor for dependency injection)
        // On mainnet the subscription address will be: 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6
        operatorFilterRegistry.registerAndSubscribe(
            address(this),
            operatorFiltererInputs.coriCuratedSubscriptionAddress
        );
    }

    /**
     * @notice See {IDynamicBlueprint.prepareBlueprintAndCreateSale}
     */
    function prepareBlueprintAndCreateSale(
        BlueprintPreparationConfig calldata config,
        IStorefront.Sale memory sale,
        address storefront
    ) external override onlyRole(MINTER_ROLE) {
        require(blueprint.prepared == false, "already prepared");
        require(hasRole(STOREFRONT_MINTER_ROLE, storefront), "Storefront not authorized to mint");
        blueprint.capacity = config._capacity;

        _setupBlueprint(config._baseTokenUri, config._blueprintMetaData, config._isSoulbound);

        IStorefront(storefront).createSale(sale);

        _setBlueprintPrepared(config._blueprintMetaData);
    }

    /**
     * @notice See {IDynamicBlueprint.mintBlueprints}
     */
    function mintBlueprints(
        uint32 purchaseQuantity,
        address nftRecipient
    ) external override onlyRole(STOREFRONT_MINTER_ROLE) {
        Blueprint memory b = blueprint;
        // quantity must be available for minting
        require(b.mintedCount + purchaseQuantity <= b.capacity || b.capacity == 0, "quantity >");
        if (b.isSoulbound) {
            // if soulbound, can only mint one and the wallet must not already have a soulbound edition
            require(balanceOf(nftRecipient) == 0 && purchaseQuantity == 1, "max 1 soulbound/addr");
        }

        _mintQuantity(purchaseQuantity, nftRecipient);
    }

    /**
     * @notice See {IDynamicBlueprint.updateBlueprintArtist}
     */
    function updateBlueprintArtist(address _newArtist) external override onlyRole(MINTER_ROLE) {
        artist = _newArtist;
    }

    /**
     * @notice See {IDynamicBlueprint.updatePlatformAddress}
     */
    function updatePlatformAddress(address _platform) external override onlyRole(DEFAULT_ADMIN_ROLE) {
        grantRole(DEFAULT_ADMIN_ROLE, _platform);

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

    /**
     * @notice See {IDynamicBlueprint.updateBlueprintCapacity}
     */
    function updateBlueprintCapacity(
        uint64 _newCapacity,
        uint64 _newLatestErc721TokenIndex
    ) external override onlyRole(MINTER_ROLE) {
        // why is this a requirement?
        require(blueprint.capacity > _newCapacity, "New cap too large");

        blueprint.capacity = _newCapacity;

        latestErc721TokenIndex = _newLatestErc721TokenIndex;
    }

    /**
     * @notice See {IDynamicBlueprint.updatePerTokenURI}
     */
    function updatePerTokenURI(uint256 _tokenId, string calldata _newURI) external override onlyRole(MINTER_ROLE) {
        require(_exists(_tokenId), "!minted");
        require(!tokenIdsToURI[_tokenId].isFrozen, "uri frozen");
        tokenIdsToURI[_tokenId].tokenURI = _newURI;
    }

    /**
     * @notice See {IDynamicBlueprint.lockPerTokenURI}
     */
    function lockPerTokenURI(uint256 _tokenId) external override {
        require(ownerOf(_tokenId) == msg.sender, "!owner");
        require(!tokenIdsToURI[_tokenId].isFrozen, "uri already frozen");
        tokenIdsToURI[_tokenId].isFrozen = true;
    }

    /**
     * @notice See {IDynamicBlueprint.updateBlueprintTokenUri}
     */
    function updateBlueprintTokenUri(
        string memory newBaseTokenUri
    ) external override onlyRole(MINTER_ROLE) isBlueprintPrepared {
        require(!blueprint.tokenUriLocked, "URI locked");

        blueprint.baseTokenUri = newBaseTokenUri;

        emit BlueprintTokenUriUpdated(newBaseTokenUri);
    }

    /**
     * @notice See {IDynamicBlueprint.updateBlueprintMetadataUri}
     */
    function updateBlueprintMetadataUri(
        string calldata newMetadataUri
    ) external override onlyRole(MINTER_ROLE) isBlueprintPrepared {
        require(!blueprint.metadataUriLocked, "metadata URI locked");
        blueprint.blueprintMetadata = newMetadataUri;
    }

    /**
     * @notice See {IDynamicBlueprint-updateOperatorFilterAndRegister}
     */
    function updateOperatorFilterAndRegister(
        address newRegistry,
        address coriCuratedSubscriptionAddress
    ) external override {
        updateOperatorFilterRegistryAddress(newRegistry);
        addOperatorFiltererSubscription(coriCuratedSubscriptionAddress);
    }

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

    /**
     * @notice See {IDynamicBlueprint.lockBlueprintTokenUri}
     */
    function lockBlueprintTokenUri() external override onlyRole(DEFAULT_ADMIN_ROLE) isBlueprintPrepared {
        require(!blueprint.tokenUriLocked, "URI locked");

        blueprint.tokenUriLocked = true;
    }

    /**
     * @notice See {IDynamicBlueprint.lockBlueprintMetadataUri}
     */
    function lockBlueprintMetadataUri() external override onlyRole(DEFAULT_ADMIN_ROLE) {
        blueprint.metadataUriLocked = true;
    }

    /**
     * @notice See {IDynamicBlueprint.updateRoyalty}
     */
    function updateRoyalty(
        Royalty calldata newRoyalty
    ) external override onlyRole(DEFAULT_ADMIN_ROLE) royaltyValid(newRoyalty) {
        _royalty = newRoyalty;
    }

    /**
     * @notice See {IDynamicBlueprint.updateMinterAddress}
     */
    function updateMinterAddress(address newMinterAddress) external override onlyRole(DEFAULT_ADMIN_ROLE) {
        grantRole(MINTER_ROLE, newMinterAddress);

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

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

    /**
     * @notice See {IDynamicBlueprint.getFeeRecipients}
     */
    function getFeeRecipients(
        uint256 /* tokenId */
    ) external view override(HasSecondarySaleFees, IDynamicBlueprint) returns (address[] memory) {
        return _royalty.recipients;
    }

    /**
     * @notice See {IDynamicBlueprint.getFeeBps}
     */
    function getFeeBps(
        uint256 /* tokenId */
    ) external view override(HasSecondarySaleFees, IDynamicBlueprint) returns (uint32[] memory) {
        return _royalty.royaltyCutsBPS;
    }

    /**
     * @notice See {IDynamicBlueprint.metadataURI}
     */
    function metadataURI() external view virtual override isBlueprintPrepared returns (string memory) {
        return blueprint.blueprintMetadata;
    }

    /**
     * @notice Register this contract with the OpenSea operator registry. Subscribe to OpenSea's operator blacklist.
     * @param subscription An address that is currently registered with the operatorFiltererRegistry
     *                     that we will subscribe to.
     */
    function addOperatorFiltererSubscription(address subscription) public {
        require(owner() == msg.sender || artist == msg.sender, "unauthorized");
        operatorFilterRegistry.subscribe(address(this), subscription);
    }

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

    /**
     * @notice Override {IERC721-setApprovalForAll} to check against operator filter registry if it exists
     */
    function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
        super.setApprovalForAll(operator, approved);
    }

    /**
     * @notice Override {IERC721-approve} to check against operator filter registry if it exists
     */
    function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) {
        super.approve(operator, tokenId);
    }

    /**
     * @notice Override {IERC721-transferFrom} to check soulbound, and operator filter registry if it exists
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public override onlyAllowedOperator(from) isNotSoulbound(tokenId) {
        super.transferFrom(from, to, tokenId);
    }

    /**
     * @notice Override {IERC721-safeTransferFrom} to check soulbound, and operator filter registry if it exists
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public override onlyAllowedOperator(from) isNotSoulbound(tokenId) {
        super.safeTransferFrom(from, to, tokenId, data);
    }

    /**
     * @notice 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 (unless overridden)
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "URI query for nonexistent token");

        string memory customTokenURI = tokenIdsToURI[tokenId].tokenURI;
        if (bytes(customTokenURI).length != 0) {
            // if a custom token URI has been registered, prefer it to the default
            return customTokenURI;
        }

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

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

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

    /**
     * @notice 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);
    }

    /**
     * @notice Sets values after blueprint preparation
     * @param _blueprintMetaData Blueprint metadata uri
     */
    function _setBlueprintPrepared(string memory _blueprintMetaData) private {
        //assign the erc721 token index to the blueprint
        blueprint.erc721TokenIndex = latestErc721TokenIndex;
        blueprint.prepared = true;
        uint64 _capacity = blueprint.capacity;
        latestErc721TokenIndex += _capacity;

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

    /**
     * @notice Sets up core blueprint parameters
     * @param _baseTokenUri Base token uri for blueprint
     * @param _metadataUri Metadata uri for blueprint
     * @param _isSoulbound Denotes if tokens minted on blueprint are non-transferable
     */
    function _setupBlueprint(string memory _baseTokenUri, string memory _metadataUri, bool _isSoulbound) private {
        blueprint.baseTokenUri = _baseTokenUri;
        blueprint.blueprintMetadata = _metadataUri;

        if (_isSoulbound) {
            blueprint.isSoulbound = _isSoulbound;
        }
    }

    /**
     * @notice 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 newMintedCount = blueprint.mintedCount;
        for (uint16 i; i < _quantity; i++) {
            _mint(_nftRecipient, newTokenId + i);
            emit BlueprintMinted(newTokenId + i, newMintedCount, _nftRecipient);
            ++newMintedCount;
        }

        blueprint.erc721TokenIndex += _quantity;
        blueprint.mintedCount = newMintedCount;
    }

    /**
     * @notice Check if operator can perform an action
     * @param operator Operator attempting to perform action
     */
    function _checkFilterOperator(address operator) private 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);
            }
        }
    }
}

File 2 of 26 : AccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

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 onlyInitializing {
    }

    function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
    }
    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 virtual 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 virtual override returns (uint256) {
        return _roleMembers[role].length();
    }

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

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

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

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

File 4 of 26 : IAccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

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 5 of 26 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

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

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

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

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

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

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

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

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

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

File 7 of 26 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/ERC721.sol)

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 onlyInitializing {
        __ERC721_init_unchained(name_, symbol_);
    }

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

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(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: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _ownerOf(tokenId);
        require(owner != address(0), "ERC721: invalid token ID");
        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) {
        _requireMinted(tokenId);

        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 overridden 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 token owner or approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or 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: caller is not token owner or 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @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 _ownerOf(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) {
        address owner = ERC721Upgradeable.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == 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, 1);

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

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

        _afterTokenTransfer(address(0), to, tokenId, 1);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721Upgradeable.ownerOf(tokenId);

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

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721Upgradeable.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

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

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

    /**
     * @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 from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId, 1);

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId, 1);
    }

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

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

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    /**
     * @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 {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256, /* firstTokenId */
        uint256 batchSize
    ) internal virtual {
        if (batchSize > 1) {
            if (from != address(0)) {
                _balances[from] -= batchSize;
            }
            if (to != address(0)) {
                _balances[to] += batchSize;
            }
        }
    }

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}

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

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

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

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

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

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 13 of 26 : ERC165StorageUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)

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 onlyInitializing {
    }

    function __ERC165Storage_init_unchained() internal onlyInitializing {
    }
    /**
     * @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;
    }

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";

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

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

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

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

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

File 18 of 26 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

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.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
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) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

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

        /// @solidity memory-safe-assembly
        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 in 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;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 19 of 26 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

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

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

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

File 20 of 26 : HasSecondarySaleFees.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

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

abstract contract HasSecondarySaleFees is ERC165StorageUpgradeable {
    /*
     * bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f
     * bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb
     *
     * => 0x0ebd4c7f ^ 0xb9c4d9fb == 0xb7799584
     */
    bytes4 private constant _INTERFACE_ID_FEES = 0xb7799584;

    event SecondarySaleFees(uint256 tokenId, address[] recipients, uint256[] bps);

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

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

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

File 21 of 26 : IDynamicBlueprint.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;

import "../../storefront/interfaces/IStorefront.sol";
import "../../common/IRoyalty.sol";

/**
 * @notice Async Art Dynamic Blueprint NFT contract interface
 * @author Ohimire Labs
 */
interface IDynamicBlueprint {
    /**
     * @notice Blueprint
     * @param capacity Number of NFTs in Blueprint
     * @param mintedCount Number of Blueprint NFTs minted so far
     * @param erc721TokenIndex First token ID of the next Blueprint to be prepared
     * @param tokenUriLocked If the token metadata isn't updatable
     * @param baseTokenUri Base URI for token, resultant uri for each token is base uri concatenated with token id
     * @param metadataUriLocked If the metadata uri is frozen (cannot be modified)
     * @param blueprintMetadata A URI to web2 metadata for this entire blueprint
     * @param prepared If the blueprint is prepared
     * @param isSouldbound If the blueprint editions are soulbound tokens
     */
    struct Blueprint {
        uint64 capacity;
        uint64 mintedCount;
        uint64 erc721TokenIndex;
        bool tokenUriLocked;
        string baseTokenUri;
        bool metadataUriLocked;
        string blueprintMetadata;
        bool prepared;
        bool isSoulbound;
    }

    /**
     * @notice Data passed in when preparing blueprint
     * @param _capacity Number of NFTs in Blueprint
     * @param _blueprintMetaData Blueprint metadata uri
     * @param _baseTokenUri Base URI for token, resultant uri for each token is base uri concatenated with token id
     * @param _isSoulbound If the Blueprint is soulbound
     */
    struct BlueprintPreparationConfig {
        uint64 _capacity;
        string _blueprintMetaData;
        string _baseTokenUri;
        bool _isSoulbound;
    }

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

    /**
     * @notice Per-token optional struct tracking token-specific URIs which override baseTokenURI
     * @param tokenURI URI of token metadata
     * @param isFrozen whether or not the URI is frozen
     */
    struct DynamicBlueprintTokenURI {
        string tokenURI;
        bool isFrozen;
    }

    /**
     * @notice Prepare the blueprint and create a sale for it on a storefront 
               (this is the core operation to set up a blueprint)
     * @param config Object containing values required to prepare blueprint
     * @param sale Blueprint sale
     * @param storefront Storefront to create sale on
     */
    function prepareBlueprintAndCreateSale(
        BlueprintPreparationConfig calldata config,
        IStorefront.Sale memory sale,
        address storefront
    ) external;

    /**
     * @notice Mint a number of editions of this blueprint
     * @param purchaseQuantity How many blueprint editions to mint
     * @param nftRecipient Recipient of minted blueprints
     */
    function mintBlueprints(uint32 purchaseQuantity, address nftRecipient) external;

    /**
     * @notice Update the blueprint's artist
     * @param _newArtist New artist
     */
    function updateBlueprintArtist(address _newArtist) external;

    /**
     * @notice Update a blueprint's capacity
     * @param _newCapacity New capacity
     * @param _newLatestErc721TokenIndex Newly adjusted last ERC721 token id
     */
    function updateBlueprintCapacity(uint64 _newCapacity, uint64 _newLatestErc721TokenIndex) external;

    /**
     * @notice Update a specific token's URI
     * @param _tokenId The ID of the token
     * @param _newURI The new overriding token URI for the token
     */
    function updatePerTokenURI(uint256 _tokenId, string calldata _newURI) external;

    /**
     * @notice Lock the metadata URI of a specific token
     * @param _tokenId The ID of the token
     */
    function lockPerTokenURI(uint256 _tokenId) external;

    /**
     * @notice Update blueprint's token uri
     * @param newBaseTokenUri New base token uri to update to
     */
    function updateBlueprintTokenUri(string calldata newBaseTokenUri) external;

    /**
     * @notice Lock blueprint's token uri (from changing)
     */
    function lockBlueprintTokenUri() external;

    /**
     * @notice Update blueprint's metadata URI
     * @param newMetadataUri New metadata URI
     */
    function updateBlueprintMetadataUri(string calldata newMetadataUri) external;

    /**
     * @notice Lock blueprint's metadata uri (from changing)
     */
    function lockBlueprintMetadataUri() external;

    /**
     * @notice Update royalty config
     * @param newRoyalty New royalty parameters
     */
    function updateRoyalty(IRoyalty.Royalty calldata newRoyalty) external;

    /**
     * @notice Update contract-wide minter address, and MINTER_ROLE role ownership
     * @param newMinterAddress New minter address
     */
    function updateMinterAddress(address newMinterAddress) external;

    /**
     * @notice Update contract-wide platform address, and DEFAULT_ADMIN_ROLE role ownership
     * @param _platform New platform
     */
    function updatePlatformAddress(address _platform) external;

    /**
     * @notice Update the address that the contract will make OperatorFilter checks against. 
               Also register this contract with that registry.
     * @param newRegistry New Operator filter registry to check against
     * @param coriCuratedSubscriptionAddress CORI Curated subscription address 
     *        -> updates Async's operator filter list in coordination with OS
     */
    function updateOperatorFilterAndRegister(address newRegistry, address coriCuratedSubscriptionAddress) external;

    /**
     * @notice Return the blueprint's metadata URI
     */
    function metadataURI() external view returns (string memory);

    /**
     * @notice Get secondary fee recipients of a token
     * @param // tokenId Token ID
     */
    function getFeeRecipients(uint256 /* tokenId */) external view returns (address[] memory);

    /**
     * @notice Get secondary fee bps (allocations) of a token
     * @param // tokenId Token ID
     */
    function getFeeBps(uint256 /* tokenId */) external view returns (uint32[] memory);
}

File 22 of 26 : IOperatorFilterer.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;

/**
 * @notice Interface containing OS operator filterer inputs shared throughout Dynamic Blueprint system
 * @author Ohimire Labs
 */
interface IOperatorFilterer {
    /**
     * @notice Shared operator filterer inputs
     * @param operatorFilterRegistryAddress Address of OpenSea's operator filter registry contract
     * @param coriCuratedSubscriptionAddress Address of CORI canonical filtered-list
     *                                       (Async's filtered list will update in accordance with this parameter)
     */
    struct OperatorFiltererInputs {
        address operatorFilterRegistryAddress;
        address coriCuratedSubscriptionAddress;
    }
}

File 23 of 26 : IRoyalty.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;

/**
 * @notice Interface containing shared royalty object throughout Dynamic Blueprint system
 * @author Ohimire Labs
 */
interface IRoyalty {
    /**
     * @notice Shared royalty object
     * @param recipients Royalty recipients
     * @param royaltyCutsBPS Percentage of purchase allocated to each royalty recipient, in basis points
     */
    struct Royalty {
        address[] recipients;
        uint32[] royaltyCutsBPS;
    }
}

File 24 of 26 : Royalty.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;

import "./IRoyalty.sol";

/**
 * @notice Shared royalty validation logic in Dynamic Blueprints system
 * @author Ohimire Labs
 */
abstract contract Royalty is IRoyalty {
    /**
     * @notice Validate a royalty object
     * @param royalty Royalty being validated
     */
    modifier royaltyValid(Royalty memory royalty) {
        require(royalty.recipients.length == royalty.royaltyCutsBPS.length, "Royalty arrays mismatched lengths");
        uint256 royaltyCutsSum = 0;
        for (uint i = 0; i < royalty.recipients.length; i++) {
            royaltyCutsSum += royalty.royaltyCutsBPS[i];
        }
        require(royaltyCutsSum <= 10000, "Royalty too large");
        _;
    }
}

File 25 of 26 : IOperatorFilterRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface IOperatorFilterRegistry {
    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);

    function isOperatorAllowed(address registrant, address operator) external view returns (bool);
}

File 26 of 26 : IStorefront.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;

/**
 * @notice Dynamic Blueprint and Expansion storefront interface
 * @author Ohimire Labs
 */
interface IStorefront {
    /**
     * @notice Denotes statate of sale
     */
    enum SaleState {
        not_started,
        started,
        paused
    }

    /**
     * @notice Sale data
     * @param maxPurchaseAmount Max number of purchases allowed in one tx on this sale
     * @param saleEndTimestamp Marks end of sale
     * @param price Price of each purchase of sale
     * @param packId ID of pack that sale is for (if for expansion pack). O if sale is for DBP
     * @param erc20Token Address of erc20 currency that payments must be made in. 0 address if in native gas token
     * @param merkleroot Root of merkle tree containing allowlist
     * @param saleState State of sale
     * @param tokenContract Address of contract where tokens to be minted in sale are
     * @param artist Sale artist
     * @param primaryFee Fee split on sales
     * @param mintAmountArtist How many purchases the artist can mint for free
     * @param mintAmountPlatform How many purchases the platform can mint for free
     */
    struct Sale {
        uint64 maxPurchaseAmount;
        uint128 saleEndTimestamp;
        uint128 price;
        uint256 packId;
        address erc20Token;
        bytes32 merkleroot;
        SaleState saleState;
        address tokenContract;
        address artist;
        PrimaryFeeInfo primaryFee;
        uint256 mintAmountArtist;
        uint256 mintAmountPlatform;
    }

    /**
     * @notice Object holding primary fee data
     * @param feeBPS Primary fee percentage allocations in basis points,
     *               should always add up to 10,000 and include the creator to payout
     * @param feeRecipients Primary fee recipients, including the artist/creator
     */
    struct PrimaryFeeInfo {
        uint32[] feeBPS;
        address[] feeRecipients;
    }

    /**
     * @notice Emitted when a new sale is created
     * @param saleId the ID of the sale which was just created
     * @param packId the ID of the pack which will be sold in the created sale
     * @param tokenContract the ID of the DBP/Expansion contract where the pack on sale was created
     */
    event SaleCreated(uint256 indexed saleId, uint256 indexed packId, address indexed tokenContract);

    /**
     * @notice Emitted when a sale is started
     * @param saleId ID of sale
     */
    event SaleStarted(uint256 indexed saleId);

    /**
     * @notice Emitted when a sale is paused
     * @param saleId ID of sale
     */
    event SalePaused(uint256 indexed saleId);

    /**
     * @notice Emitted when a sale is unpaused
     * @param saleId ID of sale
     */
    event SaleUnpaused(uint256 indexed saleId);

    /**
     * @notice Create a sale
     * @param sale Sale being created
     */
    function createSale(Sale calldata sale) external;

    /**
     * @notice Update a sale
     * @param saleId ID of sale being updated
     * @param maxPurchaseAmount New max purchase amount
     * @param saleEndTimestamp New sale end timestamp
     * @param price New price
     * @param erc20Token New ERC20 token
     * @param merkleroot New merkleroot
     * @param primaryFee New primaryFee
     * @param mintAmountArtist New mintAmountArtist
     * @param mintAmountPlatform New mintAmountPlatform
     */
    function updateSale(
        uint256 saleId,
        uint64 maxPurchaseAmount,
        uint128 saleEndTimestamp,
        uint128 price,
        address erc20Token,
        bytes32 merkleroot,
        PrimaryFeeInfo calldata primaryFee,
        uint256 mintAmountArtist,
        uint256 mintAmountPlatform
    ) external;

    /**
     * @notice Update a sale's state
     * @param saleId ID of sale that's being updated
     * @param saleState New sale state
     */
    function updateSaleState(uint256 saleId, SaleState saleState) external;

    /**
     * @notice Withdraw credits of native gas token that failed to send
     * @param recipient Recipient that was meant to receive failed payment
     */
    function withdrawAllFailedCredits(address payable recipient) external;

    /**
     * @notice Update primary fee for a sale
     * @param saleId ID of sale being updated
     * @param primaryFee New primary fee for sale
     */
    function updatePrimaryFee(uint256 saleId, PrimaryFeeInfo calldata primaryFee) external;

    /**
     * @notice Update merkleroot for a sale
     * @param saleId ID of sale being updated
     * @param _newMerkleroot New merkleroot for sale
     */
    function updateMerkleroot(uint256 saleId, bytes32 _newMerkleroot) external;

    /**
     * @notice Update the platform address
     * @param _platform New platform
     */
    function updatePlatformAddress(address _platform) external;

    /**
     * @notice Return a sale based on its sale ID
     * @param saleId ID of sale being returned
     */
    function getSale(uint256 saleId) external view returns (Sale memory);
}

Settings
{
  "metadata": {
    "bytecodeHash": "none"
  },
  "optimizer": {
    "enabled": true,
    "runs": 1
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "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":true,"internalType":"uint128","name":"tokenId","type":"uint128"},{"indexed":false,"internalType":"uint64","name":"newMintedCount","type":"uint64"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"BlueprintMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"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":"newBaseTokenUri","type":"string"}],"name":"BlueprintTokenUriUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":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":"STOREFRONT_MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"subscription","type":"address"}],"name":"addOperatorFiltererSubscription","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":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blueprint","outputs":[{"internalType":"uint64","name":"capacity","type":"uint64"},{"internalType":"uint64","name":"mintedCount","type":"uint64"},{"internalType":"uint64","name":"erc721TokenIndex","type":"uint64"},{"internalType":"bool","name":"tokenUriLocked","type":"bool"},{"internalType":"string","name":"baseTokenUri","type":"string"},{"internalType":"bool","name":"metadataUriLocked","type":"bool"},{"internalType":"string","name":"blueprintMetadata","type":"string"},{"internalType":"bool","name":"prepared","type":"bool"},{"internalType":"bool","name":"isSoulbound","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"broadcast","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"","type":"uint256"}],"name":"getFeeBps","outputs":[{"internalType":"uint32[]","name":"","type":"uint32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getFeeRecipients","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 IDynamicBlueprint.DynamicBlueprintsInput","name":"dynamicBlueprintsInput","type":"tuple"},{"internalType":"address","name":"_platform","type":"address"},{"internalType":"address","name":"_minter","type":"address"},{"components":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint32[]","name":"royaltyCutsBPS","type":"uint32[]"}],"internalType":"struct IRoyalty.Royalty","name":"_royaltyParameters","type":"tuple"},{"internalType":"address[]","name":"storefrontMinters","type":"address[]"},{"internalType":"address","name":"_broadcast","type":"address"},{"components":[{"internalType":"address","name":"operatorFilterRegistryAddress","type":"address"},{"internalType":"address","name":"coriCuratedSubscriptionAddress","type":"address"}],"internalType":"struct IOperatorFilterer.OperatorFiltererInputs","name":"operatorFiltererInputs","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestErc721TokenIndex","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockBlueprintMetadataUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockBlueprintTokenUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"lockPerTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"metadataURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"purchaseQuantity","type":"uint32"},{"internalType":"address","name":"nftRecipient","type":"address"}],"name":"mintBlueprints","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":"platform","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"_capacity","type":"uint64"},{"internalType":"string","name":"_blueprintMetaData","type":"string"},{"internalType":"string","name":"_baseTokenUri","type":"string"},{"internalType":"bool","name":"_isSoulbound","type":"bool"}],"internalType":"struct IDynamicBlueprint.BlueprintPreparationConfig","name":"config","type":"tuple"},{"components":[{"internalType":"uint64","name":"maxPurchaseAmount","type":"uint64"},{"internalType":"uint128","name":"saleEndTimestamp","type":"uint128"},{"internalType":"uint128","name":"price","type":"uint128"},{"internalType":"uint256","name":"packId","type":"uint256"},{"internalType":"address","name":"erc20Token","type":"address"},{"internalType":"bytes32","name":"merkleroot","type":"bytes32"},{"internalType":"enum IStorefront.SaleState","name":"saleState","type":"uint8"},{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"address","name":"artist","type":"address"},{"components":[{"internalType":"uint32[]","name":"feeBPS","type":"uint32[]"},{"internalType":"address[]","name":"feeRecipients","type":"address[]"}],"internalType":"struct IStorefront.PrimaryFeeInfo","name":"primaryFee","type":"tuple"},{"internalType":"uint256","name":"mintAmountArtist","type":"uint256"},{"internalType":"uint256","name":"mintAmountPlatform","type":"uint256"}],"internalType":"struct IStorefront.Sale","name":"sale","type":"tuple"},{"internalType":"address","name":"storefront","type":"address"}],"name":"prepareBlueprintAndCreateSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"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":"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":"","type":"uint256"}],"name":"tokenIdsToURI","outputs":[{"internalType":"string","name":"tokenURI","type":"string"},{"internalType":"bool","name":"isFrozen","type":"bool"}],"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":[{"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":"string","name":"newMetadataUri","type":"string"}],"name":"updateBlueprintMetadataUri","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"},{"internalType":"address","name":"coriCuratedSubscriptionAddress","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":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"string","name":"_newURI","type":"string"}],"name":"updatePerTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_platform","type":"address"}],"name":"updatePlatformAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint32[]","name":"royaltyCutsBPS","type":"uint32[]"}],"internalType":"struct IRoyalty.Royalty","name":"newRoyalty","type":"tuple"}],"name":"updateRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50600161012d55614b9e806100266000396000f3fe608060405234801561001057600080fd5b50600436106102675760003560e01c806301ffc9a71461026c57806303ee438c1461029457806306fdde03146102a9578063081812fc146102b1578063095ea7b3146102d15780630ebd4c7f146102e657806315f56cb61461030657806323b872dd1461031957806324297d531461032c578063248a9ca31461033f5780632f2ff15d146103605780632fcfb95a1461037357806330cf65bc14610386578063338b584b1461039957806334d722c9146103ac57806336568abe146103c057806342842e0e146103d357806343bc1612146103e657806345b15590146103fa5780634bde38c81461040d5780634d073a5a146104285780636352211e146104545780636bca4f2f146104675780636dc14ba61461046f57806370a08231146104825780638da5cb5b146104955780638f9f193f1461049d5780639010d07c146104b057806391d14854146104c357806395d89b41146104d65780639ab4b89e146104de578063a04a44ac146104f1578063a217fddf14610504578063a22cb4651461050c578063a6c30fda1461051f578063afc9804014610534578063b058854114610548578063b0ccc31e14610550578063b88d4fde14610564578063b8d1e53214610577578063b9c4d9fb1461058a578063c05efa15146105aa578063c87b56dd146105c7578063ca15c873146105da578063d5391393146105ed578063d547741f14610602578063db30e20014610615578063e0781a0814610636578063e6a60eb614610649578063e8a3d4851461065c578063e985e9c514610664578063f34e33ab14610677578063fe63e7571461068a575b600080fd5b61027f61027a366004613a3d565b61069d565b60405190151581526020015b60405180910390f35b61029c6106e6565b60405161028b9190614080565b61029c6107a6565b6102c46102bf3660046139dd565b6107b5565b60405161028b9190613fef565b6102e46102df366004613977565b6107dc565b005b6102f96102f43660046139dd565b6107f5565b60405161028b919061406d565b6102e4610314366004613b00565b61087f565b6102e4610327366004613889565b610ac6565b6102e461033a366004613833565b610b1d565b61035261034d3660046139dd565b610b59565b60405190815260200161028b565b6102e461036e3660046139f6565b610b6e565b6102e4610381366004613833565b610b8a565b6102e4610394366004613833565b610bf7565b6102e46103a7366004613da3565b610c9d565b61012f546102c4906001600160a01b031681565b6102e46103ce3660046139f6565b610f56565b6102e46103e1366004613889565b610fd4565b610130546102c4906001600160a01b031681565b6102e4610408366004613d24565b610fef565b61012e546102c490600160401b90046001600160a01b031681565b61012e5461043c906001600160401b031681565b6040516001600160401b03909116815260200161028b565b6102c46104623660046139dd565b6110b3565b6102e46110e7565b6102e461047d366004613850565b611103565b610352610490366004613833565b611115565b6102c461119b565b6102e46104ab366004613833565b6111b2565b6102c46104be366004613a1b565b611216565b61027f6104d13660046139f6565b611235565b61029c611260565b6102e46104ec366004613d58565b61126f565b6102e46104ff366004613a77565b611330565b610352600081565b6102e461051a366004613949565b6113c2565b610352600080516020614b1283398151915281565b610138546102c4906001600160a01b031681565b6102e46113d6565b610139546102c4906001600160a01b031681565b6102e46105723660046138ca565b611446565b6102e4610585366004613833565b611497565b61059d6105983660046139dd565b611534565b60405161028b919061405a565b6105b261159b565b60405161028b9998979695949392919061454d565b61029c6105d53660046139dd565b611710565b6103526105e83660046139dd565b6118f4565b610352600080516020614b5283398151915281565b6102e46106103660046139f6565b61190b565b6106286106233660046139dd565b611927565b60405161028b929190614093565b6102e4610644366004613ab8565b6119cf565b6102e4610657366004613c4a565b611a85565b61029c611e50565b61027f610672366004613850565b611edf565b6102e46106853660046139dd565b611f0d565b6102e4610698366004613ddc565b611fcf565b60006001600160e01b03198216632dde656160e21b14806106c257506106c28261206a565b806106d157506106d1826120ba565b806106e057506106e0826120eb565b92915050565b6101355460609060ff166107155760405162461bcd60e51b815260040161070c906140b7565b60405180910390fd5b610134805461072390614925565b80601f016020809104026020016040519081016040528092919081815260200182805461074f90614925565b801561079c5780601f106107715761010080835404028352916020019161079c565b820191906000526020600020905b81548152906001019060200180831161077f57829003601f168201915b5050505050905090565b60606065805461072390614925565b60006107c082612110565b506000908152606960205260409020546001600160a01b031690565b816107e681612135565b6107f083836121fd565b505050565b606061013a60010180548060200260200160405190810160405280929190818152602001828054801561087357602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116108365790505b50505050509050919050565b600080516020614b528339815191526108978161230e565b6101355460ff16156108de5760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c1c995c185c995960821b604482015260640161070c565b6108f6600080516020614b1283398151915283611235565b61094c5760405162461bcd60e51b815260206004820152602160248201527f53746f726566726f6e74206e6f7420617574686f72697a656420746f206d696e6044820152601d60fa1b606482015260840161070c565b6109596020850185613dc1565b61013180546001600160401b0319166001600160401b0392909216919091179055610a1661098a604086018661460e565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506109cc92505050602087018761460e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610a119250505060808801606089016139a3565b612318565b60405163519e0a1360e11b81526001600160a01b0383169063a33c142690610a4290869060040161439b565b600060405180830381600087803b158015610a5c57600080fd5b505af1158015610a70573d6000803e3d6000fd5b50610ac09250610a86915050602086018661460e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061236392505050565b50505050565b826001600160a01b0381163314610ae057610ae033612135565b610135548290610100900460ff1615610b0b5760405162461bcd60e51b815260040161070c90614259565b610b16858585612430565b5050505050565b600080516020614b52833981519152610b358161230e565b5061013080546001600160a01b0319166001600160a01b0392909216919091179055565b600090815260c9602052604090206001015490565b610b7782610b59565b610b808161230e565b6107f08383612461565b6000610b958161230e565b610bad600080516020614b5283398151915283610b6e565b61012f54610bd390600080516020614b52833981519152906001600160a01b031661190b565b5061012f80546001600160a01b0319166001600160a01b0392909216919091179055565b33610c0061119b565b6001600160a01b03161480610c205750610130546001600160a01b031633145b610c3c5760405162461bcd60e51b815260040161070c906142cd565b61013954604051632cc5350560e21b81526001600160a01b039091169063b314d41490610c6f9030908590600401614003565b600060405180830381600087803b158015610c8957600080fd5b505af1158015610b16573d6000803e3d6000fd5b600080516020614b12833981519152610cb58161230e565b604080516101208101825261013180546001600160401b038082168452600160401b820481166020850152600160801b82041693830193909352600160c01b90920460ff16151560608201526101328054600093916080840191610d1890614925565b80601f0160208091040260200160405190810160405280929190818152602001828054610d4490614925565b8015610d915780601f10610d6657610100808354040283529160200191610d91565b820191906000526020600020905b815481529060010190602001808311610d7457829003601f168201915b5050509183525050600282015460ff1615156020820152600382018054604090920191610dbd90614925565b80601f0160208091040260200160405190810160405280929190818152602001828054610de990614925565b8015610e365780601f10610e0b57610100808354040283529160200191610e36565b820191906000526020600020905b815481529060010190602001808311610e1957829003601f168201915b50505091835250506004919091015460ff80821615156020808501919091526101009092041615156040909201919091528151908201519192506001600160401b031690610e8b9063ffffffff871690614735565b6001600160401b0316111580610ea9575080516001600160401b0316155b610ee25760405162461bcd60e51b815260206004820152600a60248201526938bab0b73a34ba3c901f60b11b604482015260640161070c565b80610100015115610f4c57610ef683611115565b158015610f0957508363ffffffff166001145b610f4c5760405162461bcd60e51b815260206004820152601460248201527336b0bc10189039b7bab63137bab73217b0b2323960611b604482015260640161070c565b610ac08484612483565b6001600160a01b0381163314610fc65760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161070c565b610fd082826125da565b5050565b6107f083838360405180602001604052806000815250611446565b6000610ffa8161230e565b611003826147a2565b602081015151815151146110295760405162461bcd60e51b815260040161070c90614218565b6000805b82515181101561107a578260200151818151811061104d5761104d6149dc565b602002602001015163ffffffff1682611066919061471d565b9150806110728161497c565b91505061102d565b5061271081111561109d5760405162461bcd60e51b815260040161070c90614370565b8361013a6110ab8282614a15565b505050505050565b6000806110bf836125fc565b90506001600160a01b0381166106e05760405162461bcd60e51b815260040161070c906142f3565b60006110f28161230e565b50610133805460ff19166001179055565b61110c82611497565b610fd081610bf7565b60006001600160a01b03821661117f5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161070c565b506001600160a01b031660009081526068602052604090205490565b61012e54600160401b90046001600160a01b031690565b60006111bd8161230e565b6111c8600083610b6e565b61012e546111e890600090600160401b90046001600160a01b031661190b565b5061012e80546001600160a01b03909216600160401b02600160401b600160e01b0319909216919091179055565b600082815260fb6020526040812061122e9083612617565b9392505050565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606066805461072390614925565b600080516020614b528339815191526112878161230e565b61129084612623565b6112c65760405162461bcd60e51b8152602060048201526007602482015266085b5a5b9d195960ca1b604482015260640161070c565b6000848152610136602052604090206001015460ff16156113165760405162461bcd60e51b815260206004820152600a6024820152693ab93490333937bd32b760b11b604482015260640161070c565b600084815261013660205260409020610b1690848461347a565b600080516020614b528339815191526113488161230e565b6101355460ff1661136b5760405162461bcd60e51b815260040161070c906140b7565b6101335460ff16156113b55760405162461bcd60e51b81526020600482015260136024820152721b595d1859185d1848155492481b1bd8dad959606a1b604482015260640161070c565b610ac0610134848461347a565b816113cc81612135565b6107f08383612640565b60006113e18161230e565b6101355460ff166114045760405162461bcd60e51b815260040161070c906140b7565b61013154600160c01b900460ff161561142f5760405162461bcd60e51b815260040161070c906141f4565b50610131805460ff60c01b1916600160c01b179055565b836001600160a01b03811633146114605761146033612135565b610135548390610100900460ff161561148b5760405162461bcd60e51b815260040161070c90614259565b6110ab8686868661264b565b336114a061119b565b6001600160a01b031614806114c05750610130546001600160a01b031633145b6114dc5760405162461bcd60e51b815260040161070c906142cd565b61013980546001600160a01b0319166001600160a01b038316908117909155156115315761013954604051632210724360e11b81526001600160a01b0390911690634420e48690610c6f903090600401613fef565b50565b606061013a60000180548060200260200160405190810160405280929190818152602001828054801561087357602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115725750505050509050919050565b610131805461013280546001600160401b0380841694600160401b8504821694600160801b810490921693600160c01b90920460ff16929091906115de90614925565b80601f016020809104026020016040519081016040528092919081815260200182805461160a90614925565b80156116575780601f1061162c57610100808354040283529160200191611657565b820191906000526020600020905b81548152906001019060200180831161163a57829003601f168201915b5050506002840154600385018054949560ff90921694919350915061167b90614925565b80601f01602080910402602001604051908101604052809291908181526020018280546116a790614925565b80156116f45780601f106116c9576101008083540402835291602001916116f4565b820191906000526020600020905b8154815290600101906020018083116116d757829003601f168201915b5050506004909301549192505060ff8082169161010090041689565b606061171b82612623565b6117675760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e00604482015260640161070c565b600082815261013660205260408120805461178190614925565b80601f01602080910402602001604051908101604052809291908181526020018280546117ad90614925565b80156117fa5780601f106117cf576101008083540402835291602001916117fa565b820191906000526020600020905b8154815290600101906020018083116117dd57829003601f168201915b5050505050905080516000146118105792915050565b6000610131600101805461182390614925565b80601f016020809104026020016040519081016040528092919081815260200182805461184f90614925565b801561189c5780601f106118715761010080835404028352916020019161189c565b820191906000526020600020905b81548152906001019060200180831161187f57829003601f168201915b5050505050905060008151116118c157604051806020016040528060008152506118ec565b806118cb8561267d565b6040516020016118dc929190613f28565b6040516020818303038152906040525b949350505050565b600081815260fb602052604081206106e090612719565b61191482610b59565b61191d8161230e565b6107f083836125da565b6101366020526000908152604090208054819061194390614925565b80601f016020809104026020016040519081016040528092919081815260200182805461196f90614925565b80156119bc5780601f10611991576101008083540402835291602001916119bc565b820191906000526020600020905b81548152906001019060200180831161199f57829003601f168201915b5050506001909301549192505060ff1682565b600080516020614b528339815191526119e78161230e565b6101355460ff16611a0a5760405162461bcd60e51b815260040161070c906140b7565b61013154600160c01b900460ff1615611a355760405162461bcd60e51b815260040161070c906141f4565b8151611a49906101329060208501906134fe565b507f57cafa311d6d28ea1d59c17aa93e87ca0d9aa0ef533ee169e7ee99f0f49afe1a82604051611a799190614080565b60405180910390a15050565b600054610100900460ff1615808015611aa55750600054600160ff909116105b80611ac65750611ab430612723565b158015611ac6575060005460ff166001145b611ae25760405162461bcd60e51b815260040161070c9061427f565b6000805460ff191660011790558015611b05576000805461ff0019166101001790555b611b0e866147a2565b60208101515181515114611b345760405162461bcd60e51b815260040161070c90614218565b6000805b825151811015611b855782602001518181518110611b5857611b586149dc565b602002602001015163ffffffff1682611b71919061471d565b915080611b7d8161497c565b915050611b38565b50612710811115611ba85760405162461bcd60e51b815260040161070c90614370565b611c31611bb58c8061460e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611bf79250505060208e018e61460e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061273292505050565b611c39612763565b611c41612829565b611c4c60008b612852565b611c64600080516020614b528339815191528a612852565b60005b86811015611cbf57611cad600080516020614b12833981519152898984818110611c9357611c936149dc565b9050602002016020810190611ca89190613833565b612852565b80611cb78161497c565b915050611c67565b5061012e8054600160401b600160e01b031916600160401b6001600160a01b038d8116919091029190911790915561012f80546001600160a01b031916918b16919091179055611d1560808c0160608d01613833565b61013080546001600160a01b0319166001600160a01b0392909216919091179055611d4360408c018c61460e565b611d50916101379161347a565b508761013a611d5f8282614a15565b505061013880546001600160a01b0319166001600160a01b038716179055611d8a6020850185613833565b61013980546001600160a01b0319166001600160a01b03929092169182179055637d3e3dbe30611dc06040880160208901613833565b6040518363ffffffff1660e01b8152600401611ddd929190614003565b600060405180830381600087803b158015611df757600080fd5b505af1158015611e0b573d6000803e3d6000fd5b5050505050508015611e45576000805461ff001916905560405160018152600080516020614b328339815191529060200160405180910390a15b505050505050505050565b6101378054611e5e90614925565b80601f0160208091040260200160405190810160405280929190818152602001828054611e8a90614925565b8015611ed75780601f10611eac57610100808354040283529160200191611ed7565b820191906000526020600020905b815481529060010190602001808311611eba57829003601f168201915b505050505081565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b33611f17826110b3565b6001600160a01b031614611f565760405162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015260640161070c565b6000818152610136602052604090206001015460ff1615611fae5760405162461bcd60e51b81526020600482015260126024820152713ab9349030b63932b0b23c90333937bd32b760711b604482015260640161070c565b6000908152610136602052604090206001908101805460ff19169091179055565b600080516020614b52833981519152611fe78161230e565b610131546001600160401b038085169116116120395760405162461bcd60e51b81526020600482015260116024820152704e65772063617020746f6f206c6172676560781b604482015260640161070c565b5061013180546001600160401b039384166001600160401b03199182161790915561012e8054929093169116179055565b60006001600160e01b031982166380ac58cd60e01b148061209b57506001600160e01b03198216635b5e139f60e01b145b806106e057506301ffc9a760e01b6001600160e01b03198316146106e0565b60006120c58261206a565b806106e05750506001600160e01b03191660009081526097602052604090205460ff1690565b60006001600160e01b03198216635a05180f60e01b14806106e057506106e08261285c565b61211981612623565b6115315760405162461bcd60e51b815260040161070c906142f3565b610139546001600160a01b0316801580159061215b57506000816001600160a01b03163b115b15610fd057604051633185c44d60e21b81526001600160a01b0382169063c61711349061218e9030908690600401614003565b60206040518083038186803b1580156121a657600080fd5b505afa1580156121ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121de91906139c0565b610fd05781604051633b79c77360e21b815260040161070c9190613fef565b6000612208826110b3565b9050806001600160a01b0316836001600160a01b031614156122765760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161070c565b336001600160a01b038216148061229257506122928133611edf565b6123045760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161070c565b6107f08383612881565b61153181336128ef565b825161232c906101329060208601906134fe565b508151612341906101349060208501906134fe565b5080156107f05761013580548215156101000261ff0019909116179055505050565b61012e80546101318054600160801b6001600160401b03938416908102600160801b600160c01b031983168117909355610135805460ff191660011790559183169216919091179182916000906123bb908490614735565b82546001600160401b039182166101009390930a928302919092021990911617905550610130546040516001600160a01b03909116907feace9ffe7fa97ff7dbf4b23bcc99df5b088f5af2913bc589b0ad786a775f3cb99061242490849086906101329061447e565b60405180910390a25050565b61243a3382612948565b6124565760405162461bcd60e51b815260040161070c906140da565b6107f08383836129a6565b61246b8282612b05565b600082815260fb602052604090206107f09082612b8b565b610131546001600160401b03600160801b8204811691600160401b90041660005b8463ffffffff168161ffff161015612558576124d6846124c861ffff8416866146f2565b6001600160801b0316612ba0565b6124e461ffff8216846146f2565b604080516001600160401b03851681526001600160a01b03871660208201526001600160801b0392909216917f316901b3d7bc6bb45350b12d018d0716b43089303ece477800134577a24a6f97910160405180910390a261254482614997565b9150806125508161495a565b9150506124a4565b50610131805463ffffffff86169190601090612585908490600160801b90046001600160401b0316614735565b92506101000a8154816001600160401b0302191690836001600160401b031602179055508061013160000160086101000a8154816001600160401b0302191690836001600160401b0316021790555050505050565b6125e48282612ca9565b600082815260fb602052604090206107f09082612d10565b6000908152606760205260409020546001600160a01b031690565b600061122e8383612d25565b60008061262f836125fc565b6001600160a01b0316141592915050565b610fd0338383612d4f565b6126553383612948565b6126715760405162461bcd60e51b815260040161070c906140da565b610ac084848484612e1a565b6060600061268a83612e4d565b60010190506000816001600160401b038111156126a9576126a96149f2565b6040519080825280601f01601f1916602001820160405280156126d3576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461270c57612711565b6126dd565b509392505050565b60006106e0825490565b6001600160a01b03163b151590565b600054610100900460ff166127595760405162461bcd60e51b815260040161070c90614325565b610fd08282612f23565b600054610100900460ff16158080156127835750600054600160ff909116105b806127a4575061279230612723565b1580156127a4575060005460ff166001145b6127c05760405162461bcd60e51b815260040161070c9061427f565b6000805460ff1916600117905580156127e3576000805461ff0019166101001790555b6127f3632dde656160e21b612f71565b8015611531576000805461ff001916905560405160018152600080516020614b328339815191529060200160405180910390a150565b600054610100900460ff166128505760405162461bcd60e51b815260040161070c90614325565b565b610fd08282612461565b60006001600160e01b03198216637965db0b60e01b14806106e057506106e0826120ba565b600081815260696020526040902080546001600160a01b0319166001600160a01b03841690811790915581906128b6826110b3565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6128f98282611235565b610fd05761290681612fef565b612911836020613001565b604051602001612922929190613f80565b60408051601f198184030181529082905262461bcd60e51b825261070c91600401614080565b600080612954836110b3565b9050806001600160a01b0316846001600160a01b0316148061297b575061297b8185611edf565b806118ec5750836001600160a01b0316612994846107b5565b6001600160a01b031614949350505050565b826001600160a01b03166129b9826110b3565b6001600160a01b0316146129df5760405162461bcd60e51b815260040161070c90614179565b6001600160a01b038216612a415760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161070c565b612a4e838383600161319c565b826001600160a01b0316612a61826110b3565b6001600160a01b031614612a875760405162461bcd60e51b815260040161070c90614179565b600081815260696020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526068855283862080546000190190559087168086528386208054600101905586865260679094528285208054909216841790915590518493600080516020614b7283398151915291a4505050565b612b0f8282611235565b610fd057600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612b473390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061122e836001600160a01b038416613224565b6001600160a01b038216612bf65760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161070c565b612bff81612623565b15612c1c5760405162461bcd60e51b815260040161070c906141be565b612c2a60008383600161319c565b612c3381612623565b15612c505760405162461bcd60e51b815260040161070c906141be565b6001600160a01b038216600081815260686020908152604080832080546001019055848352606790915280822080546001600160a01b031916841790555183929190600080516020614b72833981519152908290a45050565b612cb38282611235565b15610fd057600082815260c9602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061122e836001600160a01b038416613273565b6000826000018281548110612d3c57612d3c6149dc565b9060005260206000200154905092915050565b816001600160a01b0316836001600160a01b03161415612dad5760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b604482015260640161070c565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612e258484846129a6565b612e3184848484613366565b610ac05760405162461bcd60e51b815260040161070c90614127565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310612e8c5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6904ee2d6d415b85acef8160201b8310612eb6576904ee2d6d415b85acef8160201b830492506020015b662386f26fc100008310612ed457662386f26fc10000830492506010015b6305f5e1008310612eec576305f5e100830492506008015b6127108310612f0057612710830492506004015b60648310612f12576064830492506002015b600a83106106e05760010192915050565b600054610100900460ff16612f4a5760405162461bcd60e51b815260040161070c90614325565b8151612f5d9060659060208501906134fe565b5080516107f09060669060208401906134fe565b6001600160e01b03198082161415612fca5760405162461bcd60e51b815260206004820152601c60248201527b115490cc4d8d4e881a5b9d985b1a59081a5b9d195c999858d9481a5960221b604482015260640161070c565b6001600160e01b0319166000908152609760205260409020805460ff19166001179055565b60606106e06001600160a01b03831660145b60606000613010836002614757565b61301b90600261471d565b6001600160401b03811115613032576130326149f2565b6040519080825280601f01601f19166020018201604052801561305c576020820181803683370190505b509050600360fc1b81600081518110613077576130776149dc565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106130a6576130a66149dc565b60200101906001600160f81b031916908160001a90535060006130ca846002614757565b6130d590600161471d565b90505b600181111561314d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613109576131096149dc565b1a60f81b82828151811061311f5761311f6149dc565b60200101906001600160f81b031916908160001a90535060049490941c936131468161490e565b90506130d8565b50831561122e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161070c565b6001811115610ac0576001600160a01b038416156131e2576001600160a01b038416600090815260686020526040812080548392906131dc908490614776565b90915550505b6001600160a01b03831615610ac0576001600160a01b0383166000908152606860205260408120805483929061321990849061471d565b909155505050505050565b600081815260018301602052604081205461326b575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556106e0565b5060006106e0565b6000818152600183016020526040812054801561335c576000613297600183614776565b85549091506000906132ab90600190614776565b90508181146133105760008660000182815481106132cb576132cb6149dc565b90600052602060002001549050808760000184815481106132ee576132ee6149dc565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613321576133216149c6565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506106e0565b60009150506106e0565b600061337a846001600160a01b0316612723565b1561346f57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906133b190339089908890889060040161401d565b602060405180830381600087803b1580156133cb57600080fd5b505af19250505080156133fb575060408051601f3d908101601f191682019092526133f891810190613a5a565b60015b613455573d808015613429576040519150601f19603f3d011682016040523d82523d6000602084013e61342e565b606091505b50805161344d5760405162461bcd60e51b815260040161070c90614127565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506118ec565b506001949350505050565b82805461348690614925565b90600052602060002090601f0160209004810192826134a857600085556134ee565b82601f106134c15782800160ff198235161785556134ee565b828001600101855582156134ee579182015b828111156134ee5782358255916020019190600101906134d3565b506134fa929150613572565b5090565b82805461350a90614925565b90600052602060002090601f01602090048101928261352c57600085556134ee565b82601f1061354557805160ff19168380011785556134ee565b828001600101855582156134ee579182015b828111156134ee578251825591602001919060010190613557565b5b808211156134fa5760008155600101613573565b60006001600160401b038311156135a0576135a06149f2565b6135b3601f8401601f191660200161469f565b90508281528383830111156135c757600080fd5b828260208301376000602084830101529392505050565b80356135e981614ac6565b919050565b60008083601f84011261360057600080fd5b5081356001600160401b0381111561361757600080fd5b6020830191508360208260051b850101111561363257600080fd5b9250929050565b600082601f83011261364a57600080fd5b8135602061365f61365a836146cf565b61469f565b80838252828201915082860187848660051b890101111561367f57600080fd5b60005b858110156136a757813561369581614ac6565b84529284019290840190600101613682565b5090979650505050505050565b600082601f8301126136c557600080fd5b813560206136d561365a836146cf565b80838252828201915082860187848660051b89010111156136f557600080fd5b60005b858110156136a757813561370b81614aff565b845292840192908401906001016136f8565b8035600381106135e957600080fd5b60008083601f84011261373e57600080fd5b5081356001600160401b0381111561375557600080fd5b60208301915083602082850101111561363257600080fd5b60006080828403121561377f57600080fd5b50919050565b60006040828403121561377f57600080fd5b6000604082840312156137a957600080fd5b6137b1614654565b905081356001600160401b03808211156137ca57600080fd5b6137d6858386016136b4565b835260208401359150808211156137ec57600080fd5b506137f984828501613639565b60208301525092915050565b80356001600160801b03811681146135e957600080fd5b80356001600160401b03811681146135e957600080fd5b60006020828403121561384557600080fd5b813561122e81614ac6565b6000806040838503121561386357600080fd5b823561386e81614ac6565b9150602083013561387e81614ac6565b809150509250929050565b60008060006060848603121561389e57600080fd5b83356138a981614ac6565b925060208401356138b981614ac6565b929592945050506040919091013590565b600080600080608085870312156138e057600080fd5b84356138eb81614ac6565b935060208501356138fb81614ac6565b92506040850135915060608501356001600160401b0381111561391d57600080fd5b8501601f8101871361392e57600080fd5b61393d87823560208401613587565b91505092959194509250565b6000806040838503121561395c57600080fd5b823561396781614ac6565b9150602083013561387e81614adb565b6000806040838503121561398a57600080fd5b823561399581614ac6565b946020939093013593505050565b6000602082840312156139b557600080fd5b813561122e81614adb565b6000602082840312156139d257600080fd5b815161122e81614adb565b6000602082840312156139ef57600080fd5b5035919050565b60008060408385031215613a0957600080fd5b82359150602083013561387e81614ac6565b60008060408385031215613a2e57600080fd5b50508035926020909101359150565b600060208284031215613a4f57600080fd5b813561122e81614ae9565b600060208284031215613a6c57600080fd5b815161122e81614ae9565b60008060208385031215613a8a57600080fd5b82356001600160401b03811115613aa057600080fd5b613aac8582860161372c565b90969095509350505050565b600060208284031215613aca57600080fd5b81356001600160401b03811115613ae057600080fd5b8201601f81018413613af157600080fd5b6118ec84823560208401613587565b600080600060608486031215613b1557600080fd5b83356001600160401b0380821115613b2c57600080fd5b613b388783880161376d565b94506020860135915080821115613b4e57600080fd5b908501906101808288031215613b6357600080fd5b613b6b61467c565b613b748361381c565b8152613b8260208401613805565b6020820152613b9360408401613805565b604082015260608301356060820152613bae608084016135de565b608082015260a083013560a0820152613bc960c0840161371d565b60c0820152613bda60e084016135de565b60e0820152610100613bed8185016135de565b908201526101208381013583811115613c0557600080fd5b613c118a828701613797565b918301919091525061014083810135908201526101609283013592810192909252509150613c41604085016135de565b90509250925092565b600080600080600080600080610100898b031215613c6757600080fd5b88356001600160401b0380821115613c7e57600080fd5b613c8a8c838d0161376d565b995060208b01359150613c9c82614ac6565b90975060408a013590613cae82614ac6565b90965060608a01359080821115613cc457600080fd5b613cd08c838d01613785565b965060808b0135915080821115613ce657600080fd5b50613cf38b828c016135ee565b9095509350613d06905060a08a016135de565b9150613d158a60c08b01613785565b90509295985092959890939650565b600060208284031215613d3657600080fd5b81356001600160401b03811115613d4c57600080fd5b6118ec84828501613785565b600080600060408486031215613d6d57600080fd5b8335925060208401356001600160401b03811115613d8a57600080fd5b613d968682870161372c565b9497909650939450505050565b60008060408385031215613db657600080fd5b823561386e81614aff565b600060208284031215613dd357600080fd5b61122e8261381c565b60008060408385031215613def57600080fd5b613df88361381c565b9150613e066020840161381c565b90509250929050565b6001600160a01b03169052565b600081518084526020808501945080840160005b83811015613e555781516001600160a01b031687529582019590820190600101613e30565b509495945050505050565b600081518084526020808501945080840160005b83811015613e5557815163ffffffff1687529582019590820190600101613e74565b60008151808452613eae8160208601602086016148e2565b601f01601f19169290920160200192915050565b60038110613ee057634e487b7160e01b600052602160045260246000fd5b9052565b6000815160408452613ef96040850182613e60565b905060208301518482036020860152613f128282613e1c565b95945050505050565b6001600160801b03169052565b60008351613f3a8184602088016148e2565b8083019050602f60f81b8082528451613f5a8160018501602089016148e2565b6001920191820152693a37b5b2b7173539b7b760b11b6002820152600c01949350505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351613fb28160178501602088016148e2565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613fe38160288401602088016148e2565b01602801949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061405090830184613e96565b9695505050505050565b60208152600061122e6020830184613e1c565b60208152600061122e6020830184613e60565b60208152600061122e6020830184613e96565b6040815260006140a66040830185613e96565b905082151560208301529392505050565b602080825260099082015268085c1c995c185c995960ba1b604082015260600190565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6020808252601c908201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b604082015260600190565b6020808252600a9082015269155492481b1bd8dad95960b21b604082015260600190565b60208082526021908201527f526f79616c747920617272617973206d69736d617463686564206c656e6774686040820152607360f81b606082015260800190565b6020808252600c908201526b1a5cc81cdbdd5b189bdd5b9960a21b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600c908201526b1d5b985d5d1a1bdc9a5e995960a21b604082015260600190565b602080825260189082015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b602080825260119082015270526f79616c747920746f6f206c6172676560781b604082015260600190565b602081526143b56020820183516001600160401b03169052565b600060208301516143c96040840182613f1b565b5060408301516143dc6060840182613f1b565b506060830151608083015260808301516143f960a0840182613e0f565b5060a083015160c083015260c083015161441660e0840182613ec2565b5060e083015161010061442b81850183613e0f565b840151905061012061443f84820183613e0f565b80850151915050610180610140818186015261445f6101a0860184613ee4565b9086015161016086810191909152909501519301929092525090919050565b6001600160401b0384168152606060208083018290526000916144a390840186613e96565b83810360408501528454600090600181811c90808316806144c557607f831692505b8683108114156144e357634e487b7160e01b85526022600452602485fd5b82865260208601955080801561450057600181146145115761453c565b60ff1985168752878701955061453c565b60008b81526020902060005b858110156145365781548982015290840190890161451d565b88019650505b50939b9a5050505050505050505050565b6001600160401b038a8116825289811660208301528816604082015286151560608201526101206080820181905260009061458a83820189613e96565b905086151560a084015282810360c08401526145a68187613e96565b94151560e0840152505090151561010090910152979650505050505050565b6000808335601e198436030181126145dc57600080fd5b8301803591506001600160401b038211156145f657600080fd5b6020019150600581901b360382131561363257600080fd5b6000808335601e1984360301811261462557600080fd5b8301803591506001600160401b0382111561463f57600080fd5b60200191503681900382131561363257600080fd5b604080519081016001600160401b0381118282101715614676576146766149f2565b60405290565b60405161018081016001600160401b0381118282101715614676576146766149f2565b604051601f8201601f191681016001600160401b03811182821017156146c7576146c76149f2565b604052919050565b60006001600160401b038211156146e8576146e86149f2565b5060051b60200190565b60006001600160801b03828116848216808303821115614714576147146149b0565b01949350505050565b60008219821115614730576147306149b0565b500190565b60006001600160401b03828116848216808303821115614714576147146149b0565b6000816000190483118215151615614771576147716149b0565b500290565b600082821015614788576147886149b0565b500390565b5b81811015610fd0576000815560010161478e565b6000604082360312156147b457600080fd5b6147bc614654565b82356001600160401b03808211156147d357600080fd5b6147df36838701613639565b835260208501359150808211156147f557600080fd5b506137f9368286016136b4565b600160401b831115614816576148166149f2565b80548382558084101561486f578160005260206000206007850160031c8101601c8660021b168015614859576000198083018054828460200360031b1c16815550505b5061486c6007840160031c83018261478d565b50505b506000818152602081208391805b868110156148d9576148b161489185614a08565b845463ffffffff600386901b81811b801990931693909116901b16178455565b602084019350600482019150601c8211156148d157600091506001830192505b60010161487d565b50505050505050565b60005b838110156148fd5781810151838201526020016148e5565b83811115610ac05750506000910152565b60008161491d5761491d6149b0565b506000190190565b600181811c9082168061493957607f821691505b6020821081141561377f57634e487b7160e01b600052602260045260246000fd5b600061ffff80831681811415614972576149726149b0565b6001019392505050565b6000600019821415614990576149906149b0565b5060010190565b60006001600160401b0382811680821415614972576149725b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600081356106e081614aff565b614a1f82836145c5565b600160401b811115614a3357614a336149f2565b825481845580821015614a5957836000526020600020614a5782820184830161478d565b505b508260005260208060002060005b83811015614aa5578435614a7a81614ac6565b82546001600160a01b0319166001600160a01b03919091161782559382019360019182019101614a67565b5050614ab3818601866145c5565b9350915050610ac0828260018601614802565b6001600160a01b038116811461153157600080fd5b801515811461153157600080fd5b6001600160e01b03198116811461153157600080fd5b63ffffffff8116811461153157600080fdfe19ab2f9935ea21aae55c105da3820c7987d916dba8c3fce092f947cc9aa9f9f07f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa164736f6c6343000807000a

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102675760003560e01c806301ffc9a71461026c57806303ee438c1461029457806306fdde03146102a9578063081812fc146102b1578063095ea7b3146102d15780630ebd4c7f146102e657806315f56cb61461030657806323b872dd1461031957806324297d531461032c578063248a9ca31461033f5780632f2ff15d146103605780632fcfb95a1461037357806330cf65bc14610386578063338b584b1461039957806334d722c9146103ac57806336568abe146103c057806342842e0e146103d357806343bc1612146103e657806345b15590146103fa5780634bde38c81461040d5780634d073a5a146104285780636352211e146104545780636bca4f2f146104675780636dc14ba61461046f57806370a08231146104825780638da5cb5b146104955780638f9f193f1461049d5780639010d07c146104b057806391d14854146104c357806395d89b41146104d65780639ab4b89e146104de578063a04a44ac146104f1578063a217fddf14610504578063a22cb4651461050c578063a6c30fda1461051f578063afc9804014610534578063b058854114610548578063b0ccc31e14610550578063b88d4fde14610564578063b8d1e53214610577578063b9c4d9fb1461058a578063c05efa15146105aa578063c87b56dd146105c7578063ca15c873146105da578063d5391393146105ed578063d547741f14610602578063db30e20014610615578063e0781a0814610636578063e6a60eb614610649578063e8a3d4851461065c578063e985e9c514610664578063f34e33ab14610677578063fe63e7571461068a575b600080fd5b61027f61027a366004613a3d565b61069d565b60405190151581526020015b60405180910390f35b61029c6106e6565b60405161028b9190614080565b61029c6107a6565b6102c46102bf3660046139dd565b6107b5565b60405161028b9190613fef565b6102e46102df366004613977565b6107dc565b005b6102f96102f43660046139dd565b6107f5565b60405161028b919061406d565b6102e4610314366004613b00565b61087f565b6102e4610327366004613889565b610ac6565b6102e461033a366004613833565b610b1d565b61035261034d3660046139dd565b610b59565b60405190815260200161028b565b6102e461036e3660046139f6565b610b6e565b6102e4610381366004613833565b610b8a565b6102e4610394366004613833565b610bf7565b6102e46103a7366004613da3565b610c9d565b61012f546102c4906001600160a01b031681565b6102e46103ce3660046139f6565b610f56565b6102e46103e1366004613889565b610fd4565b610130546102c4906001600160a01b031681565b6102e4610408366004613d24565b610fef565b61012e546102c490600160401b90046001600160a01b031681565b61012e5461043c906001600160401b031681565b6040516001600160401b03909116815260200161028b565b6102c46104623660046139dd565b6110b3565b6102e46110e7565b6102e461047d366004613850565b611103565b610352610490366004613833565b611115565b6102c461119b565b6102e46104ab366004613833565b6111b2565b6102c46104be366004613a1b565b611216565b61027f6104d13660046139f6565b611235565b61029c611260565b6102e46104ec366004613d58565b61126f565b6102e46104ff366004613a77565b611330565b610352600081565b6102e461051a366004613949565b6113c2565b610352600080516020614b1283398151915281565b610138546102c4906001600160a01b031681565b6102e46113d6565b610139546102c4906001600160a01b031681565b6102e46105723660046138ca565b611446565b6102e4610585366004613833565b611497565b61059d6105983660046139dd565b611534565b60405161028b919061405a565b6105b261159b565b60405161028b9998979695949392919061454d565b61029c6105d53660046139dd565b611710565b6103526105e83660046139dd565b6118f4565b610352600080516020614b5283398151915281565b6102e46106103660046139f6565b61190b565b6106286106233660046139dd565b611927565b60405161028b929190614093565b6102e4610644366004613ab8565b6119cf565b6102e4610657366004613c4a565b611a85565b61029c611e50565b61027f610672366004613850565b611edf565b6102e46106853660046139dd565b611f0d565b6102e4610698366004613ddc565b611fcf565b60006001600160e01b03198216632dde656160e21b14806106c257506106c28261206a565b806106d157506106d1826120ba565b806106e057506106e0826120eb565b92915050565b6101355460609060ff166107155760405162461bcd60e51b815260040161070c906140b7565b60405180910390fd5b610134805461072390614925565b80601f016020809104026020016040519081016040528092919081815260200182805461074f90614925565b801561079c5780601f106107715761010080835404028352916020019161079c565b820191906000526020600020905b81548152906001019060200180831161077f57829003601f168201915b5050505050905090565b60606065805461072390614925565b60006107c082612110565b506000908152606960205260409020546001600160a01b031690565b816107e681612135565b6107f083836121fd565b505050565b606061013a60010180548060200260200160405190810160405280929190818152602001828054801561087357602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff16815260200190600401906020826003010492830192600103820291508084116108365790505b50505050509050919050565b600080516020614b528339815191526108978161230e565b6101355460ff16156108de5760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c1c995c185c995960821b604482015260640161070c565b6108f6600080516020614b1283398151915283611235565b61094c5760405162461bcd60e51b815260206004820152602160248201527f53746f726566726f6e74206e6f7420617574686f72697a656420746f206d696e6044820152601d60fa1b606482015260840161070c565b6109596020850185613dc1565b61013180546001600160401b0319166001600160401b0392909216919091179055610a1661098a604086018661460e565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506109cc92505050602087018761460e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610a119250505060808801606089016139a3565b612318565b60405163519e0a1360e11b81526001600160a01b0383169063a33c142690610a4290869060040161439b565b600060405180830381600087803b158015610a5c57600080fd5b505af1158015610a70573d6000803e3d6000fd5b50610ac09250610a86915050602086018661460e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061236392505050565b50505050565b826001600160a01b0381163314610ae057610ae033612135565b610135548290610100900460ff1615610b0b5760405162461bcd60e51b815260040161070c90614259565b610b16858585612430565b5050505050565b600080516020614b52833981519152610b358161230e565b5061013080546001600160a01b0319166001600160a01b0392909216919091179055565b600090815260c9602052604090206001015490565b610b7782610b59565b610b808161230e565b6107f08383612461565b6000610b958161230e565b610bad600080516020614b5283398151915283610b6e565b61012f54610bd390600080516020614b52833981519152906001600160a01b031661190b565b5061012f80546001600160a01b0319166001600160a01b0392909216919091179055565b33610c0061119b565b6001600160a01b03161480610c205750610130546001600160a01b031633145b610c3c5760405162461bcd60e51b815260040161070c906142cd565b61013954604051632cc5350560e21b81526001600160a01b039091169063b314d41490610c6f9030908590600401614003565b600060405180830381600087803b158015610c8957600080fd5b505af1158015610b16573d6000803e3d6000fd5b600080516020614b12833981519152610cb58161230e565b604080516101208101825261013180546001600160401b038082168452600160401b820481166020850152600160801b82041693830193909352600160c01b90920460ff16151560608201526101328054600093916080840191610d1890614925565b80601f0160208091040260200160405190810160405280929190818152602001828054610d4490614925565b8015610d915780601f10610d6657610100808354040283529160200191610d91565b820191906000526020600020905b815481529060010190602001808311610d7457829003601f168201915b5050509183525050600282015460ff1615156020820152600382018054604090920191610dbd90614925565b80601f0160208091040260200160405190810160405280929190818152602001828054610de990614925565b8015610e365780601f10610e0b57610100808354040283529160200191610e36565b820191906000526020600020905b815481529060010190602001808311610e1957829003601f168201915b50505091835250506004919091015460ff80821615156020808501919091526101009092041615156040909201919091528151908201519192506001600160401b031690610e8b9063ffffffff871690614735565b6001600160401b0316111580610ea9575080516001600160401b0316155b610ee25760405162461bcd60e51b815260206004820152600a60248201526938bab0b73a34ba3c901f60b11b604482015260640161070c565b80610100015115610f4c57610ef683611115565b158015610f0957508363ffffffff166001145b610f4c5760405162461bcd60e51b815260206004820152601460248201527336b0bc10189039b7bab63137bab73217b0b2323960611b604482015260640161070c565b610ac08484612483565b6001600160a01b0381163314610fc65760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161070c565b610fd082826125da565b5050565b6107f083838360405180602001604052806000815250611446565b6000610ffa8161230e565b611003826147a2565b602081015151815151146110295760405162461bcd60e51b815260040161070c90614218565b6000805b82515181101561107a578260200151818151811061104d5761104d6149dc565b602002602001015163ffffffff1682611066919061471d565b9150806110728161497c565b91505061102d565b5061271081111561109d5760405162461bcd60e51b815260040161070c90614370565b8361013a6110ab8282614a15565b505050505050565b6000806110bf836125fc565b90506001600160a01b0381166106e05760405162461bcd60e51b815260040161070c906142f3565b60006110f28161230e565b50610133805460ff19166001179055565b61110c82611497565b610fd081610bf7565b60006001600160a01b03821661117f5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161070c565b506001600160a01b031660009081526068602052604090205490565b61012e54600160401b90046001600160a01b031690565b60006111bd8161230e565b6111c8600083610b6e565b61012e546111e890600090600160401b90046001600160a01b031661190b565b5061012e80546001600160a01b03909216600160401b02600160401b600160e01b0319909216919091179055565b600082815260fb6020526040812061122e9083612617565b9392505050565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606066805461072390614925565b600080516020614b528339815191526112878161230e565b61129084612623565b6112c65760405162461bcd60e51b8152602060048201526007602482015266085b5a5b9d195960ca1b604482015260640161070c565b6000848152610136602052604090206001015460ff16156113165760405162461bcd60e51b815260206004820152600a6024820152693ab93490333937bd32b760b11b604482015260640161070c565b600084815261013660205260409020610b1690848461347a565b600080516020614b528339815191526113488161230e565b6101355460ff1661136b5760405162461bcd60e51b815260040161070c906140b7565b6101335460ff16156113b55760405162461bcd60e51b81526020600482015260136024820152721b595d1859185d1848155492481b1bd8dad959606a1b604482015260640161070c565b610ac0610134848461347a565b816113cc81612135565b6107f08383612640565b60006113e18161230e565b6101355460ff166114045760405162461bcd60e51b815260040161070c906140b7565b61013154600160c01b900460ff161561142f5760405162461bcd60e51b815260040161070c906141f4565b50610131805460ff60c01b1916600160c01b179055565b836001600160a01b03811633146114605761146033612135565b610135548390610100900460ff161561148b5760405162461bcd60e51b815260040161070c90614259565b6110ab8686868661264b565b336114a061119b565b6001600160a01b031614806114c05750610130546001600160a01b031633145b6114dc5760405162461bcd60e51b815260040161070c906142cd565b61013980546001600160a01b0319166001600160a01b038316908117909155156115315761013954604051632210724360e11b81526001600160a01b0390911690634420e48690610c6f903090600401613fef565b50565b606061013a60000180548060200260200160405190810160405280929190818152602001828054801561087357602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115725750505050509050919050565b610131805461013280546001600160401b0380841694600160401b8504821694600160801b810490921693600160c01b90920460ff16929091906115de90614925565b80601f016020809104026020016040519081016040528092919081815260200182805461160a90614925565b80156116575780601f1061162c57610100808354040283529160200191611657565b820191906000526020600020905b81548152906001019060200180831161163a57829003601f168201915b5050506002840154600385018054949560ff90921694919350915061167b90614925565b80601f01602080910402602001604051908101604052809291908181526020018280546116a790614925565b80156116f45780601f106116c9576101008083540402835291602001916116f4565b820191906000526020600020905b8154815290600101906020018083116116d757829003601f168201915b5050506004909301549192505060ff8082169161010090041689565b606061171b82612623565b6117675760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e00604482015260640161070c565b600082815261013660205260408120805461178190614925565b80601f01602080910402602001604051908101604052809291908181526020018280546117ad90614925565b80156117fa5780601f106117cf576101008083540402835291602001916117fa565b820191906000526020600020905b8154815290600101906020018083116117dd57829003601f168201915b5050505050905080516000146118105792915050565b6000610131600101805461182390614925565b80601f016020809104026020016040519081016040528092919081815260200182805461184f90614925565b801561189c5780601f106118715761010080835404028352916020019161189c565b820191906000526020600020905b81548152906001019060200180831161187f57829003601f168201915b5050505050905060008151116118c157604051806020016040528060008152506118ec565b806118cb8561267d565b6040516020016118dc929190613f28565b6040516020818303038152906040525b949350505050565b600081815260fb602052604081206106e090612719565b61191482610b59565b61191d8161230e565b6107f083836125da565b6101366020526000908152604090208054819061194390614925565b80601f016020809104026020016040519081016040528092919081815260200182805461196f90614925565b80156119bc5780601f10611991576101008083540402835291602001916119bc565b820191906000526020600020905b81548152906001019060200180831161199f57829003601f168201915b5050506001909301549192505060ff1682565b600080516020614b528339815191526119e78161230e565b6101355460ff16611a0a5760405162461bcd60e51b815260040161070c906140b7565b61013154600160c01b900460ff1615611a355760405162461bcd60e51b815260040161070c906141f4565b8151611a49906101329060208501906134fe565b507f57cafa311d6d28ea1d59c17aa93e87ca0d9aa0ef533ee169e7ee99f0f49afe1a82604051611a799190614080565b60405180910390a15050565b600054610100900460ff1615808015611aa55750600054600160ff909116105b80611ac65750611ab430612723565b158015611ac6575060005460ff166001145b611ae25760405162461bcd60e51b815260040161070c9061427f565b6000805460ff191660011790558015611b05576000805461ff0019166101001790555b611b0e866147a2565b60208101515181515114611b345760405162461bcd60e51b815260040161070c90614218565b6000805b825151811015611b855782602001518181518110611b5857611b586149dc565b602002602001015163ffffffff1682611b71919061471d565b915080611b7d8161497c565b915050611b38565b50612710811115611ba85760405162461bcd60e51b815260040161070c90614370565b611c31611bb58c8061460e565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611bf79250505060208e018e61460e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061273292505050565b611c39612763565b611c41612829565b611c4c60008b612852565b611c64600080516020614b528339815191528a612852565b60005b86811015611cbf57611cad600080516020614b12833981519152898984818110611c9357611c936149dc565b9050602002016020810190611ca89190613833565b612852565b80611cb78161497c565b915050611c67565b5061012e8054600160401b600160e01b031916600160401b6001600160a01b038d8116919091029190911790915561012f80546001600160a01b031916918b16919091179055611d1560808c0160608d01613833565b61013080546001600160a01b0319166001600160a01b0392909216919091179055611d4360408c018c61460e565b611d50916101379161347a565b508761013a611d5f8282614a15565b505061013880546001600160a01b0319166001600160a01b038716179055611d8a6020850185613833565b61013980546001600160a01b0319166001600160a01b03929092169182179055637d3e3dbe30611dc06040880160208901613833565b6040518363ffffffff1660e01b8152600401611ddd929190614003565b600060405180830381600087803b158015611df757600080fd5b505af1158015611e0b573d6000803e3d6000fd5b5050505050508015611e45576000805461ff001916905560405160018152600080516020614b328339815191529060200160405180910390a15b505050505050505050565b6101378054611e5e90614925565b80601f0160208091040260200160405190810160405280929190818152602001828054611e8a90614925565b8015611ed75780601f10611eac57610100808354040283529160200191611ed7565b820191906000526020600020905b815481529060010190602001808311611eba57829003601f168201915b505050505081565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b33611f17826110b3565b6001600160a01b031614611f565760405162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015260640161070c565b6000818152610136602052604090206001015460ff1615611fae5760405162461bcd60e51b81526020600482015260126024820152713ab9349030b63932b0b23c90333937bd32b760711b604482015260640161070c565b6000908152610136602052604090206001908101805460ff19169091179055565b600080516020614b52833981519152611fe78161230e565b610131546001600160401b038085169116116120395760405162461bcd60e51b81526020600482015260116024820152704e65772063617020746f6f206c6172676560781b604482015260640161070c565b5061013180546001600160401b039384166001600160401b03199182161790915561012e8054929093169116179055565b60006001600160e01b031982166380ac58cd60e01b148061209b57506001600160e01b03198216635b5e139f60e01b145b806106e057506301ffc9a760e01b6001600160e01b03198316146106e0565b60006120c58261206a565b806106e05750506001600160e01b03191660009081526097602052604090205460ff1690565b60006001600160e01b03198216635a05180f60e01b14806106e057506106e08261285c565b61211981612623565b6115315760405162461bcd60e51b815260040161070c906142f3565b610139546001600160a01b0316801580159061215b57506000816001600160a01b03163b115b15610fd057604051633185c44d60e21b81526001600160a01b0382169063c61711349061218e9030908690600401614003565b60206040518083038186803b1580156121a657600080fd5b505afa1580156121ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121de91906139c0565b610fd05781604051633b79c77360e21b815260040161070c9190613fef565b6000612208826110b3565b9050806001600160a01b0316836001600160a01b031614156122765760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161070c565b336001600160a01b038216148061229257506122928133611edf565b6123045760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161070c565b6107f08383612881565b61153181336128ef565b825161232c906101329060208601906134fe565b508151612341906101349060208501906134fe565b5080156107f05761013580548215156101000261ff0019909116179055505050565b61012e80546101318054600160801b6001600160401b03938416908102600160801b600160c01b031983168117909355610135805460ff191660011790559183169216919091179182916000906123bb908490614735565b82546001600160401b039182166101009390930a928302919092021990911617905550610130546040516001600160a01b03909116907feace9ffe7fa97ff7dbf4b23bcc99df5b088f5af2913bc589b0ad786a775f3cb99061242490849086906101329061447e565b60405180910390a25050565b61243a3382612948565b6124565760405162461bcd60e51b815260040161070c906140da565b6107f08383836129a6565b61246b8282612b05565b600082815260fb602052604090206107f09082612b8b565b610131546001600160401b03600160801b8204811691600160401b90041660005b8463ffffffff168161ffff161015612558576124d6846124c861ffff8416866146f2565b6001600160801b0316612ba0565b6124e461ffff8216846146f2565b604080516001600160401b03851681526001600160a01b03871660208201526001600160801b0392909216917f316901b3d7bc6bb45350b12d018d0716b43089303ece477800134577a24a6f97910160405180910390a261254482614997565b9150806125508161495a565b9150506124a4565b50610131805463ffffffff86169190601090612585908490600160801b90046001600160401b0316614735565b92506101000a8154816001600160401b0302191690836001600160401b031602179055508061013160000160086101000a8154816001600160401b0302191690836001600160401b0316021790555050505050565b6125e48282612ca9565b600082815260fb602052604090206107f09082612d10565b6000908152606760205260409020546001600160a01b031690565b600061122e8383612d25565b60008061262f836125fc565b6001600160a01b0316141592915050565b610fd0338383612d4f565b6126553383612948565b6126715760405162461bcd60e51b815260040161070c906140da565b610ac084848484612e1a565b6060600061268a83612e4d565b60010190506000816001600160401b038111156126a9576126a96149f2565b6040519080825280601f01601f1916602001820160405280156126d3576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461270c57612711565b6126dd565b509392505050565b60006106e0825490565b6001600160a01b03163b151590565b600054610100900460ff166127595760405162461bcd60e51b815260040161070c90614325565b610fd08282612f23565b600054610100900460ff16158080156127835750600054600160ff909116105b806127a4575061279230612723565b1580156127a4575060005460ff166001145b6127c05760405162461bcd60e51b815260040161070c9061427f565b6000805460ff1916600117905580156127e3576000805461ff0019166101001790555b6127f3632dde656160e21b612f71565b8015611531576000805461ff001916905560405160018152600080516020614b328339815191529060200160405180910390a150565b600054610100900460ff166128505760405162461bcd60e51b815260040161070c90614325565b565b610fd08282612461565b60006001600160e01b03198216637965db0b60e01b14806106e057506106e0826120ba565b600081815260696020526040902080546001600160a01b0319166001600160a01b03841690811790915581906128b6826110b3565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6128f98282611235565b610fd05761290681612fef565b612911836020613001565b604051602001612922929190613f80565b60408051601f198184030181529082905262461bcd60e51b825261070c91600401614080565b600080612954836110b3565b9050806001600160a01b0316846001600160a01b0316148061297b575061297b8185611edf565b806118ec5750836001600160a01b0316612994846107b5565b6001600160a01b031614949350505050565b826001600160a01b03166129b9826110b3565b6001600160a01b0316146129df5760405162461bcd60e51b815260040161070c90614179565b6001600160a01b038216612a415760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161070c565b612a4e838383600161319c565b826001600160a01b0316612a61826110b3565b6001600160a01b031614612a875760405162461bcd60e51b815260040161070c90614179565b600081815260696020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526068855283862080546000190190559087168086528386208054600101905586865260679094528285208054909216841790915590518493600080516020614b7283398151915291a4505050565b612b0f8282611235565b610fd057600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612b473390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061122e836001600160a01b038416613224565b6001600160a01b038216612bf65760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161070c565b612bff81612623565b15612c1c5760405162461bcd60e51b815260040161070c906141be565b612c2a60008383600161319c565b612c3381612623565b15612c505760405162461bcd60e51b815260040161070c906141be565b6001600160a01b038216600081815260686020908152604080832080546001019055848352606790915280822080546001600160a01b031916841790555183929190600080516020614b72833981519152908290a45050565b612cb38282611235565b15610fd057600082815260c9602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061122e836001600160a01b038416613273565b6000826000018281548110612d3c57612d3c6149dc565b9060005260206000200154905092915050565b816001600160a01b0316836001600160a01b03161415612dad5760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b604482015260640161070c565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612e258484846129a6565b612e3184848484613366565b610ac05760405162461bcd60e51b815260040161070c90614127565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310612e8c5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6904ee2d6d415b85acef8160201b8310612eb6576904ee2d6d415b85acef8160201b830492506020015b662386f26fc100008310612ed457662386f26fc10000830492506010015b6305f5e1008310612eec576305f5e100830492506008015b6127108310612f0057612710830492506004015b60648310612f12576064830492506002015b600a83106106e05760010192915050565b600054610100900460ff16612f4a5760405162461bcd60e51b815260040161070c90614325565b8151612f5d9060659060208501906134fe565b5080516107f09060669060208401906134fe565b6001600160e01b03198082161415612fca5760405162461bcd60e51b815260206004820152601c60248201527b115490cc4d8d4e881a5b9d985b1a59081a5b9d195c999858d9481a5960221b604482015260640161070c565b6001600160e01b0319166000908152609760205260409020805460ff19166001179055565b60606106e06001600160a01b03831660145b60606000613010836002614757565b61301b90600261471d565b6001600160401b03811115613032576130326149f2565b6040519080825280601f01601f19166020018201604052801561305c576020820181803683370190505b509050600360fc1b81600081518110613077576130776149dc565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106130a6576130a66149dc565b60200101906001600160f81b031916908160001a90535060006130ca846002614757565b6130d590600161471d565b90505b600181111561314d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613109576131096149dc565b1a60f81b82828151811061311f5761311f6149dc565b60200101906001600160f81b031916908160001a90535060049490941c936131468161490e565b90506130d8565b50831561122e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161070c565b6001811115610ac0576001600160a01b038416156131e2576001600160a01b038416600090815260686020526040812080548392906131dc908490614776565b90915550505b6001600160a01b03831615610ac0576001600160a01b0383166000908152606860205260408120805483929061321990849061471d565b909155505050505050565b600081815260018301602052604081205461326b575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556106e0565b5060006106e0565b6000818152600183016020526040812054801561335c576000613297600183614776565b85549091506000906132ab90600190614776565b90508181146133105760008660000182815481106132cb576132cb6149dc565b90600052602060002001549050808760000184815481106132ee576132ee6149dc565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613321576133216149c6565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506106e0565b60009150506106e0565b600061337a846001600160a01b0316612723565b1561346f57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906133b190339089908890889060040161401d565b602060405180830381600087803b1580156133cb57600080fd5b505af19250505080156133fb575060408051601f3d908101601f191682019092526133f891810190613a5a565b60015b613455573d808015613429576040519150601f19603f3d011682016040523d82523d6000602084013e61342e565b606091505b50805161344d5760405162461bcd60e51b815260040161070c90614127565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506118ec565b506001949350505050565b82805461348690614925565b90600052602060002090601f0160209004810192826134a857600085556134ee565b82601f106134c15782800160ff198235161785556134ee565b828001600101855582156134ee579182015b828111156134ee5782358255916020019190600101906134d3565b506134fa929150613572565b5090565b82805461350a90614925565b90600052602060002090601f01602090048101928261352c57600085556134ee565b82601f1061354557805160ff19168380011785556134ee565b828001600101855582156134ee579182015b828111156134ee578251825591602001919060010190613557565b5b808211156134fa5760008155600101613573565b60006001600160401b038311156135a0576135a06149f2565b6135b3601f8401601f191660200161469f565b90508281528383830111156135c757600080fd5b828260208301376000602084830101529392505050565b80356135e981614ac6565b919050565b60008083601f84011261360057600080fd5b5081356001600160401b0381111561361757600080fd5b6020830191508360208260051b850101111561363257600080fd5b9250929050565b600082601f83011261364a57600080fd5b8135602061365f61365a836146cf565b61469f565b80838252828201915082860187848660051b890101111561367f57600080fd5b60005b858110156136a757813561369581614ac6565b84529284019290840190600101613682565b5090979650505050505050565b600082601f8301126136c557600080fd5b813560206136d561365a836146cf565b80838252828201915082860187848660051b89010111156136f557600080fd5b60005b858110156136a757813561370b81614aff565b845292840192908401906001016136f8565b8035600381106135e957600080fd5b60008083601f84011261373e57600080fd5b5081356001600160401b0381111561375557600080fd5b60208301915083602082850101111561363257600080fd5b60006080828403121561377f57600080fd5b50919050565b60006040828403121561377f57600080fd5b6000604082840312156137a957600080fd5b6137b1614654565b905081356001600160401b03808211156137ca57600080fd5b6137d6858386016136b4565b835260208401359150808211156137ec57600080fd5b506137f984828501613639565b60208301525092915050565b80356001600160801b03811681146135e957600080fd5b80356001600160401b03811681146135e957600080fd5b60006020828403121561384557600080fd5b813561122e81614ac6565b6000806040838503121561386357600080fd5b823561386e81614ac6565b9150602083013561387e81614ac6565b809150509250929050565b60008060006060848603121561389e57600080fd5b83356138a981614ac6565b925060208401356138b981614ac6565b929592945050506040919091013590565b600080600080608085870312156138e057600080fd5b84356138eb81614ac6565b935060208501356138fb81614ac6565b92506040850135915060608501356001600160401b0381111561391d57600080fd5b8501601f8101871361392e57600080fd5b61393d87823560208401613587565b91505092959194509250565b6000806040838503121561395c57600080fd5b823561396781614ac6565b9150602083013561387e81614adb565b6000806040838503121561398a57600080fd5b823561399581614ac6565b946020939093013593505050565b6000602082840312156139b557600080fd5b813561122e81614adb565b6000602082840312156139d257600080fd5b815161122e81614adb565b6000602082840312156139ef57600080fd5b5035919050565b60008060408385031215613a0957600080fd5b82359150602083013561387e81614ac6565b60008060408385031215613a2e57600080fd5b50508035926020909101359150565b600060208284031215613a4f57600080fd5b813561122e81614ae9565b600060208284031215613a6c57600080fd5b815161122e81614ae9565b60008060208385031215613a8a57600080fd5b82356001600160401b03811115613aa057600080fd5b613aac8582860161372c565b90969095509350505050565b600060208284031215613aca57600080fd5b81356001600160401b03811115613ae057600080fd5b8201601f81018413613af157600080fd5b6118ec84823560208401613587565b600080600060608486031215613b1557600080fd5b83356001600160401b0380821115613b2c57600080fd5b613b388783880161376d565b94506020860135915080821115613b4e57600080fd5b908501906101808288031215613b6357600080fd5b613b6b61467c565b613b748361381c565b8152613b8260208401613805565b6020820152613b9360408401613805565b604082015260608301356060820152613bae608084016135de565b608082015260a083013560a0820152613bc960c0840161371d565b60c0820152613bda60e084016135de565b60e0820152610100613bed8185016135de565b908201526101208381013583811115613c0557600080fd5b613c118a828701613797565b918301919091525061014083810135908201526101609283013592810192909252509150613c41604085016135de565b90509250925092565b600080600080600080600080610100898b031215613c6757600080fd5b88356001600160401b0380821115613c7e57600080fd5b613c8a8c838d0161376d565b995060208b01359150613c9c82614ac6565b90975060408a013590613cae82614ac6565b90965060608a01359080821115613cc457600080fd5b613cd08c838d01613785565b965060808b0135915080821115613ce657600080fd5b50613cf38b828c016135ee565b9095509350613d06905060a08a016135de565b9150613d158a60c08b01613785565b90509295985092959890939650565b600060208284031215613d3657600080fd5b81356001600160401b03811115613d4c57600080fd5b6118ec84828501613785565b600080600060408486031215613d6d57600080fd5b8335925060208401356001600160401b03811115613d8a57600080fd5b613d968682870161372c565b9497909650939450505050565b60008060408385031215613db657600080fd5b823561386e81614aff565b600060208284031215613dd357600080fd5b61122e8261381c565b60008060408385031215613def57600080fd5b613df88361381c565b9150613e066020840161381c565b90509250929050565b6001600160a01b03169052565b600081518084526020808501945080840160005b83811015613e555781516001600160a01b031687529582019590820190600101613e30565b509495945050505050565b600081518084526020808501945080840160005b83811015613e5557815163ffffffff1687529582019590820190600101613e74565b60008151808452613eae8160208601602086016148e2565b601f01601f19169290920160200192915050565b60038110613ee057634e487b7160e01b600052602160045260246000fd5b9052565b6000815160408452613ef96040850182613e60565b905060208301518482036020860152613f128282613e1c565b95945050505050565b6001600160801b03169052565b60008351613f3a8184602088016148e2565b8083019050602f60f81b8082528451613f5a8160018501602089016148e2565b6001920191820152693a37b5b2b7173539b7b760b11b6002820152600c01949350505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351613fb28160178501602088016148e2565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613fe38160288401602088016148e2565b01602801949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061405090830184613e96565b9695505050505050565b60208152600061122e6020830184613e1c565b60208152600061122e6020830184613e60565b60208152600061122e6020830184613e96565b6040815260006140a66040830185613e96565b905082151560208301529392505050565b602080825260099082015268085c1c995c185c995960ba1b604082015260600190565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6020808252601c908201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b604082015260600190565b6020808252600a9082015269155492481b1bd8dad95960b21b604082015260600190565b60208082526021908201527f526f79616c747920617272617973206d69736d617463686564206c656e6774686040820152607360f81b606082015260800190565b6020808252600c908201526b1a5cc81cdbdd5b189bdd5b9960a21b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252600c908201526b1d5b985d5d1a1bdc9a5e995960a21b604082015260600190565b602080825260189082015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b602080825260119082015270526f79616c747920746f6f206c6172676560781b604082015260600190565b602081526143b56020820183516001600160401b03169052565b600060208301516143c96040840182613f1b565b5060408301516143dc6060840182613f1b565b506060830151608083015260808301516143f960a0840182613e0f565b5060a083015160c083015260c083015161441660e0840182613ec2565b5060e083015161010061442b81850183613e0f565b840151905061012061443f84820183613e0f565b80850151915050610180610140818186015261445f6101a0860184613ee4565b9086015161016086810191909152909501519301929092525090919050565b6001600160401b0384168152606060208083018290526000916144a390840186613e96565b83810360408501528454600090600181811c90808316806144c557607f831692505b8683108114156144e357634e487b7160e01b85526022600452602485fd5b82865260208601955080801561450057600181146145115761453c565b60ff1985168752878701955061453c565b60008b81526020902060005b858110156145365781548982015290840190890161451d565b88019650505b50939b9a5050505050505050505050565b6001600160401b038a8116825289811660208301528816604082015286151560608201526101206080820181905260009061458a83820189613e96565b905086151560a084015282810360c08401526145a68187613e96565b94151560e0840152505090151561010090910152979650505050505050565b6000808335601e198436030181126145dc57600080fd5b8301803591506001600160401b038211156145f657600080fd5b6020019150600581901b360382131561363257600080fd5b6000808335601e1984360301811261462557600080fd5b8301803591506001600160401b0382111561463f57600080fd5b60200191503681900382131561363257600080fd5b604080519081016001600160401b0381118282101715614676576146766149f2565b60405290565b60405161018081016001600160401b0381118282101715614676576146766149f2565b604051601f8201601f191681016001600160401b03811182821017156146c7576146c76149f2565b604052919050565b60006001600160401b038211156146e8576146e86149f2565b5060051b60200190565b60006001600160801b03828116848216808303821115614714576147146149b0565b01949350505050565b60008219821115614730576147306149b0565b500190565b60006001600160401b03828116848216808303821115614714576147146149b0565b6000816000190483118215151615614771576147716149b0565b500290565b600082821015614788576147886149b0565b500390565b5b81811015610fd0576000815560010161478e565b6000604082360312156147b457600080fd5b6147bc614654565b82356001600160401b03808211156147d357600080fd5b6147df36838701613639565b835260208501359150808211156147f557600080fd5b506137f9368286016136b4565b600160401b831115614816576148166149f2565b80548382558084101561486f578160005260206000206007850160031c8101601c8660021b168015614859576000198083018054828460200360031b1c16815550505b5061486c6007840160031c83018261478d565b50505b506000818152602081208391805b868110156148d9576148b161489185614a08565b845463ffffffff600386901b81811b801990931693909116901b16178455565b602084019350600482019150601c8211156148d157600091506001830192505b60010161487d565b50505050505050565b60005b838110156148fd5781810151838201526020016148e5565b83811115610ac05750506000910152565b60008161491d5761491d6149b0565b506000190190565b600181811c9082168061493957607f821691505b6020821081141561377f57634e487b7160e01b600052602260045260246000fd5b600061ffff80831681811415614972576149726149b0565b6001019392505050565b6000600019821415614990576149906149b0565b5060010190565b60006001600160401b0382811680821415614972576149725b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600081356106e081614aff565b614a1f82836145c5565b600160401b811115614a3357614a336149f2565b825481845580821015614a5957836000526020600020614a5782820184830161478d565b505b508260005260208060002060005b83811015614aa5578435614a7a81614ac6565b82546001600160a01b0319166001600160a01b03919091161782559382019360019182019101614a67565b5050614ab3818601866145c5565b9350915050610ac0828260018601614802565b6001600160a01b038116811461153157600080fd5b801515811461153157600080fd5b6001600160e01b03198116811461153157600080fd5b63ffffffff8116811461153157600080fdfe19ab2f9935ea21aae55c105da3820c7987d916dba8c3fce092f947cc9aa9f9f07f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa164736f6c6343000807000a

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.