WEMIX Price: $1.22 (-0.00%)

Contract

0xe69921d540f235B534844B65bbb38aAC99EF6036

Overview

WEMIX Balance

WEMIX3.0 LogoWEMIX3.0 LogoWEMIX3.0 Logo0 WEMIX

WEMIX Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Approve672512132024-12-06 11:47:154 mins ago1733485635IN
NC Characters: NCCHA Token
0 WEMIX0.004887100
Unseal672510242024-12-06 11:44:067 mins ago1733485446IN
NC Characters: NCCHA Token
0 WEMIX0.0167477100
Approve672506992024-12-06 11:38:4113 mins ago1733485121IN
NC Characters: NCCHA Token
0 WEMIX0.004887100
Safe Transfer Fr...672505732024-12-06 11:36:3515 mins ago1733484995IN
NC Characters: NCCHA Token
0 WEMIX0.0169756100
Approve672504512024-12-06 11:34:3317 mins ago1733484873IN
NC Characters: NCCHA Token
0 WEMIX0.004887100
Seal672504502024-12-06 11:34:3217 mins ago1733484872IN
NC Characters: NCCHA Token
0 WEMIX0.0106581100
Safe Transfer Fr...672503162024-12-06 11:32:1819 mins ago1733484738IN
NC Characters: NCCHA Token
0 WEMIX0.0172556100
Approve672501882024-12-06 11:30:1021 mins ago1733484610IN
NC Characters: NCCHA Token
0 WEMIX0.0048858100
Seal672501712024-12-06 11:29:5321 mins ago1733484593IN
NC Characters: NCCHA Token
0 WEMIX0.0106561100
Seal672501302024-12-06 11:29:1222 mins ago1733484552IN
NC Characters: NCCHA Token
0 WEMIX0.0106569100
Unseal672495382024-12-06 11:19:2032 mins ago1733483960IN
NC Characters: NCCHA Token
0 WEMIX0.0150397100
Transfer From672493972024-12-06 11:16:5934 mins ago1733483819IN
NC Characters: NCCHA Token
0 WEMIX0.0142813100
Seal672493612024-12-06 11:16:2335 mins ago1733483783IN
NC Characters: NCCHA Token
0 WEMIX0.0106549100
Approve672488852024-12-06 11:08:2743 mins ago1733483307IN
NC Characters: NCCHA Token
0 WEMIX0.004887100
Seal672485122024-12-06 11:02:1449 mins ago1733482934IN
NC Characters: NCCHA Token
0 WEMIX0.0106581100
Unseal672484802024-12-06 11:01:4250 mins ago1733482902IN
NC Characters: NCCHA Token
0 WEMIX0.0167497100
Transfer From672484122024-12-06 11:00:3451 mins ago1733482834IN
NC Characters: NCCHA Token
0 WEMIX0.0142801100
Approve672478432024-12-06 10:51:051 hr ago1733482265IN
NC Characters: NCCHA Token
0 WEMIX0.004887100
Seal672464012024-12-06 10:27:031 hr ago1733480823IN
NC Characters: NCCHA Token
0 WEMIX0.0106561100
Approve672463992024-12-06 10:27:011 hr ago1733480821IN
NC Characters: NCCHA Token
0 WEMIX0.0048858100
Unseal672462162024-12-06 10:23:581 hr ago1733480638IN
NC Characters: NCCHA Token
0 WEMIX0.0150397100
Transfer From672458932024-12-06 10:18:351 hr ago1733480315IN
NC Characters: NCCHA Token
0 WEMIX0.0128513100
Unseal672458052024-12-06 10:17:071 hr ago1733480227IN
NC Characters: NCCHA Token
0 WEMIX0.0150397100
Approve672451192024-12-06 10:05:411 hr ago1733479541IN
NC Characters: NCCHA Token
0 WEMIX0.004887100
Transfer From672447722024-12-06 9:59:541 hr ago1733479194IN
NC Characters: NCCHA Token
0 WEMIX0.0145613100
View all transactions

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

Contract Source Code Verified (Exact Match)

Contract Name:
NCCHA

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at wemixscan.com on 2024-03-08
*/

// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

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://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.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);
        }
    }
}


interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}


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

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

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


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


abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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


abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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


abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}


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


library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

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

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

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

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


interface IERC721Metadata is IERC721 {
    /**
     * @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);
}


library Strings {
    bytes16 private constant _HEX_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) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

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

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

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

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


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


enum DataVersion {invalid, common}

library CommonDataFormat {
    struct CommonData {
        bytes4 selector;
        address contractAddress;
        address account;
        address requester;
    }

    function encodeToCommonFormat(CommonData memory data) internal pure returns (bytes memory encoded) {
        return abi.encode(data);
    }

    function decodeFromCommonFormat(bytes memory request) internal pure returns (CommonData memory data) {
        return abi.decode(request, (CommonData));
    }

    function manufactureToCommon(bytes memory request) internal pure returns (bytes memory commonData) {
        return request;
    }

    function dataVersion() internal pure returns (uint) {
        return uint(DataVersion.common);
    }
}

/** 
 * //===== EXAMPLE =====//
 *  struct CustomData {
 *      CommonDataFormat.CommonData common;
 *      uint cap;
 *  }
 *
 *   library CustomDataFormat {
 *       function encodeToCustomFormat(CustomData memory data) internal pure returns (bytes memory encoded) {
 *           return abi.encode(data);
 *       }
 *
 *       function decodeFromCustomFormat(bytes memory request) internal pure returns (CustomData memory data) {
 *           return abi.decode(request, (CustomData));
 *       }
 *
 *       function manufactureCustomToCommon(bytes memory request) internal pure returns (bytes memory customData) {
 *           return abi.encode(decodeFromCustomFormat(request).common);
 *       }
 * 
 *       function manufactureCommonToCustom(bytes memory request) internal pure returns (bytes memory customData) {
 *           CommonData memory common = CommonDataFormat.decodeFromCommonFormat(request);
 *           return abi.encode(CustomData(common, 0));
 *       }
 * 
 *       function dataVersion() internal pure returns (DataVersion) {
 *           return DataVersion.custom;
 *       }
 *   }
 *
*/

interface IERC721Enumerable is IERC721 {
    /**
     * @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);
}


interface IVerifyKey {
    function getVerifyKey(address user, bytes32 functionName) external view returns (bytes32);
}

library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}


interface IRoleManager is IAccessControl {
    //===== FUNCTIONS =====//
    function setRoleAdmin(bytes32 role, bytes32 adminRole) external;
    //===== VIEW FUNCTIONS =====//
    function getRoleList(bytes32 role) external view returns (address[] memory);
}

interface IERC721Lockable {
    event Locked(uint256 indexed tokenId);
    event Unlocked(uint256 indexed tokenId);

    /** @dev External function that checks the lock status of the token.
     *  @param tokenId to check
     *  @return is locked (true : locked, false : unlocked)
     */
    function isLocked(uint256 tokenId) external view returns (bool);
}


abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _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);
    }
}


contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings 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.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).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 = _owners[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 = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not token owner nor 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 nor approved");

        _transfer(from, to, tokenId);
    }

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

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

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

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

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721.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);

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

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

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

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

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

        // Clear approvals
        delete _tokenApprovals[tokenId];

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

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

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.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 IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.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.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

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


interface IRiskManager is IERC165Upgradeable {
    //===== VIEW FUNCTIONS =====//
    function isRiskedRequest(uint version, bytes memory request) external view returns (bool);
    function isRiskedRequests(uint version, bytes[] memory requests) external view returns (bool);
}

interface IArbSys {
    function arbBlockNumber() external view returns (uint);
}

library UnaLib {

    function blockNumber(uint chainId) internal view returns (uint) {
        return chainId == 421614 || chainId == 42161 ? IArbSys(0x0000000000000000000000000000000000000064).arbBlockNumber() : block.number;
    }
}

library Converter {
    /**
    * @dev Function to change bytes to bytes32
    */
    function bytesToBytes32(bytes memory input) internal pure returns (bytes32 output) {
        uint length = input.length >= 32 ? 32 : input.length;

        for (uint i = 0; i < length; i++) {
            output |= bytes32(input[i] & 0xFF) >> (i * 8);
        }
    }

    /**
    * @dev Function to change bytes32 to string
    */
    function bytes32ToString(bytes32 _bytes32) internal pure returns (string memory) {
        uint8 i = 0;
        while(i < 32 && _bytes32[i] != 0) {
            i++;
        }
        bytes memory bytesArray = new bytes(i);
        for (i = 0; i < 32 && _bytes32[i] != 0; i++) {
            bytesArray[i] = _bytes32[i];
        }
        return string(bytesArray);
    }

    /**
    * @dev Function to change string to bytes32
    * If string length is less than 32, pad for 0 (LSB)
    */
    function stringToBytes32(string memory source) internal pure returns (bytes32 result) {
        require(bytes(source).length <= 32, "E: string too long");
        assembly {
            result := mload(add(source, 32))
        }
    }

    function concat(string memory str1, string memory str2) internal pure returns (bytes32) {
        bytes memory concatenated = bytes(string(abi.encodePacked(str1, str2)));
        require(concatenated.length <= 32, "E: string too long");
        bytes32 result;

        assembly {
            result := mload(add(concatenated, 32))
        }
        return result;
    }
}

library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    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");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' 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) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        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 if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // 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))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } 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 (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

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


abstract contract ERC721Lockable is IERC721Lockable, ERC721 {
    mapping(uint256 => bool) private _locked;

    /** @dev Lock the tokenId so that it cannot be transferred.
     *  @param tokenId to lock
     */
    function _lock(uint256 tokenId) internal virtual {
        require(_exists(tokenId), "ERC721Lockable: nonexistent token");
        require(!_locked[tokenId], "ERC721Lockable: invalid state");
        _locked[tokenId] = true;
        emit Locked(tokenId);
    }

    /** @dev Unlock the locked tokenId.
     *  @param tokenId to unlock
     */
    function _unlock(uint256 tokenId) internal virtual {
        require(_exists(tokenId), "ERC721Lockable: nonexistent token");
        require(_locked[tokenId], "ERC721Lockable: invalid state");
        delete (_locked[tokenId]);
        emit Unlocked(tokenId);
    }

    function isLocked(uint256 tokenId) public view override returns (bool) {
        return _locked[tokenId];
    }

    /** @dev Reverts If the tokenId is locked
     */
    function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override {
        require(!_locked[tokenId], "ERC721Lockable: transfer state error");
        super._beforeTokenTransfer(from, to, tokenId);
    }
}


abstract contract ERC721Burnable is Context, ERC721 {
    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved");
        _burn(tokenId);
    }
}


abstract contract ERC721URIStorage is ERC721 {
    using Strings for uint256;

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

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

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = _baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(base, _tokenURI));
        }

        return super.tokenURI(tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @dev See {ERC721-_burn}. This override additionally checks to see if a
     * token-specific URI was set for the token, and if so, it deletes the token URI from
     * the storage mapping.
     */
    function _burn(uint256 tokenId) internal virtual override {
        super._burn(tokenId);

        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }
    }
}


interface IURC721 is IERC721Metadata {
    function mint(address to, uint tokenId, string calldata tokenURI) external;
    function mintAuto(address to, string calldata tokenURI) external;
    function burn(uint tokenId) external;
    function lastId() external view returns (uint tokenId);
    function nextId() external view returns (uint tokenId);
}

