POL Price: $0.323911 (+5.01%)
Gas: 30 GWei
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Asset

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 2000 runs

Other Settings:
paris EvmVersion, MIT license
File 1 of 34 : Asset.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.18;

import {
    AccessControlUpgradeable,
    ContextUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {
    ERC1155BurnableUpgradeable,
    ERC1155Upgradeable
} from "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol";
import {
    ERC1155SupplyUpgradeable
} from "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol";
import {
    ERC1155URIStorageUpgradeable
} from "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol";
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {
    ERC2771HandlerUpgradeable
} from "@sandbox-smart-contracts/dependency-metatx/contracts/ERC2771HandlerUpgradeable.sol";
import {
    MultiRoyaltyDistributor
} from "@sandbox-smart-contracts/dependency-royalty-management/contracts/MultiRoyaltyDistributor.sol";
import {
    OperatorFiltererUpgradeable
} from "@sandbox-smart-contracts/dependency-operator-filter/contracts/OperatorFiltererUpgradeable.sol";
import {TokenIdUtils} from "./libraries/TokenIdUtils.sol";
import {IAsset} from "./interfaces/IAsset.sol";
import {ITokenUtils, IRoyaltyUGC} from "./interfaces/ITokenUtils.sol";

/// @title Asset
/// @author The Sandbox
/// @notice ERC1155 asset token contract
/// @notice Minting and burning tokens is only allowed through separate authorized contracts
/// @dev This contract is final and should not be inherited
contract Asset is
    IAsset,
    Initializable,
    ERC2771HandlerUpgradeable,
    ERC1155BurnableUpgradeable,
    AccessControlUpgradeable,
    ERC1155SupplyUpgradeable,
    ERC1155URIStorageUpgradeable,
    OperatorFiltererUpgradeable,
    MultiRoyaltyDistributor,
    ITokenUtils
{
    using TokenIdUtils for uint256;
    using Address for address;

    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");
    bytes32 public constant MODERATOR_ROLE = keccak256("MODERATOR_ROLE");

    // mapping of ipfs metadata token hash to token id
    mapping(string => uint256) public hashUsed;

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    /// @notice Initialize the contract
    /// @param forwarder The address of the trusted forwarder
    /// @param assetAdmin The address of the asset admin
    /// @param baseUri The base URI for the token metadata
    /// @param commonSubscription The address of the operator filter subscription
    /// @param manager The address of the royalty manager
    function initialize(
        address forwarder,
        address assetAdmin,
        string memory baseUri,
        address commonSubscription,
        address manager
    ) external initializer {
        __ERC2771Handler_init(forwarder);
        _grantRole(DEFAULT_ADMIN_ROLE, assetAdmin);
        _setBaseURI(baseUri);
        __OperatorFilterer_init(commonSubscription, true);
        __MultiRoyaltyDistributor_init(manager);
        __AccessControl_init();
        __ERC1155Supply_init();
        __ERC1155Burnable_init();
    }

    /// @notice Mint new tokens
    /// @dev Only callable by the minter role
    /// @param to The address of the recipient
    /// @param id The id of the token to mint
    /// @param amount The amount of the token to mint
    /// @param metadataHash The metadata hash of the token to mint
    function mint(
        address to,
        uint256 id,
        uint256 amount,
        string memory metadataHash
    ) external onlyRole(MINTER_ROLE) {
        _setMetadataHash(id, metadataHash);
        _mint(to, id, amount, "");
        address creator = id.getCreatorAddress();
        _setTokenRoyalties(id, payable(creator), creator);
    }

    /// @notice Mint new tokens with catalyst tier chosen by the creator
    /// @dev Only callable by the minter role
    /// @param to The address of the recipient
    /// @param ids The ids of the tokens to mint
    /// @param amounts The amounts of the tokens to mint
    /// @param metadataHashes The metadata hashes of the tokens to mint
    function mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        string[] memory metadataHashes
    ) external onlyRole(MINTER_ROLE) {
        require(ids.length == metadataHashes.length, "Asset: 1-Array mismatch");
        require(ids.length == amounts.length, "Asset: 2-Array mismatch");
        for (uint256 i = 0; i < ids.length; i++) {
            _setMetadataHash(ids[i], metadataHashes[i]);
        }
        _mintBatch(to, ids, amounts, "");
        for (uint256 i; i < ids.length; i++) {
            address creator = ids[i].getCreatorAddress();
            _setTokenRoyalties(ids[i], payable(creator), creator);
        }
    }

    /// @notice Burn a token from a given account
    /// @dev Only the minter role can burn tokens
    /// @dev This function was added with token recycling and bridging in mind but may have other use cases
    /// @param account The account to burn tokens from
    /// @param id The token id to burn
    /// @param amount The amount of tokens to burn
    function burnFrom(
        address account,
        uint256 id,
        uint256 amount
    ) external onlyRole(BURNER_ROLE) {
        _burn(account, id, amount);
    }

    /// @notice Burn a batch of tokens from a given account
    /// @dev Only the minter role can burn tokens
    /// @dev This function was added with token recycling and bridging in mind but may have other use cases
    /// @dev The length of the ids and amounts arrays must be the same
    /// @param account The account to burn tokens from
    /// @param ids An array of token ids to burn
    /// @param amounts An array of amounts of tokens to burn
    function burnBatchFrom(
        address account,
        uint256[] memory ids,
        uint256[] memory amounts
    ) external onlyRole(BURNER_ROLE) {
        _burnBatch(account, ids, amounts);
    }

    /// @notice Set a new URI for specific tokenid
    /// @dev The metadata hash should be the IPFS CIDv1 base32 encoded hash
    /// @param tokenId The token id to set URI for
    /// @param metadata The new URI for asset's metadata
    function setTokenURI(uint256 tokenId, string memory metadata) external onlyRole(MODERATOR_ROLE) {
        _setURI(tokenId, metadata);
    }

    /// @notice Set a new base URI
    /// @param baseURI The new base URI
    function setBaseURI(string memory baseURI) external onlyRole(DEFAULT_ADMIN_ROLE) {
        _setBaseURI(baseURI);
    }

    /// @notice returns full token URI, including baseURI and token metadata URI
    /// @param tokenId The token id to get URI for
    /// @return tokenURI the URI of the token
    function uri(uint256 tokenId)
        public
        view
        override(ERC1155Upgradeable, ERC1155URIStorageUpgradeable)
        returns (string memory tokenURI)
    {
        return ERC1155URIStorageUpgradeable.uri(tokenId);
    }

    /// @notice returns the tokenId associated with provided metadata hash
    /// @param metadataHash The metadata hash to get tokenId for
    /// @return tokenId the tokenId associated with the metadata hash
    function getTokenIdByMetadataHash(string memory metadataHash) public view returns (uint256 tokenId) {
        return hashUsed[metadataHash];
    }

    /// @notice sets the metadata hash for a given tokenId
    /// @param tokenId The tokenId to set metadata hash for
    /// @param metadataHash The metadata hash to set
    function _setMetadataHash(uint256 tokenId, string memory metadataHash) internal {
        if (hashUsed[metadataHash] != 0) {
            require(hashUsed[metadataHash] == tokenId, "Asset: Hash already used");
        } else {
            hashUsed[metadataHash] = tokenId;
            _setURI(tokenId, metadataHash);
        }
    }

    /// @notice Set a new trusted forwarder address, limited to DEFAULT_ADMIN_ROLE only
    /// @dev Change the address of the trusted forwarder for meta-TX
    /// @param trustedForwarder The new trustedForwarder
    function setTrustedForwarder(address trustedForwarder) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(trustedForwarder.isContract(), "Asset: Bad forwarder address");
        _setTrustedForwarder(trustedForwarder);
    }

    /// @notice Query if a contract implements interface `id`.
    /// @param id the interface identifier, as specified in ERC-165.
    /// @return supported `true` if the contract implements `id`.
    function supportsInterface(bytes4 id)
        public
        view
        virtual
        override(ERC1155Upgradeable, AccessControlUpgradeable, MultiRoyaltyDistributor)
        returns (bool supported)
    {
        return id == type(IRoyaltyUGC).interfaceId || super.supportsInterface(id);
    }

    function _msgSender()
        internal
        view
        virtual
        override(ContextUpgradeable, ERC2771HandlerUpgradeable)
        returns (address sender)
    {
        return ERC2771HandlerUpgradeable._msgSender();
    }

    function _msgData()
        internal
        view
        virtual
        override(ContextUpgradeable, ERC2771HandlerUpgradeable)
        returns (bytes calldata msgData)
    {
        return ERC2771HandlerUpgradeable._msgData();
    }

    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
    }

    /// @notice Transfers `values` tokens of type `ids` from  `from` to `to` (with safety call).
    /// @dev call data should be optimized to order ids so packedBalance can be used efficiently.
    /// @param from address from which tokens are transfered.
    /// @param to address to which the token will be transfered.
    /// @param ids ids of each token type transfered.
    /// @param amounts amount of each token type transfered.
    /// @param data additional data accompanying the transfer.
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override onlyAllowedOperator(from) {
        super.safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /// @notice Enable or disable approval for `operator` to manage all of the caller's tokens.
    /// @param operator address which will be granted rights to transfer all tokens of the caller.
    /// @param approved whether to approve or revoke
    function setApprovalForAll(address operator, bool approved)
        public
        virtual
        override
        onlyAllowedOperatorApproval(operator)
    {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /// @notice Transfers `value` tokens of type `id` from  `from` to `to`  (with safety call).
    /// @param from address from which tokens are transfered.
    /// @param to address to which the token will be transfered.
    /// @param id the token type transfered.
    /// @param amount amount of token transfered.
    /// @param data additional data accompanying the transfer.
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override onlyAllowedOperator(from) {
        require(from == _msgSender() || isApprovedForAll(from, _msgSender()), "Asset: Transfer error");
        _safeTransferFrom(from, to, id, amount, data);
    }

    /// @notice could be used to deploy splitter and set tokens royalties
    /// @param tokenId the id of the token for which the EIP2981 royalty is set for.
    /// @param recipient the royalty recipient for the splitter of the creator.
    /// @param creator the creator of the tokens.
    function setTokenRoyalties(
        uint256 tokenId,
        address payable recipient,
        address creator
    ) external override onlyRole(DEFAULT_ADMIN_ROLE) {
        _setTokenRoyalties(tokenId, recipient, creator);
    }

    /// @notice Extracts the creator address from a given token id
    /// @param tokenId The token id to extract the creator address from
    /// @return creator The asset creator address
    function getCreatorAddress(uint256 tokenId) external pure returns (address creator) {
        return TokenIdUtils.getCreatorAddress(tokenId);
    }

    /// @notice Extracts the tier from a given token id
    /// @param tokenId The token id to extract the tier from
    /// @return tier The asset tier, determined by the catalyst used to create it
    function getTier(uint256 tokenId) external pure returns (uint8 tier) {
        return TokenIdUtils.getTier(tokenId);
    }

    /// @notice Extracts the revealed flag from a given token id
    /// @param tokenId The token id to extract the revealed flag from
    /// @return revealed Whether the asset is revealed or not
    function isRevealed(uint256 tokenId) external pure returns (bool revealed) {
        return TokenIdUtils.isRevealed(tokenId);
    }

    /// @notice Extracts the asset nonce from a given token id
    /// @param tokenId The token id to extract the asset nonce from
    /// @return creatorNonce The asset creator nonce
    function getCreatorNonce(uint256 tokenId) external pure returns (uint16 creatorNonce) {
        return TokenIdUtils.getCreatorNonce(tokenId);
    }

    /// @notice Extracts the abilities and enhancements hash from a given token id
    /// @param tokenId The token id to extract reveal nonce from
    /// @return revealNonce The reveal nonce of the asset
    function getRevealNonce(uint256 tokenId) external pure returns (uint16 revealNonce) {
        return TokenIdUtils.getRevealNonce(tokenId);
    }

    /// @notice Extracts the bridged flag from a given token id
    /// @param tokenId The token id to extract the bridged flag from
    /// @return bridged Whether the asset is bridged or not
    function isBridged(uint256 tokenId) external pure returns (bool bridged) {
        return TokenIdUtils.isBridged(tokenId);
    }

    /// @notice This function is used to register Asset contract on the Operator Filterer Registry of OpenSea. Can only be called by admin.
    /// @dev used to register contract and subscribe to the subscriptionOrRegistrantToCopy's black list.
    /// @param subscriptionOrRegistrantToCopy registration address of the list to subscribe.
    /// @param subscribe bool to signify subscription "true"" or to copy the list "false".
    function registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(subscriptionOrRegistrantToCopy.isContract(), "Asset: Bad subscription address");
        _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);
    }

    /// @notice sets the operator filter registry address
    /// @param registry the address of the registry
    function setOperatorRegistry(address registry) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(registry.isContract(), "Asset: Bad registry address");
        OperatorFiltererUpgradeable._setOperatorFilterRegistry(registry);
    }

    /// @notice A descriptive name for the collection of tokens in this contract.
    /// @return _name the name of the tokens.
    function name() external pure returns (string memory _name) {
        return "The Sandbox's ASSETs";
    }

    /// @notice An abbreviated name for the collection of tokens in this contract.
    /// @return _symbol the symbol of the tokens.
    function symbol() external pure returns (string memory _symbol) {
        return "ASSET";
    }

    uint256[49] private __gap;
}

File 2 of 34 : IRoyaltySplitter.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

struct Recipient {
    address payable recipient;
    uint16 bps;
}

interface IRoyaltySplitter is IERC165 {
    /**
     * @dev Set the splitter recipients. Total bps must total 10000.
     */
    function setRecipients(Recipient[] calldata recipients) external;

    /**
     * @dev Get the splitter recipients;
     */
    function getRecipients() external view returns (Recipient[] memory);
}

File 3 of 34 : IEIP2981.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * EIP-2981
 */
interface IEIP2981 {
    /**
     * bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
     *
     * => 0x2a55205a = 0x2a55205a
     */
    function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);
}

