ETH Price: $3,187.53 (-7.40%)
Gas: 2 Gwei

Contract

0xa44D9ED11Ff3834052862Db7265F7CFB8A7e25F2
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60808060171593642023-04-30 14:09:47451 days ago1682863787IN
 Create: RelationProfileNFT
0 ETH0.2552101153.14686176

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RelationProfileNFT

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion
File 1 of 29 : RelationProfileNFT.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.4;

import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";

import "../core/SemanticSBTUpgradeable.sol";
import "../interfaces/social/INameService.sol";
import "../template/NameService.sol";
import {SemanticSBTLogicUpgradeable} from "../libraries/SemanticSBTLogicUpgradeable.sol";
import {NameServiceLogic} from "../libraries/NameServiceLogic.sol";


contract RelationProfileNFT is SemanticSBTUpgradeable, NameService, PausableUpgradeable {
    using StringsUpgradeable for uint256;
    using StringsUpgradeable for address;



    function initialize(
        string memory suffix_,
        string memory name_,
        string memory symbol_,
        string memory schemaURI_,
        string[] memory classes_,
        Predicate[] memory predicates_
    ) public override initializer {
        __Pausable_init_unchained();
        super.initialize(suffix_, name_, symbol_, schemaURI_, classes_, predicates_);
    }


    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }

    function withdraw() public {
        payable(owner()).transfer(address(this).balance);
    }

    function register(address owner, string calldata name, bool resolve) external override(NameService) whenNotPaused onlyMinter returns (uint tokenId) {
        return super._register(owner, name, resolve);
    }

    function register(string calldata name, uint256 deadline, uint256 _mintCount, uint256 price, bytes memory signature) external whenNotPaused payable returns (uint tokenId) {
        require(_mintCount == 0 || getMinted() < _mintCount, "NameService: error mint count");
        require(msg.value >= price, "NameService: insufficient value");
        require(_minters[NameServiceLogic.recoverAddress(address(this), msg.sender, name, deadline, _mintCount, price, signature)], "NameService: invalid signature");
        return super._register(msg.sender, name, false);
    }

    function tokenURI(uint256 tokenId)
    public
    view
    override(NameService, SemanticSBTUpgradeable)
    returns (string memory)
    {

        return super.tokenURI(tokenId);
    }


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


    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal override(NameService, ERC721Upgradeable) virtual {
        super._beforeTokenTransfer(from, to, firstTokenId, batchSize);
    }

    function _afterTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal override(NameService, ERC721Upgradeable) virtual {
        super._afterTokenTransfer(from, to, firstTokenId, batchSize);
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

File 3 of 29 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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

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

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

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

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

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

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

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

    /**
     * @dev 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 4 of 29 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

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

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

    /**
     * @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 29 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.2) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

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

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

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

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

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

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

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

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

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

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721Upgradeable.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");

        _transfer(from, to, tokenId);
    }

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _ownerOf(tokenId) != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721Upgradeable.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

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

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

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

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

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

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

        _owners[tokenId] = to;

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

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

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

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

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

        // Clear approvals
        delete _tokenApprovals[tokenId];

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

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

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

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId, 1);

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

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

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

        emit Transfer(from, to, tokenId);

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

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

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

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

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

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

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

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
     * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
     * that `ownerOf(tokenId)` is `a`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function __unsafe_increaseBalance(address account, uint256 amount) internal {
        _balances[account] += 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[44] private __gap;
}

File 6 of 29 : IERC721EnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721EnumerableUpgradeable is IERC721Upgradeable {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

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

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

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

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

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

File 11 of 29 : 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 12 of 29 : 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 13 of 29 : 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 14 of 29 : MathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";

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

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

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

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

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

File 16 of 29 : Base64.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 *
 * _Available since v4.5._
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // Loads the table into memory
        string memory table = _TABLE;

        // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
        // and split into 4 numbers of 6 bits.
        // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
        // - `data.length + 2`  -> Round up
        // - `/ 3`              -> Number of 3-bytes chunks
        // - `4 *`              -> 4 characters for each chunk
        string memory result = new string(4 * ((data.length + 2) / 3));

        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

            // Prepare result pointer, jump over length
            let resultPtr := add(result, 32)

            // Run over the input, 3 bytes at a time
            for {
                let dataPtr := data
                let endPtr := add(data, mload(data))
            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 bytes (18 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F which is the number of
                // the previous character in the ASCII table prior to the Base64 Table
                // The result is then added to the table to get the character to write,
                // and finally write it in the result pointer but with a left shift
                // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // When data `bytes` is not exactly 3 bytes long
            // it is padded with `=` characters at the end
            switch mod(mload(data), 3)
            case 1 {
                mstore8(sub(resultPtr, 1), 0x3d)
                mstore8(sub(resultPtr, 2), 0x3d)
            }
            case 2 {
                mstore8(sub(resultPtr, 1), 0x3d)
            }
        }

        return result;
    }
}

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

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    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 = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

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

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

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

File 20 of 29 : SemanticBaseStruct.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

    enum FieldType {
        INT,
        STRING,
        ADDRESS,
        SUBJECT,
        BLANKNODE
    }

    struct IntPO {
        uint256 pIndex;
        uint256 o;
    }

    struct StringPO {
        uint256 pIndex;
        string o;
    }

    struct AddressPO {
        uint256 pIndex;
        address o;
    }

    struct SubjectPO {
        uint256 pIndex;
        uint256 oIndex;
    }

    struct BlankNodePO {
        uint256 pIndex;
        IntPO[] intO;
        StringPO[] stringO;
        AddressPO[] addressO;
        SubjectPO[] subjectO;
    }

    struct BlankNodeO {
        uint256[] pIndex;
        uint256[] oIndex;
    }

    struct SPO {
        uint160 owner;
        uint256 sIndex;
        uint256[] pIndex;
        uint256[] oIndex;
    }

    struct Predicate {
        string name;
        FieldType fieldType;
    }

    struct Subject {
        string value;
        uint256 cIndex;
    }

File 21 of 29 : SemanticSBTUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;


import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "../interfaces/ISemanticSBTSchema.sol";
import "../interfaces/ISemanticSBT.sol";
import "../interfaces/IERC5192.sol";
import "./SemanticBaseStruct.sol";
import {SemanticSBTLogicUpgradeable} from "../libraries/SemanticSBTLogicUpgradeable.sol";

contract SemanticSBTUpgradeable is Initializable, OwnableUpgradeable, ERC165Upgradeable, ERC721Upgradeable, IERC721EnumerableUpgradeable, ISemanticSBT, ISemanticSBTSchema, IERC5192 {
    using AddressUpgradeable for address;
    using StringsUpgradeable for uint256;
    using StringsUpgradeable for uint160;

    using StringsUpgradeable for address;


    string internal _name;

    string private _symbol;

    SPO[] internal _tokens;

    uint256 private _burnCount;

    mapping(uint256 => address) private _tokenApprovals;

    mapping(address => mapping(address => bool)) private _operatorApprovals;

    mapping(address => bool) internal _minters;

    bool private _transferable;

    Subject[] internal _subjects;

    mapping(uint256 => mapping(string => uint256)) internal _subjectIndex;

    string internal _baseTokenURI;

    string public schemaURI;


    mapping(string => uint256) internal _classIndex;
    string[] internal _classNames;

    mapping(string => uint256) internal _predicateIndex;
    Predicate[] internal _predicates;


    string[] internal _stringO;
    BlankNodeO[] internal _blankNodeO;

    string  constant SOUL_CLASS_NAME = "Soul";

    event SetMinter(address indexed addr, bool isMinter);

    modifier onlyMinter() {
        require(_minters[msg.sender], "SemanticSBT: must be minter");
        _;
    }

    modifier onlyTransferable() {
        require(_transferable, "SemanticSBT: must transferable");
        _;
    }


    function before_init() internal {
        __Ownable_init();
        SPO memory _spo = SPO(0, 0, new uint256[](0), new uint256[](0));
        Subject memory _subject = Subject("", 0);
        _tokens.push(_spo);
        _subjects.push(_subject);

        _classNames.push("");
        _classNames.push(SOUL_CLASS_NAME);
        _classIndex[SOUL_CLASS_NAME] = 1;
        _predicates.push(Predicate("", FieldType.INT));
    }

    /* ============ External Functions ============ */

    function initialize(
        address minter,
        string memory name_,
        string memory symbol_,
        string memory baseURI_,
        string memory schemaURI_,
        string[] memory classes_,
        Predicate[] memory predicates_
    ) public virtual initializer {
        require(keccak256(abi.encode(schemaURI_)) != keccak256(abi.encode("")), "SemanticSBT: schema URI cannot be empty");
        require(predicates_.length > 0, "SemanticSBT: predicate size can not be empty");
        before_init();
        _name = name_;
        _symbol = symbol_;
        _minters[minter] = true;
        _baseTokenURI = baseURI_;
        schemaURI = schemaURI_;

        SemanticSBTLogicUpgradeable.addClass(classes_, _classNames, _classIndex);
        SemanticSBTLogicUpgradeable.addPredicate(predicates_, _predicates, _predicateIndex);
        emit SetMinter(minter, true);
    }


    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable, ERC721Upgradeable) returns (bool) {
        return interfaceId == type(IERC721Upgradeable).interfaceId ||
        interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||
        interfaceId == type(IERC721EnumerableUpgradeable).interfaceId ||
        interfaceId == type(ISemanticSBT).interfaceId ||
        interfaceId == type(ISemanticSBTSchema).interfaceId ||
        super.supportsInterface(interfaceId);
    }

    function minters(address account) public view returns (bool) {
        return _minters[account];
    }


    function transferable() public view returns (bool) {
        return _transferable;
    }

    function locked(uint256 tokenId) external override view returns (bool){
        if (_transferable) {
            return true;
        }
        return false;
    }

    function baseURI() public view returns (string memory) {
        return _baseTokenURI;
    }


    function classIndex(string memory className_) public view returns (uint256 classIndex_) {
        classIndex_ = _classIndex[className_];
    }


    function className(uint256 cIndex) public view returns (string memory name_) {
        require(cIndex > 0 && cIndex < _classNames.length, "SemanticSBT: class not exist");
        name_ = _classNames[cIndex];
    }


    function predicateIndex(string memory predicateName_) public view returns (uint256 predicateIndex_) {
        predicateIndex_ = _predicateIndex[predicateName_];
    }


    function predicate(uint256 pIndex) public view returns (string memory name_, FieldType fieldType) {
        require(pIndex > 0 && pIndex < _predicates.length, "SemanticSBT: predicate not exist");

        Predicate memory predicate_ = _predicates[pIndex];
        name_ = predicate_.name;
        fieldType = predicate_.fieldType;
    }


    function subjectIndex(string memory subjectValue, string memory className_) public view returns (uint256){
        uint256 sIndex = _subjectIndex[_classIndex[className_]][subjectValue];
        require(sIndex > 0, "SemanticSBT: does not exist");
        return sIndex;
    }


    function subject(uint256 index) public view returns (string memory subjectValue, string memory className_){
        require(index > 0 && index < _subjects.length, "SemanticSBT: does not exist");
        subjectValue = _subjects[index].value;
        className_ = _classNames[_subjects[index].cIndex];
    }


    function rdfOf(uint256 tokenId) public view override returns (string memory) {
        require(_exists(tokenId), "SemanticSBT: SemanticSBT does not exist");
        return SemanticSBTLogicUpgradeable.buildRDF(_tokens[tokenId], _classNames, _predicates, _stringO, _subjects, _blankNodeO);
    }

    function getMinted() public view returns (uint256) {
        return _tokens.length - 1;
    }


    function isOwnerOf(address account, uint256 id)
    public
    view
    returns (bool)
    {
        address owner = ownerOf(id);
        return owner == account;
    }

    function name() public view virtual override returns (string memory) {
        return _name;
    }

    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    function tokenURI(uint256 tokenId)
    public
    view
    virtual
    override
    returns (string memory)
    {
        require(
            _exists(tokenId),
            "ERC721Metadata: URI query for nonexistent token"
        );
        return
        bytes(_baseTokenURI).length > 0
        ? string(abi.encodePacked(_baseTokenURI, tokenId.toString(), ".json"))
        : SemanticSBTLogicUpgradeable.getTokenURI(tokenId, _name, rdfOf(tokenId));
    }

    function totalSupply() public view override returns (uint256) {
        return getMinted() - _burnCount;
    }


    function tokenOfOwnerByIndex(address owner, uint256 index)
    public
    view
    returns (uint256)
    {
        uint256 currentIndex = 0;
        for (uint256 i = 1; i < _tokens.length; i++) {
            if (address(_tokens[i].owner) == owner) {
                if (currentIndex == index) {
                    return i;
                }
                currentIndex += 1;
            }
        }
        revert("ERC721Enumerable: owner index out of bounds");
    }


    function tokenByIndex(uint256 index)
    public
    view
    returns (uint256)
    {
        uint256 currentIndex = 0;
        for (uint256 i = 1; i < _tokens.length; i++) {
            if (_tokens[i].owner != 0) {
                if (currentIndex == index) {
                    return i;
                }
                currentIndex += 1;
            }
        }
        revert("ERC721Enumerable: global index out of bounds");
    }


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


    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public onlyTransferable override(IERC721Upgradeable, ERC721Upgradeable) {
        super.safeTransferFrom(from, to, tokenId, "");
    }


    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public onlyTransferable override(IERC721Upgradeable, ERC721Upgradeable) {
        super.safeTransferFrom(from, to, tokenId, _data);
    }


    function setURI(string calldata newURI) external onlyOwner {
        _baseTokenURI = newURI;
    }


    function setTransferable(bool transferable_) external onlyOwner {
        _transferable = transferable_;
    }


    function setName(string calldata newName) external virtual onlyOwner {
        _name = newName;
    }


    function setSymbol(string calldata newSymbol) external onlyOwner {
        _symbol = newSymbol;
    }


    function setMinter(address addr, bool _isMinter) external onlyOwner {
        _minters[addr] = _isMinter;
        emit SetMinter(addr, _isMinter);
    }


    /* ============ Internal Functions ============ */

    function _mint(uint256 tokenId, address account, IntPO[] memory intPOList, StringPO[] memory stringPOList,
        AddressPO[] memory addressPOList, SubjectPO[] memory subjectPOList,
        BlankNodePO[] memory blankNodePOList) internal {
        uint256[] storage pIndex = _tokens[tokenId].pIndex;
        uint256[] storage oIndex = _tokens[tokenId].oIndex;

        SemanticSBTLogicUpgradeable.mint(pIndex, oIndex, intPOList, stringPOList, addressPOList, subjectPOList, blankNodePOList, _predicates, _stringO, _subjects, _blankNodeO);
        require(pIndex.length > 0, "SemanticSBT: param error");

        super._safeMint(account, tokenId);
        emit CreateRDF(tokenId, rdfOf(tokenId));
    }

    function _mint(uint256 tokenId, address account, SubjectPO[] memory subjectPOList) internal {
        uint256[] storage pIndex = _tokens[tokenId].pIndex;
        uint256[] storage oIndex = _tokens[tokenId].oIndex;

        SemanticSBTLogicUpgradeable.addSubjectPO(pIndex, oIndex, subjectPOList, _predicates, _subjects);
        require(pIndex.length > 0, "SemanticSBT: param error");

        super._safeMint(account, tokenId);
        emit CreateRDF(tokenId, rdfOf(tokenId));
    }

    function _burn(uint256 tokenId) internal override(ERC721Upgradeable) {
        string memory _rdf = rdfOf(tokenId);
        _tokens[tokenId].owner = 0;
        super._burn(tokenId);
        _burnCount++;
        emit RemoveRDF(tokenId, _rdf);
    }

    function _addEmptyToken(address account, uint256 sIndex) internal returns (uint256){
        _tokens.push(SPO(uint160(account), sIndex, new uint256[](0), new uint256[](0)));
        return _tokens.length - 1;
    }

    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal override(ERC721Upgradeable) virtual {
        _tokens[tokenId].owner = uint160(to);
        super._transfer(from, to, tokenId);
    }

}

File 22 of 29 : IERC5192.sol
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface IERC5192 {
    /// @notice Emitted when the locking status is changed to locked.
    /// @dev If a token is minted and the status is locked, this event should be emitted.
    /// @param tokenId The identifier for a token.
    event Locked(uint256 tokenId);

    /// @notice Emitted when the locking status is changed to unlocked.
    /// @dev If a token is minted and the status is unlocked, this event should be emitted.
    /// @param tokenId The identifier for a token.
    event Unlocked(uint256 tokenId);

    /// @notice Returns the locking status of an Soulbound Token
    /// @dev SBTs assigned to zero address are considered invalid, and queries
    /// about them do throw.
    /// @param tokenId The identifier for an SBT.
    function locked(uint256 tokenId) external view returns (bool);
}

File 23 of 29 : ISemanticSBT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

/**
 * @title Semantic Soulbound Token
 * Note: the EIP-165 identifier for this interface is 0xfbafb698
 */
interface ISemanticSBT {
    /**
     * @dev This emits when minting a Semantic Soulbound Token.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @param rdfStatements The RDF statements for the Semantic Soulbound Token. An RDF statement is the statement made by an RDF triple.
     */
    event CreateRDF (
        uint256 indexed tokenId,
        string rdfStatements
    );


    /**
     * @dev This emits when updating the RDF data of Semantic Soulbound Token. RDF data is a collection of RDF statements that are used to represent information about resources.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @param rdfStatements The RDF statements for the semantic soulbound token. An RDF statement is the statement made by an RDF triple.
     */
    event UpdateRDF (
        uint256 indexed tokenId,
        string rdfStatements
    );


