FRAX Price: $0.92 (+0.44%)

Contract

0x3c88f46d597e136AFA6d6183Ba03c7AaC924A198

Overview

FRAX Balance | FXTL Balance

0 FRAX | 498 FXTL

FRAX Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

1 Token Transfer found.

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ZeroWayNFT

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./interface/IZeroWayNFT.sol";

import "./lib/Message.sol";
import "./HyperlaneClient.sol";

import "./interface/IMailbox.sol";
import "./interface/IHyperlaneClient.sol";
import "./interface/IZeroWayNFT.sol";

contract ZeroWayNFT is Initializable, ReentrancyGuardUpgradeable, ERC721Upgradeable, ERC721EnumerableUpgradeable, OwnableUpgradeable, IZeroWayNFT {

    uint256 public override nextTokenId;
    uint256 public override mintFee;
    address public override hyperlaneClient;
    address public override mailboxAddr;
    string public override uri;
    uint256 public override bridgeFee;

    modifier onlyHyperlaneClient() {
        require(msg.sender == address(hyperlaneClient), "ZeroWayNFT: sender not hyperlaneClient");
        _;
    }

    event Mint(address indexed sender, address indexed target, uint256 indexed tokenId, uint256 fee);
    event Bridge(
        address indexed sender,
        uint256 indexed tokenId,
        uint32 indexed destinationDomain,
        uint256 fee,
        bytes32 messageId
    );
    event Handle(
        address indexed sender,
        uint256 indexed tokenId,
        uint32 indexed destinationDomain,
        address mailbox,
        bytes data
    );
    event SetURI(address indexed sender, string oldUri, string newUri);
    event SetMintFee(address indexed sender, uint256 mintFee);
    event WithdrawETH(address indexed sender, address to, uint256 amount);
    event SetMailbox(address indexed sender, address indexed newMailbox);
    event SetBridgeFee(address indexed sender, uint256 bridgeFee);

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

    function initialize(
        address initialOwner_,
        uint256 initialTokenId_,
        uint256 mintFee_,
        address mailboxAddr_,
        address hyperlaneClient_,
        string memory uri_
    ) public override initializer {
        __ERC721_init("ZeroWayNFT", "ZWNFT");
        __ERC721Enumerable_init();
        __Ownable_init(initialOwner_);

        nextTokenId = initialTokenId_;
        mintFee = mintFee_;
        mailboxAddr = mailboxAddr_;
        hyperlaneClient = hyperlaneClient_;
        uri = uri_;

        IHyperlaneClient(hyperlaneClient).initialize(mailboxAddr);
    }

    function mint(address target_) external payable override nonReentrant returns (uint256) {
        require(msg.value == mintFee, "ZeroWayNFT: wrong msg.value");
        uint256 tokenId = nextTokenId++;
        _mint(target_, tokenId);

        emit Mint({sender: msg.sender, target: target_, tokenId: tokenId, fee: mintFee});

        return tokenId;
    }

    function bridge(uint256 tokenId_, uint32 destinationDomain_) external payable override nonReentrant returns (uint256, bytes32) {
        _checkBridgeParams(tokenId_, destinationDomain_);
        require(ownerOf(tokenId_) == msg.sender, "ZeroWayNFT: user do not have NFT");

        _burn(tokenId_);

        uint256 hyperlaneFee = _calculateHyperlaneFee(tokenId_, destinationDomain_);
        uint256 needFee = hyperlaneFee + bridgeFee;
        require(msg.value >= needFee, "ZeroWayNFT: not enough msg.value");
        if (msg.value > needFee) {
            payable(msg.sender).transfer(msg.value - needFee);
        }

        IMailbox mailbox = IMailbox(mailboxAddr);
        bytes32 messageId = mailbox.dispatch{value: hyperlaneFee}(
            destinationDomain_,
            TypeCasts.addressToBytes32(address(hyperlaneClient)),
            abi.encode(tokenId_, msg.sender, destinationDomain_),
            _getHyperlaneMetadata()
        );

        emit Bridge({
            sender: msg.sender,
            tokenId: tokenId_,
            destinationDomain: destinationDomain_,
            fee: needFee,
            messageId: messageId
        });

        return (needFee, messageId);
    }

    function handle(
        uint32 origin_,
        bytes32 sender_,
        bytes calldata data_
    ) external payable virtual override onlyHyperlaneClient nonReentrant {
        // linter suppress: UnusedLocalVariable
        origin_;
        sender_;

        require(data_.length > 0, "ZeroWayNFT: empty data");

        (uint256 tokenId, address _sender, uint32 destinationDomain) = abi.decode(data_, (uint256, address, uint32));
        _checkHandleParams(tokenId, _sender, destinationDomain);

        _mint(_sender, tokenId);

        emit Handle({
            sender: _sender,
            tokenId: tokenId,
            destinationDomain: destinationDomain,
            mailbox: address(hyperlaneClient),
            data: data_
        });
    }

    function setURI(string memory uri_) external override onlyOwner nonReentrant {
        emit SetURI({sender: msg.sender, oldUri: uri, newUri: uri_});

        uri = uri_;
    }

    function setMintFee(uint256 mintFee_) external override onlyOwner nonReentrant {
        mintFee = mintFee_;

        emit SetMintFee({sender: msg.sender, mintFee: mintFee});
    }

    function setBridgeFee(uint256 bridgeFee_) external override onlyOwner nonReentrant {
        bridgeFee = bridgeFee_;

        emit SetBridgeFee({sender: msg.sender, bridgeFee: bridgeFee_});
    }

    function setMailbox(address newMailbox_) external onlyOwner nonReentrant {
        IHyperlaneClient(hyperlaneClient).setMailbox(newMailbox_);

        mailboxAddr = newMailbox_;

        emit SetMailbox({sender: msg.sender, newMailbox: newMailbox_});
    }

    function withdrawETH(address to_, uint256 amount_) external override onlyOwner nonReentrant {
        emit WithdrawETH({sender: msg.sender, to: to_, amount: amount_});

        payable(to_).transfer(amount_);
    }

    function calculateBridgeFee(uint256 tokenId_, uint32 destinationDomain_) external view override returns (uint256) {
        _checkBridgeParams(tokenId_, destinationDomain_);

        return (_calculateHyperlaneFee(tokenId_, destinationDomain_) + bridgeFee);
    }

    function calculateHyperlaneFee(uint256 tokenId_, uint32 destinationDomain_) external view override returns (uint256) {
        _checkBridgeParams(tokenId_, destinationDomain_);

        return (_calculateHyperlaneFee(tokenId_, destinationDomain_));
    }

    // Override OZ functions

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        _requireOwned(tokenId);

        return uri;
    }

    // The following functions are overrides required by Solidity.

    function _update(
        address to,
        uint256 tokenId,
        address auth
    ) internal override(ERC721Upgradeable, ERC721EnumerableUpgradeable) returns (address) {
        return super._update(to, tokenId, auth);
    }

    function _increaseBalance(
        address account,
        uint128 value
    ) internal override(ERC721Upgradeable, ERC721EnumerableUpgradeable) {
        super._increaseBalance(account, value);
    }

    // Internal functions

    function _calculateHyperlaneFee(uint256 tokenId_, uint32 destinationDomain_) internal view returns (uint256) {
        IMailbox mailbox = IMailbox(mailboxAddr);

        return
            mailbox.quoteDispatch(
                destinationDomain_,
                TypeCasts.addressToBytes32(address(hyperlaneClient)),
                abi.encode(tokenId_, msg.sender, destinationDomain_),
                _getHyperlaneMetadata()
            );
    }

    function _checkBridgeParams(uint256 tokenId_, uint32 destinationDomain_) internal view {
        require(ownerOf(tokenId_) != address(0), "ZeroWayNFT: nft do not exist");
        require(destinationDomain_ != 0, "ZeroWayNFT: zero domain");
        require(destinationDomain_ != block.chainid, "ZeroWayNFT: same domain");
    }

    function _checkHandleParams(uint256 tokenId_, address sender_, uint32 destinationDomain_) internal view {
        tokenId_;
        sender_;
        require(destinationDomain_ != 0, "ZeroWayNFT: zero domain");
        require(destinationDomain_ == block.chainid, "ZeroWayNFT: wrong domain");
    }

    function _bytes32ToAddress(bytes32 _buf) internal pure returns (address) {
        return address(uint160(uint256(_buf)));
    }

    function _getHyperlaneMetadata() internal view returns (bytes memory) {

        bytes memory metadata = abi.encodePacked(
            uint16(1),
            uint256(0),
            uint256(100000),
            address(this)
        );

        return metadata;
    }

    function supportsInterface(
        bytes4 interfaceId
    ) public view override(ERC721Upgradeable, ERC721EnumerableUpgradeable) returns (bool) {
        return interfaceId == type(IZeroWayNFT).interfaceId || super.supportsInterface(interfaceId);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable
    struct OwnableStorage {
        address _owner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

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

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @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) {
        OwnableStorage storage $ = _getOwnableStorage();
        return $._owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

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

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._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 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._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() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @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 {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint64) {
        return _getInitializableStorage()._initialized;
    }

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

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

File 4 of 23 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.20;

import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import {IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {ERC165Upgradeable} from "../../utils/introspection/ERC165Upgradeable.sol";
import {IERC721Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

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

    /// @custom:storage-location erc7201:openzeppelin.storage.ERC721
    struct ERC721Storage {
        // Token name
        string _name;

        // Token symbol
        string _symbol;

        mapping(uint256 tokenId => address) _owners;

        mapping(address owner => uint256) _balances;

        mapping(uint256 tokenId => address) _tokenApprovals;

        mapping(address owner => mapping(address operator => bool)) _operatorApprovals;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC721")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ERC721StorageLocation = 0x80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300;

    function _getERC721Storage() private pure returns (ERC721Storage storage $) {
        assembly {
            $.slot := ERC721StorageLocation
        }
    }

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

    function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        ERC721Storage storage $ = _getERC721Storage();
        $._name = name_;
        $._symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, 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 returns (uint256) {
        ERC721Storage storage $ = _getERC721Storage();
        if (owner == address(0)) {
            revert ERC721InvalidOwner(address(0));
        }
        return $._balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual returns (address) {
        return _requireOwned(tokenId);
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual returns (string memory) {
        ERC721Storage storage $ = _getERC721Storage();
        return $._name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual returns (string memory) {
        ERC721Storage storage $ = _getERC721Storage();
        return $._symbol;
    }

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

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string.concat(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 {
        _approve(to, tokenId, _msgSender());
    }

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

        return _getApproved(tokenId);
    }

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists
        // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
        address previousOwner = _update(to, tokenId, _msgSender());
        if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {
        transferFrom(from, to, tokenId);
        _checkOnERC721Received(from, to, tokenId, data);
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     *
     * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the
     * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances
     * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by
     * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        ERC721Storage storage $ = _getERC721Storage();
        return $._owners[tokenId];
    }

    /**
     * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.
     */
    function _getApproved(uint256 tokenId) internal view virtual returns (address) {
        ERC721Storage storage $ = _getERC721Storage();
        return $._tokenApprovals[tokenId];
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in
     * particular (ignoring whether it is owned by `owner`).
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {
        return
            spender != address(0) &&
            (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);
    }

    /**
     * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
     * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets
     * the `spender` for the specific `tokenId`.
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {
        if (!_isAuthorized(owner, spender, tokenId)) {
            if (owner == address(0)) {
                revert ERC721NonexistentToken(tokenId);
            } else {
                revert ERC721InsufficientApproval(spender, tokenId);
            }
        }
    }

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that
     * a uint256 would ever overflow from increments when these increments are bounded to uint128 values.
     *
     * WARNING: Increasing an account's balance using this function tends to be paired with an override of the
     * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership
     * remain consistent with one another.
     */
    function _increaseBalance(address account, uint128 value) internal virtual {
        ERC721Storage storage $ = _getERC721Storage();
        unchecked {
            $._balances[account] += value;
        }
    }

    /**
     * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner
     * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update.
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that
     * `auth` is either the owner of the token, or approved to operate on the token (by the owner).
     *
     * Emits a {Transfer} event.
     *
     * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.
     */
    function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {
        ERC721Storage storage $ = _getERC721Storage();
        address from = _ownerOf(tokenId);

        // Perform (optional) operator check
        if (auth != address(0)) {
            _checkAuthorized(from, auth, tokenId);
        }

        // Execute the update
        if (from != address(0)) {
            // Clear approval. No need to re-authorize or emit the Approval event
            _approve(address(0), tokenId, address(0), false);

            unchecked {
                $._balances[from] -= 1;
            }
        }

        if (to != address(0)) {
            unchecked {
                $._balances[to] += 1;
            }
        }

        $._owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        return from;
    }

    /**
     * @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 {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner != address(0)) {
            revert ERC721InvalidSender(address(0));
        }
    }

    /**
     * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance.
     *
     * 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 {
        _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);
        _checkOnERC721Received(address(0), to, tokenId, data);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal {
        address previousOwner = _update(address(0), tokenId, address(0));
        if (previousOwner == address(0)) {
            revert ERC721NonexistentToken(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 {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        } else if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients
     * are aware of the ERC721 standard 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 like {safeTransferFrom} in the sense that it invokes
     * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `tokenId` token must exist and be owned by `from`.
     * - `to` cannot be the zero address.
     * - `from` cannot be the zero address.
     * - 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) internal {
        _safeTransfer(from, to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
        _transfer(from, to, tokenId);
        _checkOnERC721Received(from, to, tokenId, data);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is
     * either the owner of the token, or approved to operate on all tokens held by this owner.
     *
     * Emits an {Approval} event.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address to, uint256 tokenId, address auth) internal {
        _approve(to, tokenId, auth, true);
    }

    /**
     * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not
     * emitted in the context of transfers.
     */
    function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {
        ERC721Storage storage $ = _getERC721Storage();
        // Avoid reading the owner unless necessary
        if (emitEvent || auth != address(0)) {
            address owner = _requireOwned(tokenId);

            // We do not use _isAuthorized because single-token approvals should not be able to call approve
            if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {
                revert ERC721InvalidApprover(auth);
            }

            if (emitEvent) {
                emit Approval(owner, to, tokenId);
            }
        }

        $._tokenApprovals[tokenId] = to;
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Requirements:
     * - operator can't be the address zero.
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
        ERC721Storage storage $ = _getERC721Storage();
        if (operator == address(0)) {
            revert ERC721InvalidOperator(operator);
        }
        $._operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).
     * Returns the owner.
     *
     * Overrides to ownership logic should be done to {_ownerOf}.
     */
    function _requireOwned(uint256 tokenId) internal view returns (address) {
        address owner = _ownerOf(tokenId);
        if (owner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        }
        return owner;
    }

    /**
     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the
     * recipient doesn't accept the token transfer. 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
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private {
        if (to.code.length > 0) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                if (retval != IERC721Receiver.onERC721Received.selector) {
                    revert ERC721InvalidReceiver(to);
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert ERC721InvalidReceiver(to);
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.20;

import {ERC721Upgradeable} from "../ERC721Upgradeable.sol";
import {IERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../../proxy/utils/Initializable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds enumerability
 * of all the token ids in the contract as well as all token ids owned by each account.
 *
 * CAUTION: `ERC721` extensions that implement custom `balanceOf` logic, such as `ERC721Consecutive`,
 * interfere with enumerability and should not be used together with `ERC721Enumerable`.
 */
abstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721Enumerable {
    /// @custom:storage-location erc7201:openzeppelin.storage.ERC721Enumerable
    struct ERC721EnumerableStorage {
        mapping(address owner => mapping(uint256 index => uint256)) _ownedTokens;
        mapping(uint256 tokenId => uint256) _ownedTokensIndex;

        uint256[] _allTokens;
        mapping(uint256 tokenId => uint256) _allTokensIndex;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC721Enumerable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ERC721EnumerableStorageLocation = 0x645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed00;

    function _getERC721EnumerableStorage() private pure returns (ERC721EnumerableStorage storage $) {
        assembly {
            $.slot := ERC721EnumerableStorageLocation
        }
    }

    /**
     * @dev An `owner`'s token query was out of bounds for `index`.
     *
     * NOTE: The owner being `address(0)` indicates a global out of bounds index.
     */
    error ERC721OutOfBoundsIndex(address owner, uint256 index);

    /**
     * @dev Batch mint is not allowed.
     */
    error ERC721EnumerableForbiddenBatchMint();

    function __ERC721Enumerable_init() internal onlyInitializing {
    }

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual returns (uint256) {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        if (index >= balanceOf(owner)) {
            revert ERC721OutOfBoundsIndex(owner, index);
        }
        return $._ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        return $._allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual returns (uint256) {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        if (index >= totalSupply()) {
            revert ERC721OutOfBoundsIndex(address(0), index);
        }
        return $._allTokens[index];
    }

    /**
     * @dev See {ERC721-_update}.
     */
    function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address) {
        address previousOwner = super._update(to, tokenId, auth);

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

        return previousOwner;
    }

    /**
     * @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 {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        uint256 length = balanceOf(to) - 1;
        $._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 {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        $._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 {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        // 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 = balanceOf(from);
        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 {
        ERC721EnumerableStorage storage $ = _getERC721EnumerableStorage();
        // 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();
    }

    /**
     * See {ERC721-_increaseBalance}. We need that to account tokens that were minted in batch
     */
    function _increaseBalance(address account, uint128 amount) internal virtual override {
        if (amount > 0) {
            revert ERC721EnumerableForbiddenBatchMint();
        }
        super._increaseBalance(account, amount);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

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

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

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

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

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

    /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard
    struct ReentrancyGuardStorage {
        uint256 _status;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;

    function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {
        assembly {
            $.slot := ReentrancyGuardStorageLocation
        }
    }

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        $._status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if ($._status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // Any calls to nonReentrant after this point will fail
        $._status = ENTERED;
    }

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        return $._status == ENTERED;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.20;

import {IERC721} from "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.20;

import {IERC721} from "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

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

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

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

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

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

File 13 of 23 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.20;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

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

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

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

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

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

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

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

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

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

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

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant HEX_DIGITS = "0123456789abcdef";
    uint8 private constant ADDRESS_LENGTH = 20;

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

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

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
    }

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        uint256 localValue = value;
        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_DIGITS[localValue & 0xf];
            localValue >>= 4;
        }
        if (localValue != 0) {
            revert StringsInsufficientHexLength(value, length);
        }
        return string(buffer);
    }

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

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

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

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import "./lib/Message.sol";

import "./interface/IHyperlaneClient.sol";
import "./interface/IMailbox.sol";
import "./interface/IZeroWayNFT.sol";

contract HyperlaneClient is Initializable, IHyperlaneClient {
    event SetMailbox(address indexed sender, address indexed mailbox);
    event ReceivedMessage(address indexed msgSender, uint32 indexed origin, bytes32 indexed sender, bytes data);

    address public override mailboxAddr;
    address public override user;

    modifier onlyMailbox() {
        require(msg.sender == address(mailboxAddr), "HyperlaneClient: sender not mailbox");
        _;
    }

    modifier onlyUser() {
        require(msg.sender == address(user), "HyperlaneClient: sender not user");
        _;
    }

    function initialize(address mailbox) external override initializer {
        mailboxAddr = mailbox;
        user = msg.sender;
    }

    function setMailbox(address newMailbox) external override onlyUser {
        mailboxAddr = newMailbox;

        emit SetMailbox({sender: msg.sender, mailbox: mailboxAddr});
    }

    function handle(uint32 origin_, bytes32 sender_, bytes calldata data_) external payable onlyMailbox {
        emit ReceivedMessage({msgSender: msg.sender, origin: origin_, sender: sender_, data: data_});

        IZeroWayNFT(user).handle{value: msg.value}(origin_, sender_, data_);
    }
}

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

interface IHyperlaneClient {
    function mailboxAddr() external view returns (address);

    function user() external view returns (address);

    function initialize(address mailbox) external;

    function setMailbox(address newMailbox) external;

    function handle(uint32 origin_, bytes32 sender_, bytes calldata data_) external payable;
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
interface IMailbox {
    event Dispatch(address indexed sender, uint32 indexed destination, bytes32 indexed recipient, bytes message);

    function dispatch(
        uint32 destinationDomain,
        bytes32 recipientAddress,
        bytes calldata messageBody
    ) external payable returns (bytes32 messageId);

    // /**
    //  * @notice Emitted when a new message is dispatched via Hyperlane
    //  * @param messageId The unique message identifier
    //  */
    // event DispatchId(bytes32 indexed messageId);

    // /**
    //  * @notice Emitted when a Hyperlane message is processed
    //  * @param messageId The unique message identifier
    //  */
    // event ProcessId(bytes32 indexed messageId);

    // /**
    //  * @notice Emitted when a Hyperlane message is delivered
    //  * @param origin The origin domain of the message
    //  * @param sender The message sender address on `origin`
    //  * @param recipient The address that handled the message
    //  */
    // event Process(
    //     uint32 indexed origin,
    //     bytes32 indexed sender,
    //     address indexed recipient
    // );

    // function localDomain() external view returns (uint32);

    function delivered(bytes32 messageId) external view returns (bool);

    // function defaultIsm() external view returns (IInterchainSecurityModule);

    // function defaultHook() external view returns (IPostDispatchHook);

    // function requiredHook() external view returns (IPostDispatchHook);

    // function latestDispatchedId() external view returns (bytes32);

    // function dispatch(
    //     uint32 destinationDomain,
    //     bytes32 recipientAddress,
    //     bytes calldata messageBody
    // ) external payable returns (bytes32 messageId);

    function quoteDispatch(
        uint32 destinationDomain,
        bytes32 recipientAddress,
        bytes calldata messageBody
    ) external view returns (uint256 fee);

    function dispatch(
        uint32 destinationDomain,
        bytes32 recipientAddress,
        bytes calldata body,
        bytes calldata defaultHookMetadata
    ) external payable returns (bytes32 messageId);

    function quoteDispatch(
        uint32 destinationDomain,
        bytes32 recipientAddress,
        bytes calldata messageBody,
        bytes calldata defaultHookMetadata
    ) external view returns (uint256 fee);

    // function dispatch(
    //     uint32 destinationDomain,
    //     bytes32 recipientAddress,
    //     bytes calldata body,
    //     bytes calldata customHookMetadata,
    //     IPostDispatchHook customHook
    // ) external payable returns (bytes32 messageId);

    // function quoteDispatch(
    //     uint32 destinationDomain,
    //     bytes32 recipientAddress,
    //     bytes calldata messageBody,
    //     bytes calldata customHookMetadata,
    //     IPostDispatchHook customHook
    // ) external view returns (uint256 fee);

    // function process(
    //     bytes calldata metadata,
    //     bytes calldata message
    // ) external payable;

    // function recipientIsm(
    //     address recipient
    // ) external view returns (IInterchainSecurityModule module);
}

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

interface IZeroWayNFT {
    function nextTokenId() external view returns (uint256);

    function mintFee() external view returns (uint256);

    function hyperlaneClient() external view returns (address);

    function mailboxAddr() external view returns (address);

    function uri() external view returns (string memory);

    function bridgeFee() external view returns (uint256);

    function initialize(
        address initialOwner_,
        uint256 initialTokenId_,
        uint256 mintFee_,
        address mailboxAddr_,
        address hyperlaneClient_,
        string memory uri_
    ) external;

    function mint(address target_) external payable returns (uint256);

    function bridge(uint256 tokenId_, uint32 destinationDomain_) external payable returns (uint256, bytes32);

    function handle(uint32 origin_, bytes32 sender_, bytes calldata data_) external payable;

    function setURI(string memory uri_) external;

    function setMintFee(uint256 mintFee_) external;

    function setBridgeFee(uint256 bridgeFee_) external;

    function withdrawETH(address to_, uint256 amount_) external;

    function calculateBridgeFee(uint256 tokenId_, uint32 destinationDomain_) external view returns (uint256);

    function calculateHyperlaneFee(uint256 tokenId_, uint32 destinationDomain_) external view returns (uint256);
}

// SPDX-License-Identifier: MIT

pragma solidity 0.8.20;

import {TypeCasts} from "./TypeCasts.sol";

/**
 * @title Hyperlane Message Library
 * @notice Library for formatted messages used by Mailbox
 **/
library Message {
    using TypeCasts for bytes32;

    uint256 private constant VERSION_OFFSET = 0;
    uint256 private constant NONCE_OFFSET = 1;
    uint256 private constant ORIGIN_OFFSET = 5;
    uint256 private constant SENDER_OFFSET = 9;
    uint256 private constant DESTINATION_OFFSET = 41;
    uint256 private constant RECIPIENT_OFFSET = 45;
    uint256 private constant BODY_OFFSET = 77;

    /**
     * @notice Returns formatted (packed) Hyperlane message with provided fields
     * @dev This function should only be used in memory message construction.
     * @param _version The version of the origin and destination Mailboxes
     * @param _nonce A nonce to uniquely identify the message on its origin chain
     * @param _originDomain Domain of origin chain
     * @param _sender Address of sender as bytes32
     * @param _destinationDomain Domain of destination chain
     * @param _recipient Address of recipient on destination chain as bytes32
     * @param _messageBody Raw bytes of message body
     * @return Formatted message
     */
    function formatMessage(
        uint8 _version,
        uint32 _nonce,
        uint32 _originDomain,
        bytes32 _sender,
        uint32 _destinationDomain,
        bytes32 _recipient,
        bytes calldata _messageBody
    ) internal pure returns (bytes memory) {
        return
            abi.encodePacked(
                _version,
                _nonce,
                _originDomain,
                _sender,
                _destinationDomain,
                _recipient,
                _messageBody
            );
    }

    /**
     * @notice Returns the message ID.
     * @param _message ABI encoded Hyperlane message.
     * @return ID of `_message`
     */
    function id(bytes memory _message) internal pure returns (bytes32) {
        return keccak256(_message);
    }

    /**
     * @notice Returns the message version.
     * @param _message ABI encoded Hyperlane message.
     * @return Version of `_message`
     */
    function version(bytes calldata _message) internal pure returns (uint8) {
        return uint8(bytes1(_message[VERSION_OFFSET:NONCE_OFFSET]));
    }

    /**
     * @notice Returns the message nonce.
     * @param _message ABI encoded Hyperlane message.
     * @return Nonce of `_message`
     */
    function nonce(bytes calldata _message) internal pure returns (uint32) {
        return uint32(bytes4(_message[NONCE_OFFSET:ORIGIN_OFFSET]));
    }

    /**
     * @notice Returns the message origin domain.
     * @param _message ABI encoded Hyperlane message.
     * @return Origin domain of `_message`
     */
    function origin(bytes calldata _message) internal pure returns (uint32) {
        return uint32(bytes4(_message[ORIGIN_OFFSET:SENDER_OFFSET]));
    }

    /**
     * @notice Returns the message sender as bytes32.
     * @param _message ABI encoded Hyperlane message.
     * @return Sender of `_message` as bytes32
     */
    function sender(bytes calldata _message) internal pure returns (bytes32) {
        return bytes32(_message[SENDER_OFFSET:DESTINATION_OFFSET]);
    }

    /**
     * @notice Returns the message sender as address.
     * @param _message ABI encoded Hyperlane message.
     * @return Sender of `_message` as address
     */
    function senderAddress(
        bytes calldata _message
    ) internal pure returns (address) {
        return sender(_message).bytes32ToAddress();
    }

    /**
     * @notice Returns the message destination domain.
     * @param _message ABI encoded Hyperlane message.
     * @return Destination domain of `_message`
     */
    function destination(
        bytes calldata _message
    ) internal pure returns (uint32) {
        return uint32(bytes4(_message[DESTINATION_OFFSET:RECIPIENT_OFFSET]));
    }

    /**
     * @notice Returns the message recipient as bytes32.
     * @param _message ABI encoded Hyperlane message.
     * @return Recipient of `_message` as bytes32
     */
    function recipient(
        bytes calldata _message
    ) internal pure returns (bytes32) {
        return bytes32(_message[RECIPIENT_OFFSET:BODY_OFFSET]);
    }

    /**
     * @notice Returns the message recipient as address.
     * @param _message ABI encoded Hyperlane message.
     * @return Recipient of `_message` as address
     */
    function recipientAddress(
        bytes calldata _message
    ) internal pure returns (address) {
        return recipient(_message).bytes32ToAddress();
    }

    /**
     * @notice Returns the message body.
     * @param _message ABI encoded Hyperlane message.
     * @return Body of `_message`
     */
    function body(
        bytes calldata _message
    ) internal pure returns (bytes calldata) {
        return bytes(_message[BODY_OFFSET:]);
    }
}

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

library TypeCasts {
    // alignment preserving cast
    function addressToBytes32(address _addr) internal pure returns (bytes32) {
        return bytes32(uint256(uint160(_addr)));
    }

    // alignment preserving cast
    function bytes32ToAddress(bytes32 _buf) internal pure returns (address) {
        return address(uint160(uint256(_buf)));
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ERC721EnumerableForbiddenBatchMint","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"ERC721OutOfBoundsIndex","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint32","name":"destinationDomain","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"messageId","type":"bytes32"}],"name":"Bridge","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint32","name":"destinationDomain","type":"uint32"},{"indexed":false,"internalType":"address","name":"mailbox","type":"address"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"Handle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"Mint","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":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"bridgeFee","type":"uint256"}],"name":"SetBridgeFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"newMailbox","type":"address"}],"name":"SetMailbox","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintFee","type":"uint256"}],"name":"SetMintFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"string","name":"oldUri","type":"string"},{"indexed":false,"internalType":"string","name":"newUri","type":"string"}],"name":"SetURI","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":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawETH","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"},{"internalType":"uint32","name":"destinationDomain_","type":"uint32"}],"name":"bridge","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"bridgeFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"uint32","name":"destinationDomain_","type":"uint32"}],"name":"calculateBridgeFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"uint32","name":"destinationDomain_","type":"uint32"}],"name":"calculateHyperlaneFee","outputs":[{"internalType":"uint256","name":"","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":"uint32","name":"origin_","type":"uint32"},{"internalType":"bytes32","name":"sender_","type":"bytes32"},{"internalType":"bytes","name":"data_","type":"bytes"}],"name":"handle","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"hyperlaneClient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"initialOwner_","type":"address"},{"internalType":"uint256","name":"initialTokenId_","type":"uint256"},{"internalType":"uint256","name":"mintFee_","type":"uint256"},{"internalType":"address","name":"mailboxAddr_","type":"address"},{"internalType":"address","name":"hyperlaneClient_","type":"address"},{"internalType":"string","name":"uri_","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mailboxAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target_","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"bridgeFee_","type":"uint256"}],"name":"setBridgeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newMailbox_","type":"address"}],"name":"setMailbox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintFee_","type":"uint256"}],"name":"setMintFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri_","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506200001c62000022565b620000d6565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620000735760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620000d35780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b612bc980620000e66000396000f3fe60806040526004361061020f5760003560e01c806370a0823111610118578063a79825e6116100a0578063e985e9c51161006f578063e985e9c51461060c578063eac989f81461062c578063eddd0d9c14610641578063f2fde38b14610661578063f3c61d6b1461068157600080fd5b8063a79825e61461058c578063b3772937146105ac578063b88d4fde146105cc578063c87b56dd146105ec57600080fd5b806382b12dd7116100e757806382b12dd7146104e45780638da5cb5b146104fa57806395d89b4114610537578063998cdf831461054c578063a22cb4651461056c57600080fd5b806370a0823114610479578063715018a61461049957806375794a3c146104ae5780638163ac55146104c457600080fd5b80632f745c591161019b57806356d5d4751161016a57806356d5d475146103f35780635a0d7c50146104065780636352211e146104265780636a627842146104465780636be99a221461045957600080fd5b80632f745c591461037357806342842e0e146103935780634782f779146103b35780634f6ccce7146103d357600080fd5b8063095ea7b3116101e2578063095ea7b3146102c557806313966db5146102e557806318160ddd1461030957806323b872dd1461032b5780632930daa41461034b57600080fd5b806301ffc9a71461021457806302fe53051461024957806306fdde031461026b578063081812fc1461028d575b600080fd5b34801561022057600080fd5b5061023461022f36600461232f565b6106a1565b60405190151581526020015b60405180910390f35b34801561025557600080fd5b506102696102643660046123f8565b6106cc565b005b34801561027757600080fd5b50610280610747565b6040516102409190612473565b34801561029957600080fd5b506102ad6102a8366004612486565b6107eb565b6040516001600160a01b039091168152602001610240565b3480156102d157600080fd5b506102696102e03660046124b4565b610800565b3480156102f157600080fd5b506102fb60015481565b604051908152602001610240565b34801561031557600080fd5b50600080516020612b54833981519152546102fb565b34801561033757600080fd5b506102696103463660046124e0565b61080f565b61035e610359366004612535565b61089f565b60408051928352602083019190915201610240565b34801561037f57600080fd5b506102fb61038e3660046124b4565b610af8565b34801561039f57600080fd5b506102696103ae3660046124e0565b610b6c565b3480156103bf57600080fd5b506102696103ce3660046124b4565b610b8c565b3480156103df57600080fd5b506102fb6103ee366004612486565b610c2e565b610269610401366004612561565b610ca6565b34801561041257600080fd5b506002546102ad906001600160a01b031681565b34801561043257600080fd5b506102ad610441366004612486565b610e04565b6102fb6104543660046125e8565b610e0f565b34801561046557600080fd5b506102fb610474366004612535565b610ef7565b34801561048557600080fd5b506102fb6104943660046125e8565b610f14565b3480156104a557600080fd5b50610269610f70565b3480156104ba57600080fd5b506102fb60005481565b3480156104d057600080fd5b506102696104df366004612605565b610f84565b3480156104f057600080fd5b506102fb60055481565b34801561050657600080fd5b507f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b03166102ad565b34801561054357600080fd5b50610280611192565b34801561055857600080fd5b50610269610567366004612486565b6111d1565b34801561057857600080fd5b5061026961058736600461268c565b611233565b34801561059857600080fd5b506102fb6105a7366004612535565b61123e565b3480156105b857600080fd5b506003546102ad906001600160a01b031681565b3480156105d857600080fd5b506102696105e73660046126ca565b611261565b3480156105f857600080fd5b50610280610607366004612486565b611278565b34801561061857600080fd5b5061023461062736600461274a565b611316565b34801561063857600080fd5b50610280611363565b34801561064d57600080fd5b5061026961065c366004612486565b6113f1565b34801561066d57600080fd5b5061026961067c3660046125e8565b611438565b34801561068d57600080fd5b5061026961069c3660046125e8565b611473565b60006001600160e01b03198216630472ae2d60e51b14806106c657506106c682611544565b92915050565b6106d4611569565b6106dc6115c4565b336001600160a01b03167f33d88cdb93c11fd88afab98fdcdc7c52e9be0eef7f16860b5d93e62d7991d98f6004836040516107189291906127b2565b60405180910390a2600461072c828261289f565b506107446001600080516020612b7483398151915255565b50565b600080516020612b34833981519152805460609190819061076790612778565b80601f016020809104026020016040519081016040528092919081815260200182805461079390612778565b80156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505091505090565b60006107f6826115fc565b506106c682611634565b61080b82823361166e565b5050565b6001600160a01b03821661083e57604051633250574960e11b8152600060048201526024015b60405180910390fd5b600061084b83833361167b565b9050836001600160a01b0316816001600160a01b031614610899576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610835565b50505050565b6000806108aa6115c4565b6108b48484611690565b336108be85610e04565b6001600160a01b0316146109145760405162461bcd60e51b815260206004820181905260248201527f5a65726f5761794e46543a207573657220646f206e6f742068617665204e46546044820152606401610835565b61091d84611796565b600061092985856117d1565b905060006005548261093b9190612975565b90508034101561098d5760405162461bcd60e51b815260206004820181905260248201527f5a65726f5761794e46543a206e6f7420656e6f756768206d73672e76616c75656044820152606401610835565b803411156109cd57336108fc6109a38334612988565b6040518115909202916000818181858888f193505050501580156109cb573d6000803e3d6000fd5b505b6003546002546001600160a01b039182169160009183916348aee8d49187918b911660408051602081018f9052339181019190915263ffffffff8d166060820152608001604051602081830303815290604052610a2861188a565b6040518663ffffffff1660e01b8152600401610a47949392919061299b565b60206040518083038185885af1158015610a65573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a8a91906129dd565b604080518581526020810183905291925063ffffffff8916918a9133917f2191de077a504770f42e598af6658ae8b3dabe334a26b7c61bbb544fd4c51e57910160405180910390a49194509092505050610af16001600080516020612b7483398151915255565b9250929050565b6000600080516020612b14833981519152610b1284610f14565b8310610b435760405163295f44f760e21b81526001600160a01b038516600482015260248101849052604401610835565b6001600160a01b0384166000908152602091825260408082208583529092522054905092915050565b610b8783838360405180602001604052806000815250611261565b505050565b610b94611569565b610b9c6115c4565b604080516001600160a01b03841681526020810183905233917f6b1f4ce962fec27598edceab6195c77516c3df32025eaf0c38d0d4009ac3bd48910160405180910390a26040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610c16573d6000803e3d6000fd5b5061080b6001600080516020612b7483398151915255565b6000600080516020612b14833981519152610c55600080516020612b548339815191525490565b8310610c7e5760405163295f44f760e21b81526000600482015260248101849052604401610835565b806002018381548110610c9357610c936129f6565b9060005260206000200154915050919050565b6002546001600160a01b03163314610d0f5760405162461bcd60e51b815260206004820152602660248201527f5a65726f5761794e46543a2073656e646572206e6f742068797065726c616e6560448201526510db1a595b9d60d21b6064820152608401610835565b610d176115c4565b80610d5d5760405162461bcd60e51b81526020600482015260166024820152755a65726f5761794e46543a20656d707479206461746160501b6044820152606401610835565b60008080610d6d84860186612a0c565b925092509250610d7e8383836118d5565b610d88828461197a565b8063ffffffff1683836001600160a01b03167f3056eb29b29d418531781ce2623aedc3d508e2fcd71eb94b3c0c96f3b3c82b34600260009054906101000a90046001600160a01b03168989604051610de293929190612a4a565b60405180910390a45050506108996001600080516020612b7483398151915255565b60006106c6826115fc565b6000610e196115c4565b6001543414610e6a5760405162461bcd60e51b815260206004820152601b60248201527f5a65726f5761794e46543a2077726f6e67206d73672e76616c756500000000006044820152606401610835565b600080548180610e7983612a8a565b919050559050610e89838261197a565b80836001600160a01b0316336001600160a01b03167f2f00e3cdd69a77be7ed215ec7b2a36784dd158f921fca79ac29deffa353fe6ee600154604051610ed191815260200190565b60405180910390a49050610ef26001600080516020612b7483398151915255565b919050565b6000610f038383611690565b610f0d83836117d1565b9392505050565b6000600080516020612b348339815191526001600160a01b038316610f4f576040516322718ad960e21b815260006004820152602401610835565b6001600160a01b039092166000908152600390920160205250604090205490565b610f78611569565b610f8260006119df565b565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff16600081158015610fca5750825b905060008267ffffffffffffffff166001148015610fe75750303b155b905081158015610ff5575080155b156110135760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561103d57845460ff60401b1916600160401b1785555b6110866040518060400160405280600a81526020016916995c9bd5d85e53919560b21b815250604051806040016040528060058152602001641695d3919560da1b815250611a50565b61108e611a62565b6110978b611a6a565b60008a90556001899055600380546001600160a01b03808b166001600160a01b03199283161790925560028054928a169290911691909117905560046110dd878261289f565b5060025460035460405163189acdbd60e31b81526001600160a01b03918216600482015291169063c4d66de890602401600060405180830381600087803b15801561112757600080fd5b505af115801561113b573d6000803e3d6000fd5b50505050831561118557845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050505050565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793018054606091600080516020612b348339815191529161076790612778565b6111d9611569565b6111e16115c4565b600581905560405181815233907fa065abcf8156e439379371f7924f05c22b16f14de6a1448c5bcbdc525b46dd85906020015b60405180910390a26107446001600080516020612b7483398151915255565b61080b338383611a7b565b600061124a8383611690565b60055461125784846117d1565b610f0d9190612975565b61126c84848461080f565b61089984848484611b2c565b6060611283826115fc565b506004805461129190612778565b80601f01602080910402602001604051908101604052809291908181526020018280546112bd90612778565b801561130a5780601f106112df5761010080835404028352916020019161130a565b820191906000526020600020905b8154815290600101906020018083116112ed57829003601f168201915b50505050509050919050565b6001600160a01b0391821660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793056020908152604080832093909416825291909152205460ff1690565b6004805461137090612778565b80601f016020809104026020016040519081016040528092919081815260200182805461139c90612778565b80156113e95780601f106113be576101008083540402835291602001916113e9565b820191906000526020600020905b8154815290600101906020018083116113cc57829003601f168201915b505050505081565b6113f9611569565b6114016115c4565b600181905560405181815233907fdd198e1876b1e7fbeb87ad607b58c7c4374eacbbf1275469f2528e47e7e5e27590602001611214565b611440611569565b6001600160a01b03811661146a57604051631e4fbdf760e01b815260006004820152602401610835565b610744816119df565b61147b611569565b6114836115c4565b60025460405163f3c61d6b60e01b81526001600160a01b0383811660048301529091169063f3c61d6b90602401600060405180830381600087803b1580156114ca57600080fd5b505af11580156114de573d6000803e3d6000fd5b5050600380546001600160a01b0319166001600160a01b0385169081179091556040519092503391507fc07146377bd65a09370b5b30130caeed15edd19f70ed12bb59752ad45b831eb490600090a36107446001600080516020612b7483398151915255565b60006001600160e01b0319821663780e9d6360e01b14806106c657506106c682611c55565b3361159b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b031614610f825760405163118cdaa760e01b8152336004820152602401610835565b600080516020612b748339815191528054600119016115f657604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b60008061160883611ca5565b90506001600160a01b0381166106c657604051637e27328960e01b815260048101849052602401610835565b60009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930460205260409020546001600160a01b031690565b610b878383836001611cdf565b6000611688848484611df5565b949350505050565b600061169b83610e04565b6001600160a01b0316036116f15760405162461bcd60e51b815260206004820152601c60248201527f5a65726f5761794e46543a206e667420646f206e6f74206578697374000000006044820152606401610835565b8063ffffffff166000036117415760405162461bcd60e51b81526020600482015260176024820152762d32b937abb0bca7232a1d103d32b937903237b6b0b4b760491b6044820152606401610835565b468163ffffffff160361080b5760405162461bcd60e51b815260206004820152601760248201527f5a65726f5761794e46543a2073616d6520646f6d61696e0000000000000000006044820152606401610835565b60006117a5600083600061167b565b90506001600160a01b03811661080b57604051637e27328960e01b815260048101839052602401610835565b6003546002546000916001600160a01b0390811691829163f7ccd3219186911660408051602081018a9052339181019190915263ffffffff8816606082015260800160405160208183030381529060405261182a61188a565b6040518563ffffffff1660e01b8152600401611849949392919061299b565b602060405180830381865afa158015611866573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168891906129dd565b60408051600160f01b602082015260006022820152620186a060428201526bffffffffffffffffffffffff193060601b16606282015281516056818303018152607690910190915290565b8063ffffffff166000036119255760405162461bcd60e51b81526020600482015260176024820152762d32b937abb0bca7232a1d103d32b937903237b6b0b4b760491b6044820152606401610835565b468163ffffffff1614610b875760405162461bcd60e51b815260206004820152601860248201527f5a65726f5761794e46543a2077726f6e6720646f6d61696e00000000000000006044820152606401610835565b6001600160a01b0382166119a457604051633250574960e11b815260006004820152602401610835565b60006119b28383600061167b565b90506001600160a01b03811615610b87576040516339e3563760e11b815260006004820152602401610835565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b611a58611eee565b61080b8282611f37565b610f82611eee565b611a72611eee565b61074481611f68565b600080516020612b348339815191526001600160a01b038316611abc57604051630b61174360e31b81526001600160a01b0384166004820152602401610835565b6001600160a01b038481166000818152600584016020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b6001600160a01b0383163b1561089957604051630a85bd0160e11b81526001600160a01b0384169063150b7a0290611b6e903390889087908790600401612aa3565b6020604051808303816000875af1925050508015611ba9575060408051601f3d908101601f19168201909252611ba691810190612ae0565b60015b611c12573d808015611bd7576040519150601f19603f3d011682016040523d82523d6000602084013e611bdc565b606091505b508051600003611c0a57604051633250574960e11b81526001600160a01b0385166004820152602401610835565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b14611c4e57604051633250574960e11b81526001600160a01b0385166004820152602401610835565b5050505050565b60006001600160e01b031982166380ac58cd60e01b1480611c8657506001600160e01b03198216635b5e139f60e01b145b806106c657506301ffc9a760e01b6001600160e01b03198316146106c6565b60009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930260205260409020546001600160a01b031690565b600080516020612b348339815191528180611d0257506001600160a01b03831615155b15611dc4576000611d12856115fc565b90506001600160a01b03841615801590611d3e5750836001600160a01b0316816001600160a01b031614155b8015611d515750611d4f8185611316565b155b15611d7a5760405163a9fbf51f60e01b81526001600160a01b0385166004820152602401610835565b8215611dc25784866001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b600093845260040160205250506040902080546001600160a01b0319166001600160a01b0392909216919091179055565b600080611e03858585611f70565b90506001600160a01b038116611e8c57611e8784600080516020612b54833981519152805460008381527f645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed0360205260408120829055600182018355919091527fa42f15e5d656f8155fd7419d740a6073999f19cd6e061449ce4a257150545bf20155565b611eaf565b846001600160a01b0316816001600160a01b031614611eaf57611eaf818561207a565b6001600160a01b038516611ecb57611ec68461211e565b611688565b846001600160a01b0316816001600160a01b0316146116885761168885856121f5565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610f8257604051631afcd79f60e31b815260040160405180910390fd5b611f3f611eee565b600080516020612b3483398151915280611f59848261289f565b5060018101610899838261289f565b611440611eee565b6000600080516020612b3483398151915281611f8b85611ca5565b90506001600160a01b03841615611fa757611fa7818587612250565b6001600160a01b03811615611fe757611fc4600086600080611cdf565b6001600160a01b0381166000908152600383016020526040902080546000190190555b6001600160a01b03861615612018576001600160a01b03861660009081526003830160205260409020805460010190555b600085815260028301602052604080822080546001600160a01b0319166001600160a01b038a811691821790925591518893918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a495945050505050565b600080516020612b14833981519152600061209484610f14565b60008481526001840160205260409020549091508082146120e9576001600160a01b03851660009081526020848152604080832085845282528083205484845281842081905583526001860190915290208190555b50600092835260018201602090815260408085208590556001600160a01b039095168452918252838320908352905290812055565b600080516020612b5483398151915254600080516020612b148339815191529060009061214d90600190612988565b6000848152600384016020526040812054600285018054939450909284908110612179576121796129f6565b906000526020600020015490508084600201838154811061219c5761219c6129f6565b6000918252602080832090910192909255828152600386019091526040808220849055868252812055600284018054806121d8576121d8612afd565b600190038181906000526020600020016000905590555050505050565b600080516020612b148339815191526000600161221185610f14565b61221b9190612988565b6001600160a01b0390941660009081526020838152604080832087845282528083208690559482526001909301909252502055565b61225b8383836122b4565b610b87576001600160a01b03831661228957604051637e27328960e01b815260048101829052602401610835565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610835565b60006001600160a01b038316158015906116885750826001600160a01b0316846001600160a01b031614806122ee57506122ee8484611316565b806116885750826001600160a01b031661230783611634565b6001600160a01b031614949350505050565b6001600160e01b03198116811461074457600080fd5b60006020828403121561234157600080fd5b8135610f0d81612319565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561237d5761237d61234c565b604051601f8501601f19908116603f011681019082821181831017156123a5576123a561234c565b816040528093508581528686860111156123be57600080fd5b858560208301376000602087830101525050509392505050565b600082601f8301126123e957600080fd5b610f0d83833560208501612362565b60006020828403121561240a57600080fd5b813567ffffffffffffffff81111561242157600080fd5b611688848285016123d8565b6000815180845260005b8181101561245357602081850181015186830182015201612437565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610f0d602083018461242d565b60006020828403121561249857600080fd5b5035919050565b6001600160a01b038116811461074457600080fd5b600080604083850312156124c757600080fd5b82356124d28161249f565b946020939093013593505050565b6000806000606084860312156124f557600080fd5b83356125008161249f565b925060208401356125108161249f565b929592945050506040919091013590565b803563ffffffff81168114610ef257600080fd5b6000806040838503121561254857600080fd5b8235915061255860208401612521565b90509250929050565b6000806000806060858703121561257757600080fd5b61258085612521565b935060208501359250604085013567ffffffffffffffff808211156125a457600080fd5b818701915087601f8301126125b857600080fd5b8135818111156125c757600080fd5b8860208285010111156125d957600080fd5b95989497505060200194505050565b6000602082840312156125fa57600080fd5b8135610f0d8161249f565b60008060008060008060c0878903121561261e57600080fd5b86356126298161249f565b9550602087013594506040870135935060608701356126478161249f565b925060808701356126578161249f565b915060a087013567ffffffffffffffff81111561267357600080fd5b61267f89828a016123d8565b9150509295509295509295565b6000806040838503121561269f57600080fd5b82356126aa8161249f565b9150602083013580151581146126bf57600080fd5b809150509250929050565b600080600080608085870312156126e057600080fd5b84356126eb8161249f565b935060208501356126fb8161249f565b925060408501359150606085013567ffffffffffffffff81111561271e57600080fd5b8501601f8101871361272f57600080fd5b61273e87823560208401612362565b91505092959194509250565b6000806040838503121561275d57600080fd5b82356127688161249f565b915060208301356126bf8161249f565b600181811c9082168061278c57607f821691505b6020821081036127ac57634e487b7160e01b600052602260045260246000fd5b50919050565b6040815260008084546127c481612778565b80604086015260606001808416600081146127e6576001811461280057612831565b60ff1985168884015283151560051b880183019550612831565b8960005260208060002060005b868110156128285781548b820187015290840190820161280d565b8a018501975050505b50505050508281036020840152612848818561242d565b95945050505050565b601f821115610b8757600081815260208120601f850160051c810160208610156128785750805b601f850160051c820191505b8181101561289757828155600101612884565b505050505050565b815167ffffffffffffffff8111156128b9576128b961234c565b6128cd816128c78454612778565b84612851565b602080601f83116001811461290257600084156128ea5750858301515b600019600386901b1c1916600185901b178555612897565b600085815260208120601f198616915b8281101561293157888601518255948401946001909101908401612912565b508582101561294f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b808201808211156106c6576106c661295f565b818103818111156106c6576106c661295f565b63ffffffff851681528360208201526080604082015260006129c0608083018561242d565b82810360608401526129d2818561242d565b979650505050505050565b6000602082840312156129ef57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b600080600060608486031215612a2157600080fd5b833592506020840135612a338161249f565b9150612a4160408501612521565b90509250925092565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b600060018201612a9c57612a9c61295f565b5060010190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612ad69083018461242d565b9695505050505050565b600060208284031215612af257600080fd5b8151610f0d81612319565b634e487b7160e01b600052603160045260246000fdfe645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed0080bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed029b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a264697066735822122039de0ee8af29342aa043390a943231172debf60613a347c2e83202ff45ee503b64736f6c63430008140033

Deployed Bytecode

0x60806040526004361061020f5760003560e01c806370a0823111610118578063a79825e6116100a0578063e985e9c51161006f578063e985e9c51461060c578063eac989f81461062c578063eddd0d9c14610641578063f2fde38b14610661578063f3c61d6b1461068157600080fd5b8063a79825e61461058c578063b3772937146105ac578063b88d4fde146105cc578063c87b56dd146105ec57600080fd5b806382b12dd7116100e757806382b12dd7146104e45780638da5cb5b146104fa57806395d89b4114610537578063998cdf831461054c578063a22cb4651461056c57600080fd5b806370a0823114610479578063715018a61461049957806375794a3c146104ae5780638163ac55146104c457600080fd5b80632f745c591161019b57806356d5d4751161016a57806356d5d475146103f35780635a0d7c50146104065780636352211e146104265780636a627842146104465780636be99a221461045957600080fd5b80632f745c591461037357806342842e0e146103935780634782f779146103b35780634f6ccce7146103d357600080fd5b8063095ea7b3116101e2578063095ea7b3146102c557806313966db5146102e557806318160ddd1461030957806323b872dd1461032b5780632930daa41461034b57600080fd5b806301ffc9a71461021457806302fe53051461024957806306fdde031461026b578063081812fc1461028d575b600080fd5b34801561022057600080fd5b5061023461022f36600461232f565b6106a1565b60405190151581526020015b60405180910390f35b34801561025557600080fd5b506102696102643660046123f8565b6106cc565b005b34801561027757600080fd5b50610280610747565b6040516102409190612473565b34801561029957600080fd5b506102ad6102a8366004612486565b6107eb565b6040516001600160a01b039091168152602001610240565b3480156102d157600080fd5b506102696102e03660046124b4565b610800565b3480156102f157600080fd5b506102fb60015481565b604051908152602001610240565b34801561031557600080fd5b50600080516020612b54833981519152546102fb565b34801561033757600080fd5b506102696103463660046124e0565b61080f565b61035e610359366004612535565b61089f565b60408051928352602083019190915201610240565b34801561037f57600080fd5b506102fb61038e3660046124b4565b610af8565b34801561039f57600080fd5b506102696103ae3660046124e0565b610b6c565b3480156103bf57600080fd5b506102696103ce3660046124b4565b610b8c565b3480156103df57600080fd5b506102fb6103ee366004612486565b610c2e565b610269610401366004612561565b610ca6565b34801561041257600080fd5b506002546102ad906001600160a01b031681565b34801561043257600080fd5b506102ad610441366004612486565b610e04565b6102fb6104543660046125e8565b610e0f565b34801561046557600080fd5b506102fb610474366004612535565b610ef7565b34801561048557600080fd5b506102fb6104943660046125e8565b610f14565b3480156104a557600080fd5b50610269610f70565b3480156104ba57600080fd5b506102fb60005481565b3480156104d057600080fd5b506102696104df366004612605565b610f84565b3480156104f057600080fd5b506102fb60055481565b34801561050657600080fd5b507f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b03166102ad565b34801561054357600080fd5b50610280611192565b34801561055857600080fd5b50610269610567366004612486565b6111d1565b34801561057857600080fd5b5061026961058736600461268c565b611233565b34801561059857600080fd5b506102fb6105a7366004612535565b61123e565b3480156105b857600080fd5b506003546102ad906001600160a01b031681565b3480156105d857600080fd5b506102696105e73660046126ca565b611261565b3480156105f857600080fd5b50610280610607366004612486565b611278565b34801561061857600080fd5b5061023461062736600461274a565b611316565b34801561063857600080fd5b50610280611363565b34801561064d57600080fd5b5061026961065c366004612486565b6113f1565b34801561066d57600080fd5b5061026961067c3660046125e8565b611438565b34801561068d57600080fd5b5061026961069c3660046125e8565b611473565b60006001600160e01b03198216630472ae2d60e51b14806106c657506106c682611544565b92915050565b6106d4611569565b6106dc6115c4565b336001600160a01b03167f33d88cdb93c11fd88afab98fdcdc7c52e9be0eef7f16860b5d93e62d7991d98f6004836040516107189291906127b2565b60405180910390a2600461072c828261289f565b506107446001600080516020612b7483398151915255565b50565b600080516020612b34833981519152805460609190819061076790612778565b80601f016020809104026020016040519081016040528092919081815260200182805461079390612778565b80156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505091505090565b60006107f6826115fc565b506106c682611634565b61080b82823361166e565b5050565b6001600160a01b03821661083e57604051633250574960e11b8152600060048201526024015b60405180910390fd5b600061084b83833361167b565b9050836001600160a01b0316816001600160a01b031614610899576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610835565b50505050565b6000806108aa6115c4565b6108b48484611690565b336108be85610e04565b6001600160a01b0316146109145760405162461bcd60e51b815260206004820181905260248201527f5a65726f5761794e46543a207573657220646f206e6f742068617665204e46546044820152606401610835565b61091d84611796565b600061092985856117d1565b905060006005548261093b9190612975565b90508034101561098d5760405162461bcd60e51b815260206004820181905260248201527f5a65726f5761794e46543a206e6f7420656e6f756768206d73672e76616c75656044820152606401610835565b803411156109cd57336108fc6109a38334612988565b6040518115909202916000818181858888f193505050501580156109cb573d6000803e3d6000fd5b505b6003546002546001600160a01b039182169160009183916348aee8d49187918b911660408051602081018f9052339181019190915263ffffffff8d166060820152608001604051602081830303815290604052610a2861188a565b6040518663ffffffff1660e01b8152600401610a47949392919061299b565b60206040518083038185885af1158015610a65573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a8a91906129dd565b604080518581526020810183905291925063ffffffff8916918a9133917f2191de077a504770f42e598af6658ae8b3dabe334a26b7c61bbb544fd4c51e57910160405180910390a49194509092505050610af16001600080516020612b7483398151915255565b9250929050565b6000600080516020612b14833981519152610b1284610f14565b8310610b435760405163295f44f760e21b81526001600160a01b038516600482015260248101849052604401610835565b6001600160a01b0384166000908152602091825260408082208583529092522054905092915050565b610b8783838360405180602001604052806000815250611261565b505050565b610b94611569565b610b9c6115c4565b604080516001600160a01b03841681526020810183905233917f6b1f4ce962fec27598edceab6195c77516c3df32025eaf0c38d0d4009ac3bd48910160405180910390a26040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610c16573d6000803e3d6000fd5b5061080b6001600080516020612b7483398151915255565b6000600080516020612b14833981519152610c55600080516020612b548339815191525490565b8310610c7e5760405163295f44f760e21b81526000600482015260248101849052604401610835565b806002018381548110610c9357610c936129f6565b9060005260206000200154915050919050565b6002546001600160a01b03163314610d0f5760405162461bcd60e51b815260206004820152602660248201527f5a65726f5761794e46543a2073656e646572206e6f742068797065726c616e6560448201526510db1a595b9d60d21b6064820152608401610835565b610d176115c4565b80610d5d5760405162461bcd60e51b81526020600482015260166024820152755a65726f5761794e46543a20656d707479206461746160501b6044820152606401610835565b60008080610d6d84860186612a0c565b925092509250610d7e8383836118d5565b610d88828461197a565b8063ffffffff1683836001600160a01b03167f3056eb29b29d418531781ce2623aedc3d508e2fcd71eb94b3c0c96f3b3c82b34600260009054906101000a90046001600160a01b03168989604051610de293929190612a4a565b60405180910390a45050506108996001600080516020612b7483398151915255565b60006106c6826115fc565b6000610e196115c4565b6001543414610e6a5760405162461bcd60e51b815260206004820152601b60248201527f5a65726f5761794e46543a2077726f6e67206d73672e76616c756500000000006044820152606401610835565b600080548180610e7983612a8a565b919050559050610e89838261197a565b80836001600160a01b0316336001600160a01b03167f2f00e3cdd69a77be7ed215ec7b2a36784dd158f921fca79ac29deffa353fe6ee600154604051610ed191815260200190565b60405180910390a49050610ef26001600080516020612b7483398151915255565b919050565b6000610f038383611690565b610f0d83836117d1565b9392505050565b6000600080516020612b348339815191526001600160a01b038316610f4f576040516322718ad960e21b815260006004820152602401610835565b6001600160a01b039092166000908152600390920160205250604090205490565b610f78611569565b610f8260006119df565b565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff16600081158015610fca5750825b905060008267ffffffffffffffff166001148015610fe75750303b155b905081158015610ff5575080155b156110135760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561103d57845460ff60401b1916600160401b1785555b6110866040518060400160405280600a81526020016916995c9bd5d85e53919560b21b815250604051806040016040528060058152602001641695d3919560da1b815250611a50565b61108e611a62565b6110978b611a6a565b60008a90556001899055600380546001600160a01b03808b166001600160a01b03199283161790925560028054928a169290911691909117905560046110dd878261289f565b5060025460035460405163189acdbd60e31b81526001600160a01b03918216600482015291169063c4d66de890602401600060405180830381600087803b15801561112757600080fd5b505af115801561113b573d6000803e3d6000fd5b50505050831561118557845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050505050565b7f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793018054606091600080516020612b348339815191529161076790612778565b6111d9611569565b6111e16115c4565b600581905560405181815233907fa065abcf8156e439379371f7924f05c22b16f14de6a1448c5bcbdc525b46dd85906020015b60405180910390a26107446001600080516020612b7483398151915255565b61080b338383611a7b565b600061124a8383611690565b60055461125784846117d1565b610f0d9190612975565b61126c84848461080f565b61089984848484611b2c565b6060611283826115fc565b506004805461129190612778565b80601f01602080910402602001604051908101604052809291908181526020018280546112bd90612778565b801561130a5780601f106112df5761010080835404028352916020019161130a565b820191906000526020600020905b8154815290600101906020018083116112ed57829003601f168201915b50505050509050919050565b6001600160a01b0391821660009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab00793056020908152604080832093909416825291909152205460ff1690565b6004805461137090612778565b80601f016020809104026020016040519081016040528092919081815260200182805461139c90612778565b80156113e95780601f106113be576101008083540402835291602001916113e9565b820191906000526020600020905b8154815290600101906020018083116113cc57829003601f168201915b505050505081565b6113f9611569565b6114016115c4565b600181905560405181815233907fdd198e1876b1e7fbeb87ad607b58c7c4374eacbbf1275469f2528e47e7e5e27590602001611214565b611440611569565b6001600160a01b03811661146a57604051631e4fbdf760e01b815260006004820152602401610835565b610744816119df565b61147b611569565b6114836115c4565b60025460405163f3c61d6b60e01b81526001600160a01b0383811660048301529091169063f3c61d6b90602401600060405180830381600087803b1580156114ca57600080fd5b505af11580156114de573d6000803e3d6000fd5b5050600380546001600160a01b0319166001600160a01b0385169081179091556040519092503391507fc07146377bd65a09370b5b30130caeed15edd19f70ed12bb59752ad45b831eb490600090a36107446001600080516020612b7483398151915255565b60006001600160e01b0319821663780e9d6360e01b14806106c657506106c682611c55565b3361159b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b031614610f825760405163118cdaa760e01b8152336004820152602401610835565b600080516020612b748339815191528054600119016115f657604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b60008061160883611ca5565b90506001600160a01b0381166106c657604051637e27328960e01b815260048101849052602401610835565b60009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930460205260409020546001600160a01b031690565b610b878383836001611cdf565b6000611688848484611df5565b949350505050565b600061169b83610e04565b6001600160a01b0316036116f15760405162461bcd60e51b815260206004820152601c60248201527f5a65726f5761794e46543a206e667420646f206e6f74206578697374000000006044820152606401610835565b8063ffffffff166000036117415760405162461bcd60e51b81526020600482015260176024820152762d32b937abb0bca7232a1d103d32b937903237b6b0b4b760491b6044820152606401610835565b468163ffffffff160361080b5760405162461bcd60e51b815260206004820152601760248201527f5a65726f5761794e46543a2073616d6520646f6d61696e0000000000000000006044820152606401610835565b60006117a5600083600061167b565b90506001600160a01b03811661080b57604051637e27328960e01b815260048101839052602401610835565b6003546002546000916001600160a01b0390811691829163f7ccd3219186911660408051602081018a9052339181019190915263ffffffff8816606082015260800160405160208183030381529060405261182a61188a565b6040518563ffffffff1660e01b8152600401611849949392919061299b565b602060405180830381865afa158015611866573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168891906129dd565b60408051600160f01b602082015260006022820152620186a060428201526bffffffffffffffffffffffff193060601b16606282015281516056818303018152607690910190915290565b8063ffffffff166000036119255760405162461bcd60e51b81526020600482015260176024820152762d32b937abb0bca7232a1d103d32b937903237b6b0b4b760491b6044820152606401610835565b468163ffffffff1614610b875760405162461bcd60e51b815260206004820152601860248201527f5a65726f5761794e46543a2077726f6e6720646f6d61696e00000000000000006044820152606401610835565b6001600160a01b0382166119a457604051633250574960e11b815260006004820152602401610835565b60006119b28383600061167b565b90506001600160a01b03811615610b87576040516339e3563760e11b815260006004820152602401610835565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b611a58611eee565b61080b8282611f37565b610f82611eee565b611a72611eee565b61074481611f68565b600080516020612b348339815191526001600160a01b038316611abc57604051630b61174360e31b81526001600160a01b0384166004820152602401610835565b6001600160a01b038481166000818152600584016020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a350505050565b6001600160a01b0383163b1561089957604051630a85bd0160e11b81526001600160a01b0384169063150b7a0290611b6e903390889087908790600401612aa3565b6020604051808303816000875af1925050508015611ba9575060408051601f3d908101601f19168201909252611ba691810190612ae0565b60015b611c12573d808015611bd7576040519150601f19603f3d011682016040523d82523d6000602084013e611bdc565b606091505b508051600003611c0a57604051633250574960e11b81526001600160a01b0385166004820152602401610835565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b14611c4e57604051633250574960e11b81526001600160a01b0385166004820152602401610835565b5050505050565b60006001600160e01b031982166380ac58cd60e01b1480611c8657506001600160e01b03198216635b5e139f60e01b145b806106c657506301ffc9a760e01b6001600160e01b03198316146106c6565b60009081527f80bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab007930260205260409020546001600160a01b031690565b600080516020612b348339815191528180611d0257506001600160a01b03831615155b15611dc4576000611d12856115fc565b90506001600160a01b03841615801590611d3e5750836001600160a01b0316816001600160a01b031614155b8015611d515750611d4f8185611316565b155b15611d7a5760405163a9fbf51f60e01b81526001600160a01b0385166004820152602401610835565b8215611dc25784866001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b600093845260040160205250506040902080546001600160a01b0319166001600160a01b0392909216919091179055565b600080611e03858585611f70565b90506001600160a01b038116611e8c57611e8784600080516020612b54833981519152805460008381527f645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed0360205260408120829055600182018355919091527fa42f15e5d656f8155fd7419d740a6073999f19cd6e061449ce4a257150545bf20155565b611eaf565b846001600160a01b0316816001600160a01b031614611eaf57611eaf818561207a565b6001600160a01b038516611ecb57611ec68461211e565b611688565b846001600160a01b0316816001600160a01b0316146116885761168885856121f5565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610f8257604051631afcd79f60e31b815260040160405180910390fd5b611f3f611eee565b600080516020612b3483398151915280611f59848261289f565b5060018101610899838261289f565b611440611eee565b6000600080516020612b3483398151915281611f8b85611ca5565b90506001600160a01b03841615611fa757611fa7818587612250565b6001600160a01b03811615611fe757611fc4600086600080611cdf565b6001600160a01b0381166000908152600383016020526040902080546000190190555b6001600160a01b03861615612018576001600160a01b03861660009081526003830160205260409020805460010190555b600085815260028301602052604080822080546001600160a01b0319166001600160a01b038a811691821790925591518893918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a495945050505050565b600080516020612b14833981519152600061209484610f14565b60008481526001840160205260409020549091508082146120e9576001600160a01b03851660009081526020848152604080832085845282528083205484845281842081905583526001860190915290208190555b50600092835260018201602090815260408085208590556001600160a01b039095168452918252838320908352905290812055565b600080516020612b5483398151915254600080516020612b148339815191529060009061214d90600190612988565b6000848152600384016020526040812054600285018054939450909284908110612179576121796129f6565b906000526020600020015490508084600201838154811061219c5761219c6129f6565b6000918252602080832090910192909255828152600386019091526040808220849055868252812055600284018054806121d8576121d8612afd565b600190038181906000526020600020016000905590555050505050565b600080516020612b148339815191526000600161221185610f14565b61221b9190612988565b6001600160a01b0390941660009081526020838152604080832087845282528083208690559482526001909301909252502055565b61225b8383836122b4565b610b87576001600160a01b03831661228957604051637e27328960e01b815260048101829052602401610835565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610835565b60006001600160a01b038316158015906116885750826001600160a01b0316846001600160a01b031614806122ee57506122ee8484611316565b806116885750826001600160a01b031661230783611634565b6001600160a01b031614949350505050565b6001600160e01b03198116811461074457600080fd5b60006020828403121561234157600080fd5b8135610f0d81612319565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561237d5761237d61234c565b604051601f8501601f19908116603f011681019082821181831017156123a5576123a561234c565b816040528093508581528686860111156123be57600080fd5b858560208301376000602087830101525050509392505050565b600082601f8301126123e957600080fd5b610f0d83833560208501612362565b60006020828403121561240a57600080fd5b813567ffffffffffffffff81111561242157600080fd5b611688848285016123d8565b6000815180845260005b8181101561245357602081850181015186830182015201612437565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610f0d602083018461242d565b60006020828403121561249857600080fd5b5035919050565b6001600160a01b038116811461074457600080fd5b600080604083850312156124c757600080fd5b82356124d28161249f565b946020939093013593505050565b6000806000606084860312156124f557600080fd5b83356125008161249f565b925060208401356125108161249f565b929592945050506040919091013590565b803563ffffffff81168114610ef257600080fd5b6000806040838503121561254857600080fd5b8235915061255860208401612521565b90509250929050565b6000806000806060858703121561257757600080fd5b61258085612521565b935060208501359250604085013567ffffffffffffffff808211156125a457600080fd5b818701915087601f8301126125b857600080fd5b8135818111156125c757600080fd5b8860208285010111156125d957600080fd5b95989497505060200194505050565b6000602082840312156125fa57600080fd5b8135610f0d8161249f565b60008060008060008060c0878903121561261e57600080fd5b86356126298161249f565b9550602087013594506040870135935060608701356126478161249f565b925060808701356126578161249f565b915060a087013567ffffffffffffffff81111561267357600080fd5b61267f89828a016123d8565b9150509295509295509295565b6000806040838503121561269f57600080fd5b82356126aa8161249f565b9150602083013580151581146126bf57600080fd5b809150509250929050565b600080600080608085870312156126e057600080fd5b84356126eb8161249f565b935060208501356126fb8161249f565b925060408501359150606085013567ffffffffffffffff81111561271e57600080fd5b8501601f8101871361272f57600080fd5b61273e87823560208401612362565b91505092959194509250565b6000806040838503121561275d57600080fd5b82356127688161249f565b915060208301356126bf8161249f565b600181811c9082168061278c57607f821691505b6020821081036127ac57634e487b7160e01b600052602260045260246000fd5b50919050565b6040815260008084546127c481612778565b80604086015260606001808416600081146127e6576001811461280057612831565b60ff1985168884015283151560051b880183019550612831565b8960005260208060002060005b868110156128285781548b820187015290840190820161280d565b8a018501975050505b50505050508281036020840152612848818561242d565b95945050505050565b601f821115610b8757600081815260208120601f850160051c810160208610156128785750805b601f850160051c820191505b8181101561289757828155600101612884565b505050505050565b815167ffffffffffffffff8111156128b9576128b961234c565b6128cd816128c78454612778565b84612851565b602080601f83116001811461290257600084156128ea5750858301515b600019600386901b1c1916600185901b178555612897565b600085815260208120601f198616915b8281101561293157888601518255948401946001909101908401612912565b508582101561294f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b808201808211156106c6576106c661295f565b818103818111156106c6576106c661295f565b63ffffffff851681528360208201526080604082015260006129c0608083018561242d565b82810360608401526129d2818561242d565b979650505050505050565b6000602082840312156129ef57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b600080600060608486031215612a2157600080fd5b833592506020840135612a338161249f565b9150612a4160408501612521565b90509250925092565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b600060018201612a9c57612a9c61295f565b5060010190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612ad69083018461242d565b9695505050505050565b600060208284031215612af257600080fd5b8151610f0d81612319565b634e487b7160e01b600052603160045260246000fdfe645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed0080bb2b638cc20bc4d0a60d66940f3ab4a00c1d7b313497ca82fb0b4ab0079300645e039705490088daad89bae25049a34f4a9072d398537b1ab2425f24cbed029b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a264697066735822122039de0ee8af29342aa043390a943231172debf60613a347c2e83202ff45ee503b64736f6c63430008140033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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.