File 4 of 34 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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:
 *
 * ```solidity
 * 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}:
 *
 * ```solidity
 * 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. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
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 5 of 34 : 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 34 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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]
 * ```solidity
 * 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 Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 7 of 34 : ERC1155Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

import "./IERC1155Upgradeable.sol";
import "./IERC1155ReceiverUpgradeable.sol";
import "./extensions/IERC1155MetadataURIUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {
    using AddressUpgradeable for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

    // Mapping from account to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    function __ERC1155_init(string memory uri_) internal onlyInitializing {
        __ERC1155_init_unchained(uri_);
    }

    function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {
        _setURI(uri_);
    }

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

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: address zero is not a valid owner");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] memory accounts,
        uint256[] memory ids
    ) public view virtual override returns (uint256[] memory) {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
        }

        return batchBalances;
    }

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

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

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner or approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not token owner or approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(address from, uint256 id, uint256 amount) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }

        emit TransferSingle(operator, from, address(0), id, amount);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

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

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `ids` and `amounts` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155ReceiverUpgradeable.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non-ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155ReceiverUpgradeable.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non-ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }

    /**
     * @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[47] private __gap;
}

File 8 of 34 : IERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155ReceiverUpgradeable is IERC165Upgradeable {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 9 of 34 : IERC1155Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155Upgradeable is IERC165Upgradeable {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] calldata accounts,
        uint256[] calldata ids
    ) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 10 of 34 : ERC1155BurnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Extension of {ERC1155} that allows token holders to destroy both their
 * own tokens and those that they have been approved to use.
 *
 * _Available since v3.1._
 */
abstract contract ERC1155BurnableUpgradeable is Initializable, ERC1155Upgradeable {
    function __ERC1155Burnable_init() internal onlyInitializing {
    }

    function __ERC1155Burnable_init_unchained() internal onlyInitializing {
    }
    function burn(address account, uint256 id, uint256 value) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not token owner or approved"
        );

        _burn(account, id, value);
    }

    function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not token owner or approved"
        );

        _burnBatch(account, ids, values);
    }

    /**
     * @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 11 of 34 : ERC1155SupplyUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Extension of ERC1155 that adds tracking of total supply per id.
 *
 * Useful for scenarios where Fungible and Non-fungible tokens have to be
 * clearly identified. Note: While a totalSupply of 1 might mean the
 * corresponding is an NFT, there is no guarantees that no other token with the
 * same id are not going to be minted.
 */
abstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable {
    function __ERC1155Supply_init() internal onlyInitializing {
    }

    function __ERC1155Supply_init_unchained() internal onlyInitializing {
    }
    mapping(uint256 => uint256) private _totalSupply;

    /**
     * @dev Total amount of tokens in with a given id.
     */
    function totalSupply(uint256 id) public view virtual returns (uint256) {
        return _totalSupply[id];
    }

    /**
     * @dev Indicates whether any token exist with a given id, or not.
     */
    function exists(uint256 id) public view virtual returns (bool) {
        return ERC1155SupplyUpgradeable.totalSupply(id) > 0;
    }

    /**
     * @dev See {ERC1155-_beforeTokenTransfer}.
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);

        if (from == address(0)) {
            for (uint256 i = 0; i < ids.length; ++i) {
                _totalSupply[ids[i]] += amounts[i];
            }
        }

        if (to == address(0)) {
            for (uint256 i = 0; i < ids.length; ++i) {
                uint256 id = ids[i];
                uint256 amount = amounts[i];
                uint256 supply = _totalSupply[id];
                require(supply >= amount, "ERC1155: burn amount exceeds totalSupply");
                unchecked {
                    _totalSupply[id] = supply - amount;
                }
            }
        }
    }

    /**
     * @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 12 of 34 : ERC1155URIStorageUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)

pragma solidity ^0.8.0;

import "../../../utils/StringsUpgradeable.sol";
import "../ERC1155Upgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev ERC1155 token with storage based token URI management.
 * Inspired by the ERC721URIStorage extension
 *
 * _Available since v4.6._
 */
abstract contract ERC1155URIStorageUpgradeable is Initializable, ERC1155Upgradeable {
    function __ERC1155URIStorage_init() internal onlyInitializing {
        __ERC1155URIStorage_init_unchained();
    }

    function __ERC1155URIStorage_init_unchained() internal onlyInitializing {
        _baseURI = "";
    }
    using StringsUpgradeable for uint256;

    // Optional base URI
    string private _baseURI;

    // Optional mapping for token URIs
    mapping(uint256 => string) private _tokenURIs;

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the concatenation of the `_baseURI`
     * and the token-specific uri if the latter is set
     *
     * This enables the following behaviors:
     *
     * - if `_tokenURIs[tokenId]` is set, then the result is the concatenation
     *   of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`
     *   is empty per default);
     *
     * - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`
     *   which in most cases will contain `ERC1155._uri`;
     *
     * - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a
     *   uri value set, then the result is empty.
     */
    function uri(uint256 tokenId) public view virtual override returns (string memory) {
        string memory tokenURI = _tokenURIs[tokenId];

        // If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked).
        return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);
    }

    /**
     * @dev Sets `tokenURI` as the tokenURI of `tokenId`.
     */
    function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {
        _tokenURIs[tokenId] = tokenURI;
        emit URI(uri(tokenId), tokenId);
    }

    /**
     * @dev Sets `baseURI` as the `_baseURI` for all tokens
     */
    function _setBaseURI(string memory baseURI) internal virtual {
        _baseURI = baseURI;
    }

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

File 13 of 34 : IERC1155MetadataURIUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155Upgradeable.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

File 14 of 34 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 15 of 34 : 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 16 of 34 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.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 `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value))));
    }

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

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 17 of 34 : 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 18 of 34 : 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 19 of 34 : MathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 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 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

File 20 of 34 : SignedMathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMathUpgradeable {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

File 23 of 34 : IAsset.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.18;

/// @title Asset interface
/// @author The Sandbox
interface IAsset {
    // AssetData reflects the asset tokenId structure
    // Refer to TokenIdUtils.sol
    struct AssetData {
        uint256 tokenId;
        address creator;
        uint256 amount;
        uint8 tier;
        uint16 creatorNonce;
        bool revealed;
        string metadataHash;
        bool bridged;
    }

    event TrustedForwarderChanged(address indexed newTrustedForwarderAddress);

    /// @notice Mint new tokens
    /// @dev Only callable by the minter role
    /// @param to The address of the recipient
    /// @param id The id of the token to mint
    /// @param amount The amount of the token to mint
    /// @param metadataHash The metadata hash of the token to mint
    function mint(
        address to,
        uint256 id,
        uint256 amount,
        string memory metadataHash
    ) external;

    /// @notice Mint new tokens with catalyst tier chosen by the creator
    /// @dev Only callable by the minter role
    /// @param to The address of the recipient
    /// @param ids The ids of the tokens to mint
    /// @param amounts The amounts of the tokens to mint
    /// @param metadataHashes The metadata hashes of the tokens to mint
    function mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        string[] memory metadataHashes
    ) external;

    /// @notice Burn a token from a given account
    /// @dev Only the minter role can burn tokens
    /// @dev This function was added with token recycling and bridging in mind but may have other use cases
    /// @param account The account to burn tokens from
    /// @param id The token id to burn
    /// @param amount The amount of tokens to burn
    function burnFrom(
        address account,
        uint256 id,
        uint256 amount
    ) external;

    /// @notice Burn a batch of tokens from a given account
    /// @dev Only the minter role can burn tokens
    /// @dev This function was added with token recycling and bridging in mind but may have other use cases
    /// @dev The length of the ids and amounts arrays must be the same
    /// @param account The account to burn tokens from
    /// @param ids An array of token ids to burn
    /// @param amounts An array of amounts of tokens to burn
    function burnBatchFrom(
        address account,
        uint256[] memory ids,
        uint256[] memory amounts
    ) external;

    /// @notice returns the tokenId associated with provided metadata hash
    /// @param metadataHash The metadata hash to get tokenId for
    /// @return tokenId the tokenId associated with the metadata hash
    function getTokenIdByMetadataHash(string memory metadataHash) external view returns (uint256 tokenId);
}

File 24 of 34 : ITokenUtils.sol
//SPDX-License-Identifier: MIT
pragma solidity 0.8.18;

import {IRoyaltyUGC} from "@sandbox-smart-contracts/dependency-royalty-management/contracts/interfaces/IRoyaltyUGC.sol";

/// @title TokenUtils interface
/// @author The Sandbox
interface ITokenUtils is IRoyaltyUGC {
    /// @notice Extracts the tier from a given token id
    /// @param tokenId The token id to extract the tier from
    /// @return tier The asset tier, determined by the catalyst used to create it
    function getTier(uint256 tokenId) external pure returns (uint8 tier);

    /// @notice Extracts the revealed flag from a given token id
    /// @param tokenId The token id to extract the revealed flag from
    /// @return revealed Whether the asset is revealed or not
    function isRevealed(uint256 tokenId) external pure returns (bool revealed);

    /// @notice Extracts the asset nonce from a given token id
    /// @param tokenId The token id to extract the asset nonce from
    /// @return creatorNonce The asset creator nonce
    function getCreatorNonce(uint256 tokenId) external pure returns (uint16 creatorNonce);

    /// @notice Extracts the abilities and enhancements hash from a given token id
    /// @param tokenId The token id to extract reveal nonce from
    /// @return revealNonce The reveal nonce of the asset
    function getRevealNonce(uint256 tokenId) external pure returns (uint16 revealNonce);

    /// @notice Extracts the bridged flag from a given token id
    /// @param tokenId The token id to extract the bridged flag from
    /// @return bridged Whether the asset is bridged or not
    function isBridged(uint256 tokenId) external pure returns (bool bridged);

    /// @notice Extracts the creator address from a given token id
    /// @param tokenId The token id to extract the creator address from
    /// @return creator The asset creator address
    function getCreatorAddress(uint256 tokenId) external pure returns (address creator);
}

File 25 of 34 : TokenIdUtils.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IAsset} from "../interfaces/IAsset.sol";

/// @title TokenIdUtils library
/// @author The Sandbox
/// @notice Contains utility functions for token ids
library TokenIdUtils {
    // Layer masks
    uint256 public constant TIER_MASK = 0xFF;
    uint256 public constant NONCE_MASK = 0xFFFF;
    uint256 public constant REVEAL_NONCE_MASK = 0xFFFF;
    uint256 public constant BRIDGED_MASK = 0x1;

    // Bit shifts
    uint256 public constant CREATOR_SHIFT = 0;
    uint256 public constant TIER_SHIFT = 160;
    uint256 public constant NONCE_SHIFT = 168;
    uint256 public constant REVEAL_NONCE_SHIFT = 184;
    uint256 public constant BRIDGED_SHIFT = 200;

    /// @notice Generates a token id for a given asset
    /// @dev The token id is generated by concatenating the following fields:
    /// @dev creator address, tier, creator nonce, reveal nonce and bridged boolean
    /// @dev The first 160 bits are the creator address
    /// @dev The next 8 bits are the tier
    /// @dev The next 16 bits are the creator nonce
    /// @dev The next 16 bits are for reveal nonce.
    /// @dev The last bit is for bridged boolean
    /// @param creator The address of the creator of the asset
    /// @param tier The tier of the asset determined by the catalyst used to create it
    /// @param creatorNonce The nonce of the asset creator
    /// @param revealNonce The reveal nonce of the asset
    /// @param bridged Whether the asset is bridged or not
    /// @return tokenId The generated token id
    function generateTokenId(
        address creator,
        uint8 tier,
        uint16 creatorNonce,
        uint16 revealNonce,
        bool bridged
    ) internal pure returns (uint256 tokenId) {
        uint160 creatorAddress = uint160(creator);

        tokenId = tokenId =
            uint256(creatorAddress) |
            (uint256(tier) << TIER_SHIFT) |
            (uint256(creatorNonce) << NONCE_SHIFT) |
            (uint256(revealNonce) << REVEAL_NONCE_SHIFT) |
            (uint256(bridged ? 1 : 0) << BRIDGED_SHIFT);

        return tokenId;
    }

    /// @notice Extracts the creator address from a given token id
    /// @param tokenId The token id to extract the creator address from
    /// @return creator The asset creator address
    function getCreatorAddress(uint256 tokenId) internal pure returns (address creator) {
        creator = address(uint160(tokenId));
        return creator;
    }

    /// @notice Extracts the tier from a given token id
    /// @param tokenId The token id to extract the tier from
    /// @return tier The asset tier, determined by the catalyst used to create it
    function getTier(uint256 tokenId) internal pure returns (uint8 tier) {
        tier = uint8((tokenId >> TIER_SHIFT) & TIER_MASK);
        return tier;
    }

    /// @notice Extracts the revealed flag from a given token id
    /// @param tokenId The token id to extract the revealed flag from
    /// @return isRevealed Whether the asset is revealed or not
    function isRevealed(uint256 tokenId) internal pure returns (bool) {
        uint16 revealNonce = getRevealNonce(tokenId);
        return revealNonce != 0;
    }

    /// @notice Extracts the asset nonce from a given token id
    /// @param tokenId The token id to extract the asset nonce from
    /// @return creatorNonce The asset creator nonce
    function getCreatorNonce(uint256 tokenId) internal pure returns (uint16) {
        uint16 creatorNonce = uint16((tokenId >> NONCE_SHIFT) & NONCE_MASK);
        return creatorNonce;
    }

    /// @notice Extracts the abilities and enhancements hash from a given token id
    /// @param tokenId The token id to extract reveal nonce from
    /// @return revealNonce The reveal nonce of the asset
    function getRevealNonce(uint256 tokenId) internal pure returns (uint16) {
        uint16 revealNonce = uint16((tokenId >> REVEAL_NONCE_SHIFT) & REVEAL_NONCE_MASK);
        return revealNonce;
    }

    /// @notice Extracts the bridged flag from a given token id
    /// @param tokenId The token id to extract the bridged flag from
    /// @return bridged Whether the asset is bridged or not
    function isBridged(uint256 tokenId) internal pure returns (bool) {
        bool bridged = ((tokenId >> BRIDGED_SHIFT) & BRIDGED_MASK) == 1;
        return bridged;
    }

    /// @notice Extracts the asset data from a given token id
    /// @dev Created to limit the number of functions that need to be called when revealing an asset
    /// @param tokenId The token id to extract the asset data from
    /// @return data The asset data struct
    function getData(uint256 tokenId) internal pure returns (IAsset.AssetData memory data) {
        data.creator = getCreatorAddress(tokenId);
        data.tier = getTier(tokenId);
        data.revealed = isRevealed(tokenId);
        data.creatorNonce = getCreatorNonce(tokenId);
        data.bridged = isBridged(tokenId);
    }
}