abstract contract RiskGuard is Context {
    using CommonDataFormat for CommonDataFormat.CommonData;

    // the contract mananging request risk
    address immutable public riskManager; 

    constructor(address riskManager_) {
        require(riskManager_.code.length > 0 && address(riskManager_) != address(0), "RiskGuard: only contract");
        riskManager = riskManager_;
    }
    /**
     * @dev Checks for risks associated with a single address before executing the function.
     * 
     * The caller's address is inherently included in the risk check.
     * 
     * TIP: It is used when there is only one address related to the function call, excluding the caller.
     */
    modifier nonRisk(bytes4 selector, address account) {
        if(account != _msgSender()) _isRiskedRequests(selector, _makeArray(account));
        else _isRiskedRequest(selector, account);
        _;
    }
    
    /**
     * @dev Checks for risks associated with addresses before executing the function.
     * 
     * The caller's address is inherently included in the risk check.
     * 
     * TIP: "It is used when there are two addresses related to the function call, excluding the caller
     *      : one for `from` and another for `to`.
     */
    modifier nonRisks(bytes4 selector, address from, address to) {
        _isRiskedRequests(selector, _makeArray(from, to));
        _;
    }

    /**
     * @dev Call `RiskManager` for requests. (false: not exist risk, true: exist risk)
     *      If it exists risk, revert it.
     * @param selector function signature to detect risk
     * @param accounts the addresses to inspect for risk
     */
    function _isRiskedRequests(bytes4 selector, address[] memory accounts) internal view {
        require(
            !IRiskManager(riskManager).isRiskedRequests(
                CommonDataFormat.dataVersion(),
                _getCommonFormatBytes(selector, accounts)
            ), "RiskGuard: risked request"
        );
    }

    /**
     * @dev Call `RiskManager` for a request. (false: not exist risk, true: exist risk)
     *      If it exists risk, revert it.
     * @param selector function selector to inspect for risk
     * @param account the address to inspect for risk
     */
    function _isRiskedRequest(bytes4 selector, address account) internal view {
        require(
            !IRiskManager(riskManager).isRiskedRequest(
                CommonDataFormat.dataVersion(),
                CommonDataFormat.encodeToCommonFormat(CommonDataFormat.CommonData(selector, address(this), account, _msgSender()))
            ), "RiskGuard: risked request"
        );
    }

    /**
     * @dev To enable the `RiskManager` to handle requests for risk assessment 
     *      for multiple addresses, it converts them into bytes format.
     * @param selector function selector to inspect for risk
     * @param accounts the addresses to inspect for risk
     * 
     */
    function _getCommonFormatBytes(
        bytes4 selector, 
        address[] memory accounts
    ) internal view returns(bytes[] memory) {
        bytes[] memory request = new bytes[](accounts.length);
        address  sender = _msgSender();
        for (uint i; i < accounts.length; ) {
            request[i] = CommonDataFormat.encodeToCommonFormat(
                CommonDataFormat.CommonData(selector, address(this), accounts[i], sender)
            );
            unchecked{ i++; }
        }
            
        return request;
    }

    /**
     * @dev Creating a data format for the `RiskManager` call.
     */
    function _makeArray (
        address from, 
        address to
    ) internal view returns(address[] memory _addressArray) {
        _addressArray = new address[](3);
        _addressArray[0] = _msgSender();
        _addressArray[1] = from;
        _addressArray[2] = to;
    }

    /**
     * @dev Creating a data format for the `RiskManager` call.
     */
    function _makeArray (
        address to
    ) internal view returns(address[] memory _addressArray) {
        _addressArray = new address[](2);
        _addressArray[0] = _msgSender();
        _addressArray[1] = to;
    }
}

contract NightCrowBase is Ownable {
    //===== VARIABLES =====//
    address public roleManager;
    bytes32 constant public setterRole = "NightCrowSetter";
    bytes32 constant public validatorRole = "NightCrowValidator";

    //===== MODIFIERS =====//
    modifier onlyValidRole(bytes32 role) {
        require(_msgSender() == owner() || _hasRole(role, msg.sender),
            "NightCrow: sender has not the role"
        );
        _;
    }

    modifier onlyCA(address addr) {
        require(addr != address(0) && addr.code.length > 0,
            "NightCrow: address is not CA"
        );
        _;
    }

    //===== CONSTRUCTOR =====//
    constructor(address _roleManager) {
        setRoleManager(_roleManager);
    }

    //===== FUNCTIONS =====//
    function setRoleManager(address _roleManager) public onlyValidRole(setterRole) onlyCA(_roleManager) {
        roleManager = _roleManager;
    }

    function _hasRole(bytes32 role, address addr) internal view returns (bool) {
        return IRoleManager(roleManager).hasRole(role, addr);
    }
}

abstract contract VerifyKey is IVerifyKey {
    using Counters for Counters.Counter;

    mapping(bytes32 => bytes4) internal _functionSelectors;
    mapping(address => Counters.Counter) private _userNonce;

    function getVerifyKey(address user, bytes32 functionName) external virtual override view returns (bytes32) {
        return _getVerifyKey(user, _functionSelectors[functionName]);
    }

    function _getVerifyKey(address user, bytes4 selector) internal virtual view returns (bytes32) {
        address _user = user;
        // vault manager address, chainId, user address, user nonce
        return keccak256(abi.encodePacked(address(this), block.chainid, _user, selector, _userNonce[_user].current()));
    }

    function _renewSeed(address user) internal virtual {
        _userNonce[user].increment();
    }

    function _checkAlreadyRegistered(bytes32 functionName) internal virtual returns (bool) {
        return _functionSelectors[functionName] == bytes4(0);
    }

    function _registFunctionSelector(bytes32 functionName, bytes4 selector) internal virtual {
        bytes32 _functionName = functionName;
        require(_checkAlreadyRegistered(_functionName), "VerifyKey: already registered");
        _functionSelectors[_functionName] = selector;
    }
}

interface INightCrowEcho {
    enum TokenType {ERC20, ERC721, ERC1155}

    function echo(
        bytes32 requestID,
        bytes32 service,
        bytes32 token,
        TokenType tokenType,
        bytes4 selector,
        bool isSuccess,
        bytes32 message,
        uint blockNumber,
        uint deadline,
        bytes calldata callData
    ) external;
}


abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}