    /**
     * @dev This emits when burning or revoking Semantic Soulbound Token.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     * @param rdfStatements The RDF statements for the Semantic Soulbound Token. An RDF statement is the statement made by an RDF triple.
     */
    event RemoveRDF (
        uint256 indexed tokenId,
        string rdfStatements
    );

    /**
     * @dev Returns the RDF statements of the Semantic Soulbound Token. An RDF statement is the statement made by an RDF triple.
     * @param tokenId The identifier for the Semantic Soulbound Token.
     */
    function rdfOf(uint256 tokenId) external view returns (string memory);

}

File 24 of 29 : ISemanticSBTSchema.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.12;

interface ISemanticSBTSchema {

    /**
     * @dev Returns the Uniform Resource Identifier [URI](https://www.ietf.org/rfc/rfc3986.txt) for semantic metadata
     */
    function schemaURI() external view returns (string memory);
}

File 25 of 29 : INameService.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import "../ISemanticSBT.sol";

interface INameService is ISemanticSBT {

    /**
     * To register a name
     * @param owner : The owner of a name
     * @param name : The name to be registered.
     * @param reverseRecord : Whether to set a record for resolving the name.
     * @return tokenId : The tokenId.
     */
    function register(address owner, string calldata name, bool reverseRecord) external returns (uint tokenId);

    /**
     * To set a record for resolving the name, linking the name to an address.
     * @param owner : The owner of the name. If the address is zero address, then the link is canceled.
     * @param name : The name.
     */
    function setNameForAddr(address owner, string calldata name) external;

    /**
     * A profileURI set for the caller
     * @param profileURI : The transaction hash from arweave.
     */
    function setProfileURI(string memory profileURI) external;

    /**
     * To resolve a name.
     * @param name : The name.
     * @return owner : The address.
     */
    function addr(string calldata name) external view returns (address owner);

    /**
     * Reverse mapping
     * @param owner : The address.
     * @return name : The name.
     */
    function nameOf(address owner) external view returns (string memory name);

    /**
     * To query the profileURI of an address.
     * @param owner : The address.
     * @return profileURI : The transaction hash from arweave.
     */
    function profileURI(address owner) external view returns (string memory profileURI);


}

File 26 of 29 : NameServiceLogic.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import "../core/SemanticBaseStruct.sol";
import '@openzeppelin/contracts/utils/Base64.sol';
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {StringUtils} from "./StringUtils.sol";


library NameServiceLogic {
    using StringUtils for *;
    using StringsUpgradeable for uint256;
    using StringsUpgradeable for address;
    using ECDSA for bytes;
    using ECDSA for bytes32;

    uint256 constant HOLD_PREDICATE_INDEX = 1;
    uint256 constant RESOLVE_PREDICATE_INDEX = 2;
    string constant DESCRIPTION = "Name Service";
    string constant BACK_IMG = "";


    function register(address caller, address owner, uint256 sIndex, bool resolve,
        mapping(address => uint256) storage _ownedResolvedName,
        mapping(uint256 => address) storage _ownerOfResolvedName) external returns (SubjectPO[] memory) {
        SubjectPO[] memory subjectPOList = new SubjectPO[](1);
        if (resolve) {
            require(caller == owner, "NameService:can not set for others");
            setNameForAddr(owner, sIndex,
                _ownedResolvedName,
                _ownerOfResolvedName);
            subjectPOList[0] = SubjectPO(RESOLVE_PREDICATE_INDEX, sIndex);
        } else {
            subjectPOList[0] = SubjectPO(HOLD_PREDICATE_INDEX, sIndex);
        }
        return subjectPOList;
    }


    /**
     * To set a record for resolving the name, linking the name to an address.
     * @param addr : The owner of the name. If the address is zero address, then the link is canceled.
     */
    function setNameForAddr(address addr, uint256 dSIndex,
        mapping(address => uint256) storage _ownedResolvedName,
        mapping(uint256 => address) storage _ownerOfResolvedName) public {
        if (addr != address(0)) {
            require(_ownerOfResolvedName[dSIndex] == address(0), "NameService:already resolved");
            if (_ownedResolvedName[addr] != 0) {
                delete _ownerOfResolvedName[_ownedResolvedName[addr]];
            }
        } else {
            require(_ownerOfResolvedName[dSIndex] != address(0), "NameService:not resolved");
            delete _ownedResolvedName[_ownerOfResolvedName[dSIndex]];
        }
        _ownedResolvedName[addr] = dSIndex;
        _ownerOfResolvedName[dSIndex] = addr;
    }

    function updatePIndexOfToken(address addr, SPO storage spo) public {
        if (addr == address(0)) {
            spo.pIndex[0] = HOLD_PREDICATE_INDEX;
        } else {
            spo.pIndex[0] = RESOLVE_PREDICATE_INDEX;
        }
    }


    function checkValidLength(string memory name,
        uint256 _minNameLength,
        uint256 _maxNameLength,
        mapping(uint256 => uint256) storage _nameLengthControl,
        mapping(uint256 => uint256) storage _countOfNameLength) external view returns (bool){
        uint256 len = name.strlen();
        if (len < _minNameLength) {
            return false;
        }
        if (_maxNameLength > 0 && len > _maxNameLength) {
            return false;
        }
        if (_nameLengthControl[len] == 0) {
            return true;
        } else if (_nameLengthControl[len] - _countOfNameLength[len] > 0) {
            return true;
        }
        return false;
    }

    function isZeroWidth(string memory name) external pure returns (bool) {
        bytes memory nb = bytes(name);
        // zero width for /u200b /u200c /u200d and U+FEFF
        for (uint256 i; i < nb.length - 2; i++) {
            if (bytes1(nb[i]) == 0xe2 && bytes1(nb[i + 1]) == 0x80) {
                if (bytes1(nb[i + 2]) == 0x8b || bytes1(nb[i + 2]) == 0x8c || bytes1(nb[i + 2]) == 0x8d) {
                    return true;
                }
            } else if (bytes1(nb[i]) == 0xef) {
                if (bytes1(nb[i + 1]) == 0xbb && bytes1(nb[i + 2]) == 0xbf) return true;
            }
        }
        return false;
    }


    function getTokenURI(
        uint256 id,
        string calldata name,
        string calldata rdf
    ) external pure returns (string memory) {
        return
        string(
            abi.encodePacked(
                'data:application/json;base64,',
                Base64.encode(
                    abi.encodePacked(
                        '{"name":"',
                        id.toString(),
                        '","description":"',
                        DESCRIPTION,
                        '","image":"data:image/svg+xml;base64,',
                        _getSVGImageBase64Encoded(name),
                        '","attributes":[{"trait_type":"id","value":"#',
                        id.toString(),
                        '"},{"trait_type":"semantic_rdf","value":"',
                        rdf,
                        '"}]}'
                    )
                )
            )
        );
    }


    function recoverAddress(address contractAddress, address caller, string calldata name, uint256 deadline, uint256 _mintCount, uint256 price, bytes memory signature) external view returns (address) {
        require(deadline > block.timestamp, "NameService:signature expired");
        bytes32 hash = keccak256(
            abi.encodePacked(
                contractAddress,
                caller,
                deadline,
                _mintCount,
                price,
                name
            )
        ).toEthSignedMessageHash();
        return hash.recover(signature);
    }


    function _getSVGImageBase64Encoded(string memory name)
    internal
    pure
    returns (string memory)
    {
        return
        Base64.encode(
            abi.encodePacked(
                '<svg  class="icon" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" width="512" height="512" fill="white" > <defs> <pattern id="backImg" patternUnits="userSpaceOnUse" x="0" y="0" width="512" height="512"> <image width="512" height="512" preserveAspectRatio="none" href="',
                BACK_IMG,
                '"/> </pattern></defs><rect xmlns="http://www.w3.org/2000/svg" id="default-picture-background" x="0" width="512" height="512" fill="url(#backImg)"/> <text x="40" y="450" fill="#FF4F99" font-size="28" >',
                name,
                '</text></svg>'
            )
        );
    }

}

File 27 of 29 : SemanticSBTLogicUpgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;

import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import '@openzeppelin/contracts/utils/Base64.sol';
import "../core/SemanticBaseStruct.sol";

library SemanticSBTLogicUpgradeable {
    using AddressUpgradeable for address;
    using StringsUpgradeable for uint256;
    using StringsUpgradeable for uint160;
    using StringsUpgradeable for address;


    struct Signature {
        uint8 v;
        bytes32 r;
        bytes32 s;
        uint256 deadline;
    }

    struct SemanticStorage {
        string[] _classNames;
        Predicate[] _predicates;
        string[] _stringO;
        Subject[] _subjects;
        BlankNodeO[] _blankNodeO;
    }

    string  constant TURTLE_LINE_SUFFIX = ";";
    string  constant TURTLE_END_SUFFIX = " . ";
    string  constant SOUL_CLASS_NAME = "Soul";

    string  constant public ENTITY_PREFIX = ":";
    string  constant public PROPERTY_PREFIX = "p:";

    string  constant CONCATENATION_CHARACTER = "_";
    string  constant BLANK_NODE_START_CHARACTER = "[";
    string  constant BLANK_NODE_END_CHARACTER = "]";
    string  constant BLANK_SPACE = " ";

    bytes32 internal constant EIP712_REVISION_HASH = keccak256('1');
    bytes32 internal constant EIP712_DOMAIN_TYPE_HASH = keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)');


    function addClass(string[] calldata classList, string[] storage _classNames, mapping(string => uint256) storage _classIndex) external {
        uint256 len = classList.length;
        for (uint256 i; i < len;) {
            string memory className_ = classList[i];
            require(
                keccak256(abi.encode(className_)) != keccak256(abi.encode("")),
                "SemanticSBT: Class cannot be empty"
            );
            require(_classIndex[className_] == 0, "SemanticSBT: class already added");
            _classNames.push(className_);
            _classIndex[className_] = _classNames.length - 1;
            unchecked{
                ++i;
            }
        }
    }


    function addPredicate(Predicate[] calldata predicates, Predicate[] storage _predicates, mapping(string => uint256) storage _predicateIndex) external {
        uint256 len = predicates.length;
        for (uint256 i; i < len; ) {
            Predicate memory predicate_ = predicates[i];
            require(
                keccak256(abi.encode(predicate_.name)) !=
                keccak256(abi.encode("")),
                "SemanticSBT: Predicate cannot be empty"
            );
            require(_predicateIndex[predicate_.name] == 0, "SemanticSBT: predicate already added");
            _predicates.push(predicate_);
            _predicateIndex[predicate_.name] = _predicates.length - 1;
            unchecked{
                ++i;
            }
        }
    }


    function addSubject(string calldata value, string calldata className_,
        Subject[] storage _subjects,
        mapping(uint256 => mapping(string => uint256)) storage _subjectIndex,
        mapping(string => uint256) storage _classIndex) external returns (uint256 sIndex) {
        uint256 cIndex = _classIndex[className_];
        require(cIndex > 0, "SemanticSBT: param error");
        require(_subjectIndex[cIndex][value] == 0, "SemanticSBT: subject already added");
        sIndex = _addSubject(value, cIndex, _subjects, _subjectIndex);
    }

    function mint(uint256[] storage pIndex, uint256[] storage oIndex,
        IntPO[] memory intPOList, StringPO[] memory stringPOList, AddressPO[] memory addressPOList, SubjectPO[] memory subjectPOList,
        BlankNodePO[] memory blankNodePOList, Predicate[] storage _predicates, string[] storage _stringO, Subject[] storage _subjects, BlankNodeO[] storage _blankNodeO) external {

        addIntPO(pIndex, oIndex, intPOList, _predicates);
        addStringPO(pIndex, oIndex, stringPOList, _predicates, _stringO);
        addAddressPO(pIndex, oIndex, addressPOList, _predicates);
        addSubjectPO(pIndex, oIndex, subjectPOList, _predicates, _subjects);
        addBlankNodePO(pIndex, oIndex, blankNodePOList, _predicates, _stringO, _subjects, _blankNodeO);

    }


    function addIntPO(uint256[] storage pIndex, uint256[] storage oIndex, IntPO[] memory intPOList, Predicate[] storage _predicates) internal {
        uint256 len = intPOList.length;
        for (uint256 i; i < len; ) {
            IntPO memory intPO = intPOList[i];
            checkPredicate(intPO.pIndex, FieldType.INT, _predicates);
            pIndex.push(intPO.pIndex);
            oIndex.push(intPO.o);
            unchecked{
                ++i;
            }
        }
    }

    function addStringPO(uint256[] storage pIndex, uint256[] storage oIndex, StringPO[] memory stringPOList, Predicate[] storage _predicates, string[] storage _stringO) internal {
        uint256 len = stringPOList.length;
        for (uint256 i; i < len; ) {
            StringPO memory stringPO = stringPOList[i];
            checkPredicate(stringPO.pIndex, FieldType.STRING, _predicates);
            uint256 _oIndex = _stringO.length;
            _stringO.push(stringPO.o);
            pIndex.push(stringPO.pIndex);
            oIndex.push(_oIndex);
            unchecked{
                ++i;
            }
        }
    }

    function addAddressPO(uint256[] storage pIndex, uint256[] storage oIndex, AddressPO[] memory addressPOList, Predicate[] storage _predicates) internal {
        uint256 len = addressPOList.length;
        for (uint256 i; i < len;) {
            AddressPO memory addressPO = addressPOList[i];
            checkPredicate(addressPO.pIndex, FieldType.ADDRESS, _predicates);
            pIndex.push(addressPO.pIndex);
            oIndex.push(uint160(addressPO.o));
            unchecked{
                ++i;
            }
        }
    }

    function addSubjectPO(uint256[] storage pIndex, uint256[] storage oIndex, SubjectPO[] memory subjectPOList, Predicate[] storage _predicates, Subject[] storage _subjects) internal {
        uint256 len = subjectPOList.length;
        for (uint256 i; i < len;) {
            SubjectPO memory subjectPO = subjectPOList[i];
            checkPredicate(subjectPO.pIndex, FieldType.SUBJECT, _predicates);
            require(subjectPO.oIndex > 0 && subjectPO.oIndex < _subjects.length, "SemanticSBT: subject not exist");
            pIndex.push(subjectPO.pIndex);
            oIndex.push(subjectPO.oIndex);
            unchecked{
                ++i;
            }
        }
    }

    function addBlankNodePO(uint256[] storage pIndex, uint256[] storage oIndex, BlankNodePO[] memory blankNodePOList, Predicate[] storage _predicates, string[] storage _stringO, Subject[] storage _subjects, BlankNodeO[] storage _blankNodeO) internal {
        uint256 len = blankNodePOList.length;
        for (uint256 i; i < len;) {
            BlankNodePO memory blankNodePO = blankNodePOList[i];
            require(blankNodePO.pIndex < _predicates.length, "SemanticSBT: predicate not exist");

            uint256 _blankNodeOIndex = _blankNodeO.length;
            _blankNodeO.push(BlankNodeO(new uint256[](0), new uint256[](0)));
            uint256[] storage blankNodePIndex = _blankNodeO[_blankNodeOIndex].pIndex;
            uint256[] storage blankNodeOIndex = _blankNodeO[_blankNodeOIndex].oIndex;

            addIntPO(blankNodePIndex, blankNodeOIndex, blankNodePO.intO, _predicates);
            addStringPO(blankNodePIndex, blankNodeOIndex, blankNodePO.stringO, _predicates, _stringO);
            addAddressPO(blankNodePIndex, blankNodeOIndex, blankNodePO.addressO, _predicates);
            addSubjectPO(blankNodePIndex, blankNodeOIndex, blankNodePO.subjectO, _predicates, _subjects);

            pIndex.push(blankNodePO.pIndex);
            oIndex.push(_blankNodeOIndex);
            unchecked{
                ++i;
            }
        }
    }



    function buildRDF(SPO storage spo, string[] storage _classNames, Predicate[] storage _predicates, string[] storage _stringO, Subject[] storage _subjects, BlankNodeO[] storage _blankNodeO) external view returns (string memory _rdf){
        _rdf = buildS(spo, _classNames, _subjects);

        uint256 len = spo.pIndex.length;
        for (uint256 i; i < len;) {
            uint256 pIndex = spo.pIndex[i];
            uint256 oIndex = spo.oIndex[i];
            FieldType fieldType = _predicates[pIndex].fieldType;
            if (FieldType.INT == fieldType) {
                _rdf = string.concat(_rdf, buildIntRDF(oIndex, _predicates[pIndex].name));
            } else if (FieldType.STRING == fieldType) {
                _rdf = string.concat(_rdf, buildStringRDF(_predicates[pIndex].name, _stringO[oIndex]));
            } else if (FieldType.ADDRESS == fieldType) {
                _rdf = string.concat(_rdf, buildAddressRDF(oIndex, _predicates[pIndex].name));
            } else if (FieldType.SUBJECT == fieldType) {
                _rdf = string.concat(_rdf, buildSubjectRDF(_classNames[_subjects[oIndex].cIndex], _predicates[pIndex].name, _subjects[oIndex].value));
            } else if (FieldType.BLANKNODE == fieldType) {
                _rdf = string.concat(_rdf, buildBlankNodeRDF(pIndex, oIndex, _classNames, _predicates, _stringO, _subjects, _blankNodeO));
            }
            string memory suffix = i == len - 1 ? TURTLE_END_SUFFIX : TURTLE_LINE_SUFFIX;
            _rdf = string.concat(_rdf, suffix);
            unchecked{
                ++i;
            }
        }
    }

    function buildS(SPO storage spo, string[] storage _classNames, Subject[] storage _subjects) public view returns (string memory){
        uint256 sIndex = spo.sIndex;
        string memory _className = sIndex == 0 ? SOUL_CLASS_NAME : _classNames[_subjects[sIndex].cIndex];
        string memory subjectValue = sIndex == 0 ? address(spo.owner).toHexString() : _subjects[sIndex].value;
        return string.concat(ENTITY_PREFIX, _className, CONCATENATION_CHARACTER, subjectValue, BLANK_SPACE);
    }

    function buildIntRDF(uint256 oIndex, string storage name) internal view returns (string memory){
        string memory p = string.concat(PROPERTY_PREFIX, name);
        string memory o = oIndex.toString();
        return string.concat(p, BLANK_SPACE, o);
    }

    function buildStringRDF(string storage name, string storage _stringO) internal view returns (string memory){
        string memory p = string.concat(PROPERTY_PREFIX, name);
        string memory o = string.concat('"', _stringO, '"');
        return string.concat(p, BLANK_SPACE, o);
    }

    function buildAddressRDF(uint256 oIndex, string storage name) internal view returns (string memory){
        string memory p = string.concat(PROPERTY_PREFIX, name);
        string memory o = string.concat(ENTITY_PREFIX, SOUL_CLASS_NAME, CONCATENATION_CHARACTER, address(uint160(oIndex)).toHexString());
        return string.concat(p, BLANK_SPACE, o);
    }


    function buildSubjectRDF(string storage _className, string storage name, string storage value) internal view returns (string memory){
        string memory p = string.concat(PROPERTY_PREFIX, name);
        string memory o = string.concat(ENTITY_PREFIX, _className, CONCATENATION_CHARACTER, value);
        return string.concat(p, BLANK_SPACE, o);
    }


    function buildBlankNodeRDF(uint256 pIndex, uint256 oIndex, string[] storage _classNames, Predicate[] storage _predicates, string[] storage _stringO, Subject[] storage _subjects, BlankNodeO[] storage _blankNodeO) internal view returns (string memory){
        string memory p = string.concat(PROPERTY_PREFIX, _predicates[pIndex].name);

        uint256[] memory blankPList = _blankNodeO[oIndex].pIndex;
        uint256[] memory blankOList = _blankNodeO[oIndex].oIndex;

        string memory _rdf = "";
        for (uint256 i; i < blankPList.length;) {
            FieldType fieldType = _predicates[blankPList[i]].fieldType;
            if (FieldType.INT == fieldType) {
                _rdf = string.concat(_rdf, buildIntRDF(blankOList[i], _predicates[blankPList[i]].name));
            } else if (FieldType.STRING == fieldType) {
                _rdf = string.concat(_rdf, buildStringRDF(_predicates[blankPList[i]].name, _stringO[blankOList[i]]));
            } else if (FieldType.ADDRESS == fieldType) {
                _rdf = string.concat(_rdf, buildAddressRDF(blankOList[i], _predicates[blankPList[i]].name));
            } else if (FieldType.SUBJECT == fieldType) {
                _rdf = string.concat(_rdf, buildSubjectRDF(_classNames[_subjects[blankOList[i]].cIndex], _predicates[blankPList[i]].name, _subjects[blankOList[i]].value));
            }
            if (i < blankPList.length - 1) {
                _rdf = string.concat(_rdf, TURTLE_LINE_SUFFIX);
            }
            unchecked{
                ++i;
            }
        }

        return string.concat(p, BLANK_SPACE, BLANK_NODE_START_CHARACTER, _rdf, BLANK_NODE_END_CHARACTER);
    }

    function buildStringRDFCustom(string calldata class, string calldata entityValue, string calldata predicate, string calldata o) external pure returns (string memory){
        string memory s = string.concat(ENTITY_PREFIX, class, CONCATENATION_CHARACTER, entityValue, BLANK_SPACE);
        string memory p = string.concat(PROPERTY_PREFIX, predicate, BLANK_SPACE);
        return string.concat(s, p, o, TURTLE_END_SUFFIX);
    }

    function getTokenURI(
        uint256 id,
        string memory description,
        string memory rdf
    ) external pure returns (string memory) {
        return
        string(
            abi.encodePacked(
                'data:application/json;base64,',
                Base64.encode(
                    abi.encodePacked(
                        '{"name":"',
                        id.toString(),
                        '","description":"',
                        description,
                        '","image":"data:image/svg+xml;base64,',
                        _getSVGImageBase64Encoded(getText(10, 150, rdf)),
                        '"}'
                    )
                )
            )
        );
    }


    function _getSVGImageBase64Encoded(string memory text)
    internal
    pure
    returns (string memory)
    {
        return
        Base64.encode(
            abi.encodePacked(
                '<svg  class="icon" viewBox="0 0 1200 450" version="1.1" xmlns="http://www.w3.org/2000/svg" width="1200" height="450" fill="white" > <rect xmlns="http://www.w3.org/2000/svg" x="0" width="1200" height="450" fill="white"/>',
                text,
                '</svg>'
            )
        );
    }


    function getText(uint256 x, uint256 y, string memory content) public pure returns (string memory){
        return string.concat(
            '<text x="',
            x.toString(),
            '" y="',
            y.toString(),
            '" fill="black" font-size="20" >',
            content,
            '</text>');
    }


    function recoverSignerFromSignature(string calldata name, address contractAddress, bytes32 hashedMessage, address expectedAddress, Signature calldata sig) external view returns (address){
        require(sig.deadline > block.timestamp, "SemanticSBT: signature expired");
        address signer = ecrecover(_calculateDigest(name, contractAddress, hashedMessage),
            sig.v,
            sig.r,
            sig.s);
        require(expectedAddress == signer, "SemanticSBT: signature invalid");
        return signer;
    }


    function _calculateDigest(string memory name, address contractAddress, bytes32 hashedMessage) internal view returns (bytes32) {
        bytes32 digest;
        unchecked {
            digest = keccak256(
                abi.encodePacked('\x19\x01', _calculateDomainSeparator(name, contractAddress), hashedMessage)
            );
        }
        return digest;
    }

    function _calculateDomainSeparator(string memory name, address contractAddress) internal view returns (bytes32){
        return
        keccak256(
            abi.encode(
                EIP712_DOMAIN_TYPE_HASH,
                keccak256(bytes(name)),
                EIP712_REVISION_HASH,
                block.chainid,
                contractAddress
            )
        );
    }


    function checkPredicate(uint256 pIndex, FieldType fieldType, Predicate[] storage _predicates) public view {
        require(pIndex > 0 && pIndex < _predicates.length, "SemanticSBT: predicate not exist");
        require(_predicates[pIndex].fieldType == fieldType, "SemanticSBT: predicate type error");
    }


    function _addSubject(string memory value, uint256 cIndex,
        Subject[] storage _subjects,
        mapping(uint256 => mapping(string => uint256)) storage _subjectIndex) public returns (uint256 sIndex){
        sIndex = _subjects.length;
        _subjectIndex[cIndex][value] = sIndex;
        _subjects.push(Subject(value, cIndex));
    }
}