File 26 of 34 : ERC2771HandlerAbstract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @dev minimal ERC2771 handler to keep bytecode-size down
/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol
abstract contract ERC2771HandlerAbstract {
    /// @notice return true if the forwarder is the trusted forwarder
    /// @param forwarder trusted forwarder address to check
    /// @return true if the address is the same as the trusted forwarder
    function isTrustedForwarder(address forwarder) external view returns (bool) {
        return _isTrustedForwarder(forwarder);
    }

    /// @notice if the call is from the trusted forwarder the sender is extracted from calldata, msg.sender otherwise
    /// @return sender the calculated address of the sender
    function _msgSender() internal view virtual returns (address sender) {
        if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {
            // The assembly code is more direct than the Solidity version using `abi.decode`.
            // solhint-disable-next-line no-inline-assembly
            assembly {
                sender := shr(96, calldataload(sub(calldatasize(), 20)))
            }
        } else {
            sender = msg.sender;
        }
    }

    /// @notice if the call is from the trusted forwarder the sender is removed from calldata
    /// @return the calldata without the sender
    function _msgData() internal view virtual returns (bytes calldata) {
        if (_isTrustedForwarder(msg.sender) && msg.data.length >= 20) {
            return msg.data[:msg.data.length - 20];
        } else {
            return msg.data;
        }
    }

    /// @notice return true if the forwarder is the trusted forwarder
    /// @param forwarder trusted forwarder address to check
    /// @return true if the address is the same as the trusted forwarder
    /// @dev this function must be IMPLEMENTED
    function _isTrustedForwarder(address forwarder) internal view virtual returns (bool);
}

File 27 of 34 : ERC2771HandlerUpgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {ERC2771HandlerAbstract} from "./ERC2771HandlerAbstract.sol";

/// @dev minimal ERC2771 handler to keep bytecode-size down
/// based on: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/metatx/ERC2771Context.sol
contract ERC2771HandlerUpgradeable is Initializable, ERC2771HandlerAbstract {
    address private _trustedForwarder;

    /// @notice Emitted when a `newTrustedForwarder` is set, replacing the `oldTrustedForwarder`
    /// @param oldTrustedForwarder old trusted forwarder
    /// @param newTrustedForwarder new trusted forwarder
    /// @param operator the sender of the transaction
    event TrustedForwarderSet(
        address indexed oldTrustedForwarder,
        address indexed newTrustedForwarder,
        address indexed operator
    );

    /// @notice initialize the trusted forwarder address
    /// @param forwarder trusted forwarder address or zero to disable it
    // solhint-disable-next-line func-name-mixedcase
    function __ERC2771Handler_init(address forwarder) internal onlyInitializing {
        __ERC2771Handler_init_unchained(forwarder);
    }

    /// @notice initialize the trusted forwarder address
    /// @param forwarder trusted forwarder address or zero to disable it
    // solhint-disable-next-line func-name-mixedcase
    function __ERC2771Handler_init_unchained(address forwarder) internal onlyInitializing {
        _setTrustedForwarder(forwarder);
    }

    /// @notice return the address of the trusted forwarder
    /// @return return the address of the trusted forwarder
    function getTrustedForwarder() external view returns (address) {
        return _trustedForwarder;
    }

    /// @notice set the address of the trusted forwarder
    /// @param newForwarder the address of the new forwarder.
    function _setTrustedForwarder(address newForwarder) internal virtual {
        require(newForwarder != _trustedForwarder, "ERC2771HandlerUpgradeable: forwarder already set");
        emit TrustedForwarderSet(_trustedForwarder, newForwarder, _msgSender());
        _trustedForwarder = newForwarder;
    }

    /// @notice return true if the forwarder is the trusted forwarder
    /// @param forwarder trusted forwarder address to check
    /// @return true if the address is the same as the trusted forwarder
    function _isTrustedForwarder(address forwarder) internal view virtual override returns (bool) {
        return forwarder == _trustedForwarder;
    }

    /// @notice if the call is from the trusted forwarder the sender is extracted from calldata, msg.sender otherwise
    /// @return sender the calculated address of the sender
    function _msgSender() internal view virtual override returns (address sender) {
        return super._msgSender();
    }

    /// @notice if the call is from the trusted forwarder the sender is removed from calldata
    /// @return the calldata without the sender
    function _msgData() internal view virtual override returns (bytes calldata) {
        return super._msgData();
    }

    uint256[49] private __gap;
}

File 28 of 34 : OperatorFiltererUpgradeable.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {IOperatorFilterRegistry} from "./interfaces/IOperatorFilterRegistry.sol";
import {ContextUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";

///@title OperatorFiltererUpgradeable
///@author The Sandbox
///@notice This contract would subscribe or copy or just to the subscription provided or just register to default subscription list. The operator filter registry's address could be set using a setter which could be implemented in inheriting contract
abstract contract OperatorFiltererUpgradeable is Initializable, ContextUpgradeable {
    event OperatorFilterRegistrySet(address indexed registry);

    IOperatorFilterRegistry private operatorFilterRegistry;

    // solhint-disable-next-line func-name-mixedcase
    function __OperatorFilterer_init(address subscriptionOrRegistrantToCopy, bool subscribe) internal onlyInitializing {
        operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); // Address of the operator filterer registry
        // If an inheriting token contract is deployed to a network without the registry deployed, the modifier
        // will not revert, but the contract will need to be registered with the registry once it is deployed in
        // order for the modifier to filter addresses.
        _registerAndSubscribe(subscriptionOrRegistrantToCopy, subscribe);
    }

    function _registerAndSubscribe(address subscriptionOrRegistrantToCopy, bool subscribe) internal {
        if (address(operatorFilterRegistry).code.length > 0) {
            if (!operatorFilterRegistry.isRegistered(address(this))) {
                if (subscribe) {
                    operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
                } else {
                    if (subscriptionOrRegistrantToCopy != address(0)) {
                        operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
                    } else {
                        operatorFilterRegistry.register(address(this));
                    }
                }
            }
        }
    }

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

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

    /// @notice returns the operator filter registry.
    /// @return operatorFilterRegistryAddress address of operator filter registry contract.
    function getOperatorFilterRegistry() external view returns (IOperatorFilterRegistry operatorFilterRegistryAddress) {
        return _getOperatorFilterRegistry();
    }

    /// @notice internal method to set the operator filter registry
    /// @param registry address the registry.
    function _setOperatorFilterRegistry(address registry) internal {
        operatorFilterRegistry = IOperatorFilterRegistry(registry);
        emit OperatorFilterRegistrySet(registry);
    }

    /// @notice internal method to get the operator filter registry.
    function _getOperatorFilterRegistry()
        internal
        view
        returns (IOperatorFilterRegistry operatorFilterRegistryAddress)
    {
        return operatorFilterRegistry;
    }

    uint256[49] private __gap;
}

File 29 of 34 : IOperatorFilterRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @title IOperatorFilterRegistry
/// @notice Interface for managing operators and filtering.
interface IOperatorFilterRegistry {
    ///@notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns
    ///        true if supplied registrant address is not registered.
    function isOperatorAllowed(address registrant, address operator) external view returns (bool isAllowed);

    ///@notice Registers an address with the registry. May be called by address itself or by EIP-173 owner.
    function register(address registrant) external;

    ///@notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes.
    function registerAndSubscribe(address registrant, address subscription) external;

    ///@notice Registers an address with the registry and copies the filtered operators and codeHashes from another
    ///        address without subscribing.
    function registerAndCopyEntries(address registrant, address registrantToCopy) external;

    ///@notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner.
    ///        Note that this does not remove any filtered addresses or codeHashes.
    ///        Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes.
    function unregister(address addr) external;

    ///@notice Update an operator address for a registered address - when filtered is true, the operator is filtered.
    function updateOperator(
        address registrant,
        address operator,
        bool filtered
    ) external;

    ///@notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates.
    function updateOperators(
        address registrant,
        address[] calldata operators,
        bool filtered
    ) external;

    ///@notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered.
    function updateCodeHash(
        address registrant,
        bytes32 codehash,
        bool filtered
    ) external;

    ///@notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates.
    function updateCodeHashes(
        address registrant,
        bytes32[] calldata codeHashes,
        bool filtered
    ) external;

    ///@notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous
    ///        subscription if present.
    ///        Note that accounts with subscriptions may go on to subscribe to other accounts - in this case,
    ///        subscriptions will not be forwarded. Instead the former subscription's existing entries will still be
    ///        used.
    function subscribe(address registrant, address registrantToSubscribe) external;

    ///@notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes.
    function unsubscribe(address registrant, bool copyExistingEntries) external;

    ///@notice Get the subscription address of a given registrant, if any.
    function subscriptionOf(address addr) external returns (address registrant);

    ///@notice Get the set of addresses subscribed to a given registrant.
    ///        Note that order is not guaranteed as updates are made.
    function subscribers(address registrant) external returns (address[] memory subscribersList);

    ///@notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant.
    ///        Note that order is not guaranteed as updates are made.
    function subscriberAt(address registrant, uint256 index) external returns (address subscriberAddress);

    ///@notice Copy filtered operators and codeHashes from a different registrantToCopy to addr.
    function copyEntriesOf(address registrant, address registrantToCopy) external;

    ///@notice Returns true if operator is filtered by a given address or its subscription.
    function isOperatorFiltered(address registrant, address operator) external returns (bool isFiltered);

    ///@notice Returns true if the hash of an address's code is filtered by a given address or its subscription.
    function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool isFiltered);

    ///@notice Returns true if a codeHash is filtered by a given address or its subscription.
    function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool isFiltered);

    ///@notice Returns a list of filtered operators for a given address or its subscription.
    function filteredOperators(address addr) external returns (address[] memory operatorList);

    ///@notice Returns the set of filtered codeHashes for a given address or its subscription.
    ///        Note that order is not guaranteed as updates are made.
    function filteredCodeHashes(address addr) external returns (bytes32[] memory codeHashList);

    ///@notice Returns the filtered operator at the given index of the set of filtered operators for a given address or
    ///        its subscription.
    ///        Note that order is not guaranteed as updates are made.
    function filteredOperatorAt(address registrant, uint256 index) external returns (address operator);

    ///@notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or
    ///        its subscription.
    ///        Note that order is not guaranteed as updates are made.
    function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32 codeHash);

    ///@notice Returns true if an address has registered
    function isRegistered(address addr) external returns (bool registered);

    ///@dev Convenience method to compute the code hash of an arbitrary contract
    function codeHashOf(address addr) external returns (bytes32 codeHash);
}

File 30 of 34 : MultiRoyaltyDistributor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {ERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
import {IMultiRoyaltyDistributor, IMultiRoyaltyRecipients} from "./interfaces/IMultiRoyaltyDistributor.sol";
import {
    IRoyaltySplitter,
    IERC165
} from "@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol";
import {IEIP2981} from "@manifoldxyz/royalty-registry-solidity/contracts/specs/IEIP2981.sol";
import {IRoyaltyManager, Recipient} from "./interfaces/IRoyaltyManager.sol";

/// @title MultiRoyaltyDistributor
/// @author The Sandbox
/// @dev  The MultiRoyaltyDistributor contract implements the ERC-2981 and ERC-165 interfaces for a royalty payment system. This payment system can be used to pay royalties to multiple recipients through splitters.
/// @dev  This contract calls to the Royalties manager contract to deploy RoyaltySplitter for a creator to split its royalty between the creator and Sandbox and use it for every token minted by that creator.
abstract contract MultiRoyaltyDistributor is IEIP2981, IMultiRoyaltyDistributor, ERC165Upgradeable {
    uint16 internal constant TOTAL_BASIS_POINTS = 10000;
    address private royaltyManager;

    mapping(uint256 => address payable) private _tokenRoyaltiesSplitter;
    uint256[] private _tokensWithRoyalties;

    // solhint-disable-next-line func-name-mixedcase
    function __MultiRoyaltyDistributor_init(address _royaltyManager) internal onlyInitializing {
        _setRoyaltyManager(_royaltyManager);
        __ERC165_init_unchained();
    }

    /// @notice Query if a contract implements interface `id`.
    /// @param interfaceId the interface identifier, as specified in ERC-165.
    /// @return isSupported `true` if the contract implements `id`.
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165Upgradeable, IERC165)
        returns (bool isSupported)
    {
        return
            interfaceId == type(IEIP2981).interfaceId ||
            interfaceId == type(IMultiRoyaltyDistributor).interfaceId ||
            interfaceId == type(IMultiRoyaltyRecipients).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /// @notice sets token royalty
    /// @dev deploys a splitter if a creator doesn't have one
    /// @param tokenId id of token
    /// @param recipient royalty recipient
    /// @param creator of the token
    function _setTokenRoyalties(
        uint256 tokenId,
        address payable recipient,
        address creator
    ) internal {
        address payable creatorSplitterAddress = IRoyaltyManager(royaltyManager).deploySplitter(creator, recipient);

        if (_tokenRoyaltiesSplitter[tokenId] != address(0)) {
            if (_tokenRoyaltiesSplitter[tokenId] != creatorSplitterAddress) {
                _setTokenRoyaltiesSplitter(tokenId, creatorSplitterAddress);
            }
        } else {
            _tokensWithRoyalties.push(tokenId);
            _setTokenRoyaltiesSplitter(tokenId, creatorSplitterAddress);
        }
    }

    /// @notice EIP 2981 royalty info function to return the royalty receiver and royalty amount
    /// @param tokenId of the token for which the royalty is needed to be distributed
    /// @param value the amount on which the royalty is calculated
    /// @return receiver address the royalty receiver
    /// @return royaltyAmount value the EIP2981 royalty
    function royaltyInfo(uint256 tokenId, uint256 value)
        public
        view
        override
        returns (address receiver, uint256 royaltyAmount)
    {
        (address payable _defaultRoyaltyReceiver, uint16 _defaultRoyaltyBPS) =
            IRoyaltyManager(royaltyManager).getRoyaltyInfo();
        if (_tokenRoyaltiesSplitter[tokenId] != address(0)) {
            return (_tokenRoyaltiesSplitter[tokenId], (value * _defaultRoyaltyBPS) / TOTAL_BASIS_POINTS);
        }
        if (_defaultRoyaltyReceiver != address(0) && _defaultRoyaltyBPS != 0) {
            return (_defaultRoyaltyReceiver, (value * _defaultRoyaltyBPS) / TOTAL_BASIS_POINTS);
        }
        return (address(0), 0);
    }

    /// @notice returns the EIP-2981 royalty receiver for each token (i.e. splitters) including the default royalty receiver.
    /// @return splits the royalty receiver's array
    function getAllSplits() external view override returns (address payable[] memory splits) {
        uint256 startingIndex;
        uint256 endingIndex = _tokensWithRoyalties.length;
        (address payable _defaultRoyaltyReceiver, ) = IRoyaltyManager(royaltyManager).getRoyaltyInfo();
        if (_defaultRoyaltyReceiver != address(0)) {
            splits = new address payable[](1 + _tokensWithRoyalties.length);
            splits[0] = _defaultRoyaltyReceiver;
            startingIndex = 1;
            ++endingIndex;
        } else {
            // unreachable in practice
            splits = new address payable[](_tokensWithRoyalties.length);
        }
        for (uint256 i = startingIndex; i < endingIndex; ++i) {
            splits[i] = _tokenRoyaltiesSplitter[_tokensWithRoyalties[i - startingIndex]];
        }
    }

    /// @notice returns the royalty recipients for each tokenId.
    /// @dev returns the default address for tokens with no recipients.
    /// @param tokenId is the token id for which the recipient should be returned.
    /// @return recipients array of royalty recipients for the token
    function getRecipients(uint256 tokenId) public view returns (Recipient[] memory recipients) {
        address payable splitterAddress = _tokenRoyaltiesSplitter[tokenId];
        (address payable _defaultRoyaltyReceiver, ) = IRoyaltyManager(royaltyManager).getRoyaltyInfo();
        if (splitterAddress != address(0)) {
            return IRoyaltySplitter(splitterAddress).getRecipients();
        }
        recipients = new Recipient[](1);
        recipients[0] = Recipient({recipient: _defaultRoyaltyReceiver, bps: TOTAL_BASIS_POINTS});
        return recipients;
    }

    /// @notice internal function to set the token royalty splitter
    /// @param tokenId id of token
    /// @param splitterAddress address of the splitter contract
    function _setTokenRoyaltiesSplitter(uint256 tokenId, address payable splitterAddress) internal {
        _tokenRoyaltiesSplitter[tokenId] = splitterAddress;
        emit TokenRoyaltySplitterSet(tokenId, splitterAddress);
    }

    /// @notice returns the address of token royalty splitter.
    /// @param tokenId is the token id for which royalty splitter should be returned.
    /// @return splitterAddress address of royalty splitter for the token
    function getTokenRoyaltiesSplitter(uint256 tokenId) external view returns (address payable splitterAddress) {
        return _tokenRoyaltiesSplitter[tokenId];
    }

    /// @notice returns the address of royalty manager.
    /// @return managerAddress address of royalty manager.
    function getRoyaltyManager() external view returns (address managerAddress) {
        return royaltyManager;
    }

    /// @notice set royalty manager address
    /// @param _royaltyManager address of royalty manager to set
    function _setRoyaltyManager(address _royaltyManager) internal {
        royaltyManager = _royaltyManager;
        emit RoyaltyManagerSet(_royaltyManager);
    }

    uint256[47] private __gap;
}

File 31 of 34 : IMultiRoyaltyDistributor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {IMultiRoyaltyRecipients} from "./IMultiRoyaltyRecipients.sol";
import {Recipient} from "@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol";

///Multi-receiver EIP2981 reference override implementation
interface IMultiRoyaltyDistributor is IERC165, IMultiRoyaltyRecipients {
    event TokenRoyaltyRemoved(uint256 tokenId);
    event DefaultRoyaltyBpsSet(uint16 royaltyBPS);

    event DefaultRoyaltyReceiverSet(address indexed recipient);

    event RoyaltyRecipientSet(address indexed splitter, address indexed recipient);

    event TokenRoyaltySplitterSet(uint256 tokenId, address splitterAddress);

    event RoyaltyManagerSet(address indexed _royaltyManager);

    struct TokenRoyaltyConfig {
        uint256 tokenId;
        uint16 royaltyBPS;
        Recipient[] recipients;
    }

    ///@notice Set per token royalties.  Passing a recipient of address(0) will delete any existing configuration
    ///@param tokenId The ID of the token for which to set the royalties.
    ///@param recipient The address that will receive the royalties.
    ///@param creator The creator's address for the token.
    function setTokenRoyalties(
        uint256 tokenId,
        address payable recipient,
        address creator
    ) external;

    ///@notice Helper function to get all splits contracts
    ///@return an array of royalty receiver
    function getAllSplits() external view returns (address payable[] memory);
}

File 32 of 34 : IMultiRoyaltyRecipients.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Recipient} from "@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol";