abstract contract URC721 is IURC721, ERC721Enumerable, ERC721Burnable, ERC721Lockable, ERC721URIStorage, RiskGuard {
    using UnaLib for uint;

    //===== VARIABLES =====//
    uint public immutable code;
    uint public constant unit = 1000000000;
    uint private _lastId;

    //===== MODIFIERS =====//
    modifier onlyBridge() {
        require(_checkBridge(_msgSender()), "Una721: sender is not bridge");
        _;
    }

    modifier onlyMinter() {
        require(_checkMinter(_msgSender()), "URC721: sender is not minter");
        _;
    }

    constructor(
        string memory name,
        string memory symbol,
        address riskManager,
        uint _code
    )
        ERC721(name, symbol)
        RiskGuard(riskManager)
    {
       require(_code % unit == 0, "URC721: invalid unit");
        code = _code;
    }

    //===== FUNCTIONS =====//
    /**
     * @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,
        uint tokenId,
        string calldata _tokenURI
    )
        public
        virtual
        override
        onlyBridge
        nonRisk(this.mint.selector, to)
    {
        _mint(to, tokenId, _tokenURI);
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `tokenId` is automatically generated by a set rule (code + increamed number).
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function mintAuto(
        address to,
        string calldata _tokenURI
    )
        public
        virtual
        override
        onlyMinter
        nonRisk(this.mintAuto.selector, to)
    {
        _mintAuto(to, _tokenURI);
    }

    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(
        uint tokenId
    )
        public
        override(ERC721Burnable, IURC721)
        nonRisk(this.burn.selector, _msgSender())
    {
        super.burn(tokenId);
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    )
        public
        override(ERC721, IERC721)
        nonRisks(this.transferFrom.selector, from, to)
    {
        super.transferFrom(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    )
        public
        override(ERC721, IERC721)
        nonRisks(this.transferFrom.selector, from, to)
    {
        super.safeTransferFrom(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    )
        public
        override(ERC721, IERC721)
        nonRisks(this.transferFrom.selector, from, to)
    {
        super.safeTransferFrom(from, to, tokenId, data);
    }

    /**
     *  @dev tokens list that owned by given owner
     *  @param owner owner of tokens
     */
    function tokensOfOwner(address owner) external view returns(uint[] memory tokenIds) {
        (tokenIds, ) = _tokensOfOwner(owner, false);
    }
    
    /**
     * @dev See next token id
     */
    function lastId() public view override returns (uint tokenId) {
        return generateId(_lastId);
    }

    /**
     * @dev See next token id
     */
    function nextId() public view override returns (uint tokenId) {
        return generateId(_lastId + 1);
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint tokenId)
        public
        view
        override(ERC721, ERC721URIStorage, IERC721Metadata)
        returns (string memory)
    {
       return super.tokenURI(tokenId);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(
        bytes4 interfaceId
    )
        public
        view
        virtual
        override(ERC721,ERC721Enumerable, IERC165)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

    /**
     * @dev NFT is minted only from the specified code to the number of units.
     * @param id used to generate token id
     */
    function generateId(uint id) public view returns (uint tokenId) {
        require(id <= unit, "Una721: mint count is over");
        tokenId = code + id;
    }

    /**
     * @dev Reverts If the tokenId is locked
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint tokenId
    )
        internal
        virtual
        override(ERC721Lockable,ERC721Enumerable,ERC721)
    {
        super._beforeTokenTransfer(from, to, tokenId);
    }

    function _mint(
        address to,
        uint tokenId,
        string calldata _tokenURI
    )
        internal
    {
        _safeMint(to, tokenId);
        _setTokenURI(tokenId, _tokenURI);
    }

    function _mintAuto(
        address to,
        string calldata _tokenURI
    )
        internal
        virtual
    {
        _lastId++;
        uint tokenId = generateId(_lastId);

        _mint(to, tokenId, _tokenURI);
    }

    function _burn(uint tokenId) internal virtual override(ERC721, ERC721URIStorage) {
        super._burn(tokenId);
    }

    function _checkBridge(address sender) internal virtual view returns (bool) {}

    function _checkMinter(address sender) internal virtual view returns (bool) {}

    function _tokensOfOwner(address owner, bool lockedOption) internal view returns (uint[] memory tokenIds, uint lockedCount) {
        uint balance = ERC721.balanceOf(owner);

        tokenIds = new uint[](balance);

        unchecked {
            for(uint i = 0; i < balance; i++) {
                uint tokenId = tokenOfOwnerByIndex(owner, i);
                
                if(lockedOption) {
                    if(!isLocked(tokenId)) continue;
                    lockedCount++;
                }

                tokenIds[i] = tokenId;
            }
        }
    }
}

enum State {SEAL, PLAY}

interface INightCrowNFT {    
    function seal(
        uint tokenId,
        uint deadline,
        bytes calldata validatorSig
    ) external;

    function unseal(
        uint tokenId,
        uint deadline,
        bytes calldata validatorSig
    ) external;

    function mintItem(
        string calldata tokenURI,
        bool isUnseal,
        uint deadline,
        bytes calldata validatorSig
    ) external;

    function mintItemByValidator(
        address[] memory tos,
        string[] calldata tokenURIs,
        bool[] memory isUnseals
    ) external;

    function stateOf(uint tokenId) external view returns (State);
    function isPlay(uint tokenId) external view returns (bool);
}

abstract contract NightCrowUnaBase is NightCrowBase, VerifyKey {
    using UnaLib for uint;
    using ECDSA for bytes32;
    
    //===== VARIABLES =====//
    address public nightCrowEcho;
    bytes32 public constant success = "success";

    //===== CONSTRUCTOR =====//
    constructor(
        address roleManager,
        address _nightCrowEcho
    )
        NightCrowBase(roleManager)
    {
        setNightCrowEcho(_nightCrowEcho);
    }

    //===== FUNCTIONS =====//
    function setNightCrowEcho(
        address _nightCrowEcho
    ) public onlyValidRole(setterRole) onlyCA(_nightCrowEcho) {
        nightCrowEcho = _nightCrowEcho;
    }

    function getRequestID(
        address addr,
        bytes calldata data,
        address sender
    ) public pure returns (bytes32) {
        return keccak256(abi.encodePacked(addr, data, sender));
    }

    function _echo(
        bytes32 requestID,
        bytes32 service,
        bytes32 token,
        INightCrowEcho.TokenType tokenType,
        bytes4 selector,
        bool isSuccess,
        bytes32 message,
        uint deadline,
        bytes memory callData
    ) internal {
        INightCrowEcho(nightCrowEcho).echo(
            requestID,
            service,
            token,
            tokenType,
            selector,
            isSuccess,
            message,
            block.chainid.blockNumber(),
            deadline,
            callData
        );
    }

    function _checkValidSig(
        bytes32 role,
        bytes memory data,
        bytes memory signature
    ) internal view returns (bool isSuccess, bytes32 message) {
        address recover = keccak256(data).recover(signature);
        (isSuccess, message) = _hasRole(role, recover) ? (true, success) : (false, bytes32("invalid sig"));
    }

    function _checkDeadline(uint deadline) internal view returns (bool isSuccess, bytes32 message) {
        (isSuccess, message) = deadline >= block.chainid.blockNumber() || deadline == 0 ? (true, success) : (false, bytes32("over deadline"));
    }
}

contract NightCrowNFT is INightCrowNFT, URC721, NightCrowUnaBase {
    using ECDSA for bytes32;
    using Address for address;
    using Converter for string;

    //===== VARIABLES =====//
    mapping(uint => State) public override stateOf;    // state of the NFT

    bytes4 public constant sealSelector = INightCrowNFT.seal.selector;
    bytes4 public constant unsealSelector = INightCrowNFT.unseal.selector;
    bytes4 public constant mintItemSelector = INightCrowNFT.mintItem.selector;
    bytes4 public constant mintItemBVSelector = INightCrowNFT.mintItemByValidator.selector;

    bytes32 public constant service = "nightcrows";

    //===== MODIFIERS =====//
    modifier onlyTokenOwner(uint tokenId) {
        require(_msgSender() == ownerOf(tokenId), "NightCrowNFT: sender is not NFT's owner");
        _;
    }

    //===== EVENTS =====//
    event Sealed(address indexed _owner, uint indexed tokenId);
    event Unsealed(address indexed _owner, uint indexed tokenId);
    event ItemMinted(
        address indexed to,
        uint indexed tokenId,
        string tokenURI,
        State state
    );

    //===== CONSTRUCTOR =====//
    constructor(
        string memory name,
        string memory symbol,
        uint code,
        address roleManager,
        address riskManager,
        address nightCrowEcho
    )
        URC721(name, symbol, riskManager, code)
        NightCrowUnaBase(roleManager, nightCrowEcho)
    {
        _registFunctionSelector("seal", sealSelector);
        _registFunctionSelector("unseal", unsealSelector);
        _registFunctionSelector("mintItem", mintItemSelector);
        _registFunctionSelector("mintItemByValidator", mintItemBVSelector);
    }

    //===== MAIN FUNCTIONS =====//
    /** 
     * @dev Seals NFT unusable as game items.
     * @param tokenId to seal
     * @param deadline  deadline that this tx can be excuted
     * @param validatorSig Signature value for final confirmation if the NFT is actually an item of 'server'
     * signature (address(this), user, tokenId, deadline, server, verifyKey)
     */
    function seal(
        uint tokenId,
        uint deadline,
        bytes calldata validatorSig
    )
        external
        override
        nonRisk(sealSelector, _msgSender())
    {
        _toggle(
            tokenId,
            deadline,
            sealSelector,
            validatorSig
        );
    }

    /** 
     * @dev Unseal NFT for use as game items.
     * @param tokenId to unseal
     * @param deadline  deadline that this tx can be excuted
     * @param validatorSig Signature value for final confirmation if the NFT is actually an item of 'server'
     * signature (address(this), user, tokenId, deadline, server, verifyKey)
     */
    function unseal(
        uint tokenId,
        uint deadline,
        bytes calldata validatorSig
    )
        external
        override
        nonRisk(unsealSelector, _msgSender())
    {
        _toggle(
            tokenId,
            deadline,
            unsealSelector,
            validatorSig
        );
    }

    /**
    * @dev Mints `tokenId` and transfers it to `to`.
    * @param to  address to mint
    * @param tokenId  id of the NFT
    * @param tokenURI token uri of the NFT
    */
    function mint(
        address to,
        uint tokenId,
        string calldata tokenURI
    )
        public
        override
    {
        super.mint(to, tokenId, tokenURI);
        stateOf[tokenId] = State.SEAL;
    }

    /**
    * @dev Mints `tokenId` and transfers it to `to`.
    * @param to  address to mint
    * @param tokenURI token uri of the NFT
    */
    function mintAuto(
        address to,
        string calldata tokenURI
    )
        public
        override
    {
        super.mintAuto(to, tokenURI);
        stateOf[lastId()] = State.SEAL;
    }

     /**
    * @dev Mints `tokenId` and transfers it to `to` with the server name
    * @param tokenURI token uri of the NFT
    * @param isUnseal check the nft's state is unseal or seal
    * @param deadline  deadline that this tx can be excuted
    * @param validatorSig signature value for final confirmation if the NFT minted to the 'server' as item
     * signature (address(this), user, tokenURI, server, isUnseal deadline, verifyKey)
    */
    function mintItem(
        string calldata tokenURI,
        bool isUnseal,
        uint deadline,
        bytes calldata validatorSig
    )
        external
        override
        nonRisk(mintItemSelector, _msgSender())
    {
        address user = _msgSender();
        // avoid stack too deep
        string calldata _tokenURI = tokenURI;
        bool _isUnseal = isUnseal;
        uint _deadline = deadline;
        bytes calldata _validatorSig = validatorSig;

        (bool isSuccess, bytes32 message) = _checkData(
            user,
            _tokenURI,
            _isUnseal,
            _deadline,
            _validatorSig
        );

        if (isSuccess) _mintItem(user, _tokenURI, _isUnseal);

        bytes32 requestID = getRequestID(address(this), msg.data, user);
        
        _echo(
            requestID,
            service,
            symbol().stringToBytes32(),
            INightCrowEcho.TokenType.ERC721,
            mintItemSelector,
            isSuccess,
            message,
            _deadline,
            ""
        );
    }

    /**
    * @dev External function that generates as many token IDs as 'num'.
    * @param tos  address to mint
    * @param tokenURIs token uris of the NFT
    * @param isUnseals check the nft's state is unseal or seal
    */
    function mintItemByValidator(
        address[] memory tos,
        string[] calldata tokenURIs,
        bool[] memory isUnseals
    )
        external
        onlyValidRole(validatorRole)
    {
        require(
            tos.length == tokenURIs.length && tokenURIs.length == isUnseals.length,
            "NigthCrowNFT: invalid length"
        );
        
        _isRiskedRequests(mintItemBVSelector, tos);

        for (uint i = 0; i < tokenURIs.length;) {
            _mintItem(tos[i], tokenURIs[i], isUnseals[i]);
            unchecked { i++; }
        }
    }

    //===== VIEW FUNCTIONS =====//
    /**
     * @dev Check the NFT's state is 'PLAY'
     * The game server manages the NFT so that it can only be used in the game when the State is 'PLAY'.
     * @param tokenId to check state is 'PLAY'
     */
    function isPlay(uint tokenId) public override view returns (bool) {
        return stateOf[tokenId] == State.PLAY;
    }

    //===== INTERNAL FUNCTIONS =====//
    function _toggle(
        uint tokenId,
        uint deadline,
        bytes4 selector,
        bytes calldata validatorSig
    )
        private
    {
        address user = _msgSender();
        uint _tokenId = tokenId;
        uint _deadline = deadline;
        bytes4 _selector = selector;
        bytes calldata _validatorSig = validatorSig;
        bytes32 requestID = getRequestID(address(this), msg.data, _msgSender());
        
        (bool isSuccess, bytes32 message) = _checkData(
            user,
            _tokenId,
            _deadline,
            _selector,
            _validatorSig
        );

        if (isSuccess) {
            if (_selector == sealSelector) {
                _unlock(_tokenId);
                stateOf[_tokenId] = State.SEAL;

                emit Sealed(user, _tokenId);
            } else {
                _lock(_tokenId);
                stateOf[_tokenId] = State.PLAY;

                emit Unsealed(user, _tokenId);
            }
        }

        _echo(
            requestID,
            service,
            symbol().stringToBytes32(),
            INightCrowEcho.TokenType.ERC721,
            _selector,
            isSuccess,
            message,
            _deadline,
            ""
        );
    }

    function _mintItem(
        address to,
        string calldata tokenURI,
        bool isUnseal
    )
        private
    {
        super._mintAuto(to, tokenURI);
        uint tokenId = lastId();

        if (isUnseal) {
            _lock(tokenId);
            stateOf[tokenId] = State.PLAY;
        }

        emit ItemMinted(to, tokenId, tokenURI, stateOf[tokenId]);
    }

    function _checkBridge(address sender) internal virtual override view returns (bool) {
        return _hasRole(symbol().concat("Bridge"), sender) && sender.code.length > 0;
    }

    function _checkMinter(address sender) internal virtual override view returns (bool) {
       return sender == owner() || _hasRole(symbol().concat("Minter"), sender);
    }

    function _checkData(
        address user,
        uint tokenId,
        uint deadline,
        bytes4 selector,
        bytes calldata validatorSig
    )
        private
        returns (bool isSuccess, bytes32 message)
    {
        bytes32 verifyKey = _getVerifyKey(user, selector);
        _renewSeed(user);

        (isSuccess, message) = _checkOwner(user, tokenId);
        if (!isSuccess) return (isSuccess, message);

        (isSuccess, message) = _checkDeadline(deadline);
        if (!isSuccess) return (isSuccess, message);

        (isSuccess, message) = _checkState(tokenId, selector);
        if (!isSuccess) return (isSuccess, message);

        (isSuccess, message) = _checkValidSig(
            validatorRole,
            abi.encodePacked(
                address(this),
                user,
                tokenId,
                deadline,
                verifyKey
            ),
            validatorSig
        );

        if (!isSuccess) return (isSuccess, message);
    }

    function _checkData(
        address user,
        string calldata tokenURI,
        bool isUnseal,
        uint deadline,
        bytes calldata validatorSig
    )
        private
        returns (bool isSuccess, bytes32 message)
    {
        bytes32 verifyKey = _getVerifyKey(user, mintItemSelector);
        _renewSeed(user);

        (isSuccess, message) = _checkDeadline(deadline);
        if (!isSuccess) return (isSuccess, message);

        (isSuccess, message) = _checkValidSig(
            validatorRole,
            abi.encodePacked(
                address(this),
                user,
                tokenURI,
                isUnseal,
                deadline,
                verifyKey
            ),
            validatorSig
        );
        
        if (!isSuccess) return (isSuccess, message);
    }

    function _checkOwner(address user, uint tokenId) private view returns (bool isSuccess, bytes32 message) {
        (isSuccess, message) = user == ownerOf(tokenId)? (true, success) : (false, bytes32("sender is not NFT's owner"));
    }
    
    function _checkState(uint tokenId, bytes4 selector) private view returns (bool isSuccess, bytes32 message) {
        if (selector == sealSelector) {
            (isSuccess, message) = isPlay(tokenId) ? (true, success) : (false, bytes32("state is already SEAL"));
        } else {
            (isSuccess, message) = !isPlay(tokenId) ? (true, success) : (false, bytes32("state is already PLAY"));
        }
    }

    function _checkRole(address sender, bytes32 role) private view returns (bool) {
        return sender == owner() || (_hasRole(role, sender) && sender.code.length > 0);
    }
}

contract NCCHA is NightCrowNFT {
    constructor(
        string memory name,
        string memory symbol,
        uint code,
        address roleManager,
        address riskManager,
        address nightCrowEcho
    ) NightCrowNFT(
        name,
        symbol,
        code,
        roleManager,
        riskManager,
        nightCrowEcho
    ) {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"code","type":"uint256"},{"internalType":"address","name":"roleManager","type":"address"},{"internalType":"address","name":"riskManager","type":"address"},{"internalType":"address","name":"nightCrowEcho","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"tokenURI","type":"string"},{"indexed":false,"internalType":"enum State","name":"state","type":"uint8"}],"name":"ItemMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"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":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Sealed","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":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Unlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Unsealed","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"code","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"generateId","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"address","name":"sender","type":"address"}],"name":"getRequestID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes32","name":"functionName","type":"bytes32"}],"name":"getVerifyKey","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isPlay","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastId","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenURI","type":"string"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"string","name":"tokenURI","type":"string"}],"name":"mintAuto","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"tokenURI","type":"string"},{"internalType":"bool","name":"isUnseal","type":"bool"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"validatorSig","type":"bytes"}],"name":"mintItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintItemBVSelector","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tos","type":"address[]"},{"internalType":"string[]","name":"tokenURIs","type":"string[]"},{"internalType":"bool[]","name":"isUnseals","type":"bool[]"}],"name":"mintItemByValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintItemSelector","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextId","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nightCrowEcho","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"riskManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"roleManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"validatorSig","type":"bytes"}],"name":"seal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealSelector","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"service","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":"_nightCrowEcho","type":"address"}],"name":"setNightCrowEcho","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_roleManager","type":"address"}],"name":"setRoleManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setterRole","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stateOf","outputs":[{"internalType":"enum State","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"success","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"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":"unit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"validatorSig","type":"bytes"}],"name":"unseal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unsealSelector","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"validatorRole","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"}]