File 28 of 29 : StringUtils.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.12;

library StringUtils {
    /**
     * @dev Returns the length of a given string
     *
     * @param s The string to measure the length of
     * @return The length of the input string
     */
    function strlen(string memory s) internal pure returns (uint256) {
        uint256 len;
        uint256 i = 0;
        uint256 bytelength = bytes(s).length;
        for (len = 0; i < bytelength; len++) {
            bytes1 b = bytes(s)[i];
            if (b < 0x80) {
                i += 1;
            } else if (b < 0xE0) {
                i += 2;
            } else if (b < 0xF0) {
                i += 3;
            } else if (b < 0xF8) {
                i += 4;
            } else if (b < 0xFC) {
                i += 5;
            } else {
                i += 6;
            }
        }
        return len;
    }
}

File 29 of 29 : NameService.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.8.4;

import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";

import "../core/SemanticSBTUpgradeable.sol";
import "../interfaces/social/INameService.sol";
import {SemanticSBTLogicUpgradeable} from "../libraries/SemanticSBTLogicUpgradeable.sol";
import {NameServiceLogic} from "../libraries/NameServiceLogic.sol";


contract NameService is INameService, SemanticSBTUpgradeable {
    using StringsUpgradeable for uint256;
    using StringsUpgradeable for address;

    uint256 internal constant PROFILE_URI_PREDICATE_INDEX = 3;

    uint256 internal constant NAME_CLASS_INDEX = 2;


    string public suffix;


    mapping(address => uint256) internal _ownedResolvedName;
    mapping(uint256 => address) internal _ownerOfResolvedName;

    mapping(address => string) internal _profileURI;
    mapping(address => bool) internal _ownedProfileURI;

    function initialize(
        string memory suffix_,
        string memory name_,
        string memory symbol_,
        string memory schemaURI_,
        string[] memory classes_,
        Predicate[] memory predicates_
    ) public virtual initializer {
        super.initialize(msg.sender, name_, symbol_, "", schemaURI_, classes_, predicates_);
        suffix = suffix_;
    }


    function register(address owner, string calldata name, bool resolve) external virtual override returns (uint tokenId) {
        return _register(owner, name, resolve);
    }


    /**
     * To set a record for resolving the name, linking the name to an address.
     * @param addr_ : The owner of the name. If the address is zero address, then the link is canceled.
     * @param name : The name.
     */
    function setNameForAddr(address addr_, string calldata name) external override {
        require(addr_ == msg.sender || addr_ == address(0), "NameService:can not set for others");
        uint256 sIndex = _subjectIndex[NAME_CLASS_INDEX][name];
        uint256 tokenId = sIndex;
        require(ownerOf(tokenId) == msg.sender, "NameService:not the owner");
        SPO storage spo = _tokens[tokenId];
        NameServiceLogic.setNameForAddr(addr_, sIndex,
            _ownedResolvedName,
            _ownerOfResolvedName);
        NameServiceLogic.updatePIndexOfToken(addr_, spo);
        emit UpdateRDF(tokenId, rdfOf(tokenId));
    }

    function setProfileURI(string calldata profileURI_) external {
        _profileURI[msg.sender] = profileURI_;
        string memory rdf = SemanticSBTLogicUpgradeable.buildStringRDFCustom(SOUL_CLASS_NAME, msg.sender.toHexString(), _predicates[PROFILE_URI_PREDICATE_INDEX].name, string.concat('"', profileURI_, '"'));
        if (!_ownedProfileURI[msg.sender]) {
            _ownedProfileURI[msg.sender] = true;
            emit CreateRDF(0, rdf);
        } else {
            emit UpdateRDF(0, rdf);
        }
    }



    function addr(string calldata name) virtual override external view returns (address){
        uint256 sIndex = _subjectIndex[NAME_CLASS_INDEX][name];
        return _ownerOfResolvedName[sIndex];
    }


    function nameOf(address addr_) external view returns (string memory){
        if (addr_ == address(0)) {
            return "";
        }
        uint256 sIndex = _ownedResolvedName[addr_];
        return _subjects[sIndex].value;
    }

    function nameOfTokenId(uint256 tokenId) external view returns (string memory){
        return _subjects[tokenId].value;
    }

    function profileURI(address addr_) external view returns (string memory){
        return _profileURI[addr_];
    }

    function tokenURI(uint256 tokenId)
    public
    virtual
    view
    override(SemanticSBTUpgradeable)
    returns (string memory)
    {
        require(
            _exists(tokenId),
            "ERC721Metadata: URI query for nonexistent token"
        );
        return
        bytes(_baseTokenURI).length > 0
        ? string(abi.encodePacked(_baseTokenURI, tokenId.toString(), ".json"))
        : NameServiceLogic.getTokenURI(tokenId, _subjects[tokenId].value, rdfOf(tokenId));
    }

    function ownerOfName(string calldata name) external view returns (address){
        uint256 sIndex = _subjectIndex[NAME_CLASS_INDEX][name];
        return ownerOf(sIndex);
    }


    function supportsInterface(bytes4 interfaceId) public view virtual override(SemanticSBTUpgradeable) returns (bool) {
        return interfaceId == type(INameService).interfaceId ||
        super.supportsInterface(interfaceId);
    }


    function _register(address owner, string calldata name, bool resolve) internal returns (uint tokenId) {
        string memory fullName = string.concat(name, suffix);
        require(_subjectIndex[NAME_CLASS_INDEX][fullName] == 0, "NameService: already added");
        tokenId = _addEmptyToken(owner, 0);
        uint256 sIndex = SemanticSBTLogicUpgradeable._addSubject(fullName, NAME_CLASS_INDEX, _subjects, _subjectIndex);
        SubjectPO[] memory subjectPOList = NameServiceLogic.register(msg.sender, owner, sIndex, resolve,
            _ownedResolvedName, _ownerOfResolvedName
        );
        _mint(tokenId, owner,  subjectPOList);
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal override(ERC721Upgradeable) virtual {
        require(from == address(0) || _ownerOfResolvedName[firstTokenId] == address(0), "NameService:can not transfer when resolved");
        super._beforeTokenTransfer(from, to, firstTokenId, batchSize);
    }

    function _afterTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal override(ERC721Upgradeable) virtual {
        super._afterTokenTransfer(from, to, firstTokenId, batchSize);
        if (from != address(0)) {
            emit UpdateRDF(firstTokenId, rdfOf(firstTokenId));
        }
    }


}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1,
    "details": {
      "yul": true
    }
  },
  "viaIR": true,
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {
    "contracts/libraries/NameServiceLogic.sol": {
      "NameServiceLogic": "0x3447e2358827ece35d2838109c98f2dc30ec9e76"
    },
    "contracts/libraries/SemanticSBTLogicUpgradeable.sol": {
      "SemanticSBTLogicUpgradeable": "0xbb7e16c3832d46817279f32c57225d5f811236aa"
    }
  }
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"rdfStatements","type":"string"}],"name":"CreateRDF","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Locked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"rdfStatements","type":"string"}],"name":"RemoveRDF","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"bool","name":"isMinter","type":"bool"}],"name":"SetMinter","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Unlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"rdfStatements","type":"string"}],"name":"UpdateRDF","type":"event"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"addr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"className_","type":"string"}],"name":"classIndex","outputs":[{"internalType":"uint256","name":"classIndex_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"cIndex","type":"uint256"}],"name":"className","outputs":[{"internalType":"string","name":"name_","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"suffix_","type":"string"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"string","name":"schemaURI_","type":"string"},{"internalType":"string[]","name":"classes_","type":"string[]"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"enum FieldType","name":"fieldType","type":"uint8"}],"internalType":"struct Predicate[]","name":"predicates_","type":"tuple[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"string","name":"baseURI_","type":"string"},{"internalType":"string","name":"schemaURI_","type":"string"},{"internalType":"string[]","name":"classes_","type":"string[]"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"enum FieldType","name":"fieldType","type":"uint8"}],"internalType":"struct Predicate[]","name":"predicates_","type":"tuple[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"isOwnerOf","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"minters","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"}],"name":"nameOf","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"nameOfTokenId","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"ownerOfName","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"pIndex","type":"uint256"}],"name":"predicate","outputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"enum FieldType","name":"fieldType","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"predicateName_","type":"string"}],"name":"predicateIndex","outputs":[{"internalType":"uint256","name":"predicateIndex_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"}],"name":"profileURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"rdfOf","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"bool","name":"resolve","type":"bool"}],"name":"register","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"_mintCount","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"register","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"schemaURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"bool","name":"_isMinter","type":"bool"}],"name":"setMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newName","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr_","type":"address"},{"internalType":"string","name":"name","type":"string"}],"name":"setNameForAddr","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"profileURI_","type":"string"}],"name":"setProfileURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newSymbol","type":"string"}],"name":"setSymbol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"transferable_","type":"bool"}],"name":"setTransferable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"subject","outputs":[{"internalType":"string","name":"subjectValue","type":"string"},{"internalType":"string","name":"className_","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"subjectValue","type":"string"},{"internalType":"string","name":"className_","type":"string"}],"name":"subjectIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"suffix","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transferable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60808060405234610016576155d5908161001d8239f35b50600080fdfe6040608081526004361015610015575b50600080fd5b600090813560e01c806301ffc9a7146108ec57806302fe5305146108d457806306fdde03146108b8578063081812fc1461089c578063095ea7b314610884578063152407ae1461086857806318160ddd1461084c5780631897c0bc1461082c57806323b872dd146108145780632f745c59146107f75780633ccfd60b146107e05780633f4ba83a146107c957806342842e0e146107b157806343aaf2b0146107935780634f6ccce714610777578063511b1df91461073c57806358e23bac146107205780635c975abb146106f55780636352211e146106d95780636c0360eb146106bd57806370a08231146106a1578063715018a61461068a578063786d6b97146106725780637f873749146106395780638456cb59146106225780638da5cb5b146105f757806392ff0d31146105cc5780639377268d146105b057806395d89b41146105945780639cd237071461057d578063a1f0702d1461055f578063a22cb46514610547578063a6c1653d1461052a578063a78d24311461050e578063a9ff13a6146104e5578063ac72200d146104ba578063b45a3c0e1461049d578063b84c824614610485578063b88d4fde1461046a578063c47f002714610452578063c5b8f77214610435578063c87b56dd14610419578063c911994114610401578063cf456ae7146103e9578063d49116f5146103cb578063d4b0c403146103a2578063deeec34414610386578063e985e9c514610356578063f294e2491461033a578063f2fde38b14610320578063f46eccc4146102da578063f5c57382146102be578063f7073c3a146102a25763fbafb69814610274575061000f565b3461029e5761029a915061028f61028a36610a42565b612ef8565b905191829182610a31565b0390f35b5080fd5b503461029e5761029a91506102b6366109be565b61028f610fff565b503461029e5761029a915061028f6102d536611084565b6147e5565b503461029e5761029a915061030f6102f136611084565b6001600160a01b0316600090815260cf602052604090205460ff1690565b905191829182901515815260200190565b503461029e5761033761033236611084565b6115d5565b51f35b503461029e5761029a915061028f61035136611084565b614833565b503461029e5761029a915061030f61037f61037a61037336611517565b91906116a6565b61170e565b5460ff1690565b503461029e5761029a915061028f61039d36610a42565b612c2b565b503461029e5761029a91506103be6103b936610a42565b612d45565b92909151928392836114f6565b503461029e576103376103dd36611419565b95949094939193611b10565b503461029e576103376103fb36611307565b90613952565b503461029e57610337610413366113e1565b91614379565b503461029e5761029a915061028f61043036610a42565b614958565b503461029e5761029a915061030f61044c36610a88565b90613024565b503461029e5761033761046436610989565b9061379e565b503461029e5761033761047c36611398565b929190916135c3565b503461029e5761033761049736610989565b90613878565b503461029e5761029a91506104b136610a42565b5061030f612c0a565b503461029e5761029a91506104ce366109be565b6104d6613004565b90519081529081906020820190565b503461029e5761029a91506105016104fc36610a42565b612e20565b9290915192839283611373565b503461029e5761029a915061028f61052536610a42565b614824565b503461029e5761029a91506104d661054136611330565b90612df4565b503461029e5761033761055936611307565b90611975565b503461029e576103376105713661125d565b94939093929192613b3c565b503461029e5761033761058f3661109c565b613784565b503461029e5761029a91506105a8366109be565b61028f610ed5565b503461029e5761029a91506104d66105c736610bbd565b612cd2565b503461029e5761029a91506105e0366109be565b60ff60d05416905191829182901515815260200190565b503461029e5761029a915061060b366109be565b60335490519182916001600160a01b031682610a54565b503461029e57610631366109be565b610337613cb7565b503461029e5761029a915061066761066161065336610989565b61065b61191b565b91614317565b546117e6565b905191829182610a54565b503461029e5761033761068436610989565b9061455c565b503461029e57610699366109be565b61033761153c565b503461029e5761029a91506104d66106b836611084565b611725565b503461029e5761029a91506106d1366109be565b61028f610e4e565b503461029e5761029a91506106676106f036610a42565b6117e6565b503461029e5761029a9150610709366109be565b60ff60e05416905191829182901515815260200190565b503461029e5761029a9150610734366109be565b61028f610f5c565b503461029e5761029a915061066761076a61075961065336610989565b5460005260dd602052604060002090565b546001600160a01b031690565b503461029e5761029a91506104d661078e36610a42565b61314f565b5061029a91506104d66107a536610c67565b94939093929192613fc0565b503461029e576103376107c336610c3b565b91613366565b503461029e576107d8366109be565b610337613d45565b503461029e576107ef366109be565b610337613dca565b503461029e5761029a91506104d661080e36610a88565b9061307a565b503461029e5761033761082636610c3b565b9161326a565b503461029e5761029a91506104d661084336610be7565b92919091613dfd565b503461029e5761029a9150610860366109be565b6104d661303f565b503461029e5761029a91506104d661087f36610bbd565b612c1e565b503461029e5761033761089636610a88565b90611809565b503461029e5761029a91506106676108b336610a42565b611949565b503461029e5761029a91506108cc366109be565b61028f610da9565b503461029e576103376108e636610989565b906135dd565b50503461091a5750607f1961091561090b61090636610930565b614b83565b151560805260a090565b016080f35b80fd5b6001600160e01b03198116141561000f57565b602090600319011261000f576004356109488161091d565b90565b9181601f84011215610978578235916001600160401b038311610980576020838186019501011161097857565b505050600080fd5b50505050600080fd5b60206003198201126109b757600435906001600160401b038211610978576109b39160040161094b565b9091565b5050600080fd5b600090600319011261000f57565b600091031261000f57565b918091926000905b8282106109f75750116109f0575050565b6000910152565b915080602091830151818601520182916109df565b90602091610a25815180928185528580860191016109d7565b601f01601f1916010190565b906020610948928181520190610a0c565b602090600319011261000f5760043590565b6001600160a01b03909116815260200190565b6001600160a01b038116141561000f57565b60043590610a8682610a67565b565b604090600319011261000f57600435610aa081610a67565b9060243590565b50634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b03821117610ad957604052565b610ae1610aa7565b604052565b602081019081106001600160401b03821117610ad957604052565b606081019081106001600160401b03821117610ad957604052565b601f909101601f19168101906001600160401b03821190821017610ad957604052565b60405190610a8682610abe565b6020906001600160401b038111610b69575b601f01601f19160190565b610b71610aa7565b610b5e565b81601f8201121561097857803590610b8d82610b4c565b92610b9b6040519485610b1c565b8284526020838301011161098057816000926020809301838601378301015290565b60206003198201126109b757600435906001600160401b0382116109785761094891600401610b76565b9060606003198301126109b757600435610c0081610a67565b91602435906001600160401b03821161098057610c1f9160040161094b565b9091604435801515811415610c315790565b5050505050600080fd5b606090600319011261000f57600435610c5381610a67565b90602435610c6081610a67565b9060443590565b60a06003198201126109b7576001600160401b03916004358381116109805782610c939160040161094b565b93909392602435926044359260643592608435918211610cb95761094891600401610b76565b5050505050505050600080fd5b50634e487b7160e01b600052600060045260246000fd5b90600182811c92168015610d0f575b6020831014610cf757565b5050634e487b7160e01b600052602260045260246000fd5b91607f1691610cec565b9060009291805491610d2a83610cdd565b918282526001938481169081600014610d8c5750600114610d4c575b50505050565b90919394506000526020928360002092846000945b838610610d78575050505001019038808080610d46565b805485870183015294019385908201610d61565b60ff19166020840152505060400193503891508190508080610d46565b6040519060008260c95491610dbd83610cdd565b808352600193808516908115610e315750600114610de3575b50610a8692500383610b1c565b60c9600090815260008051602061545283398151915294602093509091905b818310610e19575050610a86935082010138610dd6565b85548884018501529485019487945091830191610e02565b94505050505060ff19166020830152610a86826040810138610dd6565b6040519060008260d35491610e6283610cdd565b808352600193808516908115610e315750600114610e875750610a8692500383610b1c565b60d3600090815260008051602061549283398151915294602093509091905b818310610ebd575050610a86935082010138610dd6565b85548884018501529485019487945091830191610ea6565b6040519060008260ca5491610ee983610cdd565b808352600193808516908115610e315750600114610f0e5750610a8692500383610b1c565b60ca60009081526000805160206154b283398151915294602093509091905b818310610f44575050610a86935082010138610dd6565b85548884018501529485019487945091830191610f2d565b60405160d454816000610f6e83610cdd565b808352600193808516908115610fe25750600114610f94575b5061094892500382610b1c565b60d4600090815260008051602061555283398151915294602093509091905b818310610fca575050610948935082010138610f87565b85548784018501529485019486945091830191610fb3565b94505050505060ff19166020820152610948816040810138610f87565b60405160db5481600061101183610cdd565b808352600193808516908115610fe25750600114611036575061094892500382610b1c565b60db600090815260008051602061551283398151915294602093509091905b81831061106c575050610948935082010138610f87565b85548784018501529485019486945091830191611055565b602090600319011261000f5760043561094881610a67565b602090600319011261000f576004358015158114156109b75790565b6020906001600160401b0381116110d1575b60051b0190565b6110d9610aa7565b6110ca565b9080601f83011215610978578135906110f6826110b8565b926111046040519485610b1c565b828452602092838086019160051b8301019280841161116c57848301915b8483106111325750505050505090565b82356001600160401b03811161115e57869161115384848094890101610b76565b815201920191611122565b505050505050505050600080fd5b50505050505050600080fd5b9080601f8301121561097857813591611190836110b8565b92604061119f81519586610b1c565b8185526020938486019185600594851b8601019482861161115e57868101935b8685106111d157505050505050505090565b6001600160401b0390853582811161123a5783019184601f19848803011261123a578451926111ff84610abe565b8a81013591821161124b57611219878c8894840101610b76565b84520135908782101561123a57828a939284809401528152019401936111bf565b505050505050505050505050600080fd5b50505050505050505050505050600080fd5b9060c06003198301126109b7576001600160401b03916004908135848111610c31578161128b918401610b76565b936024358181116112fc57826112a2918501610b76565b9360443582811161116c57836112b9918601610b76565b93606435838111610cb957846112d0918301610b76565b9360843584811161115e57816112e79184016110de565b9360a43590811161115e576109489201611178565b505050505050600080fd5b604090600319011261000f5760043561131f81610a67565b906024358015158114156109785790565b9060406003198301126109b7576001600160401b03600435818111610980578361135c91600401610b76565b926024359182116109805761094891600401610b76565b909161138a61094893604084526040840190610a0c565b916020818403910152610a0c565b9060806003198301126109b7576004356113b181610a67565b916024356113be81610a67565b9160443591606435906001600160401b0382116112fc5761094891600401610b76565b9060406003198301126109b7576004356113fa81610a67565b91602435906001600160401b038211610980576109b39160040161094b565b60e06003198201126109b75761142d610a79565b916001600160401b039160243590838211610c3157611450816004938401610b76565b9360443581811161116c5782611467918501610b76565b93606435828111610cb9578361147e918601610b76565b9360843583811161115e5784611495918301610b76565b9360a4358481116114c157816114ac9184016110de565b9360c4359081116114c1576109489201611178565b50505050505050505050600080fd5b9060058210156114dd5752565b505050634e487b7160e01b600052602160045260246000fd5b9291602061150f610a8693604087526040870190610a0c565b9401906114d0565b604090600319011261000f5760043561152f81610a67565b9060243561094881610a67565b61154461157b565b603380546001600160a01b031981169091556040516000916001600160a01b0316906000805160206154f2833981519152908390a3565b6033546001600160a01b031633141561159057565b50606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6115dd61157b565b6001600160a01b038116156115f557610a869061166a565b505060405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b80546001600160a01b0319166001600160a01b03909216919091179055565b603380546001600160a01b039283166001600160a01b031982168117909255604051919216906000805160206154f283398151915290600090a3565b6001600160a01b03166000908152609c6020526040902090565b6001600160a01b0316600090815260cf6020526040902090565b6001600160a01b03166000908152609a6020526040902090565b6001600160a01b0316600090815260df6020526040902090565b9060018060a01b0316600052602052604060002090565b6001600160a01b0316801561174557600052609a60205260406000205490565b505060405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608490fd5b156117a557565b5060405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606490fd5b6000908152609960205260409020546001600160a01b031661094881151561179e565b90611813816117e6565b6001600160a01b0381811690841681146118c85733149081156118ae575b501561184057610a8691611a28565b505060405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260849150fd5b60ff91506118c09061037a33916116a6565b541638611831565b5050505050608460405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152fd5b600260005260d26020527f251822df7baccb20562ed2cfb8675da588fc14a1f166aa1f3d3bed7a398911cd90565b61195a61195582611a7e565b61179e565b6000908152609b60205260409020546001600160a01b031690565b6001600160a01b03811691903383146119e457816119a36119b49233600052609c602052604060002061170e565b9060ff801983541691151516179055565b60405190151581527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3565b50505050606460405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152fd5b81600052609b602052611a3f81604060002061164b565b6001600160a01b0380611a51846117e6565b169116907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256000604051a4565b6000908152609960205260409020546001600160a01b0316151590565b15611aa257565b5060405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b61010061ff00196000541617600055565b959391611b5a95939160005497611b3e60ff8a60081c1615809a819b611bb3575b8115611b93575b50611a9b565b88611b51600160ff196000541617600055565b611b865761244d565b611b6057565b61ff0019600054166000556000805160206154d2833981519152602060405160018152a1565b611b8e611aff565b61244d565b303b15915081611ba5575b5038611b38565b6001915060ff161438611b9e565b600160ff8216109150611b31565b15611bc857565b5060405162461bcd60e51b815260206004820152602760248201527f53656d616e7469635342543a20736368656d61205552492063616e6e6f7420626044820152666520656d70747960c81b6064820152608490fd5b15611c2557565b5060405162461bcd60e51b815260206004820152602c60248201527f53656d616e7469635342543a207072656469636174652073697a652063616e2060448201526b6e6f7420626520656d70747960a01b6064820152608490fd5b818110611c8b575050565b60008155600101611c80565b90601f8211611ca4575050565b610a869160d36000526020600020906020601f840160051c83019310611cd2575b601f0160051c0190611c80565b9091508190611cc5565b90601f8211611ce9575050565b610a869160c96000526020600020906020601f840160051c83019310611cd257601f0160051c0190611c80565b90601f8211611d23575050565b610a869160ca6000526020600020906020601f840160051c83019310611cd257601f0160051c0190611c80565b90601f8211611d5d575050565b610a869160d46000526020600020906020601f840160051c83019310611cd257601f0160051c0190611c80565b90601f8211611d97575050565b610a869160db6000526020600020906020601f840160051c83019310611cd257601f0160051c0190611c80565b9190601f8111611dd357505050565b610a86926000526020600020906020601f840160051c83019310611cd257601f0160051c0190611c80565b80519091906001600160401b038111611ed4575b611e2681611e2160c954610cdd565b611cdc565b602080601f8311600114611e625750819293600092611e57575b50508160011b916000199060031b1c19161760c955565b015190503880611e40565b60c9600052601f19831694909190600080516020615452833981519152926000905b878210611ebc575050836001959610611ea3575b505050811b0160c955565b015160001960f88460031b161c19169055388080611e98565b80600185968294968601518155019501930190611e84565b611edc610aa7565b611e12565b80519091906001600160401b038111611fb7575b611f0981611f0460ca54610cdd565b611d16565b602080601f8311600114611f455750819293600092611f3a575b50508160011b916000199060031b1c19161760ca55565b015190503880611f23565b60ca600052601f198316949091906000805160206154b2833981519152926000905b878210611f9f575050836001959610611f86575b505050811b0160ca55565b015160001960f88460031b161c19169055388080611f7b565b80600185968294968601518155019501930190611f67565b611fbf610aa7565b611ef5565b80519091906001600160401b03811161209a575b611fec81611fe760d354610cdd565b611c97565b602080601f8311600114612028575081929360009261201d575b50508160011b916000199060031b1c19161760d355565b015190503880612006565b60d3600052601f19831694909190600080516020615492833981519152926000905b878210612082575050836001959610612069575b505050811b0160d355565b015160001960f88460031b161c1916905538808061205e565b8060018596829496860151815501950193019061204a565b6120a2610aa7565b611fd8565b80519091906001600160401b03811161217d575b6120cf816120ca60d454610cdd565b611d50565b602080601f831160011461210b5750819293600092612100575b50508160011b916000199060031b1c19161760d455565b0151905038806120e9565b60d4600052601f19831694909190600080516020615552833981519152926000905b87821061216557505083600195961061214c575b505050811b0160d455565b015160001960f88460031b161c19169055388080612141565b8060018596829496860151815501950193019061212d565b612185610aa7565b6120bb565b80519091906001600160401b038111612260575b6121b2816121ad60db54610cdd565b611d8a565b602080601f83116001146121ee57508192936000926121e3575b50508160011b916000199060031b1c19161760db55565b0151905038806121cc565b60db600052601f19831694909190600080516020615512833981519152926000905b87821061224857505083600195961061222f575b505050811b0160db55565b015160001960f88460031b161c19169055388080612224565b80600185968294968601518155019501930190612210565b612268610aa7565b61219e565b81519192916001600160401b03811161233c575b6122958161228f8454610cdd565b84611dc4565b602080601f83116001146122d15750819293946000926122c6575b50508160011b916000199060031b1c1916179055565b0151905038806122b0565b90601f198316956122e785600052602060002090565b926000905b8882106123245750508360019596971061230b575b505050811b019055565b015160001960f88460031b161c19169055388080612301565b806001859682949686015181550195019301906122ec565b612344610aa7565b612281565b919091606081016060825283518091526080820160808260051b840101916020809601916000905b8783831061238e57505050505060d59160d6604092958201520152565b806123a960019394959697607f198a82030186528851610a0c565b960192019201909291612371565b506040513d6000823e3d90fd5b919091606081016060825283518091526080820160808260051b840101916020809601916000905b8783831061240957505050505060d79160d8604092958201520152565b8060019293949596607f1989820301855261243f885191838061243485516040808652850190610a0c565b9401519101906114d0565b9601920192019092916123ec565b95949391926124e3612506946124de612501946124c560405160208101816124758b83610a31565b0391612489601f1993848101835282610b1c565b519020906040516124bb6020820192826124af8560409060208152600060208201520190565b03908101835282610b1c565b5190201415611bc1565b6124d18a511515611c1e565b6124d9612ab6565b611dfe565b611ee1565b6124fc6124ef886116c0565b805460ff19166001179055565b611fc4565b6120a7565b73bb7e16c3832d46817279f32c57225d5f811236aa90813b15610c31576000612543916040518093819263973f105f60e01b835260048301612349565b0381855af480156125fb575b6125e7575b50803b156109805761257e9160009160405180809581946306c04a3960e21b8352600483016123c4565b03915af480156125da575b6125bd575b50604051600181526001600160a01b03909116906000805160206154328339815191529080602081015b0390a2565b6125d4906125cb3d82610b1c565b3d8101906109cc565b3861258e565b6125e26123b7565b612589565b6125f5906125cb3d82610b1c565b38612554565b6126036123b7565b61254f565b6040519061261582610ae6565b6000808352366020840137565b6040519061262f82610ae6565b60008252565b50634e487b7160e01b600052603260045260246000fd5b60cb5481101561266c575b60cb60005260206000209060021b0190600090565b612674612635565b612657565b50634e487b7160e01b600052601160045260246000fd5b815191600160401b83116126ff575b81548383558084106126e1575b50602080910191600052806000206000925b8484106126cc575050505050565b600183828293518555019201930192906126be565b6126f990836000528460206000209182019101611c80565b386126ac565b612707610aa7565b61269f565b60cb54600160401b9190828110156127f0575b61273060019182810160cb5561264c565b9390936127e3575b825161274d906001600160a01b03168561164b565b60208084015183860155600285019080604086015180519485116127d6575b83548585558086106127b9575b500191600052806000206000925b8484106127a6575050505050509060036060610a869301519101612690565b8051825592850192908501908201612787565b6127d0908560005286846000209182019101611c80565b38612779565b6127de610aa7565b61276c565b6127eb610cc6565b612738565b6127f8610aa7565b61271f565b60d85481101561281d575b60d860005260206000209060011b0190600090565b612825612635565b612808565b60d15481101561284a575b60d160005260206000209060011b0190600090565b612852612635565b612835565b60d8546003101561288e575b60d860009081527f5320ad99a619a90804cd2efe3a5cf0ac1ac5c41ad9ff2c61cf699efdad77109c91565b612896612635565b612863565b600160206128bc60d1548360401b8110156128e3575b83810160d15561282a565b9390936128d6575b6128cf81518561226d565b0151910155565b6128de610cc6565b6128c4565b6128eb610aa7565b6128b1565b60d654600090600160401b811015612967575b600181018060d65581101561295a575b60d6825260008051602061547283398151915201805461293290610cdd565b601f811161293e575055565b8183526020832061295791601f0160051c810190611c80565b55565b612962612635565b612913565b61296f610aa7565b612903565b6040519061298182610abe565b600482526314dbdd5b60e21b6020830152565b60d654610a869190600160401b8110156129e0575b600181018060d6558110156129d3575b60d66000526000805160206154728339815191520161226d565b6129db612635565b6129b9565b6129e8610aa7565b6129a9565b90612a00602092828151948592016109d7565b0190565b6020612a1d9181604051938285809451938492016109d7565b810160d581520301902090565b602090612a449282604051948386809551938492016109d7565b82019081520301902090565b60206001612a7160d8548260401b811015612aa9575b82810160d8556127fd565b612a9c575b612a8184518261226d565b0191015160058110156114dd5760ff80198354169116179055565b612aa4610cc6565b612a76565b612ab1610aa7565b612a66565b612ad060ff60005460081c16612acb81612ba9565b612ba9565b612ad93361166a565b612b4a612ae4612608565b612aec612608565b60405191608083016001600160401b03811184821017612b9c575b604052600083526000602084015260408301526060820152612b4560405191612b2f83610abe565b612b37612622565b83526000602084015261270c565b61289b565b612b526128f0565b612b62612b5d612974565b612994565b612b7b612b75612b70612974565b612a04565b60019055565b610a86612b86610b3f565b612b8e612622565b815260006020820152612a50565b612ba4610aa7565b612b07565b15612bb057565b5060405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b60ff60d05416612c1957600090565b600190565b612c2790612a04565b5490565b80151580612cc7575b15612c8157610948612c6d9160d654811015612c74575b60d6600052604051928391829060008051602061547283398151915201610d19565b0382610b1c565b612c7c612635565b612c4b565b505060405162461bcd60e51b815260206004820152601c60248201527b14d95b585b9d1a58d4d0950e8818db185cdcc81b9bdd08195e1a5cdd60221b6044820152606490fd5b5060d6548110612c34565b6020612ceb9181604051938285809451938492016109d7565b810160d78152030190205490565b15612d0057565b50606460405162461bcd60e51b815260206004820152602060248201527f53656d616e7469635342543a20707265646963617465206e6f742065786973746044820152fd5b612d609080151580612d9e575b612d5b90612cf9565b6127fd565b509060ff600160405193612d7385610abe565b604051612d8481612c6d8185610d19565b85520154169160058310156114dd57826020820152519190565b5060d8548110612d52565b15612db057565b5060405162461bcd60e51b815260206004820152601b60248201527a14d95b585b9d1a58d4d0950e88191bd95cc81b9bdd08195e1a5cdd602a1b6044820152606490fd5b612e00612e1492612a04565b5460005260d2602052604060002090612a2a565b54610948811515612da9565b9081151580612e8f575b612e3390612da9565b612c6d6109486001612e60612c6d612e5a612e4d8861282a565b5060405192838092610d19565b9561282a565b50015460d654811015612c745760d6600052604051928391829060008051602061547283398151915201610d19565b5060d1548210612e2a565b602081830312610978578051906001600160401b038211610980570181601f82011215610978578051612ecc81610b4c565b92612eda6040519485610b1c565b818452602082840101116109805761094891602080850191016109d7565b612f0181611a7e565b15612fad576000612f14612f599261264c565b506040516320b093e960e11b8152600481019190915260d6602482015260d8604482015260d9606482015260d1608482015260da60a4820152918290819060c4820190565b038173bb7e16c3832d46817279f32c57225d5f811236aa5af4908115612fa0575b600091612f85575090565b610948913d90823e612f973d82610b1c565b3d810190612e9a565b612fa86123b7565b612f7a565b505060405162461bcd60e51b815260206004820152602760248201527f53656d616e7469635342543a2053656d616e74696353425420646f6573206e6f6044820152661d08195e1a5cdd60ca1b6064820152608490fd5b60cb5460018110613017575b6000190190565b61301f612679565b613010565b9061302e906117e6565b6001600160a01b0390811691161490565b613047613004565b60cc5490818110613056570390565b61305e612679565b0390565b6001906000198114613072570190565b612a00612679565b906000600191829360cb54945b8581106130ed5750505050505050608460405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152fd5b6130f68161264c565b50546001600160a01b03838116911614613119575b61311490613062565b613087565b928281146131465784613114916001198111613139575b0193905061310b565b613141612679565b613130565b50505091505090565b6000600190819260cb54935b8481106131c157505050505050608460405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152fd5b6131ca8161264c565b50546001600160a01b03166131e8575b6131e390613062565b61315b565b9181811461321557836131e3916001198111613208575b019290506131da565b613210612679565b6131ff565b505091505090565b1561322457565b5060405162461bcd60e51b815260206004820152601e60248201527f53656d616e7469635342543a206d757374207472616e7366657261626c6500006044820152606490fd5b90610a86929161327e60ff60d0541661321d565b61329061328b84336132f8565b613295565b61399d565b1561329c57565b5060405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608490fd5b6001600160a01b038061330a846117e6565b169281831692848414948515613340575b5050831561332a575b50505090565b61333691929350611949565b1614388080613324565b60ff9295509061335c91600052609c602052604060002061170e565b541692388061331b565b9091610a869261337a60ff60d0541661321d565b6040519261338784610ae6565b600084525b91610a8693916133b3936133a361328b84336132f8565b6133ae83838361399d565b613587565b61340b565b60809060208152603260208201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60608201520190565b1561341257565b5060405162461bcd60e51b81528061342c600482016133b8565b0390fd5b908160209103126109b757516109488161091d565b610948939260809260018060a01b031682526000602083015260408201528160608201520190610a0c565b6001600160a01b03918216815291166020820152604081019190915260806060820181905261094892910190610a0c565b3d156134cc573d906134b282610b4c565b916134c06040519384610b1c565b82523d6000602084013e565b606090565b909190803b1561357f57613503602091600093604051948580948193630a85bd0160e11b998a84523360048501613445565b03926001600160a01b03165af16000918161355f575b50613551575050506135296134a1565b8051908161354c57505060405162461bcd60e51b81528061342c600482016133b8565b602001fd5b6001600160e01b0319161490565b61357891925061356f3d82610b1c565b3d810190613430565b9038613519565b505050600190565b92909190823b156135ba57613503926020926000604051809681958294630a85bd0160e11b9a8b85523360048601613470565b50505050600190565b90610a869392916135d860ff60d0541661321d565b61338c565b91906135e761157b565b6001600160401b0381116136aa575b61360581611fe760d354610cdd565b6000601f821160011461363e578192936000926136335750508160011b916000199060031b1c19161760d355565b013590503880612006565b60d3600052601f1982169360008051602061549283398151915291805b868110613692575083600195961061367857505050811b0160d355565b0135600019600384901b60f8161c1916905538808061205e565b9092602060018192868601358155019401910161365b565b6136b2610aa7565b6135f6565b9092916001600160401b038111613777575b6136d78161228f8454610cdd565b6000601f821160011461371057819293946000926137055750508160011b916000199060031b1c1916179055565b0135905038806122b0565b601f1982169461372584600052602060002090565b91805b87811061375f57508360019596971061374557505050811b019055565b0135600019600384901b60f8161c19169055388080612301565b90926020600181928686013581550194019101613728565b61377f610aa7565b6136c9565b61378c61157b565b60ff801960d05416911515161760d055565b91906137a861157b565b6001600160401b03811161386b575b6137c681611e2160c954610cdd565b6000601f82116001146137ff578192936000926137f45750508160011b916000199060031b1c19161760c955565b013590503880611e40565b60c9600052601f1982169360008051602061545283398151915291805b868110613853575083600195961061383957505050811b0160c955565b0135600019600384901b60f8161c19169055388080611e98565b9092602060018192868601358155019401910161381c565b613873610aa7565b6137b7565b919061388261157b565b6001600160401b038111613945575b6138a081611f0460ca54610cdd565b6000601f82116001146138d9578192936000926138ce5750508160011b916000199060031b1c19161760ca55565b013590503880611f23565b60ca600052601f198216936000805160206154b283398151915291805b86811061392d575083600195961061391357505050811b0160ca55565b0135600019600384901b60f8161c19169055388080611f7b565b909260206001819286860135815501940191016138f6565b61394d610aa7565b613891565b60206000805160206154328339815191529161396c61157b565b6001600160a01b0316600081815260cf835260409020805460ff191660ff86151516179055926040519015158152a2565b6001600160a01b0392918381166139bd816139b78661264c565b5061164b565b6139d56139c9856117e6565b84871696168614613ae1565b8015613a8b57610a8694613a7185936139ee8587615362565b613a1083613a0a6139fe886117e6565b6001600160a01b031690565b14613ae1565b613a37613a2786600052609b602052604060002090565b80546001600160a01b0319169055565b613a40866116da565b8054600019019055613a51816116da565b60018154019055613a6c856000526099602052604060002090565b61164b565b6000805160206155328339815191526000604051a46153f2565b505050505050608460405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152fd5b15613ae857565b5060405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608490fd5b9390949192613bd7936000549660ff96613b6b888a60081c1615809a819b613caa575b8115613c885750611a9b565b88613b7e600160ff196000541617600055565b613c7b575b613bbb60005498808a60081c16613b9981612ba9565b60e0805460ff1916905515998a9182613c6e575b8215613c4c575b5050611a9b565b87613bce600160ff196000541617600055565b613c3f576141f1565b613c0f575b613be257565b613bf261ff001960005416600055565b604051600181526000805160206154d283398151915290602090a1565b613c1f61ff001960005416600055565b604051600181526000805160206154d283398151915290602090a1613bdc565b613c47611aff565b6141f1565b303b1592509082613c61575b50503880613bb4565b6001925016143880613c58565b6001828216109250613bad565b613c83611aff565b613b83565b905089303b159182613c9d575b505038611b38565b6001925016148938613c95565b60018b8216109150613b5f565b613cbf61157b565b613cc7613d00565b600160ff1960e054161760e0557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1565b60ff60e05416613d0c57565b5060405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b613d4d61157b565b60e05460ff811615613d8c5760ff191660e0557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1565b505060405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b600080808060018060a01b03603354164790828215613df4575bf115613dec57565b610a866123b7565b506108fc613de4565b613e05613d00565b60009133835260cf60205260ff60408420541615613f785782613e2e61094895613eeb93614c56565b95613e4a613e43613e3d61191b565b89612a2a565b5415614d08565b613e736020613e588661526e565b9860405180938192633bdf42b160e01b835260048301614d61565b038173bb7e16c3832d46817279f32c57225d5f811236aa5af4908115613f6b575b8391613f4d575b5060405160016266b40160e11b031981523360048201526001600160a01b03861660248201526044810191909152901515606482015260dc608482015260dd60a4820152918290819060c4820190565b0381733447e2358827ece35d2838109c98f2dc30ec9e765af4928315613f40575b8093613f1b575b505083614fb4565b613f389293503d90823e613f2f3d82610b1c565b3d810190614d8c565b903880613f13565b613f486123b7565b613f0c565b613f659150613f5c3d82610b1c565b3d810190614d52565b38613e9b565b613f736123b7565b613e94565b505050505050606460405162461bcd60e51b815260206004820152601b60248201527a29b2b6b0b73a34b1a9a12a1d1036bab9ba1031329036b4b73a32b960291b6044820152fd5b9290939491613fcd613d00565b811580156140cb575b156140805785602061404a9361037f9361401b61404f97613ffc6109489c3410156140db565b604051637a879d6960e11b815295869485948d8d333060048a0161413d565b0381733447e2358827ece35d2838109c98f2dc30ec9e765af4908115614073575b600091614055575b506116c0565b6141a4565b33614e2a565b61406d91506140643d82610b1c565b3d810190614128565b38614044565b61407b6123b7565b61403c565b50505050505050606460405162461bcd60e51b815260206004820152601d60248201527f4e616d65536572766963653a206572726f72206d696e7420636f756e740000006044820152fd5b50816140d5613004565b10613fd6565b156140e257565b5060405162461bcd60e51b815260206004820152601f60248201527f4e616d65536572766963653a20696e73756666696369656e742076616c7565006044820152606490fd5b908160209103126109b7575161094881610a67565b6001600160a01b0391821681529116602082015260e0604082018190528101839052610948969561010095919390928190878601376000868286010152601f80199101168301936060840152608083015260a082015260c083828403019101520190610a0c565b156141ab57565b5060405162461bcd60e51b815260206004820152601e60248201527f4e616d65536572766963653a20696e76616c6964207369676e617475726500006044820152606490fd5b93600193610a869692614247946040519161420b83610ae6565b600080845254600881901c60ff161598899182806142b3575b8015614299575b61423490611a9b565b60ff191617600055614280575b3361244d565b6142505761218a565b61426061ff001960005416600055565b604051600181526000805160206154d283398151915290602090a161218a565b61429461010061ff00196000541617600055565b614241565b50303b15806142a75761422b565b5060ff8116821461422b565b508160ff821610614224565b156142c657565b5060405162461bcd60e51b815260206004820152602260248201527f4e616d65536572766963653a63616e206e6f742073657420666f72206f746865604482015261727360f01b6064820152608490fd5b6020919283604051948593843782019081520301902090565b1561433757565b5060405162461bcd60e51b81526020600482015260196024820152782730b6b2a9b2b93b34b1b29d3737ba103a34329037bbb732b960391b6044820152606490fd5b9161439d91906106536001600160a01b0385163381149081156144d1575b506142bf565b54906143b5336143af6139fe856117e6565b14614330565b6143be8261264c565b5090733447e2358827ece35d2838109c98f2dc30ec9e7691823b15610c3157604051637187e73360e01b81526001600160a01b03831660048201526024810185905260dc604482015260dd6064820152600081608481875af480156144c4575b6144b0575b50823b15610c3157604051636878b1b760e01b81526001600160a01b03929092166004830152602482015290600090829060449082905af480156144a3575b61448f575b506000805160206155728339815191526125b861448383612ef8565b60405191829182610a31565b61449d906125cb3d82610b1c565b38614467565b6144ab6123b7565b614462565b6144be906125cb3d82610b1c565b38614423565b6144cc6123b7565b61441e565b90501538614397565b91906022610a869160405194818692601160f91b928360208601526021850137820190602182016000815252036002810185520183610b1c565b92614540610948959361453261454e94608088526080880190610a0c565b908682036020880152610a0c565b908482036040860152610d19565b916060818403910152610a0c565b33600090815260de602052604081209092839161457c90829085906136b7565b614584612974565b6145be6145a361459333614674565b9361459c612857565b50966144da565b60405163033a54ef60e01b8152958694859460048601614514565b038173bb7e16c3832d46817279f32c57225d5f811236aa5af4908115614667575b829161464f575b506145fa6145f661037f336116f4565b1590565b8214614630576125b87e1ff0a7f9f9bfa6a3d5d102a071d2bcae92556caf0da1318cfc2783796bab17916144836124ef336116f4565b6125b86000805160206155728339815191529160405191829182610a31565b614661913d90823e612f973d82610b1c565b386145e6565b61466f6123b7565b6145df565b604051906001600160a01b031661468a82610b01565b602a8252604036602084013760306146a183614746565b5360786146ad8361475c565b536029905b600182116146c557610948915015614799565b80600f61470192166010811015614707575b6f181899199a1a9b1b9c1cb0b131b232b360811b901a6146f7848661476d565b5360041c9161478c565b906146b2565b61470f612635565b6146d7565b9061471e82610b4c565b61472b6040519182610b1c565b828152809261473c601f1991610b4c565b0190602036910137565b602090805115614754570190565b612a00612635565b602190805160011015614754570190565b90602091805182101561477f57010190565b614787612635565b010190565b8015613017576000190190565b156147a057565b50606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b6001600160a01b031680156148105760005260dc602052612c6d610948612e4d60406000205461282a565b5060405161481d81610ae6565b6000815290565b610948612e4d612c6d9261282a565b60018060a01b031660005260de602052612c6d610948604060002060405192838092610d19565b1561486157565b5060405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b916148dc9061094894928452606060208501526060840190610d19565b916040818403910152610a0c565b60d354600092916148fa82610cdd565b9160019081811690811561494b575060011461491557505050565b909192935060d360005260209081600020906000915b85831061493a57505050500190565b80548584015291830191810161492b565b60ff191683525050019150565b61496961496482611a7e565b61485a565b61497460d354610cdd565b600090156149c6575061094861498c6149a792614a46565b6149b86040519384926149a1602085016148ea565b906129ed565b64173539b7b760d91b815260050190565b03601f198101835282610b1c565b90816149d18261282a565b506149db83612ef8565b926149fa604051948593849363a11f868360e01b8552600485016148bf565b0381733447e2358827ece35d2838109c98f2dc30ec9e765af4918215614a39575b8092614a2657505090565b61094892503d90823e612f973d82610b1c565b614a416123b7565b614a1b565b6000908072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b80821015614b75575b506904ee2d6d415b85acef8160201b80831015614b66575b50662386f26fc1000080831015614b57575b506305f5e10080831015614b48575b5061271080831015614b39575b506064821015614b29575b600a80921015614b1f575b600190816021614ad7828701614714565b95860101905b614ae9575b5050505090565b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a835304918215614b1a57919082614add565b614ae2565b9160010191614ac6565b9190606460029104910191614abb565b60049193920491019138614ab0565b60089193920491019138614aa3565b60109193920491019138614a94565b60209193920491019138614a82565b604093508104915038614a6a565b63ffffffff60e01b16631ff437cb60e31b8114908115614ba1575090565b6380ac58cd60e01b811491508115908282614c45575b8315614c34575b8315614c23575b8315614c12575b8315614bd85750505090565b925090614c01575b8115614bf0575b50388080613324565b6301ffc9a760e01b14905038614be7565b635b5e139f60e01b81149150614be0565b6316388eeb60e21b82149350614bcc565b631f75f6d360e31b82149350614bc5565b63780e9d6360e01b82149350614bbe565b635b5e139f60e01b82149350614bb7565b9190916040518381946020938484013781018281016000815260009160db5491614c7f83610cdd565b92600191828216918215614cee575050600114614cad575b505050610a86925003601f198101845283610b1c565b94925060db60005282600020946000905b838210614cd6575050610a8694500101388080614c97565b86548284018601529586019588955090840190614cbe565b91509150610a8696945060ff191690520101388080614c97565b15614d0f57565b5060405162461bcd60e51b815260206004820152601a60248201527913985b5954d95c9d9a58d94e88185b1c9958591e48185919195960321b6044820152606490fd5b908160209103126109b7575190565b91906060614d7960d292608086526080860190610a0c565b936002602082015260d160408201520152565b906020918281830312610980578051906001600160401b038211610c31570181601f8201121561098057805192614dc2846110b8565b93604093614dd285519687610b1c565b818652828087019260061b85010193818511610cb9578301915b848310614dfc5750505050505090565b8583830312610cb9578386918251614e1381610abe565b855181528286015183820152815201920191614dec565b9291614e3c614ef391610a8693614c56565b93614e51613e43614e4b61191b565b87612a2a565b6000614e7c6020614e618461526e565b9760405180938192633bdf42b160e01b835260048301614d61565b038173bb7e16c3832d46817279f32c57225d5f811236aa5af4908115614f5f575b8291614f4a575b5060405160016266b40160e11b031981523360048201526001600160a01b038416602482015260448101919091526000606482015260dc608482015260dd60a4820152928390819060c4820190565b0381733447e2358827ece35d2838109c98f2dc30ec9e765af4918215614f3d575b600092614f23575b5084614fb4565b614f3691923d90823e613f2f3d82610b1c565b9038614f1c565b614f456123b7565b614f14565b614f599150613f5c3d82610b1c565b38614ea4565b614f676123b7565b614e9d565b15614f7357565b5060405162461bcd60e51b815260206004820152601860248201527729b2b6b0b73a34b1a9a12a1d103830b930b69032b93937b960411b6044820152606490fd5b80926002614fc18361264c565b500190614fcd8361264c565b508151600392600092840190835b8381106150295750505050505091614ff8614ffd93541515614f6c565b61514d565b7e1ff0a7f9f9bfa6a3d5d102a071d2bcae92556caf0da1318cfc2783796bab176125b861448383612ef8565b90809293949596975051811015615140575b6020906005918082841b8501015190615060825180151580612d9e57612d5b90612cf9565b509360ff600180960154169081101561511d578914156150c257906150a16150a89282019161509a835180151590816150b6575b506152d0565b518b61531d565b518561531d565b019291908896959493614fdb565b905060d1541138615094565b9a5050505050505050505050608491506040519062461bcd60e51b82526004820152602160248201527f53656d616e7469635342543a207072656469636174652074797065206572726f6044820152603960f91b6064820152fd5b5050634e487b7160e01b8752505060216004525060249850929650505050505050fd5b615148612635565b61503b565b9060405161515a81610ae6565b600081526001600160a01b0383169182156151d957610a8693816133b39461518a61518483611a7e565b15615222565b61519661518483611a7e565b61519f836116da565b600181540190556151be83613a6c846000526099602052604060002090565b600060008051602061553283398151915281604051a46134d1565b5050505050606460405162461bcd60e51b815260206004820152602060248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152fd5b1561522957565b5060405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606490fd5b6130049061527a612608565b615282612608565b60405192909190608084016001600160401b038111858210176152c3575b60405260018060a01b03168352600060208401526040830152606082015261270c565b6152cb610aa7565b6152a0565b156152d757565b5060405162461bcd60e51b815260206004820152601e60248201527f53656d616e7469635342543a207375626a656374206e6f7420657869737400006044820152606490fd5b805490600160401b821015615355575b60018201808255821015615348575b60005260206000200155565b615350612635565b61533c565b61535d610aa7565b61532d565b6001600160a01b03908116159182156153d8575b50501561537f57565b5060405162461bcd60e51b815260206004820152602a60248201527f4e616d65536572766963653a63616e206e6f74207472616e73666572207768656044820152691b881c995cdbdb1d995960b21b6064820152608490fd5b90915060005260dd60205260406000205416153880615376565b6001600160a01b03166154025750565b6000805160206155728339815191526125b861541d83612ef8565b604051918291602083526020830190610a0c56fe1f96bc657d385fd83da973a43f2ad969e6d96b6779b779571a7306db7ca1cd0066be4f155c5ef2ebd3772b228f2f00681e4ed5826cdb3b1943cc11ad15ad1d28e767803f8ecf1dee6bb0345811f7312cda556058b19db6389ad9ae3568643ddd915c3eb987b20e1af620c1403197bf687fb7f18513b3a73fde6e78c7072c41a642d72674974f694b5f5159593243114d38a5c39c89d6b62fee061ff523240ee17f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024988be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e04c0d3471ead8ee99fbd8249e33f683e07c6cd6071fe102dd09617b2c353de430ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9780e26d96b1f2a9a18ef8fc72d589dbf03ef788137b64f43897e83a91e7feec80bce0080e65769d8eee2ab07368f695e8e98b7875f29deedd95b1f202a04149a364697066735822122067313ce9a79112c94abb81c6fe618a3aa05bfc633c870918d7880a4e018e382e6c6578706572696d656e74616cf564736f6c634300080c0041