/// Multi-receiver EIP2981 implementation
interface IMultiRoyaltyRecipients is IERC165 {
    /// @dev Helper function to get all recipients
    function getRecipients(uint256 tokenId) external view returns (Recipient[] memory);
}

File 33 of 34 : IRoyaltyManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Recipient} from "@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltySplitter.sol";

/// @title IRoyaltyManager
/// @notice interface for RoyaltyManager Contract
interface IRoyaltyManager {
    event RecipientSet(address indexed commonRecipient);

    event SplitSet(uint16 commonSplit);

    event RoyaltySet(uint16 royaltyBps, address indexed contractAddress);

    event TrustedForwarderSet(address indexed previousForwarder, address indexed newForwarder);

    event SplitterDeployed(address indexed creator, address indexed recipient, address splitterAddress);

    ///@notice sets the common recipient
    ///@param _commonRecipient is the common recipient for all the splitters
    function setRecipient(address payable _commonRecipient) external;

    ///@notice sets the common split
    ///@param commonSplit split for the common recipient
    function setSplit(uint16 commonSplit) external;

    ///@notice to be called by the splitters to get the common recipient and split
    ///@return recipient which has the common recipient and split
    function getCommonRecipient() external view returns (Recipient memory recipient);

    ///@notice returns the amount of basis points allocated to the creator
    ///@return creatorSplit the share of creator in bps
    function getCreatorSplit() external view returns (uint16 creatorSplit);

    ///@notice returns the commonRecipient and EIP2981 royalty split
    ///@return recipient address of common royalty recipient
    ///@return royaltySplit contract EIP2981 royalty bps
    function getRoyaltyInfo() external view returns (address payable recipient, uint16 royaltySplit);

    ///@notice deploys splitter for creator
    ///@param creator the address of the creator
    ///@param recipient the wallet of the recipient where they would receive their royalty
    ///@return creatorSplitterAddress splitter's address deployed for creator
    function deploySplitter(address creator, address payable recipient)
        external
        returns (address payable creatorSplitterAddress);

    ///@notice returns the address of splitter of a creator.
    ///@param creator the address of the creator
    ///@return creatorSplitterAddress splitter's address deployed for a creator
    function getCreatorRoyaltySplitter(address creator) external view returns (address payable creatorSplitterAddress);

    ///@notice returns the EIP2981 royalty split
    ///@param _contractAddress the address of the contract for which the royalty is required
    ///@return royaltyBps royalty bps of the contract
    function getContractRoyalty(address _contractAddress) external view returns (uint16 royaltyBps);

    ///@notice sets the trustedForwarder address to be used by the splitters
    ///@param _newForwarder is the new trusted forwarder address
    function setTrustedForwarder(address _newForwarder) external;

    ///@notice get the current trustedForwarder address
    ///@return trustedForwarder address of current trusted Forwarder
    function getTrustedForwarder() external view returns (address trustedForwarder);
}