60c06040523480156200001157600080fd5b5060405162004c5938038062004c5983398101604081905262000034916200076d565b8585858585858281818888868981848481600090805190602001906200005c929190620005dd565b50805162000072906001906020840190620005dd565b5050506000816001600160a01b03163b1180156200009857506001600160a01b03811615155b620000ea5760405162461bcd60e51b815260206004820152601860248201527f5269736b47756172643a206f6e6c7920636f6e7472616374000000000000000060448201526064015b60405180910390fd5b6001600160a01b031660805262000106633b9aca008262000817565b15620001555760405162461bcd60e51b815260206004820152601460248201527f5552433732313a20696e76616c696420756e69740000000000000000000000006044820152606401620000e1565b60a052506200016891503390506200021b565b62000173816200026d565b506200017f8162000398565b506200019c9050631cd9585b60e21b63442f74ad60e11b620004c3565b620001b8651d5b9cd9585b60d21b6345f2869960e11b620004c3565b620001d6676d696e744974656d60c01b63fcbb6cf560e01b620004c3565b620002097f6d696e744974656d427956616c696461746f72000000000000000000000000006376f30f5b60e01b620004c3565b5050505050505050505050506200089b565b600d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6e2734b3b43a21b937bba9b2ba3a32b960891b62000293600d546001600160a01b031690565b6001600160a01b0316336001600160a01b03161480620002ba5750620002ba81336200055d565b620003025760405162461bcd60e51b8152602060048201526022602482015260008051602062004c398339815191526044820152616c6560f01b6064820152608401620000e1565b816001600160a01b038116158015906200032657506000816001600160a01b03163b115b620003745760405162461bcd60e51b815260206004820152601c60248201527f4e6967687443726f773a2061646472657373206973206e6f74204341000000006044820152606401620000e1565b5050600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6e2734b3b43a21b937bba9b2ba3a32b960891b620003be600d546001600160a01b031690565b6001600160a01b0316336001600160a01b03161480620003e55750620003e581336200055d565b6200042d5760405162461bcd60e51b8152602060048201526022602482015260008051602062004c398339815191526044820152616c6560f01b6064820152608401620000e1565b816001600160a01b038116158015906200045157506000816001600160a01b03163b115b6200049f5760405162461bcd60e51b815260206004820152601c60248201527f4e6967687443726f773a2061646472657373206973206e6f74204341000000006044820152606401620000e1565b5050601180546001600160a01b0319166001600160a01b0392909216919091179055565b81620004e9816000908152600f602052604090205460e01b6001600160e01b0319161590565b620005375760405162461bcd60e51b815260206004820152601d60248201527f5665726966794b65793a20616c726561647920726567697374657265640000006044820152606401620000e1565b6000908152600f60205260409020805463ffffffff191660e09290921c91909117905550565b600e54604051632474521560e21b8152600481018490526001600160a01b03838116602483015260009216906391d1485490604401602060405180830381865afa158015620005b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005d691906200083a565b9392505050565b828054620005eb906200085e565b90600052602060002090601f0160209004810192826200060f57600085556200065a565b82601f106200062a57805160ff19168380011785556200065a565b828001600101855582156200065a579182015b828111156200065a5782518255916020019190600101906200063d565b50620006689291506200066c565b5090565b5b808211156200066857600081556001016200066d565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620006ab57600080fd5b81516001600160401b0380821115620006c857620006c862000683565b604051601f8301601f19908116603f01168101908282118183101715620006f357620006f362000683565b816040528381526020925086838588010111156200071057600080fd5b600091505b8382101562000734578582018301518183018401529082019062000715565b83821115620007465760008385830101525b9695505050505050565b80516001600160a01b03811681146200076857600080fd5b919050565b60008060008060008060c087890312156200078757600080fd5b86516001600160401b03808211156200079f57600080fd5b620007ad8a838b0162000699565b97506020890151915080821115620007c457600080fd5b50620007d389828a0162000699565b95505060408701519350620007eb6060880162000750565b9250620007fb6080880162000750565b91506200080b60a0880162000750565b90509295509295509295565b6000826200083557634e487b7160e01b600052601260045260246000fd5b500690565b6000602082840312156200084d57600080fd5b81518015158114620005d657600080fd5b600181811c908216806200087357607f821691505b602082108114156200089557634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a051614363620008d6600039600081816103ec0152610bb601526000818161048f01528181611492015261165201526143636000f3fe608060405234801561001057600080fd5b50600436106102d55760003560e01c806373dce1e011610182578063c1292cc3116100e9578063e985e9c5116100a2578063f6aacfb11161007c578063f6aacfb1146106d5578063f971fac6146106f8578063fb08e0211461070b578063fcbb6cf51461071957600080fd5b8063e985e9c514610673578063f1d588c5146106af578063f2fde38b146106c257600080fd5b8063c1292cc31461060a578063c4b1fd7814610612578063c87b56dd14610620578063c92fb94714610633578063d3fc98641461064c578063d598d4c91461065f57600080fd5b8063907af6c01161013b578063907af6c0146105ab57806395d89b41146105b6578063a22cb465146105be578063b88d4fde146105d1578063be23c5eb146105e4578063befe0aaa146105f757600080fd5b806373dce1e01461053357806376f30f5b146105415780638462151c14610554578063885ee95a146105745780638be50d32146105875780638da5cb5b1461059a57600080fd5b80632f745c59116102415780634d70d1d7116101fa57806361b8ce8c116101d457806361b8ce8c146104fd5780636352211e1461050557806370a0823114610518578063715018a61461052b57600080fd5b80634d70d1d7146104c45780634f13d9fd146104d75780634f6ccce7146104ea57600080fd5b80632f745c591461043557806342842e0e1461044857806342966c681461045b57806342f7022e1461046e578063478426631461048a5780634bb407a3146104b157600080fd5b80630b93381b116102935780630b93381b1461037d578063131a7e241461039c57806318160ddd146103cc57806323b872dd146103d457806324c12bf6146103e757806326dd92071461040e57600080fd5b8062435da5146102da57806301ffc9a71461030a57806306fdde031461032d578063081812fc14610342578063095ea7b3146103555780630a530d0e1461036a575b600080fd5b600e546102ed906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61031d61031836600461372d565b61072c565b6040519015158152602001610301565b61033561073d565b60405161030191906137a2565b6102ed6103503660046137b5565b6107cf565b6103686103633660046137ea565b6107f6565b005b610368610378366004613814565b610911565b61038e667375636365737360c81b81565b604051908152602001610301565b6103bf6103aa3660046137b5565b60126020526000908152604090205460ff1681565b6040516103019190613859565b60085461038e565b6103686103e2366004613867565b610a09565b61038e7f000000000000000000000000000000000000000000000000000000000000000081565b61041c6376f30f5b60e01b81565b6040516001600160e01b03199091168152602001610301565b61038e6104433660046137ea565b610a39565b610368610456366004613867565b610acf565b6103686104693660046137b5565b610af2565b61038e712734b3b43a21b937bbab30b634b230ba37b960711b81565b6102ed7f000000000000000000000000000000000000000000000000000000000000000081565b6103686104bf3660046138e4565b610b0e565b61038e6104d23660046137b5565b610b5a565b61038e6104e5366004613936565b610bda565b61038e6104f83660046137b5565b610c14565b61038e610ca7565b6102ed6105133660046137b5565b610cc0565b61038e610526366004613814565b610d20565b610368610da6565b61041c63442f74ad60e11b81565b61036861054f366004613ac9565b610dba565b610567610562366004613814565b610f02565b6040516103019190613bb2565b610368610582366004613bf6565b610f16565b610368610595366004613bf6565b610f3d565b600d546001600160a01b03166102ed565b61038e633b9aca0081565b610335610f64565b6103686105cc366004613c48565b610f73565b6103686105df366004613c7f565b610f82565b61031d6105f23660046137b5565b610faf565b6011546102ed906001600160a01b031681565b61038e610fdd565b61041c6345f2869960e11b81565b61033561062e3660046137b5565b610fea565b61038e6e2734b3b43a21b937bba9b2ba3a32b960891b81565b61036861065a366004613d3e565b610ff5565b61038e696e6967687463726f777360b01b81565b61031d610681366004613d7f565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6103686106bd366004613814565b61101c565b6103686106d0366004613814565b611114565b61031d6106e33660046137b5565b6000908152600a602052604090205460ff1690565b61038e6107063660046137ea565b61118d565b61041c63fcbb6cf560e01b81565b610368610727366004613db2565b6111b1565b60006107378261125c565b92915050565b60606000805461074c90613e3f565b80601f016020809104026020016040519081016040528092919081815260200182805461077890613e3f565b80156107c55780601f1061079a576101008083540402835291602001916107c5565b820191906000526020600020905b8154815290600101906020018083116107a857829003601f168201915b5050505050905090565b60006107da82611281565b506000908152600460205260409020546001600160a01b031690565b600061080182610cc0565b9050806001600160a01b0316836001600160a01b031614156108745760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061089057506108908133610681565b6109025760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161086b565b61090c83836112e0565b505050565b6e2734b3b43a21b937bba9b2ba3a32b960891b610936600d546001600160a01b031690565b6001600160a01b0316336001600160a01b0316148061095a575061095a813361134e565b6109765760405162461bcd60e51b815260040161086b90613e7a565b816001600160a01b0381161580159061099957506000816001600160a01b03163b115b6109e55760405162461bcd60e51b815260206004820152601c60248201527f4e6967687443726f773a2061646472657373206973206e6f7420434100000000604482015260640161086b565b5050601180546001600160a01b0319166001600160a01b0392909216919091179055565b6323b872dd60e01b8383610a2683610a2184846113c4565b611488565b610a3186868661156e565b505050505050565b6000610a4483610d20565b8210610aa65760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161086b565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6323b872dd60e01b8383610ae783610a2184846113c4565b610a318686866115a0565b630852cd8d60e31b33610b058282611648565b61090c836116e9565b610b19838383611717565b600060126000610b27610fdd565b81526020810191909152604001600020805460ff191660018381811115610b5057610b5061382f565b0217905550505050565b6000633b9aca00821115610bb05760405162461bcd60e51b815260206004820152601a60248201527f556e613732313a206d696e7420636f756e74206973206f766572000000000000604482015260640161086b565b610737827f0000000000000000000000000000000000000000000000000000000000000000613ed2565b600084848484604051602001610bf39493929190613eea565b6040516020818303038152906040528051906020012090505b949350505050565b6000610c1f60085490565b8210610c825760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161086b565b60088281548110610c9557610c95613f26565b90600052602060002001549050919050565b6000610cbb600c5460016104d29190613ed2565b905090565b6000818152600260205260408120546001600160a01b0316806107375760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161086b565b60006001600160a01b038216610d8a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161086b565b506001600160a01b031660009081526003602052604090205490565b610dae6117b3565b610db8600061180d565b565b712734b3b43a21b937bbab30b634b230ba37b960711b610de2600d546001600160a01b031690565b6001600160a01b0316336001600160a01b03161480610e065750610e06813361134e565b610e225760405162461bcd60e51b815260040161086b90613e7a565b845183148015610e325750815183145b610e7e5760405162461bcd60e51b815260206004820152601c60248201527f4e6967746843726f774e46543a20696e76616c6964206c656e67746800000000604482015260640161086b565b610e8f6376f30f5b60e01b86611488565b60005b83811015610a3157610efa868281518110610eaf57610eaf613f26565b6020026020010151868684818110610ec957610ec9613f26565b9050602002810190610edb9190613f3c565b868581518110610eed57610eed613f26565b602002602001015161185f565b600101610e92565b6060610f0f826000611903565b5092915050565b63442f74ad60e11b33610f298282611648565b610a31868663442f74ad60e11b87876119cb565b6345f2869960e11b33610f508282611648565b610a3186866345f2869960e11b87876119cb565b60606001805461074c90613e3f565b610f7e338383611b0a565b5050565b6323b872dd60e01b8484610f9a83610a2184846113c4565b610fa687878787611bd9565b50505050505050565b6000600160008381526012602052604090205460ff166001811115610fd657610fd661382f565b1492915050565b6000610cbb600c54610b5a565b606061073782611c11565b61100184848484611d1a565b50506000908152601260205260409020805460ff1916905550565b6e2734b3b43a21b937bba9b2ba3a32b960891b611041600d546001600160a01b031690565b6001600160a01b0316336001600160a01b031614806110655750611065813361134e565b6110815760405162461bcd60e51b815260040161086b90613e7a565b816001600160a01b038116158015906110a457506000816001600160a01b03163b115b6110f05760405162461bcd60e51b815260206004820152601c60248201527f4e6967687443726f773a2061646472657373206973206e6f7420434100000000604482015260640161086b565b5050600e80546001600160a01b0319166001600160a01b0392909216919091179055565b61111c6117b3565b6001600160a01b0381166111815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161086b565b61118a8161180d565b50565b6000818152600f60205260408120546111aa90849060e01b611db0565b9392505050565b63fcbb6cf560e01b336111c48282611648565b338888888888886000806111dd89898989898989611e2e565b9150915081156111f3576111f38989898961185f565b6000611202306000368d610bda565b905061124881696e6967687463726f777360b01b611226611221610f64565b611f1a565b600163fcbb6cf560e01b88888d60405180602001604052806000815250611f6b565b505050505050505050505050505050505050565b60006001600160e01b0319821663780e9d6360e01b1480610737575061073782611ff0565b6000818152600260205260409020546001600160a01b031661118a5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161086b565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061131582610cc0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600e54604051632474521560e21b8152600481018490526001600160a01b03838116602483015260009216906391d1485490604401602060405180830381865afa1580156113a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111aa9190613f82565b6040805160038082526080820190925260609160208201838036833701905050905033816000815181106113fa576113fa613f26565b60200260200101906001600160a01b031690816001600160a01b031681525050828160018151811061142e5761142e613f26565b60200260200101906001600160a01b031690816001600160a01b031681525050818160028151811061146257611462613f26565b60200260200101906001600160a01b031690816001600160a01b03168152505092915050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663afa960e360016114c38585612040565b6040518363ffffffff1660e01b81526004016114e0929190613f9f565b602060405180830381865afa1580156114fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115219190613f82565b15610f7e5760405162461bcd60e51b815260206004820152601960248201527f5269736b47756172643a207269736b6564207265717565737400000000000000604482015260640161086b565b611579335b82612136565b6115955760405162461bcd60e51b815260040161086b90614009565b61090c8383836121b4565b61090c83838360405180602001604052806000815250610f82565b604080516002808252606080830184529260208301908036833701905050905033816000815181106115ef576115ef613f26565b60200260200101906001600160a01b031690816001600160a01b031681525050818160018151811061162357611623613f26565b60200260200101906001600160a01b031690816001600160a01b031681525050919050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663d37c475160016116cc6040518060800160405280876001600160e01b0319168152602001306001600160a01b03168152602001866001600160a01b031681526020016116bc3390565b6001600160a01b0316905261236a565b6040518363ffffffff1660e01b81526004016114e0929190614057565b6116f233611573565b61170e5760405162461bcd60e51b815260040161086b90614009565b61118a816123c9565b611720336123d2565b61176c5760405162461bcd60e51b815260206004820152601c60248201527f5552433732313a2073656e646572206973206e6f74206d696e74657200000000604482015260640161086b565b634bb407a360e01b836001600160a01b03811633146117975761179282610a21836115bb565b6117a1565b6117a18282611648565b6117ac858585612439565b5050505050565b600d546001600160a01b03163314610db85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086b565b600d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61186a848484612439565b6000611874610fdd565b9050811561189f5761188581612469565b6000818152601260205260409020805460ff191660011790555b6000818152601260205260409081902054905182916001600160a01b038816917f1bb8f6fa8e4349c6ac47f96621aeba659efb219b578d56138ceb2632f67dc4e5916118f4918991899160ff90911690614070565b60405180910390a35050505050565b606060008061191185610d20565b9050806001600160401b0381111561192b5761192b61399a565b604051908082528060200260200182016040528015611954578160200160208202803683370190505b50925060005b818110156119c257600061196e8783610a39565b90508515611999576000818152600a602052604090205460ff1661199257506119ba565b6001909301925b808583815181106119ac576119ac613f26565b602002602001018181525050505b60010161195a565b50509250929050565b33858585858560006119df3082368a610bda565b90506000806119f289898989898961253f565b915091508115611ac2576001600160e01b0319861663442f74ad60e11b1415611a6c57611a1e8861263d565b600088815260126020526040808220805460ff191690555189916001600160a01b038c16917fdfa31364a49d58c4c419cf858f4e7b68131d83aee1c28a6f85246bda02d9d6999190a3611ac2565b611a7588612469565b600088815260126020526040808220805460ff191660011790555189916001600160a01b038c16917f9f9d379338085f1564909e23bd3c32ddae4d5e3c94cc441b620af408d7002c7b9190a35b611afa83696e6967687463726f777360b01b611adf611221610f64565b60018a87878e60405180602001604052806000815250611f6b565b5050505050505050505050505050565b816001600160a01b0316836001600160a01b03161415611b6c5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161086b565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611be33383612136565b611bff5760405162461bcd60e51b815260040161086b90614009565b611c0b8484848461270f565b50505050565b6060611c1c82611281565b6000828152600b602052604081208054611c3590613e3f565b80601f0160208091040260200160405190810160405280929190818152602001828054611c6190613e3f565b8015611cae5780601f10611c8357610100808354040283529160200191611cae565b820191906000526020600020905b815481529060010190602001808311611c9157829003601f168201915b505050505090506000611ccc60408051602081019091526000815290565b9050805160001415611cdf575092915050565b815115611d11578082604051602001611cf99291906140a8565b60405160208183030381529060405292505050919050565b610c0c84612742565b611d23336127b5565b611d6f5760405162461bcd60e51b815260206004820152601c60248201527f556e613732313a2073656e646572206973206e6f742062726964676500000000604482015260640161086b565b6334ff261960e21b846001600160a01b0381163314611d9a57611d9582610a21836115bb565b611da4565b611da48282611648565b610a31868686866127fb565b6001600160a01b03821660009081526010602090815260409182902054825130606090811b6bffffffffffffffffffffffff199081168386015246603484015296901b90951660548601526001600160e01b03199093166068850152606c8085019390935281518085039093018352608c9093019052805191012090565b60008080611e438a63fcbb6cf560e01b611db0565b9050611e698a6001600160a01b0316600090815260106020526040902080546001019055565b611e7286612845565b909350915082611e825750611f0e565b611efc712734b3b43a21b937bbab30b634b230ba37b960711b308c8c8c8c8c88604051602001611eb897969594939291906140d7565b60408051601f198184030181526020601f8a018190048102840181019092528883529190899089908190840183828082843760009201919091525061289192505050565b909350915082611f0c5750611f0e565b505b97509795505050505050565b6000602082511115611f635760405162461bcd60e51b8152602060048201526012602482015271453a20737472696e6720746f6f206c6f6e6760701b604482015260640161086b565b506020015190565b6011546001600160a01b031663aaad6deb8a8a8a8a8a8a8a611f8c466128f1565b8b8b6040518b63ffffffff1660e01b8152600401611fb39a99989796959493929190614129565b600060405180830381600087803b158015611fcd57600080fd5b505af1158015611fe1573d6000803e3d6000fd5b50505050505050505050505050565b60006001600160e01b031982166380ac58cd60e01b148061202157506001600160e01b03198216635b5e139f60e01b145b8061073757506301ffc9a760e01b6001600160e01b0319831614610737565b6060600082516001600160401b0381111561205d5761205d61399a565b60405190808252806020026020018201604052801561209057816020015b606081526020019060019003908161207b5790505b5090503360005b845181101561212c576121076040518060800160405280886001600160e01b0319168152602001306001600160a01b031681526020018784815181106120df576120df613f26565b60200260200101516001600160a01b03168152602001846001600160a01b031681525061236a565b83828151811061211957612119613f26565b6020908102919091010152600101612097565b5090949350505050565b60008061214283610cc0565b9050806001600160a01b0316846001600160a01b0316148061218957506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b80610c0c5750836001600160a01b03166121a2846107cf565b6001600160a01b031614949350505050565b826001600160a01b03166121c782610cc0565b6001600160a01b03161461222b5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161086b565b6001600160a01b03821661228d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161086b565b612298838383612972565b600081815260046020908152604080832080546001600160a01b03191690556001600160a01b0386168352600390915281208054600192906122db9084906141a1565b90915550506001600160a01b0382166000908152600360205260408120805460019290612309908490613ed2565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6040805182516001600160e01b0319166020808301919091528301516001600160a01b039081168284015291830151821660608281019190915283810151909216608082015260a0016040516020818303038152906040529050919050565b61118a8161297d565b60006123e6600d546001600160a01b031690565b6001600160a01b0316826001600160a01b0316148061073757506107376124336040518060400160405280600681526020016526b4b73a32b960d11b81525061242d610f64565b906129bd565b8361134e565b600c8054906000612449836141b8565b9190505550600061245b600c54610b5a565b9050611c0b848285856127fb565b6000818152600260205260409020546001600160a01b031661249d5760405162461bcd60e51b815260040161086b906141d3565b6000818152600a602052604090205460ff16156124fc5760405162461bcd60e51b815260206004820152601d60248201527f4552433732314c6f636b61626c653a20696e76616c6964207374617465000000604482015260640161086b565b6000818152600a6020526040808220805460ff191660011790555182917f032bc66be43dbccb7487781d168eb7bda224628a3b2c3388bdf69b532a3a161191a250565b600080600061254e8987611db0565b9050612574896001600160a01b0316600090815260106020526040902080546001019055565b61257e8989612a36565b90935091508261258e5750612632565b61259787612845565b9093509150826125a75750612632565b6125b18887612a9b565b9093509150826125c15750612632565b6040516bffffffffffffffffffffffff1930606090811b821660208401528b901b16603482015260488101899052606881018890526088810182905261262090712734b3b43a21b937bbab30b634b230ba37b960711b9060a801611eb8565b9093509150826126305750612632565b505b965096945050505050565b6000818152600260205260409020546001600160a01b03166126715760405162461bcd60e51b815260040161086b906141d3565b6000818152600a602052604090205460ff166126cf5760405162461bcd60e51b815260206004820152601d60248201527f4552433732314c6f636b61626c653a20696e76616c6964207374617465000000604482015260640161086b565b6000818152600a6020526040808220805460ff191690555182917ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184291a250565b61271a8484846121b4565b61272684848484612b31565b611c0b5760405162461bcd60e51b815260040161086b90614214565b606061274d82611281565b600061276460408051602081019091526000815290565b9050600081511161278457604051806020016040528060008152506111aa565b8061278e84612c2c565b60405160200161279f9291906140a8565b6040516020818303038152906040529392505050565b60006127e46124336040518060400160405280600681526020016542726964676560d01b81525061242d610f64565b80156107375750506001600160a01b03163b151590565b6128058484612d29565b611c0b8383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612d4392505050565b600080612851466128f1565b8310158061285d575082155b6128795760006c6f76657220646561646c696e6560981b612887565b6001667375636365737360c81b5b9094909350915050565b60008060006128b0848680519060200120612ddd90919063ffffffff16565b90506128bc868261134e565b6128d65760006a696e76616c69642073696760a81b6128e4565b6001667375636365737360c81b5b9097909650945050505050565b60008162066eee148061290557508161a4b1145b61290f5743610737565b60646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561294e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107379190614266565b61090c838383612e01565b61298681612e77565b6000818152600b60205260409020805461299f90613e3f565b15905061118a576000818152600b6020526040812061118a91613644565b60008083836040516020016129d39291906140a8565b6040516020818303038152906040529050602081511115612a2b5760405162461bcd60e51b8152602060048201526012602482015271453a20737472696e6720746f6f206c6f6e6760701b604482015260640161086b565b602001519392505050565b600080612a4283610cc0565b6001600160a01b0316846001600160a01b031614612a825760007f73656e646572206973206e6f74204e46542773206f776e657200000000000000612a90565b6001667375636365737360c81b5b909590945092505050565b6000806001600160e01b0319831663442f74ad60e11b1415612afc57612ac084610faf565b612ae4576000741cdd185d19481a5cc8185b1c9958591e4814d15053605a1b612af2565b6001667375636365737360c81b5b9092509050612b2a565b612b0584610faf565b15612a8257600074737461746520697320616c726561647920504c415960581b612a90565b9250929050565b60006001600160a01b0384163b15612c2457604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612b7590339089908890889060040161427f565b6020604051808303816000875af1925050508015612bb0575060408051601f3d908101601f19168201909252612bad918101906142bc565b60015b612c0a573d808015612bde576040519150601f19603f3d011682016040523d82523d6000602084013e612be3565b606091505b508051612c025760405162461bcd60e51b815260040161086b90614214565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610c0c565b506001610c0c565b606081612c505750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612c7a5780612c64816141b8565b9150612c739050600a836142ef565b9150612c54565b6000816001600160401b03811115612c9457612c9461399a565b6040519080825280601f01601f191660200182016040528015612cbe576020820181803683370190505b5090505b8415610c0c57612cd36001836141a1565b9150612ce0600a86614303565b612ceb906030613ed2565b60f81b818381518110612d0057612d00613f26565b60200101906001600160f81b031916908160001a905350612d22600a866142ef565b9450612cc2565b610f7e828260405180602001604052806000815250612f2d565b6000828152600260205260409020546001600160a01b0316612dbe5760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b606482015260840161086b565b6000828152600b60209081526040909120825161090c9284019061367e565b6000806000612dec8585612f60565b91509150612df981612fcd565b509392505050565b6000818152600a602052604090205460ff1615612e6c5760405162461bcd60e51b8152602060048201526024808201527f4552433732314c6f636b61626c653a207472616e736665722073746174652065604482015263393937b960e11b606482015260840161086b565b61090c838383613188565b6000612e8282610cc0565b9050612e9081600084612972565b600082815260046020908152604080832080546001600160a01b03191690556001600160a01b038416835260039091528120805460019290612ed39084906141a1565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b612f378383613240565b612f446000848484612b31565b61090c5760405162461bcd60e51b815260040161086b90614214565b600080825160411415612f975760208301516040840151606085015160001a612f8b8782858561338e565b94509450505050612b2a565b825160401415612fc15760208301516040840151612fb686838361347b565b935093505050612b2a565b50600090506002612b2a565b6000816004811115612fe157612fe161382f565b1415612fea5750565b6001816004811115612ffe57612ffe61382f565b141561304c5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161086b565b60028160048111156130605761306061382f565b14156130ae5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161086b565b60038160048111156130c2576130c261382f565b141561311b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161086b565b600481600481111561312f5761312f61382f565b141561118a5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161086b565b6001600160a01b0383166131e3576131de81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b613206565b816001600160a01b0316836001600160a01b0316146132065761320683826134b4565b6001600160a01b03821661321d5761090c81613551565b826001600160a01b0316826001600160a01b03161461090c5761090c8282613600565b6001600160a01b0382166132965760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161086b565b6000818152600260205260409020546001600160a01b0316156132fb5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161086b565b61330760008383612972565b6001600160a01b0382166000908152600360205260408120805460019290613330908490613ed2565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156133c55750600090506003613472565b8460ff16601b141580156133dd57508460ff16601c14155b156133ee5750600090506004613472565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613442573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661346b57600060019250925050613472565b9150600090505b94509492505050565b6000806001600160ff1b0383168161349860ff86901c601b613ed2565b90506134a68782888561338e565b935093505050935093915050565b600060016134c184610d20565b6134cb91906141a1565b60008381526007602052604090205490915080821461351e576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090613563906001906141a1565b6000838152600960205260408120546008805493945090928490811061358b5761358b613f26565b9060005260206000200154905080600883815481106135ac576135ac613f26565b60009182526020808320909101929092558281526009909152604080822084905585825281205560088054806135e4576135e4614317565b6001900381819060005260206000200160009055905550505050565b600061360b83610d20565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b50805461365090613e3f565b6000825580601f10613660575050565b601f01602090049060005260206000209081019061118a9190613702565b82805461368a90613e3f565b90600052602060002090601f0160209004810192826136ac57600085556136f2565b82601f106136c557805160ff19168380011785556136f2565b828001600101855582156136f2579182015b828111156136f25782518255916020019190600101906136d7565b506136fe929150613702565b5090565b5b808211156136fe5760008155600101613703565b6001600160e01b03198116811461118a57600080fd5b60006020828403121561373f57600080fd5b81356111aa81613717565b60005b8381101561376557818101518382015260200161374d565b83811115611c0b5750506000910152565b6000815180845261378e81602086016020860161374a565b601f01601f19169290920160200192915050565b6020815260006111aa6020830184613776565b6000602082840312156137c757600080fd5b5035919050565b80356001600160a01b03811681146137e557600080fd5b919050565b600080604083850312156137fd57600080fd5b613806836137ce565b946020939093013593505050565b60006020828403121561382657600080fd5b6111aa826137ce565b634e487b7160e01b600052602160045260246000fd5b600281106138555761385561382f565b9052565b602081016107378284613845565b60008060006060848603121561387c57600080fd5b613885846137ce565b9250613893602085016137ce565b9150604084013590509250925092565b60008083601f8401126138b557600080fd5b5081356001600160401b038111156138cc57600080fd5b602083019150836020828501011115612b2a57600080fd5b6000806000604084860312156138f957600080fd5b613902846137ce565b925060208401356001600160401b0381111561391d57600080fd5b613929868287016138a3565b9497909650939450505050565b6000806000806060858703121561394c57600080fd5b613955856137ce565b935060208501356001600160401b0381111561397057600080fd5b61397c878288016138a3565b909450925061398f9050604086016137ce565b905092959194509250565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156139d8576139d861399a565b604052919050565b60006001600160401b038211156139f9576139f961399a565b5060051b60200190565b60008083601f840112613a1557600080fd5b5081356001600160401b03811115613a2c57600080fd5b6020830191508360208260051b8501011115612b2a57600080fd5b801515811461118a57600080fd5b600082601f830112613a6657600080fd5b81356020613a7b613a76836139e0565b6139b0565b82815260059290921b84018101918181019086841115613a9a57600080fd5b8286015b84811015613abe578035613ab181613a47565b8352918301918301613a9e565b509695505050505050565b60008060008060608587031215613adf57600080fd5b84356001600160401b0380821115613af657600080fd5b818701915087601f830112613b0a57600080fd5b81356020613b1a613a76836139e0565b82815260059290921b8401810191818101908b841115613b3957600080fd5b948201945b83861015613b5e57613b4f866137ce565b82529482019490820190613b3e565b98505088013592505080821115613b7457600080fd5b613b8088838901613a03565b90955093506040870135915080821115613b9957600080fd5b50613ba687828801613a55565b91505092959194509250565b6020808252825182820181905260009190848201906040850190845b81811015613bea57835183529284019291840191600101613bce565b50909695505050505050565b60008060008060608587031215613c0c57600080fd5b843593506020850135925060408501356001600160401b03811115613c3057600080fd5b613c3c878288016138a3565b95989497509550505050565b60008060408385031215613c5b57600080fd5b613c64836137ce565b91506020830135613c7481613a47565b809150509250929050565b60008060008060808587031215613c9557600080fd5b613c9e856137ce565b93506020613cad8187016137ce565b93506040860135925060608601356001600160401b0380821115613cd057600080fd5b818801915088601f830112613ce457600080fd5b813581811115613cf657613cf661399a565b613d08601f8201601f191685016139b0565b91508082528984828501011115613d1e57600080fd5b808484018584013760008482840101525080935050505092959194509250565b60008060008060608587031215613d5457600080fd5b613d5d856137ce565b93506020850135925060408501356001600160401b03811115613c3057600080fd5b60008060408385031215613d9257600080fd5b613d9b836137ce565b9150613da9602084016137ce565b90509250929050565b60008060008060008060808789031215613dcb57600080fd5b86356001600160401b0380821115613de257600080fd5b613dee8a838b016138a3565b909850965060208901359150613e0382613a47565b9094506040880135935060608801359080821115613e2057600080fd5b50613e2d89828a016138a3565b979a9699509497509295939492505050565b600181811c90821680613e5357607f821691505b60208210811415613e7457634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526022908201527f4e6967687443726f773a2073656e64657220686173206e6f742074686520726f6040820152616c6560f01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008219821115613ee557613ee5613ebc565b500190565b60006bffffffffffffffffffffffff19808760601b1683528486601485013760609390931b909216920160148101929092525060280192915050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112613f5357600080fd5b8301803591506001600160401b03821115613f6d57600080fd5b602001915036819003821315612b2a57600080fd5b600060208284031215613f9457600080fd5b81516111aa81613a47565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015613ffb57605f19888703018452613fe9868351613776565b95509284019290840190600101613fcd565b509398975050505050505050565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b828152604060208201526000610c0c6040830184613776565b604081528260408201528284606083013760006060848301015260006060601f19601f8601168301019050610c0c6020830184613845565b600083516140ba81846020880161374a565b8351908301906140ce81836020880161374a565b01949350505050565b60006bffffffffffffffffffffffff19808a60601b168352808960601b16601484015250858760288401375092151560f81b939092016028810193909352602983015260498201526069019392505050565b60006101408c83528b60208401528a604084015260038a1061414d5761414d61382f565b89606084015263ffffffff60e01b8916608084015287151560a08401528660c08401528560e0840152846101008401528061012084015261419081840185613776565b9d9c50505050505050505050505050565b6000828210156141b3576141b3613ebc565b500390565b60006000198214156141cc576141cc613ebc565b5060010190565b60208082526021908201527f4552433732314c6f636b61626c653a206e6f6e6578697374656e7420746f6b656040820152603760f91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60006020828403121561427857600080fd5b5051919050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906142b290830184613776565b9695505050505050565b6000602082840312156142ce57600080fd5b81516111aa81613717565b634e487b7160e01b600052601260045260246000fd5b6000826142fe576142fe6142d9565b500490565b600082614312576143126142d9565b500690565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220e7632ab020674a894a437efeb6f4ababcb943f9014db27222a263c9314d8cfbe64736f6c634300080a00334e6967687443726f773a2073656e64657220686173206e6f742074686520726f00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000604100d89f9eac0f0118dff40296232abe0283ca0000000000000000000000008d64dc8ffffb472f98ab3fbcf74f0684133d233200000000000000000000000061b6c5505887ae548d7f769b1e8cb870faaf2468000000000000000000000000000000000000000000000000000000000000000d4e4320436861726163746572730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054e43434841000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102d55760003560e01c806373dce1e011610182578063c1292cc3116100e9578063e985e9c5116100a2578063f6aacfb11161007c578063f6aacfb1146106d5578063f971fac6146106f8578063fb08e0211461070b578063fcbb6cf51461071957600080fd5b8063e985e9c514610673578063f1d588c5146106af578063f2fde38b146106c257600080fd5b8063c1292cc31461060a578063c4b1fd7814610612578063c87b56dd14610620578063c92fb94714610633578063d3fc98641461064c578063d598d4c91461065f57600080fd5b8063907af6c01161013b578063907af6c0146105ab57806395d89b41146105b6578063a22cb465146105be578063b88d4fde146105d1578063be23c5eb146105e4578063befe0aaa146105f757600080fd5b806373dce1e01461053357806376f30f5b146105415780638462151c14610554578063885ee95a146105745780638be50d32146105875780638da5cb5b1461059a57600080fd5b80632f745c59116102415780634d70d1d7116101fa57806361b8ce8c116101d457806361b8ce8c146104fd5780636352211e1461050557806370a0823114610518578063715018a61461052b57600080fd5b80634d70d1d7146104c45780634f13d9fd146104d75780634f6ccce7146104ea57600080fd5b80632f745c591461043557806342842e0e1461044857806342966c681461045b57806342f7022e1461046e578063478426631461048a5780634bb407a3146104b157600080fd5b80630b93381b116102935780630b93381b1461037d578063131a7e241461039c57806318160ddd146103cc57806323b872dd146103d457806324c12bf6146103e757806326dd92071461040e57600080fd5b8062435da5146102da57806301ffc9a71461030a57806306fdde031461032d578063081812fc14610342578063095ea7b3146103555780630a530d0e1461036a575b600080fd5b600e546102ed906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61031d61031836600461372d565b61072c565b6040519015158152602001610301565b61033561073d565b60405161030191906137a2565b6102ed6103503660046137b5565b6107cf565b6103686103633660046137ea565b6107f6565b005b610368610378366004613814565b610911565b61038e667375636365737360c81b81565b604051908152602001610301565b6103bf6103aa3660046137b5565b60126020526000908152604090205460ff1681565b6040516103019190613859565b60085461038e565b6103686103e2366004613867565b610a09565b61038e7f000000000000000000000000000000000000000000000000000000003b9aca0081565b61041c6376f30f5b60e01b81565b6040516001600160e01b03199091168152602001610301565b61038e6104433660046137ea565b610a39565b610368610456366004613867565b610acf565b6103686104693660046137b5565b610af2565b61038e712734b3b43a21b937bbab30b634b230ba37b960711b81565b6102ed7f0000000000000000000000008d64dc8ffffb472f98ab3fbcf74f0684133d233281565b6103686104bf3660046138e4565b610b0e565b61038e6104d23660046137b5565b610b5a565b61038e6104e5366004613936565b610bda565b61038e6104f83660046137b5565b610c14565b61038e610ca7565b6102ed6105133660046137b5565b610cc0565b61038e610526366004613814565b610d20565b610368610da6565b61041c63442f74ad60e11b81565b61036861054f366004613ac9565b610dba565b610567610562366004613814565b610f02565b6040516103019190613bb2565b610368610582366004613bf6565b610f16565b610368610595366004613bf6565b610f3d565b600d546001600160a01b03166102ed565b61038e633b9aca0081565b610335610f64565b6103686105cc366004613c48565b610f73565b6103686105df366004613c7f565b610f82565b61031d6105f23660046137b5565b610faf565b6011546102ed906001600160a01b031681565b61038e610fdd565b61041c6345f2869960e11b81565b61033561062e3660046137b5565b610fea565b61038e6e2734b3b43a21b937bba9b2ba3a32b960891b81565b61036861065a366004613d3e565b610ff5565b61038e696e6967687463726f777360b01b81565b61031d610681366004613d7f565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6103686106bd366004613814565b61101c565b6103686106d0366004613814565b611114565b61031d6106e33660046137b5565b6000908152600a602052604090205460ff1690565b61038e6107063660046137ea565b61118d565b61041c63fcbb6cf560e01b81565b610368610727366004613db2565b6111b1565b60006107378261125c565b92915050565b60606000805461074c90613e3f565b80601f016020809104026020016040519081016040528092919081815260200182805461077890613e3f565b80156107c55780601f1061079a576101008083540402835291602001916107c5565b820191906000526020600020905b8154815290600101906020018083116107a857829003601f168201915b5050505050905090565b60006107da82611281565b506000908152600460205260409020546001600160a01b031690565b600061080182610cc0565b9050806001600160a01b0316836001600160a01b031614156108745760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061089057506108908133610681565b6109025760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161086b565b61090c83836112e0565b505050565b6e2734b3b43a21b937bba9b2ba3a32b960891b610936600d546001600160a01b031690565b6001600160a01b0316336001600160a01b0316148061095a575061095a813361134e565b6109765760405162461bcd60e51b815260040161086b90613e7a565b816001600160a01b0381161580159061099957506000816001600160a01b03163b115b6109e55760405162461bcd60e51b815260206004820152601c60248201527f4e6967687443726f773a2061646472657373206973206e6f7420434100000000604482015260640161086b565b5050601180546001600160a01b0319166001600160a01b0392909216919091179055565b6323b872dd60e01b8383610a2683610a2184846113c4565b611488565b610a3186868661156e565b505050505050565b6000610a4483610d20565b8210610aa65760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161086b565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6323b872dd60e01b8383610ae783610a2184846113c4565b610a318686866115a0565b630852cd8d60e31b33610b058282611648565b61090c836116e9565b610b19838383611717565b600060126000610b27610fdd565b81526020810191909152604001600020805460ff191660018381811115610b5057610b5061382f565b0217905550505050565b6000633b9aca00821115610bb05760405162461bcd60e51b815260206004820152601a60248201527f556e613732313a206d696e7420636f756e74206973206f766572000000000000604482015260640161086b565b610737827f000000000000000000000000000000000000000000000000000000003b9aca00613ed2565b600084848484604051602001610bf39493929190613eea565b6040516020818303038152906040528051906020012090505b949350505050565b6000610c1f60085490565b8210610c825760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161086b565b60088281548110610c9557610c95613f26565b90600052602060002001549050919050565b6000610cbb600c5460016104d29190613ed2565b905090565b6000818152600260205260408120546001600160a01b0316806107375760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161086b565b60006001600160a01b038216610d8a5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161086b565b506001600160a01b031660009081526003602052604090205490565b610dae6117b3565b610db8600061180d565b565b712734b3b43a21b937bbab30b634b230ba37b960711b610de2600d546001600160a01b031690565b6001600160a01b0316336001600160a01b03161480610e065750610e06813361134e565b610e225760405162461bcd60e51b815260040161086b90613e7a565b845183148015610e325750815183145b610e7e5760405162461bcd60e51b815260206004820152601c60248201527f4e6967746843726f774e46543a20696e76616c6964206c656e67746800000000604482015260640161086b565b610e8f6376f30f5b60e01b86611488565b60005b83811015610a3157610efa868281518110610eaf57610eaf613f26565b6020026020010151868684818110610ec957610ec9613f26565b9050602002810190610edb9190613f3c565b868581518110610eed57610eed613f26565b602002602001015161185f565b600101610e92565b6060610f0f826000611903565b5092915050565b63442f74ad60e11b33610f298282611648565b610a31868663442f74ad60e11b87876119cb565b6345f2869960e11b33610f508282611648565b610a3186866345f2869960e11b87876119cb565b60606001805461074c90613e3f565b610f7e338383611b0a565b5050565b6323b872dd60e01b8484610f9a83610a2184846113c4565b610fa687878787611bd9565b50505050505050565b6000600160008381526012602052604090205460ff166001811115610fd657610fd661382f565b1492915050565b6000610cbb600c54610b5a565b606061073782611c11565b61100184848484611d1a565b50506000908152601260205260409020805460ff1916905550565b6e2734b3b43a21b937bba9b2ba3a32b960891b611041600d546001600160a01b031690565b6001600160a01b0316336001600160a01b031614806110655750611065813361134e565b6110815760405162461bcd60e51b815260040161086b90613e7a565b816001600160a01b038116158015906110a457506000816001600160a01b03163b115b6110f05760405162461bcd60e51b815260206004820152601c60248201527f4e6967687443726f773a2061646472657373206973206e6f7420434100000000604482015260640161086b565b5050600e80546001600160a01b0319166001600160a01b0392909216919091179055565b61111c6117b3565b6001600160a01b0381166111815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161086b565b61118a8161180d565b50565b6000818152600f60205260408120546111aa90849060e01b611db0565b9392505050565b63fcbb6cf560e01b336111c48282611648565b338888888888886000806111dd89898989898989611e2e565b9150915081156111f3576111f38989898961185f565b6000611202306000368d610bda565b905061124881696e6967687463726f777360b01b611226611221610f64565b611f1a565b600163fcbb6cf560e01b88888d60405180602001604052806000815250611f6b565b505050505050505050505050505050505050565b60006001600160e01b0319821663780e9d6360e01b1480610737575061073782611ff0565b6000818152600260205260409020546001600160a01b031661118a5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161086b565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061131582610cc0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600e54604051632474521560e21b8152600481018490526001600160a01b03838116602483015260009216906391d1485490604401602060405180830381865afa1580156113a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111aa9190613f82565b6040805160038082526080820190925260609160208201838036833701905050905033816000815181106113fa576113fa613f26565b60200260200101906001600160a01b031690816001600160a01b031681525050828160018151811061142e5761142e613f26565b60200260200101906001600160a01b031690816001600160a01b031681525050818160028151811061146257611462613f26565b60200260200101906001600160a01b031690816001600160a01b03168152505092915050565b6001600160a01b037f0000000000000000000000008d64dc8ffffb472f98ab3fbcf74f0684133d23321663afa960e360016114c38585612040565b6040518363ffffffff1660e01b81526004016114e0929190613f9f565b602060405180830381865afa1580156114fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115219190613f82565b15610f7e5760405162461bcd60e51b815260206004820152601960248201527f5269736b47756172643a207269736b6564207265717565737400000000000000604482015260640161086b565b611579335b82612136565b6115955760405162461bcd60e51b815260040161086b90614009565b61090c8383836121b4565b61090c83838360405180602001604052806000815250610f82565b604080516002808252606080830184529260208301908036833701905050905033816000815181106115ef576115ef613f26565b60200260200101906001600160a01b031690816001600160a01b031681525050818160018151811061162357611623613f26565b60200260200101906001600160a01b031690816001600160a01b031681525050919050565b6001600160a01b037f0000000000000000000000008d64dc8ffffb472f98ab3fbcf74f0684133d23321663d37c475160016116cc6040518060800160405280876001600160e01b0319168152602001306001600160a01b03168152602001866001600160a01b031681526020016116bc3390565b6001600160a01b0316905261236a565b6040518363ffffffff1660e01b81526004016114e0929190614057565b6116f233611573565b61170e5760405162461bcd60e51b815260040161086b90614009565b61118a816123c9565b611720336123d2565b61176c5760405162461bcd60e51b815260206004820152601c60248201527f5552433732313a2073656e646572206973206e6f74206d696e74657200000000604482015260640161086b565b634bb407a360e01b836001600160a01b03811633146117975761179282610a21836115bb565b6117a1565b6117a18282611648565b6117ac858585612439565b5050505050565b600d546001600160a01b03163314610db85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086b565b600d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61186a848484612439565b6000611874610fdd565b9050811561189f5761188581612469565b6000818152601260205260409020805460ff191660011790555b6000818152601260205260409081902054905182916001600160a01b038816917f1bb8f6fa8e4349c6ac47f96621aeba659efb219b578d56138ceb2632f67dc4e5916118f4918991899160ff90911690614070565b60405180910390a35050505050565b606060008061191185610d20565b9050806001600160401b0381111561192b5761192b61399a565b604051908082528060200260200182016040528015611954578160200160208202803683370190505b50925060005b818110156119c257600061196e8783610a39565b90508515611999576000818152600a602052604090205460ff1661199257506119ba565b6001909301925b808583815181106119ac576119ac613f26565b602002602001018181525050505b60010161195a565b50509250929050565b33858585858560006119df3082368a610bda565b90506000806119f289898989898961253f565b915091508115611ac2576001600160e01b0319861663442f74ad60e11b1415611a6c57611a1e8861263d565b600088815260126020526040808220805460ff191690555189916001600160a01b038c16917fdfa31364a49d58c4c419cf858f4e7b68131d83aee1c28a6f85246bda02d9d6999190a3611ac2565b611a7588612469565b600088815260126020526040808220805460ff191660011790555189916001600160a01b038c16917f9f9d379338085f1564909e23bd3c32ddae4d5e3c94cc441b620af408d7002c7b9190a35b611afa83696e6967687463726f777360b01b611adf611221610f64565b60018a87878e60405180602001604052806000815250611f6b565b5050505050505050505050505050565b816001600160a01b0316836001600160a01b03161415611b6c5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161086b565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611be33383612136565b611bff5760405162461bcd60e51b815260040161086b90614009565b611c0b8484848461270f565b50505050565b6060611c1c82611281565b6000828152600b602052604081208054611c3590613e3f565b80601f0160208091040260200160405190810160405280929190818152602001828054611c6190613e3f565b8015611cae5780601f10611c8357610100808354040283529160200191611cae565b820191906000526020600020905b815481529060010190602001808311611c9157829003601f168201915b505050505090506000611ccc60408051602081019091526000815290565b9050805160001415611cdf575092915050565b815115611d11578082604051602001611cf99291906140a8565b60405160208183030381529060405292505050919050565b610c0c84612742565b611d23336127b5565b611d6f5760405162461bcd60e51b815260206004820152601c60248201527f556e613732313a2073656e646572206973206e6f742062726964676500000000604482015260640161086b565b6334ff261960e21b846001600160a01b0381163314611d9a57611d9582610a21836115bb565b611da4565b611da48282611648565b610a31868686866127fb565b6001600160a01b03821660009081526010602090815260409182902054825130606090811b6bffffffffffffffffffffffff199081168386015246603484015296901b90951660548601526001600160e01b03199093166068850152606c8085019390935281518085039093018352608c9093019052805191012090565b60008080611e438a63fcbb6cf560e01b611db0565b9050611e698a6001600160a01b0316600090815260106020526040902080546001019055565b611e7286612845565b909350915082611e825750611f0e565b611efc712734b3b43a21b937bbab30b634b230ba37b960711b308c8c8c8c8c88604051602001611eb897969594939291906140d7565b60408051601f198184030181526020601f8a018190048102840181019092528883529190899089908190840183828082843760009201919091525061289192505050565b909350915082611f0c5750611f0e565b505b97509795505050505050565b6000602082511115611f635760405162461bcd60e51b8152602060048201526012602482015271453a20737472696e6720746f6f206c6f6e6760701b604482015260640161086b565b506020015190565b6011546001600160a01b031663aaad6deb8a8a8a8a8a8a8a611f8c466128f1565b8b8b6040518b63ffffffff1660e01b8152600401611fb39a99989796959493929190614129565b600060405180830381600087803b158015611fcd57600080fd5b505af1158015611fe1573d6000803e3d6000fd5b50505050505050505050505050565b60006001600160e01b031982166380ac58cd60e01b148061202157506001600160e01b03198216635b5e139f60e01b145b8061073757506301ffc9a760e01b6001600160e01b0319831614610737565b6060600082516001600160401b0381111561205d5761205d61399a565b60405190808252806020026020018201604052801561209057816020015b606081526020019060019003908161207b5790505b5090503360005b845181101561212c576121076040518060800160405280886001600160e01b0319168152602001306001600160a01b031681526020018784815181106120df576120df613f26565b60200260200101516001600160a01b03168152602001846001600160a01b031681525061236a565b83828151811061211957612119613f26565b6020908102919091010152600101612097565b5090949350505050565b60008061214283610cc0565b9050806001600160a01b0316846001600160a01b0316148061218957506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b80610c0c5750836001600160a01b03166121a2846107cf565b6001600160a01b031614949350505050565b826001600160a01b03166121c782610cc0565b6001600160a01b03161461222b5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161086b565b6001600160a01b03821661228d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161086b565b612298838383612972565b600081815260046020908152604080832080546001600160a01b03191690556001600160a01b0386168352600390915281208054600192906122db9084906141a1565b90915550506001600160a01b0382166000908152600360205260408120805460019290612309908490613ed2565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6040805182516001600160e01b0319166020808301919091528301516001600160a01b039081168284015291830151821660608281019190915283810151909216608082015260a0016040516020818303038152906040529050919050565b61118a8161297d565b60006123e6600d546001600160a01b031690565b6001600160a01b0316826001600160a01b0316148061073757506107376124336040518060400160405280600681526020016526b4b73a32b960d11b81525061242d610f64565b906129bd565b8361134e565b600c8054906000612449836141b8565b9190505550600061245b600c54610b5a565b9050611c0b848285856127fb565b6000818152600260205260409020546001600160a01b031661249d5760405162461bcd60e51b815260040161086b906141d3565b6000818152600a602052604090205460ff16156124fc5760405162461bcd60e51b815260206004820152601d60248201527f4552433732314c6f636b61626c653a20696e76616c6964207374617465000000604482015260640161086b565b6000818152600a6020526040808220805460ff191660011790555182917f032bc66be43dbccb7487781d168eb7bda224628a3b2c3388bdf69b532a3a161191a250565b600080600061254e8987611db0565b9050612574896001600160a01b0316600090815260106020526040902080546001019055565b61257e8989612a36565b90935091508261258e5750612632565b61259787612845565b9093509150826125a75750612632565b6125b18887612a9b565b9093509150826125c15750612632565b6040516bffffffffffffffffffffffff1930606090811b821660208401528b901b16603482015260488101899052606881018890526088810182905261262090712734b3b43a21b937bbab30b634b230ba37b960711b9060a801611eb8565b9093509150826126305750612632565b505b965096945050505050565b6000818152600260205260409020546001600160a01b03166126715760405162461bcd60e51b815260040161086b906141d3565b6000818152600a602052604090205460ff166126cf5760405162461bcd60e51b815260206004820152601d60248201527f4552433732314c6f636b61626c653a20696e76616c6964207374617465000000604482015260640161086b565b6000818152600a6020526040808220805460ff191690555182917ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184291a250565b61271a8484846121b4565b61272684848484612b31565b611c0b5760405162461bcd60e51b815260040161086b90614214565b606061274d82611281565b600061276460408051602081019091526000815290565b9050600081511161278457604051806020016040528060008152506111aa565b8061278e84612c2c565b60405160200161279f9291906140a8565b6040516020818303038152906040529392505050565b60006127e46124336040518060400160405280600681526020016542726964676560d01b81525061242d610f64565b80156107375750506001600160a01b03163b151590565b6128058484612d29565b611c0b8383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612d4392505050565b600080612851466128f1565b8310158061285d575082155b6128795760006c6f76657220646561646c696e6560981b612887565b6001667375636365737360c81b5b9094909350915050565b60008060006128b0848680519060200120612ddd90919063ffffffff16565b90506128bc868261134e565b6128d65760006a696e76616c69642073696760a81b6128e4565b6001667375636365737360c81b5b9097909650945050505050565b60008162066eee148061290557508161a4b1145b61290f5743610737565b60646001600160a01b031663a3b1b31d6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561294e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107379190614266565b61090c838383612e01565b61298681612e77565b6000818152600b60205260409020805461299f90613e3f565b15905061118a576000818152600b6020526040812061118a91613644565b60008083836040516020016129d39291906140a8565b6040516020818303038152906040529050602081511115612a2b5760405162461bcd60e51b8152602060048201526012602482015271453a20737472696e6720746f6f206c6f6e6760701b604482015260640161086b565b602001519392505050565b600080612a4283610cc0565b6001600160a01b0316846001600160a01b031614612a825760007f73656e646572206973206e6f74204e46542773206f776e657200000000000000612a90565b6001667375636365737360c81b5b909590945092505050565b6000806001600160e01b0319831663442f74ad60e11b1415612afc57612ac084610faf565b612ae4576000741cdd185d19481a5cc8185b1c9958591e4814d15053605a1b612af2565b6001667375636365737360c81b5b9092509050612b2a565b612b0584610faf565b15612a8257600074737461746520697320616c726561647920504c415960581b612a90565b9250929050565b60006001600160a01b0384163b15612c2457604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612b7590339089908890889060040161427f565b6020604051808303816000875af1925050508015612bb0575060408051601f3d908101601f19168201909252612bad918101906142bc565b60015b612c0a573d808015612bde576040519150601f19603f3d011682016040523d82523d6000602084013e612be3565b606091505b508051612c025760405162461bcd60e51b815260040161086b90614214565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610c0c565b506001610c0c565b606081612c505750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612c7a5780612c64816141b8565b9150612c739050600a836142ef565b9150612c54565b6000816001600160401b03811115612c9457612c9461399a565b6040519080825280601f01601f191660200182016040528015612cbe576020820181803683370190505b5090505b8415610c0c57612cd36001836141a1565b9150612ce0600a86614303565b612ceb906030613ed2565b60f81b818381518110612d0057612d00613f26565b60200101906001600160f81b031916908160001a905350612d22600a866142ef565b9450612cc2565b610f7e828260405180602001604052806000815250612f2d565b6000828152600260205260409020546001600160a01b0316612dbe5760405162461bcd60e51b815260206004820152602e60248201527f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b606482015260840161086b565b6000828152600b60209081526040909120825161090c9284019061367e565b6000806000612dec8585612f60565b91509150612df981612fcd565b509392505050565b6000818152600a602052604090205460ff1615612e6c5760405162461bcd60e51b8152602060048201526024808201527f4552433732314c6f636b61626c653a207472616e736665722073746174652065604482015263393937b960e11b606482015260840161086b565b61090c838383613188565b6000612e8282610cc0565b9050612e9081600084612972565b600082815260046020908152604080832080546001600160a01b03191690556001600160a01b038416835260039091528120805460019290612ed39084906141a1565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b612f378383613240565b612f446000848484612b31565b61090c5760405162461bcd60e51b815260040161086b90614214565b600080825160411415612f975760208301516040840151606085015160001a612f8b8782858561338e565b94509450505050612b2a565b825160401415612fc15760208301516040840151612fb686838361347b565b935093505050612b2a565b50600090506002612b2a565b6000816004811115612fe157612fe161382f565b1415612fea5750565b6001816004811115612ffe57612ffe61382f565b141561304c5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161086b565b60028160048111156130605761306061382f565b14156130ae5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161086b565b60038160048111156130c2576130c261382f565b141561311b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161086b565b600481600481111561312f5761312f61382f565b141561118a5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161086b565b6001600160a01b0383166131e3576131de81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b613206565b816001600160a01b0316836001600160a01b0316146132065761320683826134b4565b6001600160a01b03821661321d5761090c81613551565b826001600160a01b0316826001600160a01b03161461090c5761090c8282613600565b6001600160a01b0382166132965760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161086b565b6000818152600260205260409020546001600160a01b0316156132fb5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161086b565b61330760008383612972565b6001600160a01b0382166000908152600360205260408120805460019290613330908490613ed2565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156133c55750600090506003613472565b8460ff16601b141580156133dd57508460ff16601c14155b156133ee5750600090506004613472565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613442573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661346b57600060019250925050613472565b9150600090505b94509492505050565b6000806001600160ff1b0383168161349860ff86901c601b613ed2565b90506134a68782888561338e565b935093505050935093915050565b600060016134c184610d20565b6134cb91906141a1565b60008381526007602052604090205490915080821461351e576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090613563906001906141a1565b6000838152600960205260408120546008805493945090928490811061358b5761358b613f26565b9060005260206000200154905080600883815481106135ac576135ac613f26565b60009182526020808320909101929092558281526009909152604080822084905585825281205560088054806135e4576135e4614317565b6001900381819060005260206000200160009055905550505050565b600061360b83610d20565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b50805461365090613e3f565b6000825580601f10613660575050565b601f01602090049060005260206000209081019061118a9190613702565b82805461368a90613e3f565b90600052602060002090601f0160209004810192826136ac57600085556136f2565b82601f106136c557805160ff19168380011785556136f2565b828001600101855582156136f2579182015b828111156136f25782518255916020019190600101906136d7565b506136fe929150613702565b5090565b5b808211156136fe5760008155600101613703565b6001600160e01b03198116811461118a57600080fd5b60006020828403121561373f57600080fd5b81356111aa81613717565b60005b8381101561376557818101518382015260200161374d565b83811115611c0b5750506000910152565b6000815180845261378e81602086016020860161374a565b601f01601f19169290920160200192915050565b6020815260006111aa6020830184613776565b6000602082840312156137c757600080fd5b5035919050565b80356001600160a01b03811681146137e557600080fd5b919050565b600080604083850312156137fd57600080fd5b613806836137ce565b946020939093013593505050565b60006020828403121561382657600080fd5b6111aa826137ce565b634e487b7160e01b600052602160045260246000fd5b600281106138555761385561382f565b9052565b602081016107378284613845565b60008060006060848603121561387c57600080fd5b613885846137ce565b9250613893602085016137ce565b9150604084013590509250925092565b60008083601f8401126138b557600080fd5b5081356001600160401b038111156138cc57600080fd5b602083019150836020828501011115612b2a57600080fd5b6000806000604084860312156138f957600080fd5b613902846137ce565b925060208401356001600160401b0381111561391d57600080fd5b613929868287016138a3565b9497909650939450505050565b6000806000806060858703121561394c57600080fd5b613955856137ce565b935060208501356001600160401b0381111561397057600080fd5b61397c878288016138a3565b909450925061398f9050604086016137ce565b905092959194509250565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156139d8576139d861399a565b604052919050565b60006001600160401b038211156139f9576139f961399a565b5060051b60200190565b60008083601f840112613a1557600080fd5b5081356001600160401b03811115613a2c57600080fd5b6020830191508360208260051b8501011115612b2a57600080fd5b801515811461118a57600080fd5b600082601f830112613a6657600080fd5b81356020613a7b613a76836139e0565b6139b0565b82815260059290921b84018101918181019086841115613a9a57600080fd5b8286015b84811015613abe578035613ab181613a47565b8352918301918301613a9e565b509695505050505050565b60008060008060608587031215613adf57600080fd5b84356001600160401b0380821115613af657600080fd5b818701915087601f830112613b0a57600080fd5b81356020613b1a613a76836139e0565b82815260059290921b8401810191818101908b841115613b3957600080fd5b948201945b83861015613b5e57613b4f866137ce565b82529482019490820190613b3e565b98505088013592505080821115613b7457600080fd5b613b8088838901613a03565b90955093506040870135915080821115613b9957600080fd5b50613ba687828801613a55565b91505092959194509250565b6020808252825182820181905260009190848201906040850190845b81811015613bea57835183529284019291840191600101613bce565b50909695505050505050565b60008060008060608587031215613c0c57600080fd5b843593506020850135925060408501356001600160401b03811115613c3057600080fd5b613c3c878288016138a3565b95989497509550505050565b60008060408385031215613c5b57600080fd5b613c64836137ce565b91506020830135613c7481613a47565b809150509250929050565b60008060008060808587031215613c9557600080fd5b613c9e856137ce565b93506020613cad8187016137ce565b93506040860135925060608601356001600160401b0380821115613cd057600080fd5b818801915088601f830112613ce457600080fd5b813581811115613cf657613cf661399a565b613d08601f8201601f191685016139b0565b91508082528984828501011115613d1e57600080fd5b808484018584013760008482840101525080935050505092959194509250565b60008060008060608587031215613d5457600080fd5b613d5d856137ce565b93506020850135925060408501356001600160401b03811115613c3057600080fd5b60008060408385031215613d9257600080fd5b613d9b836137ce565b9150613da9602084016137ce565b90509250929050565b60008060008060008060808789031215613dcb57600080fd5b86356001600160401b0380821115613de257600080fd5b613dee8a838b016138a3565b909850965060208901359150613e0382613a47565b9094506040880135935060608801359080821115613e2057600080fd5b50613e2d89828a016138a3565b979a9699509497509295939492505050565b600181811c90821680613e5357607f821691505b60208210811415613e7457634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526022908201527f4e6967687443726f773a2073656e64657220686173206e6f742074686520726f6040820152616c6560f01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008219821115613ee557613ee5613ebc565b500190565b60006bffffffffffffffffffffffff19808760601b1683528486601485013760609390931b909216920160148101929092525060280192915050565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19843603018112613f5357600080fd5b8301803591506001600160401b03821115613f6d57600080fd5b602001915036819003821315612b2a57600080fd5b600060208284031215613f9457600080fd5b81516111aa81613a47565b600060408201848352602060408185015281855180845260608601915060608160051b870101935082870160005b82811015613ffb57605f19888703018452613fe9868351613776565b95509284019290840190600101613fcd565b509398975050505050505050565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b828152604060208201526000610c0c6040830184613776565b604081528260408201528284606083013760006060848301015260006060601f19601f8601168301019050610c0c6020830184613845565b600083516140ba81846020880161374a565b8351908301906140ce81836020880161374a565b01949350505050565b60006bffffffffffffffffffffffff19808a60601b168352808960601b16601484015250858760288401375092151560f81b939092016028810193909352602983015260498201526069019392505050565b60006101408c83528b60208401528a604084015260038a1061414d5761414d61382f565b89606084015263ffffffff60e01b8916608084015287151560a08401528660c08401528560e0840152846101008401528061012084015261419081840185613776565b9d9c50505050505050505050505050565b6000828210156141b3576141b3613ebc565b500390565b60006000198214156141cc576141cc613ebc565b5060010190565b60208082526021908201527f4552433732314c6f636b61626c653a206e6f6e6578697374656e7420746f6b656040820152603760f91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60006020828403121561427857600080fd5b5051919050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906142b290830184613776565b9695505050505050565b6000602082840312156142ce57600080fd5b81516111aa81613717565b634e487b7160e01b600052601260045260246000fd5b6000826142fe576142fe6142d9565b500490565b600082614312576143126142d9565b500690565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220e7632ab020674a894a437efeb6f4ababcb943f9014db27222a263c9314d8cfbe64736f6c634300080a0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000604100d89f9eac0f0118dff40296232abe0283ca0000000000000000000000008d64dc8ffffb472f98ab3fbcf74f0684133d233200000000000000000000000061b6c5505887ae548d7f769b1e8cb870faaf2468000000000000000000000000000000000000000000000000000000000000000d4e4320436861726163746572730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054e43434841000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : name (string): NC Characters
Arg [1] : symbol (string): NCCHA
Arg [2] : code (uint256): 1000000000
Arg [3] : roleManager (address): 0x604100d89F9eaC0F0118dff40296232aBe0283ca
Arg [4] : riskManager (address): 0x8d64dC8fffFB472f98aB3FBcf74f0684133D2332
Arg [5] : nightCrowEcho (address): 0x61B6c5505887aE548d7F769b1e8CB870faAf2468

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [2] : 000000000000000000000000000000000000000000000000000000003b9aca00
Arg [3] : 000000000000000000000000604100d89f9eac0f0118dff40296232abe0283ca
Arg [4] : 0000000000000000000000008d64dc8ffffb472f98ab3fbcf74f0684133d2332
Arg [5] : 00000000000000000000000061b6c5505887ae548d7f769b1e8cb870faaf2468
Arg [6] : 000000000000000000000000000000000000000000000000000000000000000d
Arg [7] : 4e43204368617261637465727300000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [9] : 4e43434841000000000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
view all blocks validated

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

OVERVIEW

In NIGHT CROWS, each character serves as the subject of gameplay, as well as the synthesis of added value generated from the in-game economy. By minting a character into a NFT, you can convert your character into assets and claim the ownership.

Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.