ETH Price: $2,426.43 (-1.28%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040188108082023-12-18 5:30:23323 days ago1702877423IN
 Create: Game
0 ETH0.0533366631.72873001

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Game

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 18 : Game.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import { IERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import { ERC721HolderUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
import { EnumerableSetUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";
import "./../interfaces/IGame.sol";
import "./../interfaces/ILand.sol";
import "./../library/SafeToken.sol";
import "./../interfaces/ISignatureVerifier.sol";

contract Game is
    ERC721HolderUpgradeable, 
    PausableUpgradeable,
    ReentrancyGuardUpgradeable,
    OwnableUpgradeable, 
    IGame
{
    using SafeToken for address;
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;
    IERC20Upgradeable public token;
    ISignatureVerifier public verifier;
    ILand public land;
    address public treasury;
    
    mapping (address => EnumerableSetUpgradeable.UintSet) private lands;
    mapping (uint256 => address) public ownerOfLandByIds;
    address public manager;

    function initialize(
        address token_,
        address verifier_,
        address land_,
        address treasury_
    ) external initializer {
        __Pausable_init();
        __Ownable_init();
        __ERC721Holder_init();
        token = IERC20Upgradeable(token_);
        verifier = ISignatureVerifier(verifier_);
        land = ILand(land_);
        treasury = treasury_;
    }

    function depositLand(uint256[] calldata landIds) external nonReentrant whenNotPaused {
        address account = msg.sender;
        for (uint8 i = 0; i < landIds.length; i++) {
            require(land.ownerOf(landIds[i]) == msg.sender, "o");
            lands[account].add(landIds[i]);
            ownerOfLandByIds[landIds[i]] = account;
            land.safeTransferFrom(account, address(this), landIds[i]);
        }       
        emit LandDeposited(account, landIds);
    }

    function directDeposit(address account, uint256[] memory landIds) external override {
        require(msg.sender == manager, "caller is not manager");
        for (uint8 i = 0; i < landIds.length; i++) {
            lands[account].add(landIds[i]);
            ownerOfLandByIds[landIds[i]] = account;
        }
        emit LandDeposited(account, landIds);
    }

    function getLand(address account) external override view returns (uint256[] memory) {
        return lands[account].values(); 
    }
 
    function withdrawTokenFromLand(
        bytes32 nonce,
        uint256 landId,
        uint256 amount,
        bytes memory signature
    ) external nonReentrant whenNotPaused {
        require(amount > 0, "i");
        address account = msg.sender;
        verifier.verifyWithdrawTokenFromLand(nonce, account, landId, amount, signature);
        SafeToken.safeTransfer(address(token), account, amount);
        emit TokenWithdrewFromLand(account, landId, amount, nonce);
    }

    function withdrawLand(uint256[] memory landIds) external nonReentrant whenNotPaused {
        address account = msg.sender;
        for (uint8 i = 0; i < landIds.length; i++) {
            require(ownerOfLand(msg.sender, landIds[i]), "o");       
            lands[account].remove(landIds[i]);
            land.safeTransferFrom(address(this), account, landIds[i]);
            delete ownerOfLandByIds[landIds[i]];
        }       
        emit LandWithdrew(account, landIds);
    }

    function depositToken(uint256 amount) external nonReentrant whenNotPaused {
        address account = msg.sender;
        require(amount > 0 && token.balanceOf(account) >= amount);
        token.transferFrom(account, treasury, amount);
        emit TokenDeposited(account, amount);
    }

    function withdrawToken(
        bytes32 nonce,
        uint256 amount,
        bytes memory signature
    ) external nonReentrant whenNotPaused {
        require(amount > 0, "i");
        address account = msg.sender;
        verifier.verifyWithdrawToken(nonce, account, amount, signature);
        SafeToken.safeTransfer(address(token), account, amount);
        emit TokenWithdrew(account, amount, nonce);
    }

    function ownerOfLand(address account, uint256 landId) public override view returns (bool) {
        return landId != 0 && lands[account].contains(landId);
    }

    function setManager(address manager_) external onlyOwner {
        manager = manager_;
    }

    function setTreasury(address treasury_) external onlyOwner {
        treasury = treasury_;
    }

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

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

    function withdrawEmergency(address token_, address to, uint256 value) external onlyOwner {
        SafeToken.safeTransfer(token_, to, value);
    }

    uint256[46] private __gap;
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. 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 {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

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

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

pragma solidity ^0.8.2;

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

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

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

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

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

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

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

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

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

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

File 4 of 18 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

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

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

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

File 5 of 18 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../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;

    uint256 private _status;

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

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

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

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

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

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

    /**
     * @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) {
        return _status == _ENTERED;
    }

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

File 6 of 18 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}

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

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

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

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

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 10 of 18 : ERC721HolderUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721HolderUpgradeable is Initializable, IERC721ReceiverUpgradeable {
    function __ERC721Holder_init() internal onlyInitializing {
    }

    function __ERC721Holder_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSetUpgradeable {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

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

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

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

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

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

        return result;
    }
}

File 15 of 18 : IGame.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IGame {

    event LandDeposited(address from, uint256[] landId);
    event LandWithdrew(address from, uint256[] landId);
    event TokenWithdrewFromLand(address from, uint256 landId, uint256 amount, bytes32 nonce);
    event TokenDeposited(address from, uint256 amount);
    event TokenWithdrew(address from, uint256 amount, bytes32 nonce);
    
    function getLand(address account) external view returns (uint256[] memory);

    function ownerOfLand(
        address account,
        uint256 landId
    ) external view returns (bool);

    function directDeposit(address account, uint256[] memory landIds) external;

}

File 16 of 18 : ILand.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { IERC721EnumerableUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol";

interface ILand is IERC721EnumerableUpgradeable {
    event NFTMinted (address to, uint256[] ids);
    event NFTClaimed (address to, uint256 id, uint256 nekoId);
    event NFTMintedAndDeposited(address owner, address to, uint256[] ids, bytes32 nonce);

    function currentId() external view returns (uint256);

    function mintToken(address to, bool isClaim, uint256 nekoId) external;

    function mintBatchToken(address to, uint256 amount, address owner, bytes32 nonce) external;

    function genesisMinter(address) external view returns (bool);

    function baseURI() external view returns (string memory);
}

File 17 of 18 : ISignatureVerifier.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;


interface ISignatureVerifier {
    event UsedNonce(address account, bytes32 nonce, string action);

    function verifyWithdrawTokenFromLand (
        bytes32 nonce,
        address receiver,
        uint256 landId,
        uint256 amount,
        bytes memory signature
    )
    external
    returns (bool);

    function verifyWithdrawToken (
        bytes32 nonce,
        address receiver,
        uint256 amount,
        bytes memory signature
    )
    external
    returns (bool);

    function verifyWithdrawEnrich (
        bytes32 nonce,
        address receiver,
        uint256[] memory enrichIds,
        uint256[] memory amounts,
        bytes memory signature
    )
    external
    returns (bool);

    function verifyWithdrawResource (
        bytes32 nonce,
        address receiver,
        uint256[] memory resourceIds,
        uint256[] memory amounts,
        bytes memory signature
    )
    external
    returns (bool);

    function verifyClaimLand (
        bytes32 nonce,
        address receiver,
        uint256[] memory nekoId,
        bytes memory signature
    )
    external 
    returns (bool);
}

File 18 of 18 : SafeToken.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface ERC20Interface {
    function balanceOf(address user) external view returns (uint256);
}

library SafeToken {
    function myBalance(address token) internal view returns (uint256) {
        return ERC20Interface(token).balanceOf(address(this));
    }

    function balanceOf(address token, address user) internal view returns (uint256) {
        return ERC20Interface(token).balanceOf(user);
    }

    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes("approve(address,uint256)")));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "!safeApprove");
    }

    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes("transfer(address,uint256)")));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "!safeTransfer");
    }

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes("transferFrom(address,address,uint256)")));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "!safeTransferFrom");
    }

    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, "!s");
    }
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"landId","type":"uint256[]"}],"name":"LandDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"landId","type":"uint256[]"}],"name":"LandWithdrew","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"TokenWithdrew","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"landId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"TokenWithdrewFromLand","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"uint256[]","name":"landIds","type":"uint256[]"}],"name":"depositLand","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256[]","name":"landIds","type":"uint256[]"}],"name":"directDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getLand","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"address","name":"verifier_","type":"address"},{"internalType":"address","name":"land_","type":"address"},{"internalType":"address","name":"treasury_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"land","outputs":[{"internalType":"contract ILand","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"manager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"landId","type":"uint256"}],"name":"ownerOfLand","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ownerOfLandByIds","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"manager_","type":"address"}],"name":"setManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"treasury_","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"verifier","outputs":[{"internalType":"contract ISignatureVerifier","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"withdrawEmergency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"landIds","type":"uint256[]"}],"name":"withdrawLand","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"nonce","type":"bytes32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"nonce","type":"bytes32"},{"internalType":"uint256","name":"landId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"withdrawTokenFromLand","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50611d71806100206000396000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c80638456cb59116100de578063d8111a8611610097578063f0f4426011610071578063f0f4426014610350578063f2fde38b14610363578063f8c8765e14610376578063fc0c546a1461038957600080fd5b8063d8111a8614610300578063d9e84eb514610313578063db965a761461032657600080fd5b80638456cb591461029b5780638c980129146102a35780638da5cb5b146102b6578063a9eb5b7c146102c7578063b140e461146102da578063d0ebdbe7146102ed57600080fd5b80635c975abb116101305780635c975abb14610223578063614e4cdb1461023a57806361d027b31461025a5780636215be771461026d578063715018a6146102805780638304cc901461028857600080fd5b8063150b7a0214610178578063274a0fce146101b45780632b7ac3f3146101c95780632bbdb207146101f45780633f4ba83a14610207578063481c6a751461020f575b600080fd5b610196610186366004611703565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020015b60405180910390f35b6101c76101c236600461176f565b61039c565b005b60fc546101dc906001600160a01b031681565b6040516001600160a01b0390911681526020016101ab565b6101c76102023660046117b0565b6103b4565b6101c76104f2565b610101546101dc906001600160a01b031681565b60655460ff165b60405190151581526020016101ab565b61024d610248366004611800565b610504565b6040516101ab9190611858565b60fe546101dc906001600160a01b031681565b6101c761027b36600461186b565b61052e565b6101c76106b4565b6101c7610296366004611884565b6106c6565b6101c761080e565b60fd546101dc906001600160a01b031681565b60c9546001600160a01b03166101dc565b61022a6102d53660046118c6565b61081e565b6101c76102e83660046118f2565b610853565b6101c76102fb366004611800565b610ac4565b6101c761030e3660046119e7565b610aef565b6101c7610321366004611a37565b610c4b565b6101dc61033436600461186b565b610100602052600090815260409020546001600160a01b031681565b6101c761035e366004611800565b610e3d565b6101c7610371366004611800565b610e67565b6101c7610384366004611a74565b610edd565b60fb546101dc906001600160a01b031681565b6103a461104c565b6103af8383836110a6565b505050565b6103bc6111aa565b6103c4611204565b600082116103fd5760405162461bcd60e51b81526020600482015260016024820152606960f81b60448201526064015b60405180910390fd5b60fc54604051630315e4b760e01b815233916001600160a01b031690630315e4b790610433908790859088908890600401611b28565b602060405180830381600087803b15801561044d57600080fd5b505af1158015610461573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104859190611b5f565b5060fb5461049d906001600160a01b031682856110a6565b604080516001600160a01b0383168152602081018590529081018590527f33b33dda89b868825f1a3cee51ed39421a81c4460d64f037df10bcf9f199c1dd9060600160405180910390a1506103af6001609755565b6104fa61104c565b61050261124a565b565b6001600160a01b038116600090815260ff602052604090206060906105289061129c565b92915050565b6105366111aa565b61053e611204565b3381158015906105c9575060fb546040516370a0823160e01b81526001600160a01b038381166004830152849216906370a082319060240160206040518083038186803b15801561058e57600080fd5b505afa1580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c69190611b81565b10155b6105d257600080fd5b60fb5460fe546040516323b872dd60e01b81526001600160a01b0384811660048301529182166024820152604481018590529116906323b872dd90606401602060405180830381600087803b15801561062a57600080fd5b505af115801561063e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106629190611b5f565b50604080516001600160a01b0383168152602081018490527fbc7c8a4d8049a3f99a02f2a20640c206a2e4d3f2fa54fd20da9f01fda3620cda91015b60405180910390a1506106b16001609755565b50565b6106bc61104c565b61050260006112a9565b6106ce6111aa565b6106d6611204565b6000821161070a5760405162461bcd60e51b81526020600482015260016024820152606960f81b60448201526064016103f4565b60fc5460405163647aa04f60e11b815233916001600160a01b03169063c8f5409e906107429088908590899089908990600401611b9a565b602060405180830381600087803b15801561075c57600080fd5b505af1158015610770573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107949190611b5f565b5060fb546107ac906001600160a01b031682856110a6565b604080516001600160a01b038316815260208101869052908101849052606081018690527f9422874f1c81535e7e94eacdb914750e2eb5d5004fe27348ffbdbe0691a8f8fb9060800160405180910390a1506108086001609755565b50505050565b61081661104c565b6105026112fb565b6000811580159061084c57506001600160a01b038316600090815260ff6020526040902061084c9083611338565b9392505050565b61085b6111aa565b610863611204565b3360005b60ff8116831115610a795760fd5433906001600160a01b0316636352211e868660ff861681811061089a5761089a611bcd565b905060200201356040518263ffffffff1660e01b81526004016108bf91815260200190565b60206040518083038186803b1580156108d757600080fd5b505afa1580156108eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090f9190611be3565b6001600160a01b0316146109495760405162461bcd60e51b81526020600482015260016024820152606f60f81b60448201526064016103f4565b61098884848360ff1681811061096157610961611bcd565b6001600160a01b038616600090815260ff6020908152604090912093910201359050611350565b5081610100600086868560ff168181106109a4576109a4611bcd565b6020908102929092013583525081019190915260400160002080546001600160a01b0319166001600160a01b0392831617905560fd54166342842e0e8330878760ff87168181106109f7576109f7611bcd565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b158015610a4e57600080fd5b505af1158015610a62573d6000803e3d6000fd5b505050508080610a7190611c16565b915050610867565b507fc8575ddcf22a1fcb14a74fbfa463ba9e4f5027e86b2cfbae7968779752feb3e1818484604051610aad93929190611c36565b60405180910390a150610ac06001609755565b5050565b610acc61104c565b61010180546001600160a01b0319166001600160a01b0392909216919091179055565b610101546001600160a01b03163314610b425760405162461bcd60e51b815260206004820152601560248201527431b0b63632b91034b9903737ba1036b0b730b3b2b960591b60448201526064016103f4565b60005b81518160ff161015610c0d57610ba4828260ff1681518110610b6957610b69611bcd565b602002602001015160ff6000866001600160a01b03166001600160a01b0316815260200190815260200160002061135090919063ffffffff16565b50826101006000848460ff1681518110610bc057610bc0611bcd565b6020026020010151815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080610c0590611c16565b915050610b45565b507fc8575ddcf22a1fcb14a74fbfa463ba9e4f5027e86b2cfbae7968779752feb3e18282604051610c3f929190611c83565b60405180910390a15050565b610c536111aa565b610c5b611204565b3360005b82518160ff161015610e0b57610c9133848360ff1681518110610c8457610c84611bcd565b602002602001015161081e565b610cc15760405162461bcd60e51b81526020600482015260016024820152606f60f81b60448201526064016103f4565b610d14838260ff1681518110610cd957610cd9611bcd565b602002602001015160ff6000856001600160a01b03166001600160a01b0316815260200190815260200160002061135c90919063ffffffff16565b5060fd5483516001600160a01b03909116906342842e0e9030908590879060ff8716908110610d4557610d45611bcd565b60209081029190910101516040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b158015610d9f57600080fd5b505af1158015610db3573d6000803e3d6000fd5b505050506101006000848360ff1681518110610dd157610dd1611bcd565b602090810291909101810151825281019190915260400160002080546001600160a01b031916905580610e0381611c16565b915050610c5f565b507f82f615f11899ce9d65149066e1ba8d4998afd38f0d912bede595dc6dce847343818360405161069e929190611c83565b610e4561104c565b60fe80546001600160a01b0319166001600160a01b0392909216919091179055565b610e6f61104c565b6001600160a01b038116610ed45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103f4565b6106b1816112a9565b600054610100900460ff1615808015610efd5750600054600160ff909116105b80610f175750303b158015610f17575060005460ff166001145b610f7a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103f4565b6000805460ff191660011790558015610f9d576000805461ff0019166101001790555b610fa5611368565b610fad611397565b610fb56113c6565b60fb80546001600160a01b038088166001600160a01b03199283161790925560fc805487841690831617905560fd805486841690831617905560fe8054928516929091169190911790558015611045576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b60c9546001600160a01b031633146105025760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103f4565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916111029190611ca7565b6000604051808303816000865af19150503d806000811461113f576040519150601f19603f3d011682016040523d82523d6000602084013e611144565b606091505b509150915081801561116e57508051158061116e57508080602001905181019061116e9190611b5f565b6110455760405162461bcd60e51b815260206004820152600d60248201526c10b9b0b332aa3930b739b332b960991b60448201526064016103f4565b600260975414156111fd5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103f4565b6002609755565b60655460ff16156105025760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103f4565b6112526113ed565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6060600061084c83611436565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611303611204565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861127f3390565b6000818152600183016020526040812054151561084c565b600061084c8383611492565b600061084c83836114e1565b600054610100900460ff1661138f5760405162461bcd60e51b81526004016103f490611cc3565b6105026115d4565b600054610100900460ff166113be5760405162461bcd60e51b81526004016103f490611cc3565b610502611607565b600054610100900460ff166105025760405162461bcd60e51b81526004016103f490611cc3565b60655460ff166105025760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016103f4565b60608160000180548060200260200160405190810160405280929190818152602001828054801561148657602002820191906000526020600020905b815481526020019060010190808311611472575b50505050509050919050565b60008181526001830160205260408120546114d957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610528565b506000610528565b600081815260018301602052604081205480156115ca576000611505600183611d0e565b855490915060009061151990600190611d0e565b905081811461157e57600086600001828154811061153957611539611bcd565b906000526020600020015490508087600001848154811061155c5761155c611bcd565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061158f5761158f611d25565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610528565b6000915050610528565b600054610100900460ff166115fb5760405162461bcd60e51b81526004016103f490611cc3565b6065805460ff19169055565b600054610100900460ff1661162e5760405162461bcd60e51b81526004016103f490611cc3565b610502336112a9565b6001600160a01b03811681146106b157600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561168b5761168b61164c565b604052919050565b600082601f8301126116a457600080fd5b813567ffffffffffffffff8111156116be576116be61164c565b6116d1601f8201601f1916602001611662565b8181528460208386010111156116e657600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561171957600080fd5b843561172481611637565b9350602085013561173481611637565b925060408501359150606085013567ffffffffffffffff81111561175757600080fd5b61176387828801611693565b91505092959194509250565b60008060006060848603121561178457600080fd5b833561178f81611637565b9250602084013561179f81611637565b929592945050506040919091013590565b6000806000606084860312156117c557600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156117ea57600080fd5b6117f686828701611693565b9150509250925092565b60006020828403121561181257600080fd5b813561084c81611637565b600081518084526020808501945080840160005b8381101561184d57815187529582019590820190600101611831565b509495945050505050565b60208152600061084c602083018461181d565b60006020828403121561187d57600080fd5b5035919050565b6000806000806080858703121561189a57600080fd5b843593506020850135925060408501359150606085013567ffffffffffffffff81111561175757600080fd5b600080604083850312156118d957600080fd5b82356118e481611637565b946020939093013593505050565b6000806020838503121561190557600080fd5b823567ffffffffffffffff8082111561191d57600080fd5b818501915085601f83011261193157600080fd5b81358181111561194057600080fd5b8660208260051b850101111561195557600080fd5b60209290920196919550909350505050565b600082601f83011261197857600080fd5b8135602067ffffffffffffffff8211156119945761199461164c565b8160051b6119a3828201611662565b92835284810182019282810190878511156119bd57600080fd5b83870192505b848310156119dc578235825291830191908301906119c3565b979650505050505050565b600080604083850312156119fa57600080fd5b8235611a0581611637565b9150602083013567ffffffffffffffff811115611a2157600080fd5b611a2d85828601611967565b9150509250929050565b600060208284031215611a4957600080fd5b813567ffffffffffffffff811115611a6057600080fd5b611a6c84828501611967565b949350505050565b60008060008060808587031215611a8a57600080fd5b8435611a9581611637565b93506020850135611aa581611637565b92506040850135611ab581611637565b91506060850135611ac581611637565b939692955090935050565b60005b83811015611aeb578181015183820152602001611ad3565b838111156108085750506000910152565b60008151808452611b14816020860160208601611ad0565b601f01601f19169290920160200192915050565b84815260018060a01b0384166020820152826040820152608060608201526000611b556080830184611afc565b9695505050505050565b600060208284031215611b7157600080fd5b8151801515811461084c57600080fd5b600060208284031215611b9357600080fd5b5051919050565b85815260018060a01b038516602082015283604082015282606082015260a0608082015260006119dc60a0830184611afc565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611bf557600080fd5b815161084c81611637565b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff811415611c2d57611c2d611c00565b60010192915050565b6001600160a01b0384168152604060208201819052810182905260006001600160fb1b03831115611c6657600080fd5b8260051b8085606085013760009201606001918252509392505050565b6001600160a01b0383168152604060208201819052600090611a6c9083018461181d565b60008251611cb9818460208701611ad0565b9190910192915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600082821015611d2057611d20611c00565b500390565b634e487b7160e01b600052603160045260246000fdfea26469706673582212208a20dbdf1b20a0f2412eafe9ab08ef8981b85d743e5fea6a3250f1cd7ce2c22f64736f6c63430008090033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101735760003560e01c80638456cb59116100de578063d8111a8611610097578063f0f4426011610071578063f0f4426014610350578063f2fde38b14610363578063f8c8765e14610376578063fc0c546a1461038957600080fd5b8063d8111a8614610300578063d9e84eb514610313578063db965a761461032657600080fd5b80638456cb591461029b5780638c980129146102a35780638da5cb5b146102b6578063a9eb5b7c146102c7578063b140e461146102da578063d0ebdbe7146102ed57600080fd5b80635c975abb116101305780635c975abb14610223578063614e4cdb1461023a57806361d027b31461025a5780636215be771461026d578063715018a6146102805780638304cc901461028857600080fd5b8063150b7a0214610178578063274a0fce146101b45780632b7ac3f3146101c95780632bbdb207146101f45780633f4ba83a14610207578063481c6a751461020f575b600080fd5b610196610186366004611703565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020015b60405180910390f35b6101c76101c236600461176f565b61039c565b005b60fc546101dc906001600160a01b031681565b6040516001600160a01b0390911681526020016101ab565b6101c76102023660046117b0565b6103b4565b6101c76104f2565b610101546101dc906001600160a01b031681565b60655460ff165b60405190151581526020016101ab565b61024d610248366004611800565b610504565b6040516101ab9190611858565b60fe546101dc906001600160a01b031681565b6101c761027b36600461186b565b61052e565b6101c76106b4565b6101c7610296366004611884565b6106c6565b6101c761080e565b60fd546101dc906001600160a01b031681565b60c9546001600160a01b03166101dc565b61022a6102d53660046118c6565b61081e565b6101c76102e83660046118f2565b610853565b6101c76102fb366004611800565b610ac4565b6101c761030e3660046119e7565b610aef565b6101c7610321366004611a37565b610c4b565b6101dc61033436600461186b565b610100602052600090815260409020546001600160a01b031681565b6101c761035e366004611800565b610e3d565b6101c7610371366004611800565b610e67565b6101c7610384366004611a74565b610edd565b60fb546101dc906001600160a01b031681565b6103a461104c565b6103af8383836110a6565b505050565b6103bc6111aa565b6103c4611204565b600082116103fd5760405162461bcd60e51b81526020600482015260016024820152606960f81b60448201526064015b60405180910390fd5b60fc54604051630315e4b760e01b815233916001600160a01b031690630315e4b790610433908790859088908890600401611b28565b602060405180830381600087803b15801561044d57600080fd5b505af1158015610461573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104859190611b5f565b5060fb5461049d906001600160a01b031682856110a6565b604080516001600160a01b0383168152602081018590529081018590527f33b33dda89b868825f1a3cee51ed39421a81c4460d64f037df10bcf9f199c1dd9060600160405180910390a1506103af6001609755565b6104fa61104c565b61050261124a565b565b6001600160a01b038116600090815260ff602052604090206060906105289061129c565b92915050565b6105366111aa565b61053e611204565b3381158015906105c9575060fb546040516370a0823160e01b81526001600160a01b038381166004830152849216906370a082319060240160206040518083038186803b15801561058e57600080fd5b505afa1580156105a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c69190611b81565b10155b6105d257600080fd5b60fb5460fe546040516323b872dd60e01b81526001600160a01b0384811660048301529182166024820152604481018590529116906323b872dd90606401602060405180830381600087803b15801561062a57600080fd5b505af115801561063e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106629190611b5f565b50604080516001600160a01b0383168152602081018490527fbc7c8a4d8049a3f99a02f2a20640c206a2e4d3f2fa54fd20da9f01fda3620cda91015b60405180910390a1506106b16001609755565b50565b6106bc61104c565b61050260006112a9565b6106ce6111aa565b6106d6611204565b6000821161070a5760405162461bcd60e51b81526020600482015260016024820152606960f81b60448201526064016103f4565b60fc5460405163647aa04f60e11b815233916001600160a01b03169063c8f5409e906107429088908590899089908990600401611b9a565b602060405180830381600087803b15801561075c57600080fd5b505af1158015610770573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107949190611b5f565b5060fb546107ac906001600160a01b031682856110a6565b604080516001600160a01b038316815260208101869052908101849052606081018690527f9422874f1c81535e7e94eacdb914750e2eb5d5004fe27348ffbdbe0691a8f8fb9060800160405180910390a1506108086001609755565b50505050565b61081661104c565b6105026112fb565b6000811580159061084c57506001600160a01b038316600090815260ff6020526040902061084c9083611338565b9392505050565b61085b6111aa565b610863611204565b3360005b60ff8116831115610a795760fd5433906001600160a01b0316636352211e868660ff861681811061089a5761089a611bcd565b905060200201356040518263ffffffff1660e01b81526004016108bf91815260200190565b60206040518083038186803b1580156108d757600080fd5b505afa1580156108eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090f9190611be3565b6001600160a01b0316146109495760405162461bcd60e51b81526020600482015260016024820152606f60f81b60448201526064016103f4565b61098884848360ff1681811061096157610961611bcd565b6001600160a01b038616600090815260ff6020908152604090912093910201359050611350565b5081610100600086868560ff168181106109a4576109a4611bcd565b6020908102929092013583525081019190915260400160002080546001600160a01b0319166001600160a01b0392831617905560fd54166342842e0e8330878760ff87168181106109f7576109f7611bcd565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b158015610a4e57600080fd5b505af1158015610a62573d6000803e3d6000fd5b505050508080610a7190611c16565b915050610867565b507fc8575ddcf22a1fcb14a74fbfa463ba9e4f5027e86b2cfbae7968779752feb3e1818484604051610aad93929190611c36565b60405180910390a150610ac06001609755565b5050565b610acc61104c565b61010180546001600160a01b0319166001600160a01b0392909216919091179055565b610101546001600160a01b03163314610b425760405162461bcd60e51b815260206004820152601560248201527431b0b63632b91034b9903737ba1036b0b730b3b2b960591b60448201526064016103f4565b60005b81518160ff161015610c0d57610ba4828260ff1681518110610b6957610b69611bcd565b602002602001015160ff6000866001600160a01b03166001600160a01b0316815260200190815260200160002061135090919063ffffffff16565b50826101006000848460ff1681518110610bc057610bc0611bcd565b6020026020010151815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080610c0590611c16565b915050610b45565b507fc8575ddcf22a1fcb14a74fbfa463ba9e4f5027e86b2cfbae7968779752feb3e18282604051610c3f929190611c83565b60405180910390a15050565b610c536111aa565b610c5b611204565b3360005b82518160ff161015610e0b57610c9133848360ff1681518110610c8457610c84611bcd565b602002602001015161081e565b610cc15760405162461bcd60e51b81526020600482015260016024820152606f60f81b60448201526064016103f4565b610d14838260ff1681518110610cd957610cd9611bcd565b602002602001015160ff6000856001600160a01b03166001600160a01b0316815260200190815260200160002061135c90919063ffffffff16565b5060fd5483516001600160a01b03909116906342842e0e9030908590879060ff8716908110610d4557610d45611bcd565b60209081029190910101516040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b158015610d9f57600080fd5b505af1158015610db3573d6000803e3d6000fd5b505050506101006000848360ff1681518110610dd157610dd1611bcd565b602090810291909101810151825281019190915260400160002080546001600160a01b031916905580610e0381611c16565b915050610c5f565b507f82f615f11899ce9d65149066e1ba8d4998afd38f0d912bede595dc6dce847343818360405161069e929190611c83565b610e4561104c565b60fe80546001600160a01b0319166001600160a01b0392909216919091179055565b610e6f61104c565b6001600160a01b038116610ed45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103f4565b6106b1816112a9565b600054610100900460ff1615808015610efd5750600054600160ff909116105b80610f175750303b158015610f17575060005460ff166001145b610f7a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103f4565b6000805460ff191660011790558015610f9d576000805461ff0019166101001790555b610fa5611368565b610fad611397565b610fb56113c6565b60fb80546001600160a01b038088166001600160a01b03199283161790925560fc805487841690831617905560fd805486841690831617905560fe8054928516929091169190911790558015611045576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b60c9546001600160a01b031633146105025760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103f4565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916111029190611ca7565b6000604051808303816000865af19150503d806000811461113f576040519150601f19603f3d011682016040523d82523d6000602084013e611144565b606091505b509150915081801561116e57508051158061116e57508080602001905181019061116e9190611b5f565b6110455760405162461bcd60e51b815260206004820152600d60248201526c10b9b0b332aa3930b739b332b960991b60448201526064016103f4565b600260975414156111fd5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103f4565b6002609755565b60655460ff16156105025760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103f4565b6112526113ed565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6060600061084c83611436565b60c980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611303611204565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861127f3390565b6000818152600183016020526040812054151561084c565b600061084c8383611492565b600061084c83836114e1565b600054610100900460ff1661138f5760405162461bcd60e51b81526004016103f490611cc3565b6105026115d4565b600054610100900460ff166113be5760405162461bcd60e51b81526004016103f490611cc3565b610502611607565b600054610100900460ff166105025760405162461bcd60e51b81526004016103f490611cc3565b60655460ff166105025760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016103f4565b60608160000180548060200260200160405190810160405280929190818152602001828054801561148657602002820191906000526020600020905b815481526020019060010190808311611472575b50505050509050919050565b60008181526001830160205260408120546114d957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610528565b506000610528565b600081815260018301602052604081205480156115ca576000611505600183611d0e565b855490915060009061151990600190611d0e565b905081811461157e57600086600001828154811061153957611539611bcd565b906000526020600020015490508087600001848154811061155c5761155c611bcd565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061158f5761158f611d25565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610528565b6000915050610528565b600054610100900460ff166115fb5760405162461bcd60e51b81526004016103f490611cc3565b6065805460ff19169055565b600054610100900460ff1661162e5760405162461bcd60e51b81526004016103f490611cc3565b610502336112a9565b6001600160a01b03811681146106b157600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561168b5761168b61164c565b604052919050565b600082601f8301126116a457600080fd5b813567ffffffffffffffff8111156116be576116be61164c565b6116d1601f8201601f1916602001611662565b8181528460208386010111156116e657600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561171957600080fd5b843561172481611637565b9350602085013561173481611637565b925060408501359150606085013567ffffffffffffffff81111561175757600080fd5b61176387828801611693565b91505092959194509250565b60008060006060848603121561178457600080fd5b833561178f81611637565b9250602084013561179f81611637565b929592945050506040919091013590565b6000806000606084860312156117c557600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156117ea57600080fd5b6117f686828701611693565b9150509250925092565b60006020828403121561181257600080fd5b813561084c81611637565b600081518084526020808501945080840160005b8381101561184d57815187529582019590820190600101611831565b509495945050505050565b60208152600061084c602083018461181d565b60006020828403121561187d57600080fd5b5035919050565b6000806000806080858703121561189a57600080fd5b843593506020850135925060408501359150606085013567ffffffffffffffff81111561175757600080fd5b600080604083850312156118d957600080fd5b82356118e481611637565b946020939093013593505050565b6000806020838503121561190557600080fd5b823567ffffffffffffffff8082111561191d57600080fd5b818501915085601f83011261193157600080fd5b81358181111561194057600080fd5b8660208260051b850101111561195557600080fd5b60209290920196919550909350505050565b600082601f83011261197857600080fd5b8135602067ffffffffffffffff8211156119945761199461164c565b8160051b6119a3828201611662565b92835284810182019282810190878511156119bd57600080fd5b83870192505b848310156119dc578235825291830191908301906119c3565b979650505050505050565b600080604083850312156119fa57600080fd5b8235611a0581611637565b9150602083013567ffffffffffffffff811115611a2157600080fd5b611a2d85828601611967565b9150509250929050565b600060208284031215611a4957600080fd5b813567ffffffffffffffff811115611a6057600080fd5b611a6c84828501611967565b949350505050565b60008060008060808587031215611a8a57600080fd5b8435611a9581611637565b93506020850135611aa581611637565b92506040850135611ab581611637565b91506060850135611ac581611637565b939692955090935050565b60005b83811015611aeb578181015183820152602001611ad3565b838111156108085750506000910152565b60008151808452611b14816020860160208601611ad0565b601f01601f19169290920160200192915050565b84815260018060a01b0384166020820152826040820152608060608201526000611b556080830184611afc565b9695505050505050565b600060208284031215611b7157600080fd5b8151801515811461084c57600080fd5b600060208284031215611b9357600080fd5b5051919050565b85815260018060a01b038516602082015283604082015282606082015260a0608082015260006119dc60a0830184611afc565b634e487b7160e01b600052603260045260246000fd5b600060208284031215611bf557600080fd5b815161084c81611637565b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff811415611c2d57611c2d611c00565b60010192915050565b6001600160a01b0384168152604060208201819052810182905260006001600160fb1b03831115611c6657600080fd5b8260051b8085606085013760009201606001918252509392505050565b6001600160a01b0383168152604060208201819052600090611a6c9083018461181d565b60008251611cb9818460208701611ad0565b9190910192915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600082821015611d2057611d20611c00565b500390565b634e487b7160e01b600052603160045260246000fdfea26469706673582212208a20dbdf1b20a0f2412eafe9ab08ef8981b85d743e5fea6a3250f1cd7ce2c22f64736f6c63430008090033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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