File 34 of 34 : IRoyaltyUGC.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @title IRoyaltyUGC
/// @notice interface define function for managing creator of UGC (User-Generated Content)
interface IRoyaltyUGC {
    ///@notice Gets the address of the creator associated with a specific token.
    ///@param tokenId the Id of token to retrieve the creator address for
    ///@return creator the address of creator
    function getCreatorAddress(uint256 tokenId) external pure returns (address creator);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"royaltyBPS","type":"uint16"}],"name":"DefaultRoyaltyBpsSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"DefaultRoyaltyReceiverSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"registry","type":"address"}],"name":"OperatorFilterRegistrySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_royaltyManager","type":"address"}],"name":"RoyaltyManagerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"splitter","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"RoyaltyRecipientSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenRoyaltyRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"splitterAddress","type":"address"}],"name":"TokenRoyaltySplitterSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newTrustedForwarderAddress","type":"address"}],"name":"TrustedForwarderChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldTrustedForwarder","type":"address"},{"indexed":true,"internalType":"address","name":"newTrustedForwarder","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"}],"name":"TrustedForwarderSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[],"name":"BURNER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"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":"MODERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"burnBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"burnBatchFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllSplits","outputs":[{"internalType":"address payable[]","name":"splits","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getCreatorAddress","outputs":[{"internalType":"address","name":"creator","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getCreatorNonce","outputs":[{"internalType":"uint16","name":"creatorNonce","type":"uint16"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getOperatorFilterRegistry","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"operatorFilterRegistryAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getRecipients","outputs":[{"components":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"uint16","name":"bps","type":"uint16"}],"internalType":"struct Recipient[]","name":"recipients","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getRevealNonce","outputs":[{"internalType":"uint16","name":"revealNonce","type":"uint16"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRoyaltyManager","outputs":[{"internalType":"address","name":"managerAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTier","outputs":[{"internalType":"uint8","name":"tier","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"string","name":"metadataHash","type":"string"}],"name":"getTokenIdByMetadataHash","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenRoyaltiesSplitter","outputs":[{"internalType":"address payable","name":"splitterAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTrustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"hashUsed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"},{"internalType":"address","name":"assetAdmin","type":"address"},{"internalType":"string","name":"baseUri","type":"string"},{"internalType":"address","name":"commonSubscription","type":"address"},{"internalType":"address","name":"manager","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isBridged","outputs":[{"internalType":"bool","name":"bridged","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isRevealed","outputs":[{"internalType":"bool","name":"revealed","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"metadataHash","type":"string"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"string[]","name":"metadataHashes","type":"string[]"}],"name":"mintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"_name","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"subscriptionOrRegistrantToCopy","type":"address"},{"internalType":"bool","name":"subscribe","type":"bool"}],"name":"registerAndSubscribe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","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":"string","name":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"registry","type":"address"}],"name":"setOperatorRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"address","name":"creator","type":"address"}],"name":"setTokenRoyalties","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"metadata","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"trustedForwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"id","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"supported","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"tokenURI","type":"string"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b614f9780620000f36000396000f3fe608060405234801561001057600080fd5b50600436106103355760003560e01c80638082f110116101b2578063ac4a0fb6116100f9578063d547741f116100a2578063f242432a1161007c578063f242432a1461085f578063f5298aca14610872578063fd90e89714610885578063fdda1d0e146108a557600080fd5b8063d547741f146107fd578063da74222814610810578063e985e9c51461082357600080fd5b8063befa6645116100d3578063befa6645146107aa578063ce1b815f146107bf578063d5391393146107d657600080fd5b8063ac4a0fb614610763578063bb7fde7114610776578063bd85b0391461078957600080fd5b80639d28fb861161015b578063a30b4db911610135578063a30b4db914610711578063a55784ef14610724578063abe396031461073757600080fd5b80639d28fb86146106e3578063a217fddf146106f6578063a22cb465146106fe57600080fd5b8063933f39581161018c578063933f39581461068557806395d89b41146106985780639a1b2fb4146106d157600080fd5b80638082f1101461060f57806381de2dc21461063957806391d148541461064c57600080fd5b80632f2ff15d116102815780635055fbc31161022a578063572b6c0511610204578063572b6c05146105af5780636b20c454146105c2578063791459ea146105d5578063797669c9146105e857600080fd5b80635055fbc31461056957806350c821b01461057c57806355f804b31461059c57600080fd5b80634f062c5a1161025b5780634f062c5a1461050e5780634f124995146105335780634f558e791461054657600080fd5b80632f2ff15d146104c857806336568abe146104db5780634e1273f4146104ee57600080fd5b806320820ec3116102e35780632a41a355116102bd5780632a41a3551461045d5780632a55205a146104835780632eb2c2d6146104b557600080fd5b806320820ec314610400578063248a9ca314610413578063282c51f31461043657600080fd5b80630e89341c116103145780630e89341c146103c5578063124d91e5146103d8578063162094c4146103ed57600080fd5b8062fdd58e1461033a57806301ffc9a71461036057806306fdde0314610383575b600080fd5b61034d610348366004613fe0565b6108b8565b6040519081526020015b60405180910390f35b61037361036e366004614022565b610966565b6040519015158152602001610357565b60408051808201909152601481527f5468652053616e64626f7827732041535345547300000000000000000000000060208201525b604051610357919061408f565b6103b86103d33660046140a2565b6109a4565b6103eb6103e63660046140bb565b6109af565b005b6103eb6103fb3660046141cd565b6109ea565b6103eb61040e3660046142a9565b610a23565b61034d6104213660046140a2565b600090815260fa602052604090206001015490565b61034d7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b61047061046b3660046140a2565b610a58565b60405161ffff9091168152602001610357565b61049661049136600461431f565b610a68565b604080516001600160a01b039093168352602083019190915201610357565b6103eb6104c3366004614341565b610b8a565b6103eb6104d63660046143ef565b610cbc565b6103eb6104e93660046143ef565b610ce1565b6105016104fc36600461441f565b610d7d565b604051610357919061451d565b61052161051c3660046140a2565b610ebb565b60405160ff9091168152602001610357565b6103eb610541366004614530565b610eca565b6103736105543660046140a2565b600090815261012c6020526040902054151590565b6103736105773660046140a2565b610ee0565b610584610eeb565b6040516001600160a01b039091168152602001610357565b6103eb6105aa366004614572565b610f05565b6103736105bd3660046145a7565b610f19565b6103eb6105d03660046142a9565b610f36565b6103eb6105e33660046145d2565b610fe1565b61034d7f71f3d55856e4058ed06ee057d79ada615f65cdf5f9ee88181b914225088f834f81565b61058461061d3660046140a2565b60009081526101c360205260409020546001600160a01b031690565b6104706106473660046140a2565b61104d565b61037361065a3660046143ef565b600091825260fa602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6103736106933660046140a2565b61105d565b60408051808201909152600581527f415353455400000000000000000000000000000000000000000000000000000060208201526103b8565b6101c2546001600160a01b0316610584565b6103eb6106f13660046145a7565b61106e565b61034d600081565b6103eb61070c3660046145d2565b6110d9565b61058461071f3660046140a2565b6111da565b6103eb610732366004614600565b6111e2565b61034d610745366004614572565b80516020818301810180516101f48252928201919093012091525481565b6103eb610771366004614718565b61138b565b6103eb6107843660046147a2565b6114f0565b61034d6107973660046140a2565b600090815261012c602052604090205490565b6107b261154b565b6040516103579190614805565b6000546201000090046001600160a01b0316610584565b61034d7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6103eb61080b3660046143ef565b611765565b6103eb61081e3660046145a7565b61178a565b610373610831366004614852565b6001600160a01b03918216600090815260976020908152604080832093909416825291909152205460ff1690565b6103eb61086d366004614880565b6117f5565b6103eb6108803660046140bb565b611a0e565b6108986108933660046140a2565b611ab9565b60405161035791906148e9565b61034d6108b3366004614572565b611c5b565b60006001600160a01b03831661093b5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201527f616c6964206f776e65720000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060008181526096602090815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b031982167fa30b4db9000000000000000000000000000000000000000000000000000000001480610960575061096082611c84565b606061096082611d2a565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a8486109d981611e0c565b6109e4848484611e20565b50505050565b7f71f3d55856e4058ed06ee057d79ada615f65cdf5f9ee88181b914225088f834f610a1481611e0c565b610a1e8383611ff7565b505050565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848610a4d81611e0c565b6109e4848484612055565b60006109608260b81c61ffff1690565b6000806000806101c260009054906101000a90046001600160a01b03166001600160a01b031663a86a28d16040518163ffffffff1660e01b81526004016040805180830381865afa158015610ac1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae5919061495c565b60008881526101c3602052604090205491935091506001600160a01b031615610b475760008681526101c360205260409020546001600160a01b0316612710610b3261ffff8416886149a7565b610b3c91906149be565b935093505050610b83565b6001600160a01b03821615801590610b62575061ffff811615155b15610b795781612710610b3261ffff8416886149a7565b6000809350935050505b9250929050565b6101905485906001600160a01b03163b15610ca757610ba76122e7565b6001600160a01b0316816001600160a01b031603610bd157610bcc86868686866122f1565b610cb4565b610190546001600160a01b031663c617113430610bec6122e7565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381865afa158015610c37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5b91906149e0565b610ca75760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f7765640000000000000000000000006044820152606401610932565b610cb486868686866122f1565b505050505050565b600082815260fa6020526040902060010154610cd781611e0c565b610a1e83836123a5565b610ce96122e7565b6001600160a01b0316816001600160a01b031614610d6f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610932565b610d798282612448565b5050565b60608151835114610df65760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d6174636800000000000000000000000000000000000000000000006064820152608401610932565b6000835167ffffffffffffffff811115610e1257610e126140f0565b604051908082528060200260200182016040528015610e3b578160200160208202803683370190505b50905060005b8451811015610eb357610e86858281518110610e5f57610e5f6149fd565b6020026020010151858381518110610e7957610e796149fd565b60200260200101516108b8565b828281518110610e9857610e986149fd565b6020908102919091010152610eac81614a13565b9050610e41565b509392505050565b60006109608260a01c60ff1690565b6000610ed581611e0c565b6109e48484846124e9565b60006109608261260e565b6000610f00610190546001600160a01b031690565b905090565b6000610f1081611e0c565b610d798261262c565b600080546001600160a01b03838116620100009092041614610960565b610f3e6122e7565b6001600160a01b0316836001600160a01b03161480610f645750610f64836108316122e7565b610fd65760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f7665640000000000000000000000000000000000006064820152608401610932565b610a1e838383612055565b6000610fec81611e0c565b6001600160a01b0383163b6110435760405162461bcd60e51b815260206004820152601f60248201527f41737365743a2042616420737562736372697074696f6e2061646472657373006044820152606401610932565b610a1e8383612639565b60006109608260a81c61ffff1690565b6000600160c883901c811614610960565b600061107981611e0c565b6001600160a01b0382163b6110d05760405162461bcd60e51b815260206004820152601b60248201527f41737365743a20426164207265676973747279206164647265737300000000006044820152606401610932565b610d7982612805565b6101905482906001600160a01b03163b156111c857610190546040517fc61711340000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0383811660248301529091169063c617113490604401602060405180830381865afa158015611158573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117c91906149e0565b6111c85760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f7765640000000000000000000000006044820152606401610932565b610a1e6111d36122e7565b848461285d565b600081610960565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661120c81611e0c565b815184511461125d5760405162461bcd60e51b815260206004820152601760248201527f41737365743a20312d4172726179206d69736d617463680000000000000000006044820152606401610932565b82518451146112ae5760405162461bcd60e51b815260206004820152601760248201527f41737365743a20322d4172726179206d69736d617463680000000000000000006044820152606401610932565b60005b8451811015611308576112f68582815181106112cf576112cf6149fd565b60200260200101518483815181106112e9576112e96149fd565b6020026020010151612951565b8061130081614a13565b9150506112b1565b5061132485858560405180602001604052806000815250612a12565b60005b8451811015610cb4576000611352868381518110611347576113476149fd565b602002602001015190565b9050611378868381518110611369576113696149fd565b602002602001015182836124e9565b508061138381614a13565b915050611327565b600054610100900460ff16158080156113ab5750600054600160ff909116105b806113c55750303b1580156113c5575060005460ff166001145b6114375760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610932565b6000805460ff19166001179055801561145a576000805461ff0019166101001790555b61146386612c0f565b61146e6000866123a5565b6114778461262c565b611482836001612c83565b61148b82612d26565b611493612d9e565b61149b612d9e565b6114a3612d9e565b8015610cb4576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661151a81611e0c565b6115248483612951565b61153f85858560405180602001604052806000815250612e0b565b83610cb48180806124e9565b6101c4546101c254604080517fa86a28d10000000000000000000000000000000000000000000000000000000081528151606094600094909385936001600160a01b039092169263a86a28d19260048082019392918290030181865afa1580156115b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115dd919061495c565b5090506001600160a01b03811615611682576101c4546115fe906001614a2d565b67ffffffffffffffff811115611616576116166140f0565b60405190808252806020026020018201604052801561163f578160200160208202803683370190505b5093508084600081518110611656576116566149fd565b6001600160a01b03909216602092830291909101909101526001925061167b82614a13565b91506116cb565b6101c45467ffffffffffffffff81111561169e5761169e6140f0565b6040519080825280602002602001820160405280156116c7578160200160208202803683370190505b5093505b825b8281101561175e576101c360006101c46116e78785614a40565b815481106116f7576116f76149fd565b9060005260206000200154815260200190815260200160002060009054906101000a90046001600160a01b0316858281518110611736576117366149fd565b6001600160a01b039092166020928302919091019091015261175781614a13565b90506116cd565b5050505090565b600082815260fa602052604090206001015461178081611e0c565b610a1e8383612448565b600061179581611e0c565b6001600160a01b0382163b6117ec5760405162461bcd60e51b815260206004820152601c60248201527f41737365743a2042616420666f727761726465722061646472657373000000006044820152606401610932565b610d7982612f4e565b6101905485906001600160a01b03163b15611987576118126122e7565b6001600160a01b0316816001600160a01b0316036118b1576118326122e7565b6001600160a01b0316866001600160a01b031614806118585750611858866108316122e7565b6118a45760405162461bcd60e51b815260206004820152601560248201527f41737365743a205472616e73666572206572726f7200000000000000000000006044820152606401610932565b610bcc8686868686613063565b610190546001600160a01b031663c6171134306118cc6122e7565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381865afa158015611917573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193b91906149e0565b6119875760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f7765640000000000000000000000006044820152606401610932565b61198f6122e7565b6001600160a01b0316866001600160a01b031614806119b557506119b5866108316122e7565b611a015760405162461bcd60e51b815260206004820152601560248201527f41737365743a205472616e73666572206572726f7200000000000000000000006044820152606401610932565b610cb48686868686613063565b611a166122e7565b6001600160a01b0316836001600160a01b03161480611a3c5750611a3c836108316122e7565b611aae5760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f7665640000000000000000000000000000000000006064820152608401610932565b610a1e838383611e20565b60008181526101c36020526040808220546101c25482517fa86a28d100000000000000000000000000000000000000000000000000000000815283516060956001600160a01b039485169590949093169263a86a28d192600480820193918290030181865afa158015611b30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b54919061495c565b5090506001600160a01b03821615611bd457816001600160a01b031663d78d610b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611ba4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611bcc9190810190614a53565b949350505050565b60408051600180825281830190925290816020015b6040805180820190915260008082526020820152815260200190600190039081611be95790505092506040518060400160405280826001600160a01b0316815260200161271061ffff1681525083600081518110611c4957611c496149fd565b60200260200101819052505050919050565b60006101f482604051611c6e9190614b26565b9081526020016040518091039020549050919050565b60006001600160e01b031982167f2a55205a000000000000000000000000000000000000000000000000000000001480611ce757506001600160e01b031982167ff1e82fd000000000000000000000000000000000000000000000000000000000145b80611d1b57506001600160e01b031982167ffd90e89700000000000000000000000000000000000000000000000000000000145b80610960575061096082613256565b600081815261015f6020526040812080546060929190611d4990614b42565b80601f0160208091040260200160405190810160405280929190818152602001828054611d7590614b42565b8015611dc25780601f10611d9757610100808354040283529160200191611dc2565b820191906000526020600020905b815481529060010190602001808311611da557829003601f168201915b505050505090506000815111611de057611ddb83613294565b611e05565b61015e81604051602001611df5929190614b7c565b6040516020818303038152906040525b9392505050565b611e1d81611e186122e7565b613328565b50565b6001600160a01b038316611e9c5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610932565b6000611ea66122e7565b90506000611eb38461339d565b90506000611ec08461339d565b9050611ee0838760008585604051806020016040528060008152506133e8565b60008581526096602090815260408083206001600160a01b038a16845290915290205484811015611f785760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e6365000000000000000000000000000000000000000000000000000000006064820152608401610932565b60008681526096602090815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46040805160208101909152600090525b50505050505050565b600082815261015f602052604090206120108282614c49565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b61203c846109a4565b604051612049919061408f565b60405180910390a25050565b6001600160a01b0383166120d15760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610932565b80518251146121335760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610932565b600061213d6122e7565b905061215d818560008686604051806020016040528060008152506133e8565b60005b835181101561227a57600084828151811061217d5761217d6149fd565b60200260200101519050600084838151811061219b5761219b6149fd565b60209081029190910181015160008481526096835260408082206001600160a01b038c1683529093529190912054909150818110156122415760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e6365000000000000000000000000000000000000000000000000000000006064820152608401610932565b60009283526096602090815260408085206001600160a01b038b168652909152909220910390558061227281614a13565b915050612160565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516122cb929190614d09565b60405180910390a46040805160208101909152600090526109e4565b6000610f006133f6565b6122f96122e7565b6001600160a01b0316856001600160a01b0316148061231f575061231f856108316122e7565b6123915760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f7665640000000000000000000000000000000000006064820152608401610932565b61239e8585858585613400565b5050505050565b600082815260fa602090815260408083206001600160a01b038516845290915290205460ff16610d7957600082815260fa602090815260408083206001600160a01b03851684529091529020805460ff191660011790556124046122e7565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260fa602090815260408083206001600160a01b038516845290915290205460ff1615610d7957600082815260fa602090815260408083206001600160a01b03851684529091529020805460ff191690556124a56122e7565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b6101c2546040517ff06040b40000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528481166024830152600092169063f06040b4906044016020604051808303816000875af1158015612558573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257c9190614d37565b60008581526101c360205260409020549091506001600160a01b0316156125ce5760008481526101c360205260409020546001600160a01b038281169116146125c9576125c9848261369d565b6109e4565b6101c480546001810182556000919091527f5ac35dca7c3a7d5ae9d0add1efdc4aa02e10dd5cac0b90d2122cf0f0cc68317f018490556109e4848261369d565b60008061261f8360b81c61ffff1690565b61ffff1615159392505050565b61015e610d798282614c49565b610190546001600160a01b03163b15610d7957610190546040517fc3c5a5470000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169063c3c5a547906024016020604051808303816000875af11580156126b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126d491906149e0565b610d7957801561275a57610190546040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03848116602483015290911690637d3e3dbe906044015b600060405180830381600087803b15801561274657600080fd5b505af1158015610cb4573d6000803e3d6000fd5b6001600160a01b038216156127bb57610190546040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0384811660248301529091169063a0af29039060440161272c565b610190546040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690634420e4869060240161272c565b610190805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fe9919957d871eafd2de063f58e6c3015bdee186c8a161b85d6173122db2210f890600090a250565b816001600160a01b0316836001600160a01b0316036128e45760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c6600000000000000000000000000000000000000000000006064820152608401610932565b6001600160a01b03838116600081815260976020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6101f4816040516129629190614b26565b9081526020016040518091039020546000146129e657816101f48260405161298a9190614b26565b90815260200160405180910390205414610d795760405162461bcd60e51b815260206004820152601860248201527f41737365743a204861736820616c7265616479207573656400000000000000006044820152606401610932565b816101f4826040516129f89190614b26565b90815260405190819003602001902055610d798282611ff7565b6001600160a01b038416612a8e5760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610932565b8151835114612af05760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610932565b6000612afa6122e7565b9050612b0b816000878787876133e8565b60005b8451811015612ba757838181518110612b2957612b296149fd565b602002602001015160966000878481518110612b4757612b476149fd565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000206000828254612b8f9190614a2d565b90915550819050612b9f81614a13565b915050612b0e565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612bf8929190614d09565b60405180910390a461239e81600087878787613711565b600054610100900460ff16612c7a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610932565b611e1d816138fd565b600054610100900460ff16612cee5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610932565b610190805473ffffffffffffffffffffffffffffffffffffffff19166daaeb6d7670e522a718067333cd4e179055610d798282612639565b600054610100900460ff16612d915760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610932565b612d9a81613971565b611e1d5b600054610100900460ff16612e095760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610932565b565b6001600160a01b038416612e875760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610932565b6000612e916122e7565b90506000612e9e8561339d565b90506000612eab8561339d565b9050612ebc836000898585896133e8565b60008681526096602090815260408083206001600160a01b038b16845290915281208054879290612eee908490614a2d565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611fee836000898989896139c9565b6000546001600160a01b0362010000909104811690821603612fd85760405162461bcd60e51b815260206004820152603060248201527f4552433237373148616e646c65725570677261646561626c653a20666f72776160448201527f7264657220616c726561647920736574000000000000000000000000000000006064820152608401610932565b612fe06122e7565b600080546040516001600160a01b0393841693858116936201000090930416917f8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e591a4600080546001600160a01b0390921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6001600160a01b0384166130df5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610932565b60006130e96122e7565b905060006130f68561339d565b905060006131038561339d565b90506131138389898585896133e8565b60008681526096602090815260408083206001600160a01b038c168452909152902054858110156131ac5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e73666572000000000000000000000000000000000000000000006064820152608401610932565b60008781526096602090815260408083206001600160a01b038d8116855292528083208985039055908a168252812080548892906131eb908490614a2d565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461324b848a8a8a8a8a6139c9565b505050505050505050565b60006001600160e01b031982167f7965db0b000000000000000000000000000000000000000000000000000000001480610960575061096082613b0c565b6060609880546132a390614b42565b80601f01602080910402602001604051908101604052809291908181526020018280546132cf90614b42565b801561331c5780601f106132f15761010080835404028352916020019161331c565b820191906000526020600020905b8154815290600101906020018083116132ff57829003601f168201915b50505050509050919050565b600082815260fa602090815260408083206001600160a01b038516845290915290205460ff16610d795761335b81613ba7565b613366836020613bb9565b604051602001613377929190614d54565b60408051601f198184030181529082905262461bcd60e51b82526109329160040161408f565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106133d7576133d76149fd565b602090810291909101015292915050565b610cb4868686868686613de2565b6000610f00613f73565b81518351146134625760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610932565b6001600160a01b0384166134de5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610932565b60006134e86122e7565b90506134f88187878787876133e8565b60005b8451811015613637576000858281518110613518576135186149fd565b602002602001015190506000858381518110613536576135366149fd565b60209081029190910181015160008481526096835260408082206001600160a01b038e1683529093529190912054909150818110156135dd5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e73666572000000000000000000000000000000000000000000006064820152608401610932565b60008381526096602090815260408083206001600160a01b038e8116855292528083208585039055908b1682528120805484929061361c908490614a2d565b925050819055505050508061363090614a13565b90506134fb565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051613687929190614d09565b60405180910390a4610cb4818787878787613711565b60008281526101c36020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385169081179091558251858152918201527fe1684be972745471d95b80171bd593d7a1afd40c8d04f90bb29f27b78853918a910160405180910390a15050565b6001600160a01b0384163b15610cb4576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c819061376e9089908990889088908890600401614dd5565b6020604051808303816000875af19250505080156137a9575060408051601f3d908101601f191682019092526137a691810190614e27565b60015b61385e576137b5614e44565b806308c379a0036137ee57506137c9614e5f565b806137d457506137f0565b8060405162461bcd60e51b8152600401610932919061408f565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d4552433131353560448201527f526563656976657220696d706c656d656e7465720000000000000000000000006064820152608401610932565b6001600160e01b031981167fbc197c810000000000000000000000000000000000000000000000000000000014611fee5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e730000000000000000000000000000000000000000000000006064820152608401610932565b600054610100900460ff166139685760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610932565b611e1d81612f4e565b6101c2805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f1ad03d64d67ed9b2c90cfdf8dc8e54de3e41af88ae55e45a53dc27e476406de890600090a250565b6001600160a01b0384163b15610cb4576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e6190613a269089908990889088908890600401614f07565b6020604051808303816000875af1925050508015613a61575060408051601f3d908101601f19168201909252613a5e91810190614e27565b60015b613a6d576137b5614e44565b6001600160e01b031981167ff23a6e610000000000000000000000000000000000000000000000000000000014611fee5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e730000000000000000000000000000000000000000000000006064820152608401610932565b60006001600160e01b031982167fd9b67a26000000000000000000000000000000000000000000000000000000001480613b6f57506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061096057507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614610960565b60606109606001600160a01b03831660145b60606000613bc88360026149a7565b613bd3906002614a2d565b67ffffffffffffffff811115613beb57613beb6140f0565b6040519080825280601f01601f191660200182016040528015613c15576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613c4c57613c4c6149fd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613caf57613caf6149fd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000613ceb8460026149a7565b613cf6906001614a2d565b90505b6001811115613d93577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613d3757613d376149fd565b1a60f81b828281518110613d4d57613d4d6149fd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93613d8c81614f4a565b9050613cf9565b508315611e055760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610932565b6001600160a01b038516613e6a5760005b8351811015613e6857828181518110613e0e57613e0e6149fd565b602002602001015161012c6000868481518110613e2d57613e2d6149fd565b602002602001015181526020019081526020016000206000828254613e529190614a2d565b90915550613e61905081614a13565b9050613df3565b505b6001600160a01b038416610cb45760005b8351811015611fee576000848281518110613e9857613e986149fd565b602002602001015190506000848381518110613eb657613eb66149fd565b60200260200101519050600061012c600084815260200190815260200160002054905081811015613f4f5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f7460448201527f616c537570706c790000000000000000000000000000000000000000000000006064820152608401610932565b600092835261012c602052604090922091039055613f6c81614a13565b9050613e7b565b600080546201000090046001600160a01b031633148015613f95575060143610155b15613fc557507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b50335b90565b6001600160a01b0381168114611e1d57600080fd5b60008060408385031215613ff357600080fd5b8235613ffe81613fcb565b946020939093013593505050565b6001600160e01b031981168114611e1d57600080fd5b60006020828403121561403457600080fd5b8135611e058161400c565b60005b8381101561405a578181015183820152602001614042565b50506000910152565b6000815180845261407b81602086016020860161403f565b601f01601f19169290920160200192915050565b602081526000611e056020830184614063565b6000602082840312156140b457600080fd5b5035919050565b6000806000606084860312156140d057600080fd5b83356140db81613fcb565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b6040810181811067ffffffffffffffff82111715614126576141266140f0565b60405250565b601f19601f830116810181811067ffffffffffffffff82111715614152576141526140f0565b6040525050565b600082601f83011261416a57600080fd5b813567ffffffffffffffff811115614184576141846140f0565b60405161419b6020601f19601f850116018261412c565b8181528460208386010111156141b057600080fd5b816020850160208301376000918101602001919091529392505050565b600080604083850312156141e057600080fd5b82359150602083013567ffffffffffffffff8111156141fe57600080fd5b61420a85828601614159565b9150509250929050565b600067ffffffffffffffff82111561422e5761422e6140f0565b5060051b60200190565b600082601f83011261424957600080fd5b8135602061425682614214565b604051614263828261412c565b83815260059390931b850182019282810191508684111561428357600080fd5b8286015b8481101561429e5780358352918301918301614287565b509695505050505050565b6000806000606084860312156142be57600080fd5b83356142c981613fcb565b9250602084013567ffffffffffffffff808211156142e657600080fd5b6142f287838801614238565b9350604086013591508082111561430857600080fd5b5061431586828701614238565b9150509250925092565b6000806040838503121561433257600080fd5b50508035926020909101359150565b600080600080600060a0868803121561435957600080fd5b853561436481613fcb565b9450602086013561437481613fcb565b9350604086013567ffffffffffffffff8082111561439157600080fd5b61439d89838a01614238565b945060608801359150808211156143b357600080fd5b6143bf89838a01614238565b935060808801359150808211156143d557600080fd5b506143e288828901614159565b9150509295509295909350565b6000806040838503121561440257600080fd5b82359150602083013561441481613fcb565b809150509250929050565b6000806040838503121561443257600080fd5b823567ffffffffffffffff8082111561444a57600080fd5b818501915085601f83011261445e57600080fd5b8135602061446b82614214565b604051614478828261412c565b83815260059390931b850182019282810191508984111561449857600080fd5b948201945b838610156144bf5785356144b081613fcb565b8252948201949082019061449d565b965050860135925050808211156144d557600080fd5b5061420a85828601614238565b600081518084526020808501945080840160005b83811015614512578151875295820195908201906001016144f6565b509495945050505050565b602081526000611e0560208301846144e2565b60008060006060848603121561454557600080fd5b83359250602084013561455781613fcb565b9150604084013561456781613fcb565b809150509250925092565b60006020828403121561458457600080fd5b813567ffffffffffffffff81111561459b57600080fd5b611bcc84828501614159565b6000602082840312156145b957600080fd5b8135611e0581613fcb565b8015158114611e1d57600080fd5b600080604083850312156145e557600080fd5b82356145f081613fcb565b91506020830135614414816145c4565b6000806000806080858703121561461657600080fd5b843561462181613fcb565b935060208581013567ffffffffffffffff8082111561463f57600080fd5b61464b89838a01614238565b9550604088013591508082111561466157600080fd5b61466d89838a01614238565b9450606088013591508082111561468357600080fd5b818801915088601f83011261469757600080fd5b81356146a281614214565b6040516146af828261412c565b82815260059290921b840185019185810191508b8311156146cf57600080fd5b8585015b83811015614707578035858111156146eb5760008081fd5b6146f98e89838a0101614159565b8452509186019186016146d3565b50989b979a50959850505050505050565b600080600080600060a0868803121561473057600080fd5b853561473b81613fcb565b9450602086013561474b81613fcb565b9350604086013567ffffffffffffffff81111561476757600080fd5b61477388828901614159565b935050606086013561478481613fcb565b9150608086013561479481613fcb565b809150509295509295909350565b600080600080608085870312156147b857600080fd5b84356147c381613fcb565b93506020850135925060408501359150606085013567ffffffffffffffff8111156147ed57600080fd5b6147f987828801614159565b91505092959194509250565b6020808252825182820181905260009190848201906040850190845b818110156148465783516001600160a01b031683529284019291840191600101614821565b50909695505050505050565b6000806040838503121561486557600080fd5b823561487081613fcb565b9150602083013561441481613fcb565b600080600080600060a0868803121561489857600080fd5b85356148a381613fcb565b945060208601356148b381613fcb565b93506040860135925060608601359150608086013567ffffffffffffffff8111156148dd57600080fd5b6143e288828901614159565b602080825282518282018190526000919060409081850190868401855b8281101561493857815180516001600160a01b0316855286015161ffff16868501529284019290850190600101614906565b5091979650505050505050565b805161ffff8116811461495757600080fd5b919050565b6000806040838503121561496f57600080fd5b825161497a81613fcb565b915061498860208401614945565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761096057610960614991565b6000826149db57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156149f257600080fd5b8151611e05816145c4565b634e487b7160e01b600052603260045260246000fd5b60006000198203614a2657614a26614991565b5060010190565b8082018082111561096057610960614991565b8181038181111561096057610960614991565b60006020808385031215614a6657600080fd5b825167ffffffffffffffff811115614a7d57600080fd5b8301601f81018513614a8e57600080fd5b8051614a9981614214565b60408051614aa7838261412c565b83815260069390931b8401850192858101925088841115614ac757600080fd5b938501935b83851015614b1a5781858a031215614ae45760008081fd5b8151614aef81614106565b8551614afa81613fcb565b8152614b07868801614945565b8188015283529381019391850191614acc565b98975050505050505050565b60008251614b3881846020870161403f565b9190910192915050565b600181811c90821680614b5657607f821691505b602082108103614b7657634e487b7160e01b600052602260045260246000fd5b50919050565b6000808454614b8a81614b42565b60018281168015614ba25760018114614bb757614be6565b60ff1984168752821515830287019450614be6565b8860005260208060002060005b85811015614bdd5781548a820152908401908201614bc4565b50505082870194505b505050508351614bfa81836020880161403f565b01949350505050565b601f821115610a1e57600081815260208120601f850160051c81016020861015614c2a5750805b601f850160051c820191505b81811015610cb457828155600101614c36565b815167ffffffffffffffff811115614c6357614c636140f0565b614c7781614c718454614b42565b84614c03565b602080601f831160018114614cac5760008415614c945750858301515b600019600386901b1c1916600185901b178555610cb4565b600085815260208120601f198616915b82811015614cdb57888601518255948401946001909101908401614cbc565b5085821015614cf95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000614d1c60408301856144e2565b8281036020840152614d2e81856144e2565b95945050505050565b600060208284031215614d4957600080fd5b8151611e0581613fcb565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614d8c81601785016020880161403f565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351614dc981602884016020880161403f565b01602801949350505050565b60006001600160a01b03808816835280871660208401525060a06040830152614e0160a08301866144e2565b8281036060840152614e1381866144e2565b90508281036080840152614b1a8185614063565b600060208284031215614e3957600080fd5b8151611e058161400c565b600060033d1115613fc85760046000803e5060005160e01c90565b600060443d1015614e6d5790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff8160248401118184111715614ebb57505050505090565b8285019150815181811115614ed35750505050505090565b843d8701016020828501011115614eed5750505050505090565b614efc6020828601018761412c565b509095945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152614f3f60a0830184614063565b979650505050505050565b600081614f5957614f59614991565b50600019019056fea2646970667358221220d2a8f4c567255adefbd3352a959497b393030c4ece1505a6ac0542d1cb3cc7a464736f6c63430008120033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103355760003560e01c80638082f110116101b2578063ac4a0fb6116100f9578063d547741f116100a2578063f242432a1161007c578063f242432a1461085f578063f5298aca14610872578063fd90e89714610885578063fdda1d0e146108a557600080fd5b8063d547741f146107fd578063da74222814610810578063e985e9c51461082357600080fd5b8063befa6645116100d3578063befa6645146107aa578063ce1b815f146107bf578063d5391393146107d657600080fd5b8063ac4a0fb614610763578063bb7fde7114610776578063bd85b0391461078957600080fd5b80639d28fb861161015b578063a30b4db911610135578063a30b4db914610711578063a55784ef14610724578063abe396031461073757600080fd5b80639d28fb86146106e3578063a217fddf146106f6578063a22cb465146106fe57600080fd5b8063933f39581161018c578063933f39581461068557806395d89b41146106985780639a1b2fb4146106d157600080fd5b80638082f1101461060f57806381de2dc21461063957806391d148541461064c57600080fd5b80632f2ff15d116102815780635055fbc31161022a578063572b6c0511610204578063572b6c05146105af5780636b20c454146105c2578063791459ea146105d5578063797669c9146105e857600080fd5b80635055fbc31461056957806350c821b01461057c57806355f804b31461059c57600080fd5b80634f062c5a1161025b5780634f062c5a1461050e5780634f124995146105335780634f558e791461054657600080fd5b80632f2ff15d146104c857806336568abe146104db5780634e1273f4146104ee57600080fd5b806320820ec3116102e35780632a41a355116102bd5780632a41a3551461045d5780632a55205a146104835780632eb2c2d6146104b557600080fd5b806320820ec314610400578063248a9ca314610413578063282c51f31461043657600080fd5b80630e89341c116103145780630e89341c146103c5578063124d91e5146103d8578063162094c4146103ed57600080fd5b8062fdd58e1461033a57806301ffc9a71461036057806306fdde0314610383575b600080fd5b61034d610348366004613fe0565b6108b8565b6040519081526020015b60405180910390f35b61037361036e366004614022565b610966565b6040519015158152602001610357565b60408051808201909152601481527f5468652053616e64626f7827732041535345547300000000000000000000000060208201525b604051610357919061408f565b6103b86103d33660046140a2565b6109a4565b6103eb6103e63660046140bb565b6109af565b005b6103eb6103fb3660046141cd565b6109ea565b6103eb61040e3660046142a9565b610a23565b61034d6104213660046140a2565b600090815260fa602052604090206001015490565b61034d7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a84881565b61047061046b3660046140a2565b610a58565b60405161ffff9091168152602001610357565b61049661049136600461431f565b610a68565b604080516001600160a01b039093168352602083019190915201610357565b6103eb6104c3366004614341565b610b8a565b6103eb6104d63660046143ef565b610cbc565b6103eb6104e93660046143ef565b610ce1565b6105016104fc36600461441f565b610d7d565b604051610357919061451d565b61052161051c3660046140a2565b610ebb565b60405160ff9091168152602001610357565b6103eb610541366004614530565b610eca565b6103736105543660046140a2565b600090815261012c6020526040902054151590565b6103736105773660046140a2565b610ee0565b610584610eeb565b6040516001600160a01b039091168152602001610357565b6103eb6105aa366004614572565b610f05565b6103736105bd3660046145a7565b610f19565b6103eb6105d03660046142a9565b610f36565b6103eb6105e33660046145d2565b610fe1565b61034d7f71f3d55856e4058ed06ee057d79ada615f65cdf5f9ee88181b914225088f834f81565b61058461061d3660046140a2565b60009081526101c360205260409020546001600160a01b031690565b6104706106473660046140a2565b61104d565b61037361065a3660046143ef565b600091825260fa602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6103736106933660046140a2565b61105d565b60408051808201909152600581527f415353455400000000000000000000000000000000000000000000000000000060208201526103b8565b6101c2546001600160a01b0316610584565b6103eb6106f13660046145a7565b61106e565b61034d600081565b6103eb61070c3660046145d2565b6110d9565b61058461071f3660046140a2565b6111da565b6103eb610732366004614600565b6111e2565b61034d610745366004614572565b80516020818301810180516101f48252928201919093012091525481565b6103eb610771366004614718565b61138b565b6103eb6107843660046147a2565b6114f0565b61034d6107973660046140a2565b600090815261012c602052604090205490565b6107b261154b565b6040516103579190614805565b6000546201000090046001600160a01b0316610584565b61034d7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6103eb61080b3660046143ef565b611765565b6103eb61081e3660046145a7565b61178a565b610373610831366004614852565b6001600160a01b03918216600090815260976020908152604080832093909416825291909152205460ff1690565b6103eb61086d366004614880565b6117f5565b6103eb6108803660046140bb565b611a0e565b6108986108933660046140a2565b611ab9565b60405161035791906148e9565b61034d6108b3366004614572565b611c5b565b60006001600160a01b03831661093b5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201527f616c6964206f776e65720000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060008181526096602090815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b031982167fa30b4db9000000000000000000000000000000000000000000000000000000001480610960575061096082611c84565b606061096082611d2a565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a8486109d981611e0c565b6109e4848484611e20565b50505050565b7f71f3d55856e4058ed06ee057d79ada615f65cdf5f9ee88181b914225088f834f610a1481611e0c565b610a1e8383611ff7565b505050565b7f3c11d16cbaffd01df69ce1c404f6340ee057498f5f00246190ea54220576a848610a4d81611e0c565b6109e4848484612055565b60006109608260b81c61ffff1690565b6000806000806101c260009054906101000a90046001600160a01b03166001600160a01b031663a86a28d16040518163ffffffff1660e01b81526004016040805180830381865afa158015610ac1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae5919061495c565b60008881526101c3602052604090205491935091506001600160a01b031615610b475760008681526101c360205260409020546001600160a01b0316612710610b3261ffff8416886149a7565b610b3c91906149be565b935093505050610b83565b6001600160a01b03821615801590610b62575061ffff811615155b15610b795781612710610b3261ffff8416886149a7565b6000809350935050505b9250929050565b6101905485906001600160a01b03163b15610ca757610ba76122e7565b6001600160a01b0316816001600160a01b031603610bd157610bcc86868686866122f1565b610cb4565b610190546001600160a01b031663c617113430610bec6122e7565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381865afa158015610c37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c5b91906149e0565b610ca75760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f7765640000000000000000000000006044820152606401610932565b610cb486868686866122f1565b505050505050565b600082815260fa6020526040902060010154610cd781611e0c565b610a1e83836123a5565b610ce96122e7565b6001600160a01b0316816001600160a01b031614610d6f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610932565b610d798282612448565b5050565b60608151835114610df65760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d6174636800000000000000000000000000000000000000000000006064820152608401610932565b6000835167ffffffffffffffff811115610e1257610e126140f0565b604051908082528060200260200182016040528015610e3b578160200160208202803683370190505b50905060005b8451811015610eb357610e86858281518110610e5f57610e5f6149fd565b6020026020010151858381518110610e7957610e796149fd565b60200260200101516108b8565b828281518110610e9857610e986149fd565b6020908102919091010152610eac81614a13565b9050610e41565b509392505050565b60006109608260a01c60ff1690565b6000610ed581611e0c565b6109e48484846124e9565b60006109608261260e565b6000610f00610190546001600160a01b031690565b905090565b6000610f1081611e0c565b610d798261262c565b600080546001600160a01b03838116620100009092041614610960565b610f3e6122e7565b6001600160a01b0316836001600160a01b03161480610f645750610f64836108316122e7565b610fd65760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f7665640000000000000000000000000000000000006064820152608401610932565b610a1e838383612055565b6000610fec81611e0c565b6001600160a01b0383163b6110435760405162461bcd60e51b815260206004820152601f60248201527f41737365743a2042616420737562736372697074696f6e2061646472657373006044820152606401610932565b610a1e8383612639565b60006109608260a81c61ffff1690565b6000600160c883901c811614610960565b600061107981611e0c565b6001600160a01b0382163b6110d05760405162461bcd60e51b815260206004820152601b60248201527f41737365743a20426164207265676973747279206164647265737300000000006044820152606401610932565b610d7982612805565b6101905482906001600160a01b03163b156111c857610190546040517fc61711340000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0383811660248301529091169063c617113490604401602060405180830381865afa158015611158573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117c91906149e0565b6111c85760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f7765640000000000000000000000006044820152606401610932565b610a1e6111d36122e7565b848461285d565b600081610960565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661120c81611e0c565b815184511461125d5760405162461bcd60e51b815260206004820152601760248201527f41737365743a20312d4172726179206d69736d617463680000000000000000006044820152606401610932565b82518451146112ae5760405162461bcd60e51b815260206004820152601760248201527f41737365743a20322d4172726179206d69736d617463680000000000000000006044820152606401610932565b60005b8451811015611308576112f68582815181106112cf576112cf6149fd565b60200260200101518483815181106112e9576112e96149fd565b6020026020010151612951565b8061130081614a13565b9150506112b1565b5061132485858560405180602001604052806000815250612a12565b60005b8451811015610cb4576000611352868381518110611347576113476149fd565b602002602001015190565b9050611378868381518110611369576113696149fd565b602002602001015182836124e9565b508061138381614a13565b915050611327565b600054610100900460ff16158080156113ab5750600054600160ff909116105b806113c55750303b1580156113c5575060005460ff166001145b6114375760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610932565b6000805460ff19166001179055801561145a576000805461ff0019166101001790555b61146386612c0f565b61146e6000866123a5565b6114778461262c565b611482836001612c83565b61148b82612d26565b611493612d9e565b61149b612d9e565b6114a3612d9e565b8015610cb4576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a661151a81611e0c565b6115248483612951565b61153f85858560405180602001604052806000815250612e0b565b83610cb48180806124e9565b6101c4546101c254604080517fa86a28d10000000000000000000000000000000000000000000000000000000081528151606094600094909385936001600160a01b039092169263a86a28d19260048082019392918290030181865afa1580156115b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115dd919061495c565b5090506001600160a01b03811615611682576101c4546115fe906001614a2d565b67ffffffffffffffff811115611616576116166140f0565b60405190808252806020026020018201604052801561163f578160200160208202803683370190505b5093508084600081518110611656576116566149fd565b6001600160a01b03909216602092830291909101909101526001925061167b82614a13565b91506116cb565b6101c45467ffffffffffffffff81111561169e5761169e6140f0565b6040519080825280602002602001820160405280156116c7578160200160208202803683370190505b5093505b825b8281101561175e576101c360006101c46116e78785614a40565b815481106116f7576116f76149fd565b9060005260206000200154815260200190815260200160002060009054906101000a90046001600160a01b0316858281518110611736576117366149fd565b6001600160a01b039092166020928302919091019091015261175781614a13565b90506116cd565b5050505090565b600082815260fa602052604090206001015461178081611e0c565b610a1e8383612448565b600061179581611e0c565b6001600160a01b0382163b6117ec5760405162461bcd60e51b815260206004820152601c60248201527f41737365743a2042616420666f727761726465722061646472657373000000006044820152606401610932565b610d7982612f4e565b6101905485906001600160a01b03163b15611987576118126122e7565b6001600160a01b0316816001600160a01b0316036118b1576118326122e7565b6001600160a01b0316866001600160a01b031614806118585750611858866108316122e7565b6118a45760405162461bcd60e51b815260206004820152601560248201527f41737365743a205472616e73666572206572726f7200000000000000000000006044820152606401610932565b610bcc8686868686613063565b610190546001600160a01b031663c6171134306118cc6122e7565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381865afa158015611917573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193b91906149e0565b6119875760405162461bcd60e51b815260206004820152601460248201527f4f70657261746f72204e6f7420416c6c6f7765640000000000000000000000006044820152606401610932565b61198f6122e7565b6001600160a01b0316866001600160a01b031614806119b557506119b5866108316122e7565b611a015760405162461bcd60e51b815260206004820152601560248201527f41737365743a205472616e73666572206572726f7200000000000000000000006044820152606401610932565b610cb48686868686613063565b611a166122e7565b6001600160a01b0316836001600160a01b03161480611a3c5750611a3c836108316122e7565b611aae5760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f7665640000000000000000000000000000000000006064820152608401610932565b610a1e838383611e20565b60008181526101c36020526040808220546101c25482517fa86a28d100000000000000000000000000000000000000000000000000000000815283516060956001600160a01b039485169590949093169263a86a28d192600480820193918290030181865afa158015611b30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b54919061495c565b5090506001600160a01b03821615611bd457816001600160a01b031663d78d610b6040518163ffffffff1660e01b8152600401600060405180830381865afa158015611ba4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611bcc9190810190614a53565b949350505050565b60408051600180825281830190925290816020015b6040805180820190915260008082526020820152815260200190600190039081611be95790505092506040518060400160405280826001600160a01b0316815260200161271061ffff1681525083600081518110611c4957611c496149fd565b60200260200101819052505050919050565b60006101f482604051611c6e9190614b26565b9081526020016040518091039020549050919050565b60006001600160e01b031982167f2a55205a000000000000000000000000000000000000000000000000000000001480611ce757506001600160e01b031982167ff1e82fd000000000000000000000000000000000000000000000000000000000145b80611d1b57506001600160e01b031982167ffd90e89700000000000000000000000000000000000000000000000000000000145b80610960575061096082613256565b600081815261015f6020526040812080546060929190611d4990614b42565b80601f0160208091040260200160405190810160405280929190818152602001828054611d7590614b42565b8015611dc25780601f10611d9757610100808354040283529160200191611dc2565b820191906000526020600020905b815481529060010190602001808311611da557829003601f168201915b505050505090506000815111611de057611ddb83613294565b611e05565b61015e81604051602001611df5929190614b7c565b6040516020818303038152906040525b9392505050565b611e1d81611e186122e7565b613328565b50565b6001600160a01b038316611e9c5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610932565b6000611ea66122e7565b90506000611eb38461339d565b90506000611ec08461339d565b9050611ee0838760008585604051806020016040528060008152506133e8565b60008581526096602090815260408083206001600160a01b038a16845290915290205484811015611f785760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e6365000000000000000000000000000000000000000000000000000000006064820152608401610932565b60008681526096602090815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46040805160208101909152600090525b50505050505050565b600082815261015f602052604090206120108282614c49565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b61203c846109a4565b604051612049919061408f565b60405180910390a25050565b6001600160a01b0383166120d15760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610932565b80518251146121335760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610932565b600061213d6122e7565b905061215d818560008686604051806020016040528060008152506133e8565b60005b835181101561227a57600084828151811061217d5761217d6149fd565b60200260200101519050600084838151811061219b5761219b6149fd565b60209081029190910181015160008481526096835260408082206001600160a01b038c1683529093529190912054909150818110156122415760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e6365000000000000000000000000000000000000000000000000000000006064820152608401610932565b60009283526096602090815260408085206001600160a01b038b168652909152909220910390558061227281614a13565b915050612160565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516122cb929190614d09565b60405180910390a46040805160208101909152600090526109e4565b6000610f006133f6565b6122f96122e7565b6001600160a01b0316856001600160a01b0316148061231f575061231f856108316122e7565b6123915760405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206f7220617070726f7665640000000000000000000000000000000000006064820152608401610932565b61239e8585858585613400565b5050505050565b600082815260fa602090815260408083206001600160a01b038516845290915290205460ff16610d7957600082815260fa602090815260408083206001600160a01b03851684529091529020805460ff191660011790556124046122e7565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260fa602090815260408083206001600160a01b038516845290915290205460ff1615610d7957600082815260fa602090815260408083206001600160a01b03851684529091529020805460ff191690556124a56122e7565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b6101c2546040517ff06040b40000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528481166024830152600092169063f06040b4906044016020604051808303816000875af1158015612558573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257c9190614d37565b60008581526101c360205260409020549091506001600160a01b0316156125ce5760008481526101c360205260409020546001600160a01b038281169116146125c9576125c9848261369d565b6109e4565b6101c480546001810182556000919091527f5ac35dca7c3a7d5ae9d0add1efdc4aa02e10dd5cac0b90d2122cf0f0cc68317f018490556109e4848261369d565b60008061261f8360b81c61ffff1690565b61ffff1615159392505050565b61015e610d798282614c49565b610190546001600160a01b03163b15610d7957610190546040517fc3c5a5470000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b039091169063c3c5a547906024016020604051808303816000875af11580156126b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126d491906149e0565b610d7957801561275a57610190546040517f7d3e3dbe0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03848116602483015290911690637d3e3dbe906044015b600060405180830381600087803b15801561274657600080fd5b505af1158015610cb4573d6000803e3d6000fd5b6001600160a01b038216156127bb57610190546040517fa0af29030000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0384811660248301529091169063a0af29039060440161272c565b610190546040517f4420e4860000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0390911690634420e4869060240161272c565b610190805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517fe9919957d871eafd2de063f58e6c3015bdee186c8a161b85d6173122db2210f890600090a250565b816001600160a01b0316836001600160a01b0316036128e45760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c6600000000000000000000000000000000000000000000006064820152608401610932565b6001600160a01b03838116600081815260976020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6101f4816040516129629190614b26565b9081526020016040518091039020546000146129e657816101f48260405161298a9190614b26565b90815260200160405180910390205414610d795760405162461bcd60e51b815260206004820152601860248201527f41737365743a204861736820616c7265616479207573656400000000000000006044820152606401610932565b816101f4826040516129f89190614b26565b90815260405190819003602001902055610d798282611ff7565b6001600160a01b038416612a8e5760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610932565b8151835114612af05760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610932565b6000612afa6122e7565b9050612b0b816000878787876133e8565b60005b8451811015612ba757838181518110612b2957612b296149fd565b602002602001015160966000878481518110612b4757612b476149fd565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b031681526020019081526020016000206000828254612b8f9190614a2d565b90915550819050612b9f81614a13565b915050612b0e565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612bf8929190614d09565b60405180910390a461239e81600087878787613711565b600054610100900460ff16612c7a5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610932565b611e1d816138fd565b600054610100900460ff16612cee5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610932565b610190805473ffffffffffffffffffffffffffffffffffffffff19166daaeb6d7670e522a718067333cd4e179055610d798282612639565b600054610100900460ff16612d915760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610932565b612d9a81613971565b611e1d5b600054610100900460ff16612e095760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610932565b565b6001600160a01b038416612e875760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610932565b6000612e916122e7565b90506000612e9e8561339d565b90506000612eab8561339d565b9050612ebc836000898585896133e8565b60008681526096602090815260408083206001600160a01b038b16845290915281208054879290612eee908490614a2d565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611fee836000898989896139c9565b6000546001600160a01b0362010000909104811690821603612fd85760405162461bcd60e51b815260206004820152603060248201527f4552433237373148616e646c65725570677261646561626c653a20666f72776160448201527f7264657220616c726561647920736574000000000000000000000000000000006064820152608401610932565b612fe06122e7565b600080546040516001600160a01b0393841693858116936201000090930416917f8ca022029d8ff7ad974913f8970aeed6c5e0e7eaf494a0c5b262249f6b5759e591a4600080546001600160a01b0390921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6001600160a01b0384166130df5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610932565b60006130e96122e7565b905060006130f68561339d565b905060006131038561339d565b90506131138389898585896133e8565b60008681526096602090815260408083206001600160a01b038c168452909152902054858110156131ac5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e73666572000000000000000000000000000000000000000000006064820152608401610932565b60008781526096602090815260408083206001600160a01b038d8116855292528083208985039055908a168252812080548892906131eb908490614a2d565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461324b848a8a8a8a8a6139c9565b505050505050505050565b60006001600160e01b031982167f7965db0b000000000000000000000000000000000000000000000000000000001480610960575061096082613b0c565b6060609880546132a390614b42565b80601f01602080910402602001604051908101604052809291908181526020018280546132cf90614b42565b801561331c5780601f106132f15761010080835404028352916020019161331c565b820191906000526020600020905b8154815290600101906020018083116132ff57829003601f168201915b50505050509050919050565b600082815260fa602090815260408083206001600160a01b038516845290915290205460ff16610d795761335b81613ba7565b613366836020613bb9565b604051602001613377929190614d54565b60408051601f198184030181529082905262461bcd60e51b82526109329160040161408f565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106133d7576133d76149fd565b602090810291909101015292915050565b610cb4868686868686613de2565b6000610f00613f73565b81518351146134625760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610932565b6001600160a01b0384166134de5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610932565b60006134e86122e7565b90506134f88187878787876133e8565b60005b8451811015613637576000858281518110613518576135186149fd565b602002602001015190506000858381518110613536576135366149fd565b60209081029190910181015160008481526096835260408082206001600160a01b038e1683529093529190912054909150818110156135dd5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e73666572000000000000000000000000000000000000000000006064820152608401610932565b60008381526096602090815260408083206001600160a01b038e8116855292528083208585039055908b1682528120805484929061361c908490614a2d565b925050819055505050508061363090614a13565b90506134fb565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051613687929190614d09565b60405180910390a4610cb4818787878787613711565b60008281526101c36020908152604091829020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385169081179091558251858152918201527fe1684be972745471d95b80171bd593d7a1afd40c8d04f90bb29f27b78853918a910160405180910390a15050565b6001600160a01b0384163b15610cb4576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c819061376e9089908990889088908890600401614dd5565b6020604051808303816000875af19250505080156137a9575060408051601f3d908101601f191682019092526137a691810190614e27565b60015b61385e576137b5614e44565b806308c379a0036137ee57506137c9614e5f565b806137d457506137f0565b8060405162461bcd60e51b8152600401610932919061408f565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d4552433131353560448201527f526563656976657220696d706c656d656e7465720000000000000000000000006064820152608401610932565b6001600160e01b031981167fbc197c810000000000000000000000000000000000000000000000000000000014611fee5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e730000000000000000000000000000000000000000000000006064820152608401610932565b600054610100900460ff166139685760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610932565b611e1d81612f4e565b6101c2805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383169081179091556040517f1ad03d64d67ed9b2c90cfdf8dc8e54de3e41af88ae55e45a53dc27e476406de890600090a250565b6001600160a01b0384163b15610cb4576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e6190613a269089908990889088908890600401614f07565b6020604051808303816000875af1925050508015613a61575060408051601f3d908101601f19168201909252613a5e91810190614e27565b60015b613a6d576137b5614e44565b6001600160e01b031981167ff23a6e610000000000000000000000000000000000000000000000000000000014611fee5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e730000000000000000000000000000000000000000000000006064820152608401610932565b60006001600160e01b031982167fd9b67a26000000000000000000000000000000000000000000000000000000001480613b6f57506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061096057507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614610960565b60606109606001600160a01b03831660145b60606000613bc88360026149a7565b613bd3906002614a2d565b67ffffffffffffffff811115613beb57613beb6140f0565b6040519080825280601f01601f191660200182016040528015613c15576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110613c4c57613c4c6149fd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110613caf57613caf6149fd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000613ceb8460026149a7565b613cf6906001614a2d565b90505b6001811115613d93577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110613d3757613d376149fd565b1a60f81b828281518110613d4d57613d4d6149fd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93613d8c81614f4a565b9050613cf9565b508315611e055760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610932565b6001600160a01b038516613e6a5760005b8351811015613e6857828181518110613e0e57613e0e6149fd565b602002602001015161012c6000868481518110613e2d57613e2d6149fd565b602002602001015181526020019081526020016000206000828254613e529190614a2d565b90915550613e61905081614a13565b9050613df3565b505b6001600160a01b038416610cb45760005b8351811015611fee576000848281518110613e9857613e986149fd565b602002602001015190506000848381518110613eb657613eb66149fd565b60200260200101519050600061012c600084815260200190815260200160002054905081811015613f4f5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f7460448201527f616c537570706c790000000000000000000000000000000000000000000000006064820152608401610932565b600092835261012c602052604090922091039055613f6c81614a13565b9050613e7b565b600080546201000090046001600160a01b031633148015613f95575060143610155b15613fc557507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b50335b90565b6001600160a01b0381168114611e1d57600080fd5b60008060408385031215613ff357600080fd5b8235613ffe81613fcb565b946020939093013593505050565b6001600160e01b031981168114611e1d57600080fd5b60006020828403121561403457600080fd5b8135611e058161400c565b60005b8381101561405a578181015183820152602001614042565b50506000910152565b6000815180845261407b81602086016020860161403f565b601f01601f19169290920160200192915050565b602081526000611e056020830184614063565b6000602082840312156140b457600080fd5b5035919050565b6000806000606084860312156140d057600080fd5b83356140db81613fcb565b95602085013595506040909401359392505050565b634e487b7160e01b600052604160045260246000fd5b6040810181811067ffffffffffffffff82111715614126576141266140f0565b60405250565b601f19601f830116810181811067ffffffffffffffff82111715614152576141526140f0565b6040525050565b600082601f83011261416a57600080fd5b813567ffffffffffffffff811115614184576141846140f0565b60405161419b6020601f19601f850116018261412c565b8181528460208386010111156141b057600080fd5b816020850160208301376000918101602001919091529392505050565b600080604083850312156141e057600080fd5b82359150602083013567ffffffffffffffff8111156141fe57600080fd5b61420a85828601614159565b9150509250929050565b600067ffffffffffffffff82111561422e5761422e6140f0565b5060051b60200190565b600082601f83011261424957600080fd5b8135602061425682614214565b604051614263828261412c565b83815260059390931b850182019282810191508684111561428357600080fd5b8286015b8481101561429e5780358352918301918301614287565b509695505050505050565b6000806000606084860312156142be57600080fd5b83356142c981613fcb565b9250602084013567ffffffffffffffff808211156142e657600080fd5b6142f287838801614238565b9350604086013591508082111561430857600080fd5b5061431586828701614238565b9150509250925092565b6000806040838503121561433257600080fd5b50508035926020909101359150565b600080600080600060a0868803121561435957600080fd5b853561436481613fcb565b9450602086013561437481613fcb565b9350604086013567ffffffffffffffff8082111561439157600080fd5b61439d89838a01614238565b945060608801359150808211156143b357600080fd5b6143bf89838a01614238565b935060808801359150808211156143d557600080fd5b506143e288828901614159565b9150509295509295909350565b6000806040838503121561440257600080fd5b82359150602083013561441481613fcb565b809150509250929050565b6000806040838503121561443257600080fd5b823567ffffffffffffffff8082111561444a57600080fd5b818501915085601f83011261445e57600080fd5b8135602061446b82614214565b604051614478828261412c565b83815260059390931b850182019282810191508984111561449857600080fd5b948201945b838610156144bf5785356144b081613fcb565b8252948201949082019061449d565b965050860135925050808211156144d557600080fd5b5061420a85828601614238565b600081518084526020808501945080840160005b83811015614512578151875295820195908201906001016144f6565b509495945050505050565b602081526000611e0560208301846144e2565b60008060006060848603121561454557600080fd5b83359250602084013561455781613fcb565b9150604084013561456781613fcb565b809150509250925092565b60006020828403121561458457600080fd5b813567ffffffffffffffff81111561459b57600080fd5b611bcc84828501614159565b6000602082840312156145b957600080fd5b8135611e0581613fcb565b8015158114611e1d57600080fd5b600080604083850312156145e557600080fd5b82356145f081613fcb565b91506020830135614414816145c4565b6000806000806080858703121561461657600080fd5b843561462181613fcb565b935060208581013567ffffffffffffffff8082111561463f57600080fd5b61464b89838a01614238565b9550604088013591508082111561466157600080fd5b61466d89838a01614238565b9450606088013591508082111561468357600080fd5b818801915088601f83011261469757600080fd5b81356146a281614214565b6040516146af828261412c565b82815260059290921b840185019185810191508b8311156146cf57600080fd5b8585015b83811015614707578035858111156146eb5760008081fd5b6146f98e89838a0101614159565b8452509186019186016146d3565b50989b979a50959850505050505050565b600080600080600060a0868803121561473057600080fd5b853561473b81613fcb565b9450602086013561474b81613fcb565b9350604086013567ffffffffffffffff81111561476757600080fd5b61477388828901614159565b935050606086013561478481613fcb565b9150608086013561479481613fcb565b809150509295509295909350565b600080600080608085870312156147b857600080fd5b84356147c381613fcb565b93506020850135925060408501359150606085013567ffffffffffffffff8111156147ed57600080fd5b6147f987828801614159565b91505092959194509250565b6020808252825182820181905260009190848201906040850190845b818110156148465783516001600160a01b031683529284019291840191600101614821565b50909695505050505050565b6000806040838503121561486557600080fd5b823561487081613fcb565b9150602083013561441481613fcb565b600080600080600060a0868803121561489857600080fd5b85356148a381613fcb565b945060208601356148b381613fcb565b93506040860135925060608601359150608086013567ffffffffffffffff8111156148dd57600080fd5b6143e288828901614159565b602080825282518282018190526000919060409081850190868401855b8281101561493857815180516001600160a01b0316855286015161ffff16868501529284019290850190600101614906565b5091979650505050505050565b805161ffff8116811461495757600080fd5b919050565b6000806040838503121561496f57600080fd5b825161497a81613fcb565b915061498860208401614945565b90509250929050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761096057610960614991565b6000826149db57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156149f257600080fd5b8151611e05816145c4565b634e487b7160e01b600052603260045260246000fd5b60006000198203614a2657614a26614991565b5060010190565b8082018082111561096057610960614991565b8181038181111561096057610960614991565b60006020808385031215614a6657600080fd5b825167ffffffffffffffff811115614a7d57600080fd5b8301601f81018513614a8e57600080fd5b8051614a9981614214565b60408051614aa7838261412c565b83815260069390931b8401850192858101925088841115614ac757600080fd5b938501935b83851015614b1a5781858a031215614ae45760008081fd5b8151614aef81614106565b8551614afa81613fcb565b8152614b07868801614945565b8188015283529381019391850191614acc565b98975050505050505050565b60008251614b3881846020870161403f565b9190910192915050565b600181811c90821680614b5657607f821691505b602082108103614b7657634e487b7160e01b600052602260045260246000fd5b50919050565b6000808454614b8a81614b42565b60018281168015614ba25760018114614bb757614be6565b60ff1984168752821515830287019450614be6565b8860005260208060002060005b85811015614bdd5781548a820152908401908201614bc4565b50505082870194505b505050508351614bfa81836020880161403f565b01949350505050565b601f821115610a1e57600081815260208120601f850160051c81016020861015614c2a5750805b601f850160051c820191505b81811015610cb457828155600101614c36565b815167ffffffffffffffff811115614c6357614c636140f0565b614c7781614c718454614b42565b84614c03565b602080601f831160018114614cac5760008415614c945750858301515b600019600386901b1c1916600185901b178555610cb4565b600085815260208120601f198616915b82811015614cdb57888601518255948401946001909101908401614cbc565b5085821015614cf95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b604081526000614d1c60408301856144e2565b8281036020840152614d2e81856144e2565b95945050505050565b600060208284031215614d4957600080fd5b8151611e0581613fcb565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614d8c81601785016020880161403f565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351614dc981602884016020880161403f565b01602801949350505050565b60006001600160a01b03808816835280871660208401525060a06040830152614e0160a08301866144e2565b8281036060840152614e1381866144e2565b90508281036080840152614b1a8185614063565b600060208284031215614e3957600080fd5b8151611e058161400c565b600060033d1115613fc85760046000803e5060005160e01c90565b600060443d1015614e6d5790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff8160248401118184111715614ebb57505050505090565b8285019150815181811115614ed35750505050505090565b843d8701016020828501011115614eed5750505050505090565b614efc6020828601018761412c565b509095945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152614f3f60a0830184614063565b979650505050505050565b600081614f5957614f59614991565b50600019019056fea2646970667358221220d2a8f4c567255adefbd3352a959497b393030c4ece1505a6ac0542d1cb3cc7a464736f6c63430008120033

Block Transaction 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

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.