Deployed Bytecode

0x6040608081526004361015610015575b50600080fd5b600090813560e01c806301ffc9a7146108ec57806302fe5305146108d457806306fdde03146108b8578063081812fc1461089c578063095ea7b314610884578063152407ae1461086857806318160ddd1461084c5780631897c0bc1461082c57806323b872dd146108145780632f745c59146107f75780633ccfd60b146107e05780633f4ba83a146107c957806342842e0e146107b157806343aaf2b0146107935780634f6ccce714610777578063511b1df91461073c57806358e23bac146107205780635c975abb146106f55780636352211e146106d95780636c0360eb146106bd57806370a08231146106a1578063715018a61461068a578063786d6b97146106725780637f873749146106395780638456cb59146106225780638da5cb5b146105f757806392ff0d31146105cc5780639377268d146105b057806395d89b41146105945780639cd237071461057d578063a1f0702d1461055f578063a22cb46514610547578063a6c1653d1461052a578063a78d24311461050e578063a9ff13a6146104e5578063ac72200d146104ba578063b45a3c0e1461049d578063b84c824614610485578063b88d4fde1461046a578063c47f002714610452578063c5b8f77214610435578063c87b56dd14610419578063c911994114610401578063cf456ae7146103e9578063d49116f5146103cb578063d4b0c403146103a2578063deeec34414610386578063e985e9c514610356578063f294e2491461033a578063f2fde38b14610320578063f46eccc4146102da578063f5c57382146102be578063f7073c3a146102a25763fbafb69814610274575061000f565b3461029e5761029a915061028f61028a36610a42565b612ef8565b905191829182610a31565b0390f35b5080fd5b503461029e5761029a91506102b6366109be565b61028f610fff565b503461029e5761029a915061028f6102d536611084565b6147e5565b503461029e5761029a915061030f6102f136611084565b6001600160a01b0316600090815260cf602052604090205460ff1690565b905191829182901515815260200190565b503461029e5761033761033236611084565b6115d5565b51f35b503461029e5761029a915061028f61035136611084565b614833565b503461029e5761029a915061030f61037f61037a61037336611517565b91906116a6565b61170e565b5460ff1690565b503461029e5761029a915061028f61039d36610a42565b612c2b565b503461029e5761029a91506103be6103b936610a42565b612d45565b92909151928392836114f6565b503461029e576103376103dd36611419565b95949094939193611b10565b503461029e576103376103fb36611307565b90613952565b503461029e57610337610413366113e1565b91614379565b503461029e5761029a915061028f61043036610a42565b614958565b503461029e5761029a915061030f61044c36610a88565b90613024565b503461029e5761033761046436610989565b9061379e565b503461029e5761033761047c36611398565b929190916135c3565b503461029e5761033761049736610989565b90613878565b503461029e5761029a91506104b136610a42565b5061030f612c0a565b503461029e5761029a91506104ce366109be565b6104d6613004565b90519081529081906020820190565b503461029e5761029a91506105016104fc36610a42565b612e20565b9290915192839283611373565b503461029e5761029a915061028f61052536610a42565b614824565b503461029e5761029a91506104d661054136611330565b90612df4565b503461029e5761033761055936611307565b90611975565b503461029e576103376105713661125d565b94939093929192613b3c565b503461029e5761033761058f3661109c565b613784565b503461029e5761029a91506105a8366109be565b61028f610ed5565b503461029e5761029a91506104d66105c736610bbd565b612cd2565b503461029e5761029a91506105e0366109be565b60ff60d05416905191829182901515815260200190565b503461029e5761029a915061060b366109be565b60335490519182916001600160a01b031682610a54565b503461029e57610631366109be565b610337613cb7565b503461029e5761029a915061066761066161065336610989565b61065b61191b565b91614317565b546117e6565b905191829182610a54565b503461029e5761033761068436610989565b9061455c565b503461029e57610699366109be565b61033761153c565b503461029e5761029a91506104d66106b836611084565b611725565b503461029e5761029a91506106d1366109be565b61028f610e4e565b503461029e5761029a91506106676106f036610a42565b6117e6565b503461029e5761029a9150610709366109be565b60ff60e05416905191829182901515815260200190565b503461029e5761029a9150610734366109be565b61028f610f5c565b503461029e5761029a915061066761076a61075961065336610989565b5460005260dd602052604060002090565b546001600160a01b031690565b503461029e5761029a91506104d661078e36610a42565b61314f565b5061029a91506104d66107a536610c67565b94939093929192613fc0565b503461029e576103376107c336610c3b565b91613366565b503461029e576107d8366109be565b610337613d45565b503461029e576107ef366109be565b610337613dca565b503461029e5761029a91506104d661080e36610a88565b9061307a565b503461029e5761033761082636610c3b565b9161326a565b503461029e5761029a91506104d661084336610be7565b92919091613dfd565b503461029e5761029a9150610860366109be565b6104d661303f565b503461029e5761029a91506104d661087f36610bbd565b612c1e565b503461029e5761033761089636610a88565b90611809565b503461029e5761029a91506106676108b336610a42565b611949565b503461029e5761029a91506108cc366109be565b61028f610da9565b503461029e576103376108e636610989565b906135dd565b50503461091a5750607f1961091561090b61090636610930565b614b83565b151560805260a090565b016080f35b80fd5b6001600160e01b03198116141561000f57565b602090600319011261000f576004356109488161091d565b90565b9181601f84011215610978578235916001600160401b038311610980576020838186019501011161097857565b505050600080fd5b50505050600080fd5b60206003198201126109b757600435906001600160401b038211610978576109b39160040161094b565b9091565b5050600080fd5b600090600319011261000f57565b600091031261000f57565b918091926000905b8282106109f75750116109f0575050565b6000910152565b915080602091830151818601520182916109df565b90602091610a25815180928185528580860191016109d7565b601f01601f1916010190565b906020610948928181520190610a0c565b602090600319011261000f5760043590565b6001600160a01b03909116815260200190565b6001600160a01b038116141561000f57565b60043590610a8682610a67565b565b604090600319011261000f57600435610aa081610a67565b9060243590565b50634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b03821117610ad957604052565b610ae1610aa7565b604052565b602081019081106001600160401b03821117610ad957604052565b606081019081106001600160401b03821117610ad957604052565b601f909101601f19168101906001600160401b03821190821017610ad957604052565b60405190610a8682610abe565b6020906001600160401b038111610b69575b601f01601f19160190565b610b71610aa7565b610b5e565b81601f8201121561097857803590610b8d82610b4c565b92610b9b6040519485610b1c565b8284526020838301011161098057816000926020809301838601378301015290565b60206003198201126109b757600435906001600160401b0382116109785761094891600401610b76565b9060606003198301126109b757600435610c0081610a67565b91602435906001600160401b03821161098057610c1f9160040161094b565b9091604435801515811415610c315790565b5050505050600080fd5b606090600319011261000f57600435610c5381610a67565b90602435610c6081610a67565b9060443590565b60a06003198201126109b7576001600160401b03916004358381116109805782610c939160040161094b565b93909392602435926044359260643592608435918211610cb95761094891600401610b76565b5050505050505050600080fd5b50634e487b7160e01b600052600060045260246000fd5b90600182811c92168015610d0f575b6020831014610cf757565b5050634e487b7160e01b600052602260045260246000fd5b91607f1691610cec565b9060009291805491610d2a83610cdd565b918282526001938481169081600014610d8c5750600114610d4c575b50505050565b90919394506000526020928360002092846000945b838610610d78575050505001019038808080610d46565b805485870183015294019385908201610d61565b60ff19166020840152505060400193503891508190508080610d46565b6040519060008260c95491610dbd83610cdd565b808352600193808516908115610e315750600114610de3575b50610a8692500383610b1c565b60c9600090815260008051602061545283398151915294602093509091905b818310610e19575050610a86935082010138610dd6565b85548884018501529485019487945091830191610e02565b94505050505060ff19166020830152610a86826040810138610dd6565b6040519060008260d35491610e6283610cdd565b808352600193808516908115610e315750600114610e875750610a8692500383610b1c565b60d3600090815260008051602061549283398151915294602093509091905b818310610ebd575050610a86935082010138610dd6565b85548884018501529485019487945091830191610ea6565b6040519060008260ca5491610ee983610cdd565b808352600193808516908115610e315750600114610f0e5750610a8692500383610b1c565b60ca60009081526000805160206154b283398151915294602093509091905b818310610f44575050610a86935082010138610dd6565b85548884018501529485019487945091830191610f2d565b60405160d454816000610f6e83610cdd565b808352600193808516908115610fe25750600114610f94575b5061094892500382610b1c565b60d4600090815260008051602061555283398151915294602093509091905b818310610fca575050610948935082010138610f87565b85548784018501529485019486945091830191610fb3565b94505050505060ff19166020820152610948816040810138610f87565b60405160db5481600061101183610cdd565b808352600193808516908115610fe25750600114611036575061094892500382610b1c565b60db600090815260008051602061551283398151915294602093509091905b81831061106c575050610948935082010138610f87565b85548784018501529485019486945091830191611055565b602090600319011261000f5760043561094881610a67565b602090600319011261000f576004358015158114156109b75790565b6020906001600160401b0381116110d1575b60051b0190565b6110d9610aa7565b6110ca565b9080601f83011215610978578135906110f6826110b8565b926111046040519485610b1c565b828452602092838086019160051b8301019280841161116c57848301915b8483106111325750505050505090565b82356001600160401b03811161115e57869161115384848094890101610b76565b815201920191611122565b505050505050505050600080fd5b50505050505050600080fd5b9080601f8301121561097857813591611190836110b8565b92604061119f81519586610b1c565b8185526020938486019185600594851b8601019482861161115e57868101935b8685106111d157505050505050505090565b6001600160401b0390853582811161123a5783019184601f19848803011261123a578451926111ff84610abe565b8a81013591821161124b57611219878c8894840101610b76565b84520135908782101561123a57828a939284809401528152019401936111bf565b505050505050505050505050600080fd5b50505050505050505050505050600080fd5b9060c06003198301126109b7576001600160401b03916004908135848111610c31578161128b918401610b76565b936024358181116112fc57826112a2918501610b76565b9360443582811161116c57836112b9918601610b76565b93606435838111610cb957846112d0918301610b76565b9360843584811161115e57816112e79184016110de565b9360a43590811161115e576109489201611178565b505050505050600080fd5b604090600319011261000f5760043561131f81610a67565b906024358015158114156109785790565b9060406003198301126109b7576001600160401b03600435818111610980578361135c91600401610b76565b926024359182116109805761094891600401610b76565b909161138a61094893604084526040840190610a0c565b916020818403910152610a0c565b9060806003198301126109b7576004356113b181610a67565b916024356113be81610a67565b9160443591606435906001600160401b0382116112fc5761094891600401610b76565b9060406003198301126109b7576004356113fa81610a67565b91602435906001600160401b038211610980576109b39160040161094b565b60e06003198201126109b75761142d610a79565b916001600160401b039160243590838211610c3157611450816004938401610b76565b9360443581811161116c5782611467918501610b76565b93606435828111610cb9578361147e918601610b76565b9360843583811161115e5784611495918301610b76565b9360a4358481116114c157816114ac9184016110de565b9360c4359081116114c1576109489201611178565b50505050505050505050600080fd5b9060058210156114dd5752565b505050634e487b7160e01b600052602160045260246000fd5b9291602061150f610a8693604087526040870190610a0c565b9401906114d0565b604090600319011261000f5760043561152f81610a67565b9060243561094881610a67565b61154461157b565b603380546001600160a01b031981169091556040516000916001600160a01b0316906000805160206154f2833981519152908390a3565b6033546001600160a01b031633141561159057565b50606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6115dd61157b565b6001600160a01b038116156115f557610a869061166a565b505060405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b80546001600160a01b0319166001600160a01b03909216919091179055565b603380546001600160a01b039283166001600160a01b031982168117909255604051919216906000805160206154f283398151915290600090a3565b6001600160a01b03166000908152609c6020526040902090565b6001600160a01b0316600090815260cf6020526040902090565b6001600160a01b03166000908152609a6020526040902090565b6001600160a01b0316600090815260df6020526040902090565b9060018060a01b0316600052602052604060002090565b6001600160a01b0316801561174557600052609a60205260406000205490565b505060405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608490fd5b156117a557565b5060405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606490fd5b6000908152609960205260409020546001600160a01b031661094881151561179e565b90611813816117e6565b6001600160a01b0381811690841681146118c85733149081156118ae575b501561184057610a8691611a28565b505060405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260849150fd5b60ff91506118c09061037a33916116a6565b541638611831565b5050505050608460405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152fd5b600260005260d26020527f251822df7baccb20562ed2cfb8675da588fc14a1f166aa1f3d3bed7a398911cd90565b61195a61195582611a7e565b61179e565b6000908152609b60205260409020546001600160a01b031690565b6001600160a01b03811691903383146119e457816119a36119b49233600052609c602052604060002061170e565b9060ff801983541691151516179055565b60405190151581527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3565b50505050606460405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152fd5b81600052609b602052611a3f81604060002061164b565b6001600160a01b0380611a51846117e6565b169116907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256000604051a4565b6000908152609960205260409020546001600160a01b0316151590565b15611aa257565b5060405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b61010061ff00196000541617600055565b959391611b5a95939160005497611b3e60ff8a60081c1615809a819b611bb3575b8115611b93575b50611a9b565b88611b51600160ff196000541617600055565b611b865761244d565b611b6057565b61ff0019600054166000556000805160206154d2833981519152602060405160018152a1565b611b8e611aff565b61244d565b303b15915081611ba5575b5038611b38565b6001915060ff161438611b9e565b600160ff8216109150611b31565b15611bc857565b5060405162461bcd60e51b815260206004820152602760248201527f53656d616e7469635342543a20736368656d61205552492063616e6e6f7420626044820152666520656d70747960c81b6064820152608490fd5b15611c2557565b5060405162461bcd60e51b815260206004820152602c60248201527f53656d616e7469635342543a207072656469636174652073697a652063616e2060448201526b6e6f7420626520656d70747960a01b6064820152608490fd5b818110611c8b575050565b60008155600101611c80565b90601f8211611ca4575050565b610a869160d36000526020600020906020601f840160051c83019310611cd2575b601f0160051c0190611c80565b9091508190611cc5565b90601f8211611ce9575050565b610a869160c96000526020600020906020601f840160051c83019310611cd257601f0160051c0190611c80565b90601f8211611d23575050565b610a869160ca6000526020600020906020601f840160051c83019310611cd257601f0160051c0190611c80565b90601f8211611d5d575050565b610a869160d46000526020600020906020601f840160051c83019310611cd257601f0160051c0190611c80565b90601f8211611d97575050565b610a869160db6000526020600020906020601f840160051c83019310611cd257601f0160051c0190611c80565b9190601f8111611dd357505050565b610a86926000526020600020906020601f840160051c83019310611cd257601f0160051c0190611c80565b80519091906001600160401b038111611ed4575b611e2681611e2160c954610cdd565b611cdc565b602080601f8311600114611e625750819293600092611e57575b50508160011b916000199060031b1c19161760c955565b015190503880611e40565b60c9600052601f19831694909190600080516020615452833981519152926000905b878210611ebc575050836001959610611ea3575b505050811b0160c955565b015160001960f88460031b161c19169055388080611e98565b80600185968294968601518155019501930190611e84565b611edc610aa7565b611e12565b80519091906001600160401b038111611fb7575b611f0981611f0460ca54610cdd565b611d16565b602080601f8311600114611f455750819293600092611f3a575b50508160011b916000199060031b1c19161760ca55565b015190503880611f23565b60ca600052601f198316949091906000805160206154b2833981519152926000905b878210611f9f575050836001959610611f86575b505050811b0160ca55565b015160001960f88460031b161c19169055388080611f7b565b80600185968294968601518155019501930190611f67565b611fbf610aa7565b611ef5565b80519091906001600160401b03811161209a575b611fec81611fe760d354610cdd565b611c97565b602080601f8311600114612028575081929360009261201d575b50508160011b916000199060031b1c19161760d355565b015190503880612006565b60d3600052601f19831694909190600080516020615492833981519152926000905b878210612082575050836001959610612069575b505050811b0160d355565b015160001960f88460031b161c1916905538808061205e565b8060018596829496860151815501950193019061204a565b6120a2610aa7565b611fd8565b80519091906001600160401b03811161217d575b6120cf816120ca60d454610cdd565b611d50565b602080601f831160011461210b5750819293600092612100575b50508160011b916000199060031b1c19161760d455565b0151905038806120e9565b60d4600052601f19831694909190600080516020615552833981519152926000905b87821061216557505083600195961061214c575b505050811b0160d455565b015160001960f88460031b161c19169055388080612141565b8060018596829496860151815501950193019061212d565b612185610aa7565b6120bb565b80519091906001600160401b038111612260575b6121b2816121ad60db54610cdd565b611d8a565b602080601f83116001146121ee57508192936000926121e3575b50508160011b916000199060031b1c19161760db55565b0151905038806121cc565b60db600052601f19831694909190600080516020615512833981519152926000905b87821061224857505083600195961061222f575b505050811b0160db55565b015160001960f88460031b161c19169055388080612224565b80600185968294968601518155019501930190612210565b612268610aa7565b61219e565b81519192916001600160401b03811161233c575b6122958161228f8454610cdd565b84611dc4565b602080601f83116001146122d15750819293946000926122c6575b50508160011b916000199060031b1c1916179055565b0151905038806122b0565b90601f198316956122e785600052602060002090565b926000905b8882106123245750508360019596971061230b575b505050811b019055565b015160001960f88460031b161c19169055388080612301565b806001859682949686015181550195019301906122ec565b612344610aa7565b612281565b919091606081016060825283518091526080820160808260051b840101916020809601916000905b8783831061238e57505050505060d59160d6604092958201520152565b806123a960019394959697607f198a82030186528851610a0c565b960192019201909291612371565b506040513d6000823e3d90fd5b919091606081016060825283518091526080820160808260051b840101916020809601916000905b8783831061240957505050505060d79160d8604092958201520152565b8060019293949596607f1989820301855261243f885191838061243485516040808652850190610a0c565b9401519101906114d0565b9601920192019092916123ec565b95949391926124e3612506946124de612501946124c560405160208101816124758b83610a31565b0391612489601f1993848101835282610b1c565b519020906040516124bb6020820192826124af8560409060208152600060208201520190565b03908101835282610b1c565b5190201415611bc1565b6124d18a511515611c1e565b6124d9612ab6565b611dfe565b611ee1565b6124fc6124ef886116c0565b805460ff19166001179055565b611fc4565b6120a7565b73bb7e16c3832d46817279f32c57225d5f811236aa90813b15610c31576000612543916040518093819263973f105f60e01b835260048301612349565b0381855af480156125fb575b6125e7575b50803b156109805761257e9160009160405180809581946306c04a3960e21b8352600483016123c4565b03915af480156125da575b6125bd575b50604051600181526001600160a01b03909116906000805160206154328339815191529080602081015b0390a2565b6125d4906125cb3d82610b1c565b3d8101906109cc565b3861258e565b6125e26123b7565b612589565b6125f5906125cb3d82610b1c565b38612554565b6126036123b7565b61254f565b6040519061261582610ae6565b6000808352366020840137565b6040519061262f82610ae6565b60008252565b50634e487b7160e01b600052603260045260246000fd5b60cb5481101561266c575b60cb60005260206000209060021b0190600090565b612674612635565b612657565b50634e487b7160e01b600052601160045260246000fd5b815191600160401b83116126ff575b81548383558084106126e1575b50602080910191600052806000206000925b8484106126cc575050505050565b600183828293518555019201930192906126be565b6126f990836000528460206000209182019101611c80565b386126ac565b612707610aa7565b61269f565b60cb54600160401b9190828110156127f0575b61273060019182810160cb5561264c565b9390936127e3575b825161274d906001600160a01b03168561164b565b60208084015183860155600285019080604086015180519485116127d6575b83548585558086106127b9575b500191600052806000206000925b8484106127a6575050505050509060036060610a869301519101612690565b8051825592850192908501908201612787565b6127d0908560005286846000209182019101611c80565b38612779565b6127de610aa7565b61276c565b6127eb610cc6565b612738565b6127f8610aa7565b61271f565b60d85481101561281d575b60d860005260206000209060011b0190600090565b612825612635565b612808565b60d15481101561284a575b60d160005260206000209060011b0190600090565b612852612635565b612835565b60d8546003101561288e575b60d860009081527f5320ad99a619a90804cd2efe3a5cf0ac1ac5c41ad9ff2c61cf699efdad77109c91565b612896612635565b612863565b600160206128bc60d1548360401b8110156128e3575b83810160d15561282a565b9390936128d6575b6128cf81518561226d565b0151910155565b6128de610cc6565b6128c4565b6128eb610aa7565b6128b1565b60d654600090600160401b811015612967575b600181018060d65581101561295a575b60d6825260008051602061547283398151915201805461293290610cdd565b601f811161293e575055565b8183526020832061295791601f0160051c810190611c80565b55565b612962612635565b612913565b61296f610aa7565b612903565b6040519061298182610abe565b600482526314dbdd5b60e21b6020830152565b60d654610a869190600160401b8110156129e0575b600181018060d6558110156129d3575b60d66000526000805160206154728339815191520161226d565b6129db612635565b6129b9565b6129e8610aa7565b6129a9565b90612a00602092828151948592016109d7565b0190565b6020612a1d9181604051938285809451938492016109d7565b810160d581520301902090565b602090612a449282604051948386809551938492016109d7565b82019081520301902090565b60206001612a7160d8548260401b811015612aa9575b82810160d8556127fd565b612a9c575b612a8184518261226d565b0191015160058110156114dd5760ff80198354169116179055565b612aa4610cc6565b612a76565b612ab1610aa7565b612a66565b612ad060ff60005460081c16612acb81612ba9565b612ba9565b612ad93361166a565b612b4a612ae4612608565b612aec612608565b60405191608083016001600160401b03811184821017612b9c575b604052600083526000602084015260408301526060820152612b4560405191612b2f83610abe565b612b37612622565b83526000602084015261270c565b61289b565b612b526128f0565b612b62612b5d612974565b612994565b612b7b612b75612b70612974565b612a04565b60019055565b610a86612b86610b3f565b612b8e612622565b815260006020820152612a50565b612ba4610aa7565b612b07565b15612bb057565b5060405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b60ff60d05416612c1957600090565b600190565b612c2790612a04565b5490565b80151580612cc7575b15612c8157610948612c6d9160d654811015612c74575b60d6600052604051928391829060008051602061547283398151915201610d19565b0382610b1c565b612c7c612635565b612c4b565b505060405162461bcd60e51b815260206004820152601c60248201527b14d95b585b9d1a58d4d0950e8818db185cdcc81b9bdd08195e1a5cdd60221b6044820152606490fd5b5060d6548110612c34565b6020612ceb9181604051938285809451938492016109d7565b810160d78152030190205490565b15612d0057565b50606460405162461bcd60e51b815260206004820152602060248201527f53656d616e7469635342543a20707265646963617465206e6f742065786973746044820152fd5b612d609080151580612d9e575b612d5b90612cf9565b6127fd565b509060ff600160405193612d7385610abe565b604051612d8481612c6d8185610d19565b85520154169160058310156114dd57826020820152519190565b5060d8548110612d52565b15612db057565b5060405162461bcd60e51b815260206004820152601b60248201527a14d95b585b9d1a58d4d0950e88191bd95cc81b9bdd08195e1a5cdd602a1b6044820152606490fd5b612e00612e1492612a04565b5460005260d2602052604060002090612a2a565b54610948811515612da9565b9081151580612e8f575b612e3390612da9565b612c6d6109486001612e60612c6d612e5a612e4d8861282a565b5060405192838092610d19565b9561282a565b50015460d654811015612c745760d6600052604051928391829060008051602061547283398151915201610d19565b5060d1548210612e2a565b602081830312610978578051906001600160401b038211610980570181601f82011215610978578051612ecc81610b4c565b92612eda6040519485610b1c565b818452602082840101116109805761094891602080850191016109d7565b612f0181611a7e565b15612fad576000612f14612f599261264c565b506040516320b093e960e11b8152600481019190915260d6602482015260d8604482015260d9606482015260d1608482015260da60a4820152918290819060c4820190565b038173bb7e16c3832d46817279f32c57225d5f811236aa5af4908115612fa0575b600091612f85575090565b610948913d90823e612f973d82610b1c565b3d810190612e9a565b612fa86123b7565b612f7a565b505060405162461bcd60e51b815260206004820152602760248201527f53656d616e7469635342543a2053656d616e74696353425420646f6573206e6f6044820152661d08195e1a5cdd60ca1b6064820152608490fd5b60cb5460018110613017575b6000190190565b61301f612679565b613010565b9061302e906117e6565b6001600160a01b0390811691161490565b613047613004565b60cc5490818110613056570390565b61305e612679565b0390565b6001906000198114613072570190565b612a00612679565b906000600191829360cb54945b8581106130ed5750505050505050608460405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152fd5b6130f68161264c565b50546001600160a01b03838116911614613119575b61311490613062565b613087565b928281146131465784613114916001198111613139575b0193905061310b565b613141612679565b613130565b50505091505090565b6000600190819260cb54935b8481106131c157505050505050608460405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152fd5b6131ca8161264c565b50546001600160a01b03166131e8575b6131e390613062565b61315b565b9181811461321557836131e3916001198111613208575b019290506131da565b613210612679565b6131ff565b505091505090565b1561322457565b5060405162461bcd60e51b815260206004820152601e60248201527f53656d616e7469635342543a206d757374207472616e7366657261626c6500006044820152606490fd5b90610a86929161327e60ff60d0541661321d565b61329061328b84336132f8565b613295565b61399d565b1561329c57565b5060405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b6064820152608490fd5b6001600160a01b038061330a846117e6565b169281831692848414948515613340575b5050831561332a575b50505090565b61333691929350611949565b1614388080613324565b60ff9295509061335c91600052609c602052604060002061170e565b541692388061331b565b9091610a869261337a60ff60d0541661321d565b6040519261338784610ae6565b600084525b91610a8693916133b3936133a361328b84336132f8565b6133ae83838361399d565b613587565b61340b565b60809060208152603260208201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b60608201520190565b1561341257565b5060405162461bcd60e51b81528061342c600482016133b8565b0390fd5b908160209103126109b757516109488161091d565b610948939260809260018060a01b031682526000602083015260408201528160608201520190610a0c565b6001600160a01b03918216815291166020820152604081019190915260806060820181905261094892910190610a0c565b3d156134cc573d906134b282610b4c565b916134c06040519384610b1c565b82523d6000602084013e565b606090565b909190803b1561357f57613503602091600093604051948580948193630a85bd0160e11b998a84523360048501613445565b03926001600160a01b03165af16000918161355f575b50613551575050506135296134a1565b8051908161354c57505060405162461bcd60e51b81528061342c600482016133b8565b602001fd5b6001600160e01b0319161490565b61357891925061356f3d82610b1c565b3d810190613430565b9038613519565b505050600190565b92909190823b156135ba57613503926020926000604051809681958294630a85bd0160e11b9a8b85523360048601613470565b50505050600190565b90610a869392916135d860ff60d0541661321d565b61338c565b91906135e761157b565b6001600160401b0381116136aa575b61360581611fe760d354610cdd565b6000601f821160011461363e578192936000926136335750508160011b916000199060031b1c19161760d355565b013590503880612006565b60d3600052601f1982169360008051602061549283398151915291805b868110613692575083600195961061367857505050811b0160d355565b0135600019600384901b60f8161c1916905538808061205e565b9092602060018192868601358155019401910161365b565b6136b2610aa7565b6135f6565b9092916001600160401b038111613777575b6136d78161228f8454610cdd565b6000601f821160011461371057819293946000926137055750508160011b916000199060031b1c1916179055565b0135905038806122b0565b601f1982169461372584600052602060002090565b91805b87811061375f57508360019596971061374557505050811b019055565b0135600019600384901b60f8161c19169055388080612301565b90926020600181928686013581550194019101613728565b61377f610aa7565b6136c9565b61378c61157b565b60ff801960d05416911515161760d055565b91906137a861157b565b6001600160401b03811161386b575b6137c681611e2160c954610cdd565b6000601f82116001146137ff578192936000926137f45750508160011b916000199060031b1c19161760c955565b013590503880611e40565b60c9600052601f1982169360008051602061545283398151915291805b868110613853575083600195961061383957505050811b0160c955565b0135600019600384901b60f8161c19169055388080611e98565b9092602060018192868601358155019401910161381c565b613873610aa7565b6137b7565b919061388261157b565b6001600160401b038111613945575b6138a081611f0460ca54610cdd565b6000601f82116001146138d9578192936000926138ce5750508160011b916000199060031b1c19161760ca55565b013590503880611f23565b60ca600052601f198216936000805160206154b283398151915291805b86811061392d575083600195961061391357505050811b0160ca55565b0135600019600384901b60f8161c19169055388080611f7b565b909260206001819286860135815501940191016138f6565b61394d610aa7565b613891565b60206000805160206154328339815191529161396c61157b565b6001600160a01b0316600081815260cf835260409020805460ff191660ff86151516179055926040519015158152a2565b6001600160a01b0392918381166139bd816139b78661264c565b5061164b565b6139d56139c9856117e6565b84871696168614613ae1565b8015613a8b57610a8694613a7185936139ee8587615362565b613a1083613a0a6139fe886117e6565b6001600160a01b031690565b14613ae1565b613a37613a2786600052609b602052604060002090565b80546001600160a01b0319169055565b613a40866116da565b8054600019019055613a51816116da565b60018154019055613a6c856000526099602052604060002090565b61164b565b6000805160206155328339815191526000604051a46153f2565b505050505050608460405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152fd5b15613ae857565b5060405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608490fd5b9390949192613bd7936000549660ff96613b6b888a60081c1615809a819b613caa575b8115613c885750611a9b565b88613b7e600160ff196000541617600055565b613c7b575b613bbb60005498808a60081c16613b9981612ba9565b60e0805460ff1916905515998a9182613c6e575b8215613c4c575b5050611a9b565b87613bce600160ff196000541617600055565b613c3f576141f1565b613c0f575b613be257565b613bf261ff001960005416600055565b604051600181526000805160206154d283398151915290602090a1565b613c1f61ff001960005416600055565b604051600181526000805160206154d283398151915290602090a1613bdc565b613c47611aff565b6141f1565b303b1592509082613c61575b50503880613bb4565b6001925016143880613c58565b6001828216109250613bad565b613c83611aff565b613b83565b905089303b159182613c9d575b505038611b38565b6001925016148938613c95565b60018b8216109150613b5f565b613cbf61157b565b613cc7613d00565b600160ff1960e054161760e0557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a1565b60ff60e05416613d0c57565b5060405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b613d4d61157b565b60e05460ff811615613d8c5760ff191660e0557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a1565b505060405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b600080808060018060a01b03603354164790828215613df4575bf115613dec57565b610a866123b7565b506108fc613de4565b613e05613d00565b60009133835260cf60205260ff60408420541615613f785782613e2e61094895613eeb93614c56565b95613e4a613e43613e3d61191b565b89612a2a565b5415614d08565b613e736020613e588661526e565b9860405180938192633bdf42b160e01b835260048301614d61565b038173bb7e16c3832d46817279f32c57225d5f811236aa5af4908115613f6b575b8391613f4d575b5060405160016266b40160e11b031981523360048201526001600160a01b03861660248201526044810191909152901515606482015260dc608482015260dd60a4820152918290819060c4820190565b0381733447e2358827ece35d2838109c98f2dc30ec9e765af4928315613f40575b8093613f1b575b505083614fb4565b613f389293503d90823e613f2f3d82610b1c565b3d810190614d8c565b903880613f13565b613f486123b7565b613f0c565b613f659150613f5c3d82610b1c565b3d810190614d52565b38613e9b565b613f736123b7565b613e94565b505050505050606460405162461bcd60e51b815260206004820152601b60248201527a29b2b6b0b73a34b1a9a12a1d1036bab9ba1031329036b4b73a32b960291b6044820152fd5b9290939491613fcd613d00565b811580156140cb575b156140805785602061404a9361037f9361401b61404f97613ffc6109489c3410156140db565b604051637a879d6960e11b815295869485948d8d333060048a0161413d565b0381733447e2358827ece35d2838109c98f2dc30ec9e765af4908115614073575b600091614055575b506116c0565b6141a4565b33614e2a565b61406d91506140643d82610b1c565b3d810190614128565b38614044565b61407b6123b7565b61403c565b50505050505050606460405162461bcd60e51b815260206004820152601d60248201527f4e616d65536572766963653a206572726f72206d696e7420636f756e740000006044820152fd5b50816140d5613004565b10613fd6565b156140e257565b5060405162461bcd60e51b815260206004820152601f60248201527f4e616d65536572766963653a20696e73756666696369656e742076616c7565006044820152606490fd5b908160209103126109b7575161094881610a67565b6001600160a01b0391821681529116602082015260e0604082018190528101839052610948969561010095919390928190878601376000868286010152601f80199101168301936060840152608083015260a082015260c083828403019101520190610a0c565b156141ab57565b5060405162461bcd60e51b815260206004820152601e60248201527f4e616d65536572766963653a20696e76616c6964207369676e617475726500006044820152606490fd5b93600193610a869692614247946040519161420b83610ae6565b600080845254600881901c60ff161598899182806142b3575b8015614299575b61423490611a9b565b60ff191617600055614280575b3361244d565b6142505761218a565b61426061ff001960005416600055565b604051600181526000805160206154d283398151915290602090a161218a565b61429461010061ff00196000541617600055565b614241565b50303b15806142a75761422b565b5060ff8116821461422b565b508160ff821610614224565b156142c657565b5060405162461bcd60e51b815260206004820152602260248201527f4e616d65536572766963653a63616e206e6f742073657420666f72206f746865604482015261727360f01b6064820152608490fd5b6020919283604051948593843782019081520301902090565b1561433757565b5060405162461bcd60e51b81526020600482015260196024820152782730b6b2a9b2b93b34b1b29d3737ba103a34329037bbb732b960391b6044820152606490fd5b9161439d91906106536001600160a01b0385163381149081156144d1575b506142bf565b54906143b5336143af6139fe856117e6565b14614330565b6143be8261264c565b5090733447e2358827ece35d2838109c98f2dc30ec9e7691823b15610c3157604051637187e73360e01b81526001600160a01b03831660048201526024810185905260dc604482015260dd6064820152600081608481875af480156144c4575b6144b0575b50823b15610c3157604051636878b1b760e01b81526001600160a01b03929092166004830152602482015290600090829060449082905af480156144a3575b61448f575b506000805160206155728339815191526125b861448383612ef8565b60405191829182610a31565b61449d906125cb3d82610b1c565b38614467565b6144ab6123b7565b614462565b6144be906125cb3d82610b1c565b38614423565b6144cc6123b7565b61441e565b90501538614397565b91906022610a869160405194818692601160f91b928360208601526021850137820190602182016000815252036002810185520183610b1c565b92614540610948959361453261454e94608088526080880190610a0c565b908682036020880152610a0c565b908482036040860152610d19565b916060818403910152610a0c565b33600090815260de602052604081209092839161457c90829085906136b7565b614584612974565b6145be6145a361459333614674565b9361459c612857565b50966144da565b60405163033a54ef60e01b8152958694859460048601614514565b038173bb7e16c3832d46817279f32c57225d5f811236aa5af4908115614667575b829161464f575b506145fa6145f661037f336116f4565b1590565b8214614630576125b87e1ff0a7f9f9bfa6a3d5d102a071d2bcae92556caf0da1318cfc2783796bab17916144836124ef336116f4565b6125b86000805160206155728339815191529160405191829182610a31565b614661913d90823e612f973d82610b1c565b386145e6565b61466f6123b7565b6145df565b604051906001600160a01b031661468a82610b01565b602a8252604036602084013760306146a183614746565b5360786146ad8361475c565b536029905b600182116146c557610948915015614799565b80600f61470192166010811015614707575b6f181899199a1a9b1b9c1cb0b131b232b360811b901a6146f7848661476d565b5360041c9161478c565b906146b2565b61470f612635565b6146d7565b9061471e82610b4c565b61472b6040519182610b1c565b828152809261473c601f1991610b4c565b0190602036910137565b602090805115614754570190565b612a00612635565b602190805160011015614754570190565b90602091805182101561477f57010190565b614787612635565b010190565b8015613017576000190190565b156147a057565b50606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b6001600160a01b031680156148105760005260dc602052612c6d610948612e4d60406000205461282a565b5060405161481d81610ae6565b6000815290565b610948612e4d612c6d9261282a565b60018060a01b031660005260de602052612c6d610948604060002060405192838092610d19565b1561486157565b5060405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608490fd5b916148dc9061094894928452606060208501526060840190610d19565b916040818403910152610a0c565b60d354600092916148fa82610cdd565b9160019081811690811561494b575060011461491557505050565b909192935060d360005260209081600020906000915b85831061493a57505050500190565b80548584015291830191810161492b565b60ff191683525050019150565b61496961496482611a7e565b61485a565b61497460d354610cdd565b600090156149c6575061094861498c6149a792614a46565b6149b86040519384926149a1602085016148ea565b906129ed565b64173539b7b760d91b815260050190565b03601f198101835282610b1c565b90816149d18261282a565b506149db83612ef8565b926149fa604051948593849363a11f868360e01b8552600485016148bf565b0381733447e2358827ece35d2838109c98f2dc30ec9e765af4918215614a39575b8092614a2657505090565b61094892503d90823e612f973d82610b1c565b614a416123b7565b614a1b565b6000908072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b80821015614b75575b506904ee2d6d415b85acef8160201b80831015614b66575b50662386f26fc1000080831015614b57575b506305f5e10080831015614b48575b5061271080831015614b39575b506064821015614b29575b600a80921015614b1f575b600190816021614ad7828701614714565b95860101905b614ae9575b5050505090565b600019019083906f181899199a1a9b1b9c1cb0b131b232b360811b8282061a835304918215614b1a57919082614add565b614ae2565b9160010191614ac6565b9190606460029104910191614abb565b60049193920491019138614ab0565b60089193920491019138614aa3565b60109193920491019138614a94565b60209193920491019138614a82565b604093508104915038614a6a565b63ffffffff60e01b16631ff437cb60e31b8114908115614ba1575090565b6380ac58cd60e01b811491508115908282614c45575b8315614c34575b8315614c23575b8315614c12575b8315614bd85750505090565b925090614c01575b8115614bf0575b50388080613324565b6301ffc9a760e01b14905038614be7565b635b5e139f60e01b81149150614be0565b6316388eeb60e21b82149350614bcc565b631f75f6d360e31b82149350614bc5565b63780e9d6360e01b82149350614bbe565b635b5e139f60e01b82149350614bb7565b9190916040518381946020938484013781018281016000815260009160db5491614c7f83610cdd565b92600191828216918215614cee575050600114614cad575b505050610a86925003601f198101845283610b1c565b94925060db60005282600020946000905b838210614cd6575050610a8694500101388080614c97565b86548284018601529586019588955090840190614cbe565b91509150610a8696945060ff191690520101388080614c97565b15614d0f57565b5060405162461bcd60e51b815260206004820152601a60248201527913985b5954d95c9d9a58d94e88185b1c9958591e48185919195960321b6044820152606490fd5b908160209103126109b7575190565b91906060614d7960d292608086526080860190610a0c565b936002602082015260d160408201520152565b906020918281830312610980578051906001600160401b038211610c31570181601f8201121561098057805192614dc2846110b8565b93604093614dd285519687610b1c565b818652828087019260061b85010193818511610cb9578301915b848310614dfc5750505050505090565b8583830312610cb9578386918251614e1381610abe565b855181528286015183820152815201920191614dec565b9291614e3c614ef391610a8693614c56565b93614e51613e43614e4b61191b565b87612a2a565b6000614e7c6020614e618461526e565b9760405180938192633bdf42b160e01b835260048301614d61565b038173bb7e16c3832d46817279f32c57225d5f811236aa5af4908115614f5f575b8291614f4a575b5060405160016266b40160e11b031981523360048201526001600160a01b038416602482015260448101919091526000606482015260dc608482015260dd60a4820152928390819060c4820190565b0381733447e2358827ece35d2838109c98f2dc30ec9e765af4918215614f3d575b600092614f23575b5084614fb4565b614f3691923d90823e613f2f3d82610b1c565b9038614f1c565b614f456123b7565b614f14565b614f599150613f5c3d82610b1c565b38614ea4565b614f676123b7565b614e9d565b15614f7357565b5060405162461bcd60e51b815260206004820152601860248201527729b2b6b0b73a34b1a9a12a1d103830b930b69032b93937b960411b6044820152606490fd5b80926002614fc18361264c565b500190614fcd8361264c565b508151600392600092840190835b8381106150295750505050505091614ff8614ffd93541515614f6c565b61514d565b7e1ff0a7f9f9bfa6a3d5d102a071d2bcae92556caf0da1318cfc2783796bab176125b861448383612ef8565b90809293949596975051811015615140575b6020906005918082841b8501015190615060825180151580612d9e57612d5b90612cf9565b509360ff600180960154169081101561511d578914156150c257906150a16150a89282019161509a835180151590816150b6575b506152d0565b518b61531d565b518561531d565b019291908896959493614fdb565b905060d1541138615094565b9a5050505050505050505050608491506040519062461bcd60e51b82526004820152602160248201527f53656d616e7469635342543a207072656469636174652074797065206572726f6044820152603960f91b6064820152fd5b5050634e487b7160e01b8752505060216004525060249850929650505050505050fd5b615148612635565b61503b565b9060405161515a81610ae6565b600081526001600160a01b0383169182156151d957610a8693816133b39461518a61518483611a7e565b15615222565b61519661518483611a7e565b61519f836116da565b600181540190556151be83613a6c846000526099602052604060002090565b600060008051602061553283398151915281604051a46134d1565b5050505050606460405162461bcd60e51b815260206004820152602060248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152fd5b1561522957565b5060405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606490fd5b6130049061527a612608565b615282612608565b60405192909190608084016001600160401b038111858210176152c3575b60405260018060a01b03168352600060208401526040830152606082015261270c565b6152cb610aa7565b6152a0565b156152d757565b5060405162461bcd60e51b815260206004820152601e60248201527f53656d616e7469635342543a207375626a656374206e6f7420657869737400006044820152606490fd5b805490600160401b821015615355575b60018201808255821015615348575b60005260206000200155565b615350612635565b61533c565b61535d610aa7565b61532d565b6001600160a01b03908116159182156153d8575b50501561537f57565b5060405162461bcd60e51b815260206004820152602a60248201527f4e616d65536572766963653a63616e206e6f74207472616e73666572207768656044820152691b881c995cdbdb1d995960b21b6064820152608490fd5b90915060005260dd60205260406000205416153880615376565b6001600160a01b03166154025750565b6000805160206155728339815191526125b861541d83612ef8565b604051918291602083526020830190610a0c56fe1f96bc657d385fd83da973a43f2ad969e6d96b6779b779571a7306db7ca1cd0066be4f155c5ef2ebd3772b228f2f00681e4ed5826cdb3b1943cc11ad15ad1d28e767803f8ecf1dee6bb0345811f7312cda556058b19db6389ad9ae3568643ddd915c3eb987b20e1af620c1403197bf687fb7f18513b3a73fde6e78c7072c41a642d72674974f694b5f5159593243114d38a5c39c89d6b62fee061ff523240ee17f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024988be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e04c0d3471ead8ee99fbd8249e33f683e07c6cd6071fe102dd09617b2c353de430ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9780e26d96b1f2a9a18ef8fc72d589dbf03ef788137b64f43897e83a91e7feec80bce0080e65769d8eee2ab07368f695e8e98b7875f29deedd95b1f202a04149a364697066735822122067313ce9a79112c94abb81c6fe618a3aa05bfc633c870918d7880a4e018e382e6c6578706572696d656e74616cf564736f6c634300080c0041

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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