ETH Price: $2,897.02 (-1.32%)

Contract

0x1Efdc65256aaF88B34016b3614c33d43A9b86825

Overview

ETH Balance

Linea Mainnet LogoLinea Mainnet LogoLinea Mainnet Logo0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

> 10 Internal Transactions found.

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
272216952025-12-30 8:16:1226 days ago1767082572
0x1Efdc652...3A9b86825
0 ETH
270417682025-12-24 19:28:1632 days ago1766604496
0x1Efdc652...3A9b86825
0 ETH
265631042025-12-11 10:39:1045 days ago1765449550
0x1Efdc652...3A9b86825
0 ETH
260677562025-11-27 3:28:4260 days ago1764214122
0x1Efdc652...3A9b86825
0 ETH
260677562025-11-27 3:28:4260 days ago1764214122
0x1Efdc652...3A9b86825
0 ETH
252274042025-11-03 11:11:1883 days ago1762168278
0x1Efdc652...3A9b86825
0 ETH
250225672025-10-29 4:05:3889 days ago1761710738
0x1Efdc652...3A9b86825
0 ETH
248169462025-10-23 3:05:1195 days ago1761188711
0x1Efdc652...3A9b86825
0 ETH
247962662025-10-22 12:51:4795 days ago1761137507
0x1Efdc652...3A9b86825
0 ETH
247116862025-10-19 19:35:5598 days ago1760902555
0x1Efdc652...3A9b86825
0 ETH
246349302025-10-17 13:33:11100 days ago1760707991
0x1Efdc652...3A9b86825
0 ETH
240062002025-10-01 3:11:03117 days ago1759288263
0x1Efdc652...3A9b86825
0 ETH
238523122025-09-27 4:39:42121 days ago1758947982
0x1Efdc652...3A9b86825
0 ETH
233616172025-09-15 13:14:34132 days ago1757942074
0x1Efdc652...3A9b86825
0 ETH
231568412025-09-10 13:05:22137 days ago1757509522
0x1Efdc652...3A9b86825
0 ETH
231436862025-09-10 4:27:37138 days ago1757478457
0x1Efdc652...3A9b86825
0 ETH
231171472025-09-09 13:10:33138 days ago1757423433
0x1Efdc652...3A9b86825
0 ETH
227123992025-08-30 19:08:09148 days ago1756580889
0x1Efdc652...3A9b86825
0 ETH
225577482025-08-27 2:21:07152 days ago1756261267
0x1Efdc652...3A9b86825
0 ETH
225577482025-08-27 2:21:07152 days ago1756261267
0x1Efdc652...3A9b86825
0 ETH
225577182025-08-27 2:20:07152 days ago1756261207
0x1Efdc652...3A9b86825
0 ETH
221600842025-08-17 14:54:50161 days ago1755442490
0x1Efdc652...3A9b86825
0 ETH
220630142025-08-15 8:00:55163 days ago1755244855
0x1Efdc652...3A9b86825
0 ETH
218181642025-08-09 13:20:23169 days ago1754745623
0x1Efdc652...3A9b86825
0 ETH
218148122025-08-09 11:27:05169 days ago1754738825
0x1Efdc652...3A9b86825
0 ETH
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BattlemonPickaxe

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

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

import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "./interfaces/IBattlemonGem.sol";
import "./interfaces/IBattlemonStickers.sol";
import "./interfaces/IBattlemonPickaxe.sol";
import "./lz/oapp/OApp.sol";

contract BattlemonPickaxe is ERC721Upgradeable, OApp, IBattlemonPickaxe {
    using StringsUpgradeable for uint8;

    event CrosschainTransfer(
        address sender,
        uint tokenId,
        Rank rank,
        uint8 sharpness
    );

    uint private _nextTokenId;

    enum Rank {
        Cheap,
        Good,
        Great
    }
    uint256 public _cheapSharpPrice;
    uint256 public _goodSharpPrice;
    uint256 public _greatSharpPrice;
    address public _treasuryAddress;
    address public _gemAddress;
    address public _stickersAddress;
    address public _box;

    // Must end with "/"
    string private _uri;

    uint8[] public _chances;
    uint private _randNonce;

    mapping(uint256 => Rank) public _ranks;
    mapping(uint256 => uint8) public _sharpness;
    mapping(Rank => uint) public _supply;

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

    function initialize(
        uint256[] calldata sharpPrices,
        address treasuryAddress_,
        string calldata uri_,
        address _endpoint,
        uint startTokenId
    ) public initializer {
        __ERC721_init("Battlemon Pickaxes", "BLP");
        __OApp_init(_endpoint, msg.sender);
        __Ownable_init();
        require(sharpPrices.length == 3, "Pickaxe: Wrong length");
        _cheapSharpPrice = sharpPrices[0];
        _goodSharpPrice = sharpPrices[1];
        _greatSharpPrice = sharpPrices[2];

        _treasuryAddress = treasuryAddress_;

        _chances = [100, 40, 20];
        _uri = uri_;
        _nextTokenId = startTokenId;
    }

    function boxMint(address to, uint _type) external {
        require(msg.sender == _box, "Pickaxe: Caller not the Box");
        _innerMint(to, Rank(_type));
    }

    function sharp(uint256 tokenId) public payable {
        _requireMinted(tokenId);
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "ERC721: caller is not token owner or approved"
        );
        require(
            _sharpPrice(_ranks[tokenId]) <= msg.value,
            "Pickaxe: Insufficient funds"
        );
        (bool feeSent, ) = _treasuryAddress.call{value: msg.value}("");
        require(feeSent, "Fee not sent");
        _sharpness[tokenId] = 100;
    }

    function chipOff(uint256 tokenId) public {
        _requireMinted(tokenId);
        require(
            _isApprovedOrOwner(_msgSender(), tokenId),
            "ERC721: caller is not token owner or approved"
        );
        require(_sharpness[tokenId] >= 5, "Pickaxe: sharpness is too low");
        _sharpness[tokenId] -= 5;
        uint8 rank = uint8(_ranks[tokenId]) + 1; // 1-3
        while (rank > 0) {
            rank--; // 0-2
            uint256 random = _random(); // 0-99
            if (
                random < (uint256(_chances[rank]) * _sharpness[tokenId]) / 100
            ) {
                IBattlemonGem(_gemAddress).mint(msg.sender, rank + 1); // 1-3
                break;
            }
        }
    }

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

        return
            string(
                abi.encodePacked(_baseURI(), uint8(rankOf(tokenId)).toString())
            );
    }

    function rankOf(uint256 tokenId) public view returns (Rank) {
        _requireMinted(tokenId);

        return _ranks[tokenId];
    }

    function sharpnessOf(uint256 tokenId) public view returns (uint8) {
        _requireMinted(tokenId);

        return _sharpness[tokenId];
    }

    function supplyOf(Rank rank) public view returns (uint) {
        return _supply[rank];
    }

    function _innerMint(address to, Rank rank) internal {
        uint256 tokenId = _nextTokenId++;
        _safeMint(to, tokenId);
        _ranks[tokenId] = rank;
        _sharpness[tokenId] = 100;
        _supply[rank] += 1;
    }

    function _baseURI() internal view override returns (string memory) {
        return _uri;
    }

    function _sharpPrice(Rank rank) internal view returns (uint256) {
        if (rank == Rank.Cheap) {
            return _cheapSharpPrice;
        } else if (rank == Rank.Good) {
            return _goodSharpPrice;
        } else {
            return _greatSharpPrice;
        }
    }

    function _random() internal returns (uint) {
        _randNonce++;
        return
            uint(
                keccak256(
                    abi.encodePacked(block.timestamp, msg.sender, _randNonce)
                )
            ) % 100;
    }

    function setAddresses(
        address stickersAddress_,
        address box_,
        address gems_
    ) public onlyOwner {
        require(
            stickersAddress_ != address(0) &&
                box_ != address(0) &&
                gems_ != address(0),
            "Pickaxe: Zero address"
        );
        _stickersAddress = stickersAddress_;
        _box = box_;
        _gemAddress = gems_;
    }

    function setBaseURI(string memory newURI) public onlyOwner {
        _uri = newURI;
    }

    function quote(
        uint32 _dstEid,
        string memory _message,
        bytes memory _options,
        bool _payInLzToken
    ) public view returns (MessagingFee memory fee) {
        bytes memory message = abi.encode(_message);
        fee = _quote(_dstEid, message, _options, _payInLzToken);
    }

    function lzSend(
        uint32 dstEid,
        uint256 tokenId,
        bytes calldata _options
    ) public payable returns (MessagingReceipt memory) {
        require(ownerOf(tokenId) == msg.sender, "Pickaxe: Not sender");
        _burn(tokenId);
        MessagingReceipt memory receipt;

        bytes memory _payload = abi.encode(
            msg.sender,
            tokenId,
            _ranks[tokenId],
            _sharpness[tokenId]
        );
        receipt = _lzSend(
            dstEid,
            _payload,
            _options,
            MessagingFee(msg.value, 0),
            payable(msg.sender)
        );

        return receipt;
    }

    // struct Origin {
    //     uint32 srcEid;
    //     bytes32 sender;
    //     uint64 nonce;
    // }
    function _lzReceive(
        Origin calldata,
        bytes32,
        bytes calldata _message,
        address,
        bytes calldata
    ) internal virtual override {
        (address sender, uint256 tokenId, Rank rank, uint8 sharpness) = abi
            .decode(_message, (address, uint256, Rank, uint8));
        _safeMint(sender, tokenId);
        _ranks[tokenId] = rank;
        _sharpness[tokenId] = sharpness;

        emit CrosschainTransfer(sender, tokenId, rank, sharpness);
    }

    function airdrop(
        address[] calldata to,
        Rank[] calldata _type
    ) public onlyOwner {
        require(to.length == _type.length, "Airdrop: wDifferent length");
        for (uint i = 0; i < to.length; i++) {
            _innerMint(to[i], _type[i]);
        }
    }
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

import { IMessageLibManager } from "./IMessageLibManager.sol";
import { IMessagingComposer } from "./IMessagingComposer.sol";
import { IMessagingChannel } from "./IMessagingChannel.sol";
import { IMessagingContext } from "./IMessagingContext.sol";

struct MessagingParams {
    uint32 dstEid;
    bytes32 receiver;
    bytes message;
    bytes options;
    bool payInLzToken;
}

struct MessagingReceipt {
    bytes32 guid;
    uint64 nonce;
    MessagingFee fee;
}

struct MessagingFee {
    uint256 nativeFee;
    uint256 lzTokenFee;
}

struct Origin {
    uint32 srcEid;
    bytes32 sender;
    uint64 nonce;
}

interface ILayerZeroEndpointV2 is IMessageLibManager, IMessagingComposer, IMessagingChannel, IMessagingContext {
    event PacketSent(bytes encodedPayload, bytes options, address sendLibrary);

    event PacketVerified(Origin origin, address receiver, bytes32 payloadHash);

    event PacketDelivered(Origin origin, address receiver);

    event LzReceiveAlert(
        address indexed receiver,
        address indexed executor,
        Origin origin,
        bytes32 guid,
        uint256 gas,
        uint256 value,
        bytes message,
        bytes extraData,
        bytes reason
    );

    event LzTokenSet(address token);

    event DelegateSet(address sender, address delegate);

    function quote(MessagingParams calldata _params, address _sender) external view returns (MessagingFee memory);

    function send(
        MessagingParams calldata _params,
        address _refundAddress
    ) external payable returns (MessagingReceipt memory);

    function verify(Origin calldata _origin, address _receiver, bytes32 _payloadHash) external;

    function verifiable(Origin calldata _origin, address _receiver) external view returns (bool);

    function initializable(Origin calldata _origin, address _receiver) external view returns (bool);

    function lzReceive(
        Origin calldata _origin,
        address _receiver,
        bytes32 _guid,
        bytes calldata _message,
        bytes calldata _extraData
    ) external payable;

    // oapp can burn messages partially by calling this function with its own business logic if messages are verified in order
    function clear(address _oapp, Origin calldata _origin, bytes32 _guid, bytes calldata _message) external;

    function setLzToken(address _lzToken) external;

    function lzToken() external view returns (address);

    function nativeToken() external view returns (address);

    function setDelegate(address _delegate) external;
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

import { Origin } from "./ILayerZeroEndpointV2.sol";

interface ILayerZeroReceiver {
    function allowInitializePath(Origin calldata _origin) external view returns (bool);

    function nextNonce(uint32 _eid, bytes32 _sender) external view returns (uint64);

    function lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) external payable;
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

struct SetConfigParam {
    uint32 eid;
    uint32 configType;
    bytes config;
}

interface IMessageLibManager {
    struct Timeout {
        address lib;
        uint256 expiry;
    }

    event LibraryRegistered(address newLib);
    event DefaultSendLibrarySet(uint32 eid, address newLib);
    event DefaultReceiveLibrarySet(uint32 eid, address newLib);
    event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry);
    event SendLibrarySet(address sender, uint32 eid, address newLib);
    event ReceiveLibrarySet(address receiver, uint32 eid, address newLib);
    event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout);

    function registerLibrary(address _lib) external;

    function isRegisteredLibrary(address _lib) external view returns (bool);

    function getRegisteredLibraries() external view returns (address[] memory);

    function setDefaultSendLibrary(uint32 _eid, address _newLib) external;

    function defaultSendLibrary(uint32 _eid) external view returns (address);

    function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _timeout) external;

    function defaultReceiveLibrary(uint32 _eid) external view returns (address);

    function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external;

    function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry);

    function isSupportedEid(uint32 _eid) external view returns (bool);

    function isValidReceiveLibrary(address _receiver, uint32 _eid, address _lib) external view returns (bool);

    /// ------------------- OApp interfaces -------------------
    function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external;

    function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib);

    function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool);

    function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external;

    function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault);

    function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _gracePeriod) external;

    function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry);

    function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external;

    function getConfig(
        address _oapp,
        address _lib,
        uint32 _eid,
        uint32 _configType
    ) external view returns (bytes memory config);
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingChannel {
    event InboundNonceSkipped(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce);
    event PacketNilified(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);
    event PacketBurnt(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);

    function eid() external view returns (uint32);

    // this is an emergency function if a message cannot be verified for some reasons
    // required to provide _nextNonce to avoid race condition
    function skip(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce) external;

    function nilify(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;

    function burn(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;

    function nextGuid(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (bytes32);

    function inboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);

    function outboundNonce(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (uint64);

    function inboundPayloadHash(
        address _receiver,
        uint32 _srcEid,
        bytes32 _sender,
        uint64 _nonce
    ) external view returns (bytes32);

    function lazyInboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingComposer {
    event ComposeSent(address from, address to, bytes32 guid, uint16 index, bytes message);
    event ComposeDelivered(address from, address to, bytes32 guid, uint16 index);
    event LzComposeAlert(
        address indexed from,
        address indexed to,
        address indexed executor,
        bytes32 guid,
        uint16 index,
        uint256 gas,
        uint256 value,
        bytes message,
        bytes extraData,
        bytes reason
    );

    function composeQueue(
        address _from,
        address _to,
        bytes32 _guid,
        uint16 _index
    ) external view returns (bytes32 messageHash);

    function sendCompose(address _to, bytes32 _guid, uint16 _index, bytes calldata _message) external;

    function lzCompose(
        address _from,
        address _to,
        bytes32 _guid,
        uint16 _index,
        bytes calldata _message,
        bytes calldata _extraData
    ) external payable;
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingContext {
    function isSendingMessage() external view returns (bool);

    function getSendContext() external view returns (uint32 dstEid, address sender);
}

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

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * 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;
}

// 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 10 of 33 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

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

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

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

        _owners[tokenId] = to;

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

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

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

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

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

        // Clear approvals
        delete _tokenApprovals[tokenId];

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

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

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

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

        _beforeTokenTransfer(from, to, tokenId, 1);

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

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

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

        emit Transfer(from, to, tokenId);

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

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

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

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

File 12 of 33 : 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);
}

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

interface IBattlemonGem {
    function mint(address to, uint8 level) external;

    function levelOf(uint256 tokenId) external view returns (uint8);

    function burn(uint gemId) external;

    function checkOwnerOf(
        uint gemId,
        address sender
    ) external view returns (bool);
}

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

interface IBattlemonPickaxe {
    function boxMint(address to, uint _type) external;
}

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

interface IBattlemonStickers {
    function mint(address to, uint amount) external returns (bool);
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import {ILayerZeroEndpointV2} from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol";

/**
 * @title IOAppCore
 */
interface IOAppCore {
    // Custom error messages
    error OnlyPeer(uint32 eid, bytes32 sender);
    error NoPeer(uint32 eid);
    error InvalidEndpointCall();
    error InvalidDelegate();

    // Event emitted when a peer (OApp) is set for a corresponding endpoint
    event PeerSet(uint32 eid, bytes32 peer);

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     */
    function oAppVersion()
        external
        view
        returns (uint64 senderVersion, uint64 receiverVersion);

    /**
     * @notice Retrieves the LayerZero endpoint associated with the OApp.
     * @return iEndpoint The LayerZero endpoint as an interface.
     */
    function endpoint() external view returns (ILayerZeroEndpointV2 iEndpoint);

    /**
     * @notice Retrieves the peer (OApp) associated with a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @return peer The peer address (OApp instance) associated with the corresponding endpoint.
     */
    function peers(uint32 _eid) external view returns (bytes32 peer);

    /**
     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @param _peer The address of the peer to be associated with the corresponding endpoint.
     */
    function setPeer(uint32 _eid, bytes32 _peer) external;

    /**
     * @notice Sets the delegate address for the OApp Core.
     * @param _delegate The address of the delegate to be set.
     */
    function setDelegate(address _delegate) external;
}

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

import {ILayerZeroReceiver, Origin} from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol";

interface IOAppReceiver is ILayerZeroReceiver {
    /**
     * @notice Retrieves the address responsible for 'sending' composeMsg's to the Endpoint.
     * @return sender The address responsible for 'sending' composeMsg's to the Endpoint.
     *
     * @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer.
     * @dev The default sender IS the OApp implementer.
     */
    function composeMsgSender() external view returns (address sender);
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

// @dev Import the 'MessagingFee' and 'MessagingReceipt' so it's exposed to OApp implementers
// solhint-disable-next-line no-unused-import
import {OAppSender, MessagingFee, MessagingReceipt} from "./OAppSender.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
// @dev Import the 'Origin' so it's exposed to OApp implementers
// solhint-disable-next-line no-unused-import
import {OAppReceiver, Origin} from "./OAppReceiver.sol";
import {OAppCore} from "./OAppCore.sol";

/**
 * @title OApp
 * @dev Abstract contract serving as the base for OApp implementation, combining OAppSender and OAppReceiver functionality.
 */
abstract contract OApp is Initializable, OAppSender, OAppReceiver {
    /**
     * @dev Constructor to initialize the OApp with the provided endpoint and owner.
     * @param _endpoint The address of the LOCAL LayerZero endpoint.
     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.
     */
    // constructor(address _endpoint, address _delegate) OAppCore(_endpoint, _delegate) {}
    function __OApp_init(
        address _endpoint,
        address _delegate
    ) internal onlyInitializing {
        __OAppCore_init(_endpoint, _delegate);
    }
    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol implementation.
     * @return receiverVersion The version of the OAppReceiver.sol implementation.
     */
    function oAppVersion()
        public
        pure
        virtual
        override(OAppSender, OAppReceiver)
        returns (uint64 senderVersion, uint64 receiverVersion)
    {
        return (SENDER_VERSION, RECEIVER_VERSION);
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {IOAppCore, ILayerZeroEndpointV2} from "./interfaces/IOAppCore.sol";

/**
 * @title OAppCore
 * @dev Abstract contract implementing the IOAppCore interface with basic OApp configurations.
 */
abstract contract OAppCore is IOAppCore, OwnableUpgradeable {
    // The LayerZero endpoint associated with the given OApp
    ILayerZeroEndpointV2 public endpoint;

    // Mapping to store peers associated with corresponding endpoints
    mapping(uint32 eid => bytes32 peer) public peers;

    /**
     * @dev Constructor to initialize the OAppCore with the provided endpoint and delegate.
     * @param _endpoint The address of the LOCAL Layer Zero endpoint.
     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.
     *
     * @dev The delegate typically should be set as the owner of the contract.
     */
    function __OAppCore_init(address _endpoint, address _delegate) internal {
        endpoint = ILayerZeroEndpointV2(_endpoint);

        if (_delegate == address(0)) revert InvalidDelegate();
        endpoint.setDelegate(_delegate);
    }

    /**
     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @param _peer The address of the peer to be associated with the corresponding endpoint.
     *
     * @dev Only the owner/admin of the OApp can call this function.
     * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.
     * @dev Set this to bytes32(0) to remove the peer address.
     * @dev Peer is a bytes32 to accommodate non-evm chains.
     */
    function setPeer(uint32 _eid, bytes32 _peer) public virtual onlyOwner {
        peers[_eid] = _peer;
        emit PeerSet(_eid, _peer);
    }

    /**
     * @notice Internal function to get the peer address associated with a specific endpoint; reverts if NOT set.
     * ie. the peer is set to bytes32(0).
     * @param _eid The endpoint ID.
     * @return peer The address of the peer associated with the specified endpoint.
     */
    function _getPeerOrRevert(
        uint32 _eid
    ) internal view virtual returns (bytes32) {
        bytes32 peer = peers[_eid];
        if (peer == bytes32(0)) revert NoPeer(_eid);
        return peer;
    }

    /**
     * @notice Sets the delegate address for the OApp.
     * @param _delegate The address of the delegate to be set.
     *
     * @dev Only the owner/admin of the OApp can call this function.
     * @dev Provides the ability for a delegate to set configs, on behalf of the OApp, directly on the Endpoint contract.
     */
    function setDelegate(address _delegate) public onlyOwner {
        endpoint.setDelegate(_delegate);
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import {IOAppReceiver, Origin} from "./interfaces/IOAppReceiver.sol";
import {OAppCore} from "./OAppCore.sol";

/**
 * @title OAppReceiver
 * @dev Abstract contract implementing the ILayerZeroReceiver interface and extending OAppCore for OApp receivers.
 */
abstract contract OAppReceiver is IOAppReceiver, OAppCore {
    // Custom error message for when the caller is not the registered endpoint/
    error OnlyEndpoint(address addr);

    // @dev The version of the OAppReceiver implementation.
    // @dev Version is bumped when changes are made to this contract.
    uint64 internal constant RECEIVER_VERSION = 1;

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     *
     * @dev Providing 0 as the default for OAppSender version. Indicates that the OAppSender is not implemented.
     * ie. this is a RECEIVE only OApp.
     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions.
     */
    function oAppVersion()
        public
        view
        virtual
        returns (uint64 senderVersion, uint64 receiverVersion)
    {
        return (0, RECEIVER_VERSION);
    }

    /**
     * @notice Retrieves the address responsible for 'sending' composeMsg's to the Endpoint.
     * @return sender The address responsible for 'sending' composeMsg's to the Endpoint.
     *
     * @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer.
     * @dev The default sender IS the OApp implementer.
     */
    function composeMsgSender() public view virtual returns (address sender) {
        return address(this);
    }

    /**
     * @notice Checks if the path initialization is allowed based on the provided origin.
     * @param origin The origin information containing the source endpoint and sender address.
     * @return Whether the path has been initialized.
     *
     * @dev This indicates to the endpoint that the OApp has enabled msgs for this particular path to be received.
     * @dev This defaults to assuming if a peer has been set, its initialized.
     * Can be overridden by the OApp if there is other logic to determine this.
     */
    function allowInitializePath(
        Origin calldata origin
    ) public view virtual returns (bool) {
        return peers[origin.srcEid] == origin.sender;
    }

    /**
     * @notice Retrieves the next nonce for a given source endpoint and sender address.
     * @dev _srcEid The source endpoint ID.
     * @dev _sender The sender address.
     * @return nonce The next nonce.
     *
     * @dev The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement.
     * @dev Is required by the off-chain executor to determine the OApp expects msg execution is ordered.
     * @dev This is also enforced by the OApp.
     * @dev By default this is NOT enabled. ie. nextNonce is hardcoded to return 0.
     */
    function nextNonce(
        uint32 /*_srcEid*/,
        bytes32 /*_sender*/
    ) public view virtual returns (uint64 nonce) {
        return 0;
    }

    /**
     * @dev Entry point for receiving messages or packets from the endpoint.
     * @param _origin The origin information containing the source endpoint and sender address.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address on the src chain.
     *  - nonce: The nonce of the message.
     * @param _guid The unique identifier for the received LayerZero message.
     * @param _message The payload of the received message.
     * @param _executor The address of the executor for the received message.
     * @param _extraData Additional arbitrary data provided by the corresponding executor.
     *
     * @dev Entry point for receiving msg/packet from the LayerZero endpoint.
     */
    function lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) public payable virtual {
        // Ensures that only the endpoint can attempt to lzReceive() messages to this OApp.
        if (address(endpoint) != msg.sender) revert OnlyEndpoint(msg.sender);

        // Ensure that the sender matches the expected peer for the source endpoint.
        if (_getPeerOrRevert(_origin.srcEid) != _origin.sender)
            revert OnlyPeer(_origin.srcEid, _origin.sender);

        // Call the internal OApp implementation of lzReceive.
        _lzReceive(_origin, _guid, _message, _executor, _extraData);
    }

    /**
     * @dev Internal function to implement lzReceive logic without needing to copy the basic parameter validation.
     */
    function _lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) internal virtual;
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {MessagingParams, MessagingFee, MessagingReceipt} from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol";
import {OAppCore} from "./OAppCore.sol";

/**
 * @title OAppSender
 * @dev Abstract contract implementing the OAppSender functionality for sending messages to a LayerZero endpoint.
 */
abstract contract OAppSender is OAppCore {
    using SafeERC20 for IERC20;

    // Custom error messages
    error NotEnoughNative(uint256 msgValue);
    error LzTokenUnavailable();

    // @dev The version of the OAppSender implementation.
    // @dev Version is bumped when changes are made to this contract.
    uint64 internal constant SENDER_VERSION = 1;

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     *
     * @dev Providing 0 as the default for OAppReceiver version. Indicates that the OAppReceiver is not implemented.
     * ie. this is a SEND only OApp.
     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions
     */
    function oAppVersion()
        public
        view
        virtual
        returns (uint64 senderVersion, uint64 receiverVersion)
    {
        return (SENDER_VERSION, 0);
    }

    /**
     * @dev Internal function to interact with the LayerZero EndpointV2.quote() for fee calculation.
     * @param _dstEid The destination endpoint ID.
     * @param _message The message payload.
     * @param _options Additional options for the message.
     * @param _payInLzToken Flag indicating whether to pay the fee in LZ tokens.
     * @return fee The calculated MessagingFee for the message.
     *      - nativeFee: The native fee for the message.
     *      - lzTokenFee: The LZ token fee for the message.
     */
    function _quote(
        uint32 _dstEid,
        bytes memory _message,
        bytes memory _options,
        bool _payInLzToken
    ) internal view virtual returns (MessagingFee memory fee) {
        return
            endpoint.quote(
                MessagingParams(
                    _dstEid,
                    _getPeerOrRevert(_dstEid),
                    _message,
                    _options,
                    _payInLzToken
                ),
                address(this)
            );
    }

    /**
     * @dev Internal function to interact with the LayerZero EndpointV2.send() for sending a message.
     * @param _dstEid The destination endpoint ID.
     * @param _message The message payload.
     * @param _options Additional options for the message.
     * @param _fee The calculated LayerZero fee for the message.
     *      - nativeFee: The native fee.
     *      - lzTokenFee: The lzToken fee.
     * @param _refundAddress The address to receive any excess fee values sent to the endpoint.
     * @return receipt The receipt for the sent message.
     *      - guid: The unique identifier for the sent message.
     *      - nonce: The nonce of the sent message.
     *      - fee: The LayerZero fee incurred for the message.
     */
    function _lzSend(
        uint32 _dstEid,
        bytes memory _message,
        bytes memory _options,
        MessagingFee memory _fee,
        address _refundAddress
    ) internal virtual returns (MessagingReceipt memory receipt) {
        // @dev Push corresponding fees to the endpoint, any excess is sent back to the _refundAddress from the endpoint.
        uint256 messageValue = _payNative(_fee.nativeFee);
        if (_fee.lzTokenFee > 0) _payLzToken(_fee.lzTokenFee);

        return
            // solhint-disable-next-line check-send-result
            endpoint.send{value: messageValue}(
                MessagingParams(
                    _dstEid,
                    _getPeerOrRevert(_dstEid),
                    _message,
                    _options,
                    _fee.lzTokenFee > 0
                ),
                _refundAddress
            );
    }

    /**
     * @dev Internal function to pay the native fee associated with the message.
     * @param _nativeFee The native fee to be paid.
     * @return nativeFee The amount of native currency paid.
     *
     * @dev If the OApp needs to initiate MULTIPLE LayerZero messages in a single transaction,
     * this will need to be overridden because msg.value would contain multiple lzFees.
     * @dev Should be overridden in the event the LayerZero endpoint requires a different native currency.
     * @dev Some EVMs use an ERC20 as a method for paying transactions/gasFees.
     * @dev The endpoint is EITHER/OR, ie. it will NOT support both types of native payment at a time.
     */
    function _payNative(
        uint256 _nativeFee
    ) internal virtual returns (uint256 nativeFee) {
        if (msg.value != _nativeFee) revert NotEnoughNative(msg.value);
        return _nativeFee;
    }

    /**
     * @dev Internal function to pay the LZ token fee associated with the message.
     * @param _lzTokenFee The LZ token fee to be paid.
     *
     * @dev If the caller is trying to pay in the specified lzToken, then the lzTokenFee is passed to the endpoint.
     * @dev Any excess sent, is passed back to the specified _refundAddress in the _lzSend().
     */
    function _payLzToken(uint256 _lzTokenFee) internal virtual {
        // @dev Cannot cache the token because it is not immutable in the endpoint.
        address lzToken = endpoint.lzToken();
        if (lzToken == address(0)) revert LzTokenUnavailable();

        // Pay LZ token fee by sending tokens to the endpoint.
        IERC20(lzToken).safeTransferFrom(
            msg.sender,
            address(endpoint),
            _lzTokenFee
        );
    }
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidDelegate","type":"error"},{"inputs":[],"name":"InvalidEndpointCall","type":"error"},{"inputs":[],"name":"LzTokenUnavailable","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"NoPeer","type":"error"},{"inputs":[{"internalType":"uint256","name":"msgValue","type":"uint256"}],"name":"NotEnoughNative","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"OnlyEndpoint","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"}],"name":"OnlyPeer","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"enum BattlemonPickaxe.Rank","name":"rank","type":"uint8"},{"indexed":false,"internalType":"uint8","name":"sharpness","type":"uint8"}],"name":"CrosschainTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"eid","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"peer","type":"bytes32"}],"name":"PeerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"_box","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_chances","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_cheapSharpPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_gemAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_goodSharpPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_greatSharpPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_ranks","outputs":[{"internalType":"enum BattlemonPickaxe.Rank","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_sharpness","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_stickersAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum BattlemonPickaxe.Rank","name":"","type":"uint8"}],"name":"_supply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_treasuryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"to","type":"address[]"},{"internalType":"enum BattlemonPickaxe.Rank[]","name":"_type","type":"uint8[]"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"origin","type":"tuple"}],"name":"allowInitializePath","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"_type","type":"uint256"}],"name":"boxMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"chipOff","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"composeMsgSender","outputs":[{"internalType":"address","name":"sender","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endpoint","outputs":[{"internalType":"contract ILayerZeroEndpointV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"sharpPrices","type":"uint256[]"},{"internalType":"address","name":"treasuryAddress_","type":"address"},{"internalType":"string","name":"uri_","type":"string"},{"internalType":"address","name":"_endpoint","type":"address"},{"internalType":"uint256","name":"startTokenId","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"_origin","type":"tuple"},{"internalType":"bytes32","name":"_guid","type":"bytes32"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_options","type":"bytes"}],"name":"lzSend","outputs":[{"components":[{"internalType":"bytes32","name":"guid","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"fee","type":"tuple"}],"internalType":"struct MessagingReceipt","name":"","type":"tuple"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"nextNonce","outputs":[{"internalType":"uint64","name":"nonce","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oAppVersion","outputs":[{"internalType":"uint64","name":"senderVersion","type":"uint64"},{"internalType":"uint64","name":"receiverVersion","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"peers","outputs":[{"internalType":"bytes32","name":"peer","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_dstEid","type":"uint32"},{"internalType":"string","name":"_message","type":"string"},{"internalType":"bytes","name":"_options","type":"bytes"},{"internalType":"bool","name":"_payInLzToken","type":"bool"}],"name":"quote","outputs":[{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"fee","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"rankOf","outputs":[{"internalType":"enum BattlemonPickaxe.Rank","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"stickersAddress_","type":"address"},{"internalType":"address","name":"box_","type":"address"},{"internalType":"address","name":"gems_","type":"address"}],"name":"setAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_delegate","type":"address"}],"name":"setDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"bytes32","name":"_peer","type":"bytes32"}],"name":"setPeer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"sharp","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"sharpnessOf","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum BattlemonPickaxe.Rank","name":"rank","type":"uint8"}],"name":"supplyOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b613b1580620000f36000396000f3fe6080604052600436106102935760003560e01c80637b0311901161015a578063bb0b6a53116100c1578063f0acf1c31161007a578063f0acf1c314610865578063f2fde38b14610885578063f77e5dd3146108a5578063fac64e8b146108d2578063fc65732e146108e5578063ff7bd03d1461090557600080fd5b8063bb0b6a531461076f578063c87b56dd1461079c578063ca5eb5e1146107bc578063e985e9c5146107dc578063ee546fce14610825578063eeb500041461084557600080fd5b806395d89b411161011357806395d89b41146106c75780639b87eb28146106dc578063a061a03a146106fc578063a22cb4651461071c578063b88d4fde1461073c578063b92d0eff1461075c57600080fd5b80637b031190146105ee5780637d25a05e1461060e57806382f68dc414610649578063873ca2d1146106695780638743da6d146106895780638da5cb5b146106a957600080fd5b8063363bf964116101fe5780635e280f11116101b75780635e280f11146105365780636352211e1461055657806368e7953d1461057657806370a08231146105a3578063715018a6146105c3578063761572b4146105d857600080fd5b8063363bf9641461045957806342842e0e1461047957806346e38355146104995780634a3f9440146104b95780634e63103c146104f657806355f804b31461051657600080fd5b806313febcda1161025057806313febcda1461039e57806317442b70146103c25780632038bdc1146103e357806323b872dd146103f9578063339aef0b146104195780633400288b1461043957600080fd5b806301ffc9a71461029857806306fdde03146102cd578063081812fc146102ef578063095ea7b3146103275780630ebc78781461034957806313137d651461038b575b600080fd5b3480156102a457600080fd5b506102b86102b3366004612c7f565b610925565b60405190151581526020015b60405180910390f35b3480156102d957600080fd5b506102e2610977565b6040516102c49190612cf3565b3480156102fb57600080fd5b5061030f61030a366004612d06565b610a09565b6040516001600160a01b0390911681526020016102c4565b34801561033357600080fd5b50610347610342366004612d34565b610a30565b005b34801561035557600080fd5b50610379610364366004612d06565b60d76020526000908152604090205460ff1681565b60405160ff90911681526020016102c4565b610347610399366004612dc0565b610b4a565b3480156103aa57600080fd5b506103b460cc5481565b6040519081526020016102c4565b3480156103ce57600080fd5b506040805160018082526020820152016102c4565b3480156103ef57600080fd5b506103b460cd5481565b34801561040557600080fd5b50610347610414366004612e5f565b610be7565b34801561042557600080fd5b5060d15461030f906001600160a01b031681565b34801561044557600080fd5b50610347610454366004612eb4565b610c19565b34801561046557600080fd5b50610347610474366004612ed0565b610c76565b34801561048557600080fd5b50610347610494366004612e5f565b610d35565b6104ac6104a7366004612f1b565b610d50565b6040516102c49190612f74565b3480156104c557600080fd5b506104e96104d4366004612d06565b60d66020526000908152604090205460ff1681565b6040516102c49190612fee565b34801561050257600080fd5b50610379610511366004612d06565b610e63565b34801561052257600080fd5b5061034761053136600461309e565b610e84565b34801561054257600080fd5b5060c95461030f906001600160a01b031681565b34801561056257600080fd5b5061030f610571366004612d06565b610e9c565b34801561058257600080fd5b506103b46105913660046130e1565b60d86020526000908152604090205481565b3480156105af57600080fd5b506103b46105be3660046130fc565b610efc565b3480156105cf57600080fd5b50610347610f82565b3480156105e457600080fd5b506103b460ce5481565b3480156105fa57600080fd5b5061034761060936600461315d565b610f96565b34801561061a57600080fd5b50610631610629366004612eb4565b600092915050565b6040516001600160401b0390911681526020016102c4565b34801561065557600080fd5b506104e9610664366004612d06565b611208565b34801561067557600080fd5b50610347610684366004612d06565b611229565b34801561069557600080fd5b5060cf5461030f906001600160a01b031681565b3480156106b557600080fd5b506097546001600160a01b031661030f565b3480156106d357600080fd5b506102e2611437565b3480156106e857600080fd5b506103b46106f73660046130e1565b611446565b34801561070857600080fd5b506103476107173660046131fe565b611485565b34801561072857600080fd5b5061034761073736600461326b565b611556565b34801561074857600080fd5b506103476107573660046132a4565b611561565b34801561076857600080fd5b503061030f565b34801561077b57600080fd5b506103b461078a36600461330f565b60ca6020526000908152604090205481565b3480156107a857600080fd5b506102e26107b7366004612d06565b611599565b3480156107c857600080fd5b506103476107d73660046130fc565b6115f8565b3480156107e857600080fd5b506102b86107f736600461332a565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b34801561083157600080fd5b5060d25461030f906001600160a01b031681565b34801561085157600080fd5b50610379610860366004612d06565b61165b565b34801561087157600080fd5b5060d05461030f906001600160a01b031681565b34801561089157600080fd5b506103476108a03660046130fc565b61168f565b3480156108b157600080fd5b506108c56108c0366004613358565b611708565b6040516102c491906133de565b6103476108e0366004612d06565b611756565b3480156108f157600080fd5b50610347610900366004612d34565b61189d565b34801561091157600080fd5b506102b86109203660046133f5565b61190d565b60006001600160e01b031982166380ac58cd60e01b148061095657506001600160e01b03198216635b5e139f60e01b145b8061097157506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606065805461098690613411565b80601f01602080910402602001604051908101604052809291908181526020018280546109b290613411565b80156109ff5780601f106109d4576101008083540402835291602001916109ff565b820191906000526020600020905b8154815290600101906020018083116109e257829003601f168201915b5050505050905090565b6000610a1482611943565b506000908152606960205260409020546001600160a01b031690565b6000610a3b82610e9c565b9050806001600160a01b0316836001600160a01b031603610aad5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b0382161480610ac95750610ac981336107f7565b610b3b5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610aa4565b610b4583836119a2565b505050565b60c9546001600160a01b03163314610b77576040516391ac5e4f60e01b8152336004820152602401610aa4565b60208701803590610b9190610b8c908a61330f565b611a10565b14610bcf57610ba3602088018861330f565b60405163309afaf360e21b815263ffffffff909116600482015260208801356024820152604401610aa4565b610bde87878787878787611a4c565b50505050505050565b610bf2335b82611b05565b610c0e5760405162461bcd60e51b8152600401610aa490613445565b610b45838383611b83565b610c21611ce7565b63ffffffff8216600081815260ca6020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b610c7e611ce7565b6001600160a01b03831615801590610c9e57506001600160a01b03821615155b8015610cb257506001600160a01b03811615155b610cf65760405162461bcd60e51b81526020600482015260156024820152745069636b6178653a205a65726f206164647265737360581b6044820152606401610aa4565b60d180546001600160a01b039485166001600160a01b03199182161790915560d280549385169382169390931790925560d08054919093169116179055565b610b4583838360405180602001604052806000815250611561565b610d58612b70565b33610d6285610e9c565b6001600160a01b031614610dae5760405162461bcd60e51b81526020600482015260136024820152722834b1b5b0bc329d102737ba1039b2b73232b960691b6044820152606401610aa4565b610db784611d41565b610dbf612b70565b600085815260d6602090815260408083205460d78352818420549151610df29333938b9360ff9081169391169101613492565b60408051601f198184030181526020601f88018190048102840181019092528683529250610e56918991849190899089908190840183828082843760009201829052506040805180820190915234815260208101919091529250339150611dd69050565b925050505b949350505050565b6000610e6e82611943565b50600090815260d7602052604090205460ff1690565b610e8c611ce7565b60d3610e98828261350e565b5050565b6000818152606760205260408120546001600160a01b0316806109715760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610aa4565b60006001600160a01b038216610f665760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610aa4565b506001600160a01b031660009081526068602052604090205490565b610f8a611ce7565b610f946000611ec9565b565b600054610100900460ff1615808015610fb65750600054600160ff909116105b80610fd05750303b158015610fd0575060005460ff166001145b6110335760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610aa4565b6000805460ff191660011790558015611056576000805461ff0019166101001790555b6110a560405180604001604052806012815260200171426174746c656d6f6e205069636b6178657360701b815250604051806040016040528060038152602001620424c560ec1b815250611f1b565b6110af8333611f4c565b6110b7611f7d565b600387146110ff5760405162461bcd60e51b81526020600482015260156024820152740a0d2c6d6c2f0ca7440aee4dedcce40d8cadccee8d605b1b6044820152606401610aa4565b87876000818110611112576111126135cd565b602002919091013560cc555087876001818110611131576111316135cd565b602002919091013560cd555087876002818110611150576111506135cd565b6020908102929092013560ce555060cf80546001600160a01b0319166001600160a01b03891617905560408051606081018252606481526028928101929092526014908201526111a49060d4906003612bb7565b5060d36111b28587836135e3565b5060cb82905580156111fe576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600061121382611943565b50600090815260d6602052604090205460ff1690565b61123281611943565b61123b33610bec565b6112575760405162461bcd60e51b8152600401610aa490613445565b600081815260d76020526040902054600560ff90911610156112bb5760405162461bcd60e51b815260206004820152601d60248201527f5069636b6178653a2073686172706e65737320697320746f6f206c6f770000006044820152606401610aa4565b600081815260d7602052604081208054600592906112dd90849060ff166136b8565b82546101009290920a60ff818102199093169183160217909155600083815260d6602052604081205490925016600281111561131b5761131b612fb6565b6113269060016136d1565b90505b60ff811615610e98578061133c816136ea565b9150506000611349611fac565b600084815260d7602052604090205460d4805492935060649260ff928316928616908110611379576113796135cd565b90600052602060002090602091828204019190069054906101000a900460ff1660ff166113a69190613707565b6113b09190613734565b8110156114315760d0546001600160a01b031663691562a0336113d48560016136d1565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260ff166024820152604401600060405180830381600087803b15801561141d57600080fd5b505af1158015610bde573d6000803e3d6000fd5b50611329565b60606066805461098690613411565b600060d8600083600281111561145e5761145e612fb6565b600281111561146f5761146f612fb6565b8152602001908152602001600020549050919050565b61148d611ce7565b8281146114dc5760405162461bcd60e51b815260206004820152601a60248201527f41697264726f703a2077446966666572656e74206c656e6774680000000000006044820152606401610aa4565b60005b8381101561154f5761153d8585838181106114fc576114fc6135cd565b905060200201602081019061151191906130fc565b848484818110611523576115236135cd565b905060200201602081019061153891906130e1565b61201f565b8061154781613748565b9150506114df565b5050505050565b610e983383836120d9565b61156b3383611b05565b6115875760405162461bcd60e51b8152600401610aa490613445565b611593848484846121a7565b50505050565b60606115a482611943565b6115ac6121da565b6115d16115b884611208565b60028111156115c9576115c9612fb6565b60ff166121e9565b6040516020016115e2929190613761565b6040516020818303038152906040529050919050565b611600611ce7565b60c95460405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b15801561164757600080fd5b505af115801561154f573d6000803e3d6000fd5b60d4818154811061166b57600080fd5b9060005260206000209060209182820401919006915054906101000a900460ff1681565b611697611ce7565b6001600160a01b0381166116fc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610aa4565b61170581611ec9565b50565b604080518082019091526000808252602082015260008460405160200161172f9190612cf3565b604051602081830303815290604052905061174c8682868661227b565b9695505050505050565b61175f81611943565b61176833610bec565b6117845760405162461bcd60e51b8152600401610aa490613445565b600081815260d6602052604090205434906117a19060ff16612343565b11156117ef5760405162461bcd60e51b815260206004820152601b60248201527f5069636b6178653a20496e73756666696369656e742066756e647300000000006044820152606401610aa4565b60cf546040516000916001600160a01b03169034908381818185875af1925050503d806000811461183c576040519150601f19603f3d011682016040523d82523d6000602084013e611841565b606091505b50509050806118815760405162461bcd60e51b815260206004820152600c60248201526b119959481b9bdd081cd95b9d60a21b6044820152606401610aa4565b50600090815260d760205260409020805460ff19166064179055565b60d2546001600160a01b031633146118f75760405162461bcd60e51b815260206004820152601b60248201527f5069636b6178653a2043616c6c6572206e6f742074686520426f7800000000006044820152606401610aa4565b610e988282600281111561153857611538612fb6565b60006020820180359060ca908390611925908661330f565b63ffffffff1681526020810191909152604001600020541492915050565b6000818152606760205260409020546001600160a01b03166117055760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610aa4565b600081815260696020526040902080546001600160a01b0319166001600160a01b03841690811790915581906119d782610e9c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b63ffffffff8116600090815260ca6020526040812054806109715760405163f6ff4fb760e01b815263ffffffff84166004820152602401610aa4565b6000808080611a5d888a018a613790565b9350935093509350611a6f8484612393565b600083815260d660205260409020805483919060ff19166001836002811115611a9a57611a9a612fb6565b0217905550600083815260d7602052604090819020805460ff191660ff8416179055517fa519e15d7208f151b40cc2706d14a8e3b59f4abc455b04385fb7d8d573e13d7c90611af0908690869086908690613492565b60405180910390a15050505050505050505050565b600080611b1183610e9c565b9050806001600160a01b0316846001600160a01b03161480611b5857506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b80610e5b5750836001600160a01b0316611b7184610a09565b6001600160a01b031614949350505050565b826001600160a01b0316611b9682610e9c565b6001600160a01b031614611bbc5760405162461bcd60e51b8152600401610aa4906137dc565b6001600160a01b038216611c1e5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610aa4565b826001600160a01b0316611c3182610e9c565b6001600160a01b031614611c575760405162461bcd60e51b8152600401610aa4906137dc565b600081815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260688552838620805460001901905590871680865283862080546001019055868652606790945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6097546001600160a01b03163314610f945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610aa4565b6000611d4c82610e9c565b9050611d5782610e9c565b600083815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526068845282852080546000190190558785526067909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b611dde612b70565b6000611ded84600001516123ad565b602085015190915015611e0757611e0784602001516123d5565b60c9546040805160a0810190915263ffffffff891681526001600160a01b0390911690632637a45090839060208101611e3f8c611a10565b81526020018a815260200189815260200160008960200151111515815250866040518463ffffffff1660e01b8152600401611e7b929190613821565b60806040518083038185885af1158015611e99573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611ebe91906138e8565b979650505050505050565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16611f425760405162461bcd60e51b8152600401610aa490613959565b610e988282612488565b600054610100900460ff16611f735760405162461bcd60e51b8152600401610aa490613959565b610e9882826124c8565b600054610100900460ff16611fa45760405162461bcd60e51b8152600401610aa490613959565b610f9461256a565b60d5805460009182611fbd83613748565b909155505060d554604080514260208201526bffffffffffffffffffffffff193360601b169181019190915260548101919091526064906074016040516020818303038152906040528051906020012060001c61201a91906139a4565b905090565b60cb80546000918261203083613748565b9190505590506120408382612393565b600081815260d660205260409020805483919060ff1916600183600281111561206b5761206b612fb6565b0217905550600081815260d760205260408120805460ff1916606417905560019060d8908460028111156120a1576120a1612fb6565b60028111156120b2576120b2612fb6565b815260200190815260200160002060008282546120cf91906139b8565b9091555050505050565b816001600160a01b0316836001600160a01b03160361213a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610aa4565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6121b2848484611b83565b6121be8484848461259a565b6115935760405162461bcd60e51b8152600401610aa4906139cb565b606060d3805461098690613411565b606060006121f683612698565b60010190506000816001600160401b0381111561221557612215612ffc565b6040519080825280601f01601f19166020018201604052801561223f576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461224957509392505050565b604080518082019091526000808252602082015260c9546040805160a0810190915263ffffffff871681526001600160a01b039091169063ddc28c5890602081016122c589611a10565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b81526004016122fa929190613821565b6040805180830381865afa158015612316573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061233a9190613a1d565b95945050505050565b60008082600281111561235857612358612fb6565b0361236557505060cc5490565b600182600281111561237957612379612fb6565b0361238657505060cd5490565b505060ce5490565b919050565b610e98828260405180602001604052806000815250612770565b60008134146123d1576040516304fb820960e51b8152346004820152602401610aa4565b5090565b60c9546040805163393f876560e21b815290516000926001600160a01b03169163e4fe1d949160048083019260209291908290030181865afa15801561241f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124439190613a39565b90506001600160a01b03811661246c576040516329b99a9560e11b815260040160405180910390fd5b60c954610e98906001600160a01b0383811691339116856127a3565b600054610100900460ff166124af5760405162461bcd60e51b8152600401610aa490613959565b60656124bb838261350e565b506066610b45828261350e565b60c980546001600160a01b0319166001600160a01b0384811691909117909155811661250757604051632d618d8160e21b815260040160405180910390fd5b60c95460405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b15801561254e57600080fd5b505af1158015612562573d6000803e3d6000fd5b505050505050565b600054610100900460ff166125915760405162461bcd60e51b8152600401610aa490613959565b610f9433611ec9565b60006001600160a01b0384163b1561269057604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906125de903390899088908890600401613a56565b6020604051808303816000875af1925050508015612619575060408051601f3d908101601f1916820190925261261691810190613a89565b60015b612676573d808015612647576040519150601f19603f3d011682016040523d82523d6000602084013e61264c565b606091505b50805160000361266e5760405162461bcd60e51b8152600401610aa4906139cb565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610e5b565b506001610e5b565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106126d75772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612703576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061272157662386f26fc10000830492506010015b6305f5e1008310612739576305f5e100830492506008015b612710831061274d57612710830492506004015b6064831061275f576064830492506002015b600a83106109715760010192915050565b61277a83836127fd565b612787600084848461259a565b610b455760405162461bcd60e51b8152600401610aa4906139cb565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611593908590612988565b6001600160a01b0382166128535760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610aa4565b6000818152606760205260409020546001600160a01b0316156128b85760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610aa4565b6000818152606760205260409020546001600160a01b03161561291d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610aa4565b6001600160a01b038216600081815260686020908152604080832080546001019055848352606790915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006129dd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a5d9092919063ffffffff16565b90508051600014806129fe5750808060200190518101906129fe9190613aa6565b610b455760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610aa4565b6060610e5b848460008585600080866001600160a01b03168587604051612a849190613ac3565b60006040518083038185875af1925050503d8060008114612ac1576040519150601f19603f3d011682016040523d82523d6000602084013e612ac6565b606091505b5091509150610e568783838760608315612b41578251600003612b3a576001600160a01b0385163b612b3a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610aa4565b5081610e5b565b610e5b8383815115612b565781518083602001fd5b8060405162461bcd60e51b8152600401610aa49190612cf3565b60405180606001604052806000801916815260200160006001600160401b03168152602001612bb2604051806040016040528060008152602001600081525090565b905290565b82805482825590600052602060002090601f01602090048101928215612c4d5791602002820160005b83821115612c1e57835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302612be0565b8015612c4b5782816101000a81549060ff0219169055600101602081600001049283019260010302612c1e565b505b506123d19291505b808211156123d15760008155600101612c55565b6001600160e01b03198116811461170557600080fd5b600060208284031215612c9157600080fd5b8135612c9c81612c69565b9392505050565b60005b83811015612cbe578181015183820152602001612ca6565b50506000910152565b60008151808452612cdf816020860160208601612ca3565b601f01601f19169290920160200192915050565b602081526000612c9c6020830184612cc7565b600060208284031215612d1857600080fd5b5035919050565b6001600160a01b038116811461170557600080fd5b60008060408385031215612d4757600080fd5b8235612d5281612d1f565b946020939093013593505050565b600060608284031215612d7257600080fd5b50919050565b60008083601f840112612d8a57600080fd5b5081356001600160401b03811115612da157600080fd5b602083019150836020828501011115612db957600080fd5b9250929050565b600080600080600080600060e0888a031215612ddb57600080fd5b612de58989612d60565b96506060880135955060808801356001600160401b0380821115612e0857600080fd5b612e148b838c01612d78565b909750955060a08a01359150612e2982612d1f565b90935060c08901359080821115612e3f57600080fd5b50612e4c8a828b01612d78565b989b979a50959850939692959293505050565b600080600060608486031215612e7457600080fd5b8335612e7f81612d1f565b92506020840135612e8f81612d1f565b929592945050506040919091013590565b803563ffffffff8116811461238e57600080fd5b60008060408385031215612ec757600080fd5b612d5283612ea0565b600080600060608486031215612ee557600080fd5b8335612ef081612d1f565b92506020840135612f0081612d1f565b91506040840135612f1081612d1f565b809150509250925092565b60008060008060608587031215612f3157600080fd5b612f3a85612ea0565b93506020850135925060408501356001600160401b03811115612f5c57600080fd5b612f6887828801612d78565b95989497509550505050565b6000608082019050825182526001600160401b0360208401511660208301526040830151612faf604084018280518252602090810151910152565b5092915050565b634e487b7160e01b600052602160045260246000fd5b60038110612fea57634e487b7160e01b600052602160045260246000fd5b9052565b602081016109718284612fcc565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261302357600080fd5b81356001600160401b038082111561303d5761303d612ffc565b604051601f8301601f19908116603f0116810190828211818310171561306557613065612ffc565b8160405283815286602085880101111561307e57600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000602082840312156130b057600080fd5b81356001600160401b038111156130c657600080fd5b610e5b84828501613012565b80356003811061238e57600080fd5b6000602082840312156130f357600080fd5b612c9c826130d2565b60006020828403121561310e57600080fd5b8135612c9c81612d1f565b60008083601f84011261312b57600080fd5b5081356001600160401b0381111561314257600080fd5b6020830191508360208260051b8501011115612db957600080fd5b600080600080600080600060a0888a03121561317857600080fd5b87356001600160401b038082111561318f57600080fd5b61319b8b838c01613119565b909950975060208a013591506131b082612d1f565b909550604089013590808211156131c657600080fd5b506131d38a828b01612d78565b90955093505060608801356131e781612d1f565b809250506080880135905092959891949750929550565b6000806000806040858703121561321457600080fd5b84356001600160401b038082111561322b57600080fd5b61323788838901613119565b9096509450602087013591508082111561325057600080fd5b50612f6887828801613119565b801515811461170557600080fd5b6000806040838503121561327e57600080fd5b823561328981612d1f565b915060208301356132998161325d565b809150509250929050565b600080600080608085870312156132ba57600080fd5b84356132c581612d1f565b935060208501356132d581612d1f565b92506040850135915060608501356001600160401b038111156132f757600080fd5b61330387828801613012565b91505092959194509250565b60006020828403121561332157600080fd5b612c9c82612ea0565b6000806040838503121561333d57600080fd5b823561334881612d1f565b9150602083013561329981612d1f565b6000806000806080858703121561336e57600080fd5b61337785612ea0565b935060208501356001600160401b038082111561339357600080fd5b61339f88838901613012565b945060408701359150808211156133b557600080fd5b506133c287828801613012565b92505060608501356133d38161325d565b939692955090935050565b815181526020808301519082015260408101610971565b60006060828403121561340757600080fd5b612c9c8383612d60565b600181811c9082168061342557607f821691505b602082108103612d7257634e487b7160e01b600052602260045260246000fd5b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b6001600160a01b038516815260208101849052608081016134b66040830185612fcc565b60ff8316606083015295945050505050565b601f821115610b4557600081815260208120601f850160051c810160208610156134ef5750805b601f850160051c820191505b81811015612562578281556001016134fb565b81516001600160401b0381111561352757613527612ffc565b61353b816135358454613411565b846134c8565b602080601f83116001811461357057600084156135585750858301515b600019600386901b1c1916600185901b178555612562565b600085815260208120601f198616915b8281101561359f57888601518255948401946001909101908401613580565b50858210156135bd5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b6001600160401b038311156135fa576135fa612ffc565b61360e836136088354613411565b836134c8565b6000601f841160018114613642576000851561362a5750838201355b600019600387901b1c1916600186901b17835561154f565b600083815260209020601f19861690835b828110156136735786850135825560209485019460019092019101613653565b50868210156136905760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052601160045260246000fd5b60ff8281168282160390811115610971576109716136a2565b60ff8181168382160190811115610971576109716136a2565b600060ff8216806136fd576136fd6136a2565b6000190192915050565b8082028115828204841417610971576109716136a2565b634e487b7160e01b600052601260045260246000fd5b6000826137435761374361371e565b500490565b60006001820161375a5761375a6136a2565b5060010190565b60008351613773818460208801612ca3565b835190830190613787818360208801612ca3565b01949350505050565b600080600080608085870312156137a657600080fd5b84356137b181612d1f565b9350602085013592506137c6604086016130d2565b9150606085013560ff811681146133d357600080fd5b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6040815263ffffffff8351166040820152602083015160608201526000604084015160a0608084015261385760e0840182612cc7565b90506060850151603f198483030160a08501526138748282612cc7565b60809690960151151560c08501525050506001600160a01b039190911660209091015290565b6000604082840312156138ac57600080fd5b604051604081018181106001600160401b03821117156138ce576138ce612ffc565b604052825181526020928301519281019290925250919050565b6000608082840312156138fa57600080fd5b604051606081016001600160401b03828210818311171561391d5761391d612ffc565b816040528451835260208501519150808216821461393a57600080fd5b50602082015261394d846040850161389a565b60408201529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000826139b3576139b361371e565b500690565b80820180821115610971576109716136a2565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060408284031215613a2f57600080fd5b612c9c838361389a565b600060208284031215613a4b57600080fd5b8151612c9c81612d1f565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061174c90830184612cc7565b600060208284031215613a9b57600080fd5b8151612c9c81612c69565b600060208284031215613ab857600080fd5b8151612c9c8161325d565b60008251613ad5818460208701612ca3565b919091019291505056fea26469706673582212206d8ce441a6895bf89d39725853d5e586df5db9ad44fac42c89f0bf9d8fd9593264736f6c63430008140033

Deployed Bytecode

0x6080604052600436106102935760003560e01c80637b0311901161015a578063bb0b6a53116100c1578063f0acf1c31161007a578063f0acf1c314610865578063f2fde38b14610885578063f77e5dd3146108a5578063fac64e8b146108d2578063fc65732e146108e5578063ff7bd03d1461090557600080fd5b8063bb0b6a531461076f578063c87b56dd1461079c578063ca5eb5e1146107bc578063e985e9c5146107dc578063ee546fce14610825578063eeb500041461084557600080fd5b806395d89b411161011357806395d89b41146106c75780639b87eb28146106dc578063a061a03a146106fc578063a22cb4651461071c578063b88d4fde1461073c578063b92d0eff1461075c57600080fd5b80637b031190146105ee5780637d25a05e1461060e57806382f68dc414610649578063873ca2d1146106695780638743da6d146106895780638da5cb5b146106a957600080fd5b8063363bf964116101fe5780635e280f11116101b75780635e280f11146105365780636352211e1461055657806368e7953d1461057657806370a08231146105a3578063715018a6146105c3578063761572b4146105d857600080fd5b8063363bf9641461045957806342842e0e1461047957806346e38355146104995780634a3f9440146104b95780634e63103c146104f657806355f804b31461051657600080fd5b806313febcda1161025057806313febcda1461039e57806317442b70146103c25780632038bdc1146103e357806323b872dd146103f9578063339aef0b146104195780633400288b1461043957600080fd5b806301ffc9a71461029857806306fdde03146102cd578063081812fc146102ef578063095ea7b3146103275780630ebc78781461034957806313137d651461038b575b600080fd5b3480156102a457600080fd5b506102b86102b3366004612c7f565b610925565b60405190151581526020015b60405180910390f35b3480156102d957600080fd5b506102e2610977565b6040516102c49190612cf3565b3480156102fb57600080fd5b5061030f61030a366004612d06565b610a09565b6040516001600160a01b0390911681526020016102c4565b34801561033357600080fd5b50610347610342366004612d34565b610a30565b005b34801561035557600080fd5b50610379610364366004612d06565b60d76020526000908152604090205460ff1681565b60405160ff90911681526020016102c4565b610347610399366004612dc0565b610b4a565b3480156103aa57600080fd5b506103b460cc5481565b6040519081526020016102c4565b3480156103ce57600080fd5b506040805160018082526020820152016102c4565b3480156103ef57600080fd5b506103b460cd5481565b34801561040557600080fd5b50610347610414366004612e5f565b610be7565b34801561042557600080fd5b5060d15461030f906001600160a01b031681565b34801561044557600080fd5b50610347610454366004612eb4565b610c19565b34801561046557600080fd5b50610347610474366004612ed0565b610c76565b34801561048557600080fd5b50610347610494366004612e5f565b610d35565b6104ac6104a7366004612f1b565b610d50565b6040516102c49190612f74565b3480156104c557600080fd5b506104e96104d4366004612d06565b60d66020526000908152604090205460ff1681565b6040516102c49190612fee565b34801561050257600080fd5b50610379610511366004612d06565b610e63565b34801561052257600080fd5b5061034761053136600461309e565b610e84565b34801561054257600080fd5b5060c95461030f906001600160a01b031681565b34801561056257600080fd5b5061030f610571366004612d06565b610e9c565b34801561058257600080fd5b506103b46105913660046130e1565b60d86020526000908152604090205481565b3480156105af57600080fd5b506103b46105be3660046130fc565b610efc565b3480156105cf57600080fd5b50610347610f82565b3480156105e457600080fd5b506103b460ce5481565b3480156105fa57600080fd5b5061034761060936600461315d565b610f96565b34801561061a57600080fd5b50610631610629366004612eb4565b600092915050565b6040516001600160401b0390911681526020016102c4565b34801561065557600080fd5b506104e9610664366004612d06565b611208565b34801561067557600080fd5b50610347610684366004612d06565b611229565b34801561069557600080fd5b5060cf5461030f906001600160a01b031681565b3480156106b557600080fd5b506097546001600160a01b031661030f565b3480156106d357600080fd5b506102e2611437565b3480156106e857600080fd5b506103b46106f73660046130e1565b611446565b34801561070857600080fd5b506103476107173660046131fe565b611485565b34801561072857600080fd5b5061034761073736600461326b565b611556565b34801561074857600080fd5b506103476107573660046132a4565b611561565b34801561076857600080fd5b503061030f565b34801561077b57600080fd5b506103b461078a36600461330f565b60ca6020526000908152604090205481565b3480156107a857600080fd5b506102e26107b7366004612d06565b611599565b3480156107c857600080fd5b506103476107d73660046130fc565b6115f8565b3480156107e857600080fd5b506102b86107f736600461332a565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b34801561083157600080fd5b5060d25461030f906001600160a01b031681565b34801561085157600080fd5b50610379610860366004612d06565b61165b565b34801561087157600080fd5b5060d05461030f906001600160a01b031681565b34801561089157600080fd5b506103476108a03660046130fc565b61168f565b3480156108b157600080fd5b506108c56108c0366004613358565b611708565b6040516102c491906133de565b6103476108e0366004612d06565b611756565b3480156108f157600080fd5b50610347610900366004612d34565b61189d565b34801561091157600080fd5b506102b86109203660046133f5565b61190d565b60006001600160e01b031982166380ac58cd60e01b148061095657506001600160e01b03198216635b5e139f60e01b145b8061097157506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606065805461098690613411565b80601f01602080910402602001604051908101604052809291908181526020018280546109b290613411565b80156109ff5780601f106109d4576101008083540402835291602001916109ff565b820191906000526020600020905b8154815290600101906020018083116109e257829003601f168201915b5050505050905090565b6000610a1482611943565b506000908152606960205260409020546001600160a01b031690565b6000610a3b82610e9c565b9050806001600160a01b0316836001600160a01b031603610aad5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b0382161480610ac95750610ac981336107f7565b610b3b5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610aa4565b610b4583836119a2565b505050565b60c9546001600160a01b03163314610b77576040516391ac5e4f60e01b8152336004820152602401610aa4565b60208701803590610b9190610b8c908a61330f565b611a10565b14610bcf57610ba3602088018861330f565b60405163309afaf360e21b815263ffffffff909116600482015260208801356024820152604401610aa4565b610bde87878787878787611a4c565b50505050505050565b610bf2335b82611b05565b610c0e5760405162461bcd60e51b8152600401610aa490613445565b610b45838383611b83565b610c21611ce7565b63ffffffff8216600081815260ca6020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b610c7e611ce7565b6001600160a01b03831615801590610c9e57506001600160a01b03821615155b8015610cb257506001600160a01b03811615155b610cf65760405162461bcd60e51b81526020600482015260156024820152745069636b6178653a205a65726f206164647265737360581b6044820152606401610aa4565b60d180546001600160a01b039485166001600160a01b03199182161790915560d280549385169382169390931790925560d08054919093169116179055565b610b4583838360405180602001604052806000815250611561565b610d58612b70565b33610d6285610e9c565b6001600160a01b031614610dae5760405162461bcd60e51b81526020600482015260136024820152722834b1b5b0bc329d102737ba1039b2b73232b960691b6044820152606401610aa4565b610db784611d41565b610dbf612b70565b600085815260d6602090815260408083205460d78352818420549151610df29333938b9360ff9081169391169101613492565b60408051601f198184030181526020601f88018190048102840181019092528683529250610e56918991849190899089908190840183828082843760009201829052506040805180820190915234815260208101919091529250339150611dd69050565b925050505b949350505050565b6000610e6e82611943565b50600090815260d7602052604090205460ff1690565b610e8c611ce7565b60d3610e98828261350e565b5050565b6000818152606760205260408120546001600160a01b0316806109715760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610aa4565b60006001600160a01b038216610f665760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610aa4565b506001600160a01b031660009081526068602052604090205490565b610f8a611ce7565b610f946000611ec9565b565b600054610100900460ff1615808015610fb65750600054600160ff909116105b80610fd05750303b158015610fd0575060005460ff166001145b6110335760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610aa4565b6000805460ff191660011790558015611056576000805461ff0019166101001790555b6110a560405180604001604052806012815260200171426174746c656d6f6e205069636b6178657360701b815250604051806040016040528060038152602001620424c560ec1b815250611f1b565b6110af8333611f4c565b6110b7611f7d565b600387146110ff5760405162461bcd60e51b81526020600482015260156024820152740a0d2c6d6c2f0ca7440aee4dedcce40d8cadccee8d605b1b6044820152606401610aa4565b87876000818110611112576111126135cd565b602002919091013560cc555087876001818110611131576111316135cd565b602002919091013560cd555087876002818110611150576111506135cd565b6020908102929092013560ce555060cf80546001600160a01b0319166001600160a01b03891617905560408051606081018252606481526028928101929092526014908201526111a49060d4906003612bb7565b5060d36111b28587836135e3565b5060cb82905580156111fe576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600061121382611943565b50600090815260d6602052604090205460ff1690565b61123281611943565b61123b33610bec565b6112575760405162461bcd60e51b8152600401610aa490613445565b600081815260d76020526040902054600560ff90911610156112bb5760405162461bcd60e51b815260206004820152601d60248201527f5069636b6178653a2073686172706e65737320697320746f6f206c6f770000006044820152606401610aa4565b600081815260d7602052604081208054600592906112dd90849060ff166136b8565b82546101009290920a60ff818102199093169183160217909155600083815260d6602052604081205490925016600281111561131b5761131b612fb6565b6113269060016136d1565b90505b60ff811615610e98578061133c816136ea565b9150506000611349611fac565b600084815260d7602052604090205460d4805492935060649260ff928316928616908110611379576113796135cd565b90600052602060002090602091828204019190069054906101000a900460ff1660ff166113a69190613707565b6113b09190613734565b8110156114315760d0546001600160a01b031663691562a0336113d48560016136d1565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260ff166024820152604401600060405180830381600087803b15801561141d57600080fd5b505af1158015610bde573d6000803e3d6000fd5b50611329565b60606066805461098690613411565b600060d8600083600281111561145e5761145e612fb6565b600281111561146f5761146f612fb6565b8152602001908152602001600020549050919050565b61148d611ce7565b8281146114dc5760405162461bcd60e51b815260206004820152601a60248201527f41697264726f703a2077446966666572656e74206c656e6774680000000000006044820152606401610aa4565b60005b8381101561154f5761153d8585838181106114fc576114fc6135cd565b905060200201602081019061151191906130fc565b848484818110611523576115236135cd565b905060200201602081019061153891906130e1565b61201f565b8061154781613748565b9150506114df565b5050505050565b610e983383836120d9565b61156b3383611b05565b6115875760405162461bcd60e51b8152600401610aa490613445565b611593848484846121a7565b50505050565b60606115a482611943565b6115ac6121da565b6115d16115b884611208565b60028111156115c9576115c9612fb6565b60ff166121e9565b6040516020016115e2929190613761565b6040516020818303038152906040529050919050565b611600611ce7565b60c95460405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b15801561164757600080fd5b505af115801561154f573d6000803e3d6000fd5b60d4818154811061166b57600080fd5b9060005260206000209060209182820401919006915054906101000a900460ff1681565b611697611ce7565b6001600160a01b0381166116fc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610aa4565b61170581611ec9565b50565b604080518082019091526000808252602082015260008460405160200161172f9190612cf3565b604051602081830303815290604052905061174c8682868661227b565b9695505050505050565b61175f81611943565b61176833610bec565b6117845760405162461bcd60e51b8152600401610aa490613445565b600081815260d6602052604090205434906117a19060ff16612343565b11156117ef5760405162461bcd60e51b815260206004820152601b60248201527f5069636b6178653a20496e73756666696369656e742066756e647300000000006044820152606401610aa4565b60cf546040516000916001600160a01b03169034908381818185875af1925050503d806000811461183c576040519150601f19603f3d011682016040523d82523d6000602084013e611841565b606091505b50509050806118815760405162461bcd60e51b815260206004820152600c60248201526b119959481b9bdd081cd95b9d60a21b6044820152606401610aa4565b50600090815260d760205260409020805460ff19166064179055565b60d2546001600160a01b031633146118f75760405162461bcd60e51b815260206004820152601b60248201527f5069636b6178653a2043616c6c6572206e6f742074686520426f7800000000006044820152606401610aa4565b610e988282600281111561153857611538612fb6565b60006020820180359060ca908390611925908661330f565b63ffffffff1681526020810191909152604001600020541492915050565b6000818152606760205260409020546001600160a01b03166117055760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610aa4565b600081815260696020526040902080546001600160a01b0319166001600160a01b03841690811790915581906119d782610e9c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b63ffffffff8116600090815260ca6020526040812054806109715760405163f6ff4fb760e01b815263ffffffff84166004820152602401610aa4565b6000808080611a5d888a018a613790565b9350935093509350611a6f8484612393565b600083815260d660205260409020805483919060ff19166001836002811115611a9a57611a9a612fb6565b0217905550600083815260d7602052604090819020805460ff191660ff8416179055517fa519e15d7208f151b40cc2706d14a8e3b59f4abc455b04385fb7d8d573e13d7c90611af0908690869086908690613492565b60405180910390a15050505050505050505050565b600080611b1183610e9c565b9050806001600160a01b0316846001600160a01b03161480611b5857506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b80610e5b5750836001600160a01b0316611b7184610a09565b6001600160a01b031614949350505050565b826001600160a01b0316611b9682610e9c565b6001600160a01b031614611bbc5760405162461bcd60e51b8152600401610aa4906137dc565b6001600160a01b038216611c1e5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610aa4565b826001600160a01b0316611c3182610e9c565b6001600160a01b031614611c575760405162461bcd60e51b8152600401610aa4906137dc565b600081815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260688552838620805460001901905590871680865283862080546001019055868652606790945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6097546001600160a01b03163314610f945760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610aa4565b6000611d4c82610e9c565b9050611d5782610e9c565b600083815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526068845282852080546000190190558785526067909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b611dde612b70565b6000611ded84600001516123ad565b602085015190915015611e0757611e0784602001516123d5565b60c9546040805160a0810190915263ffffffff891681526001600160a01b0390911690632637a45090839060208101611e3f8c611a10565b81526020018a815260200189815260200160008960200151111515815250866040518463ffffffff1660e01b8152600401611e7b929190613821565b60806040518083038185885af1158015611e99573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611ebe91906138e8565b979650505050505050565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff16611f425760405162461bcd60e51b8152600401610aa490613959565b610e988282612488565b600054610100900460ff16611f735760405162461bcd60e51b8152600401610aa490613959565b610e9882826124c8565b600054610100900460ff16611fa45760405162461bcd60e51b8152600401610aa490613959565b610f9461256a565b60d5805460009182611fbd83613748565b909155505060d554604080514260208201526bffffffffffffffffffffffff193360601b169181019190915260548101919091526064906074016040516020818303038152906040528051906020012060001c61201a91906139a4565b905090565b60cb80546000918261203083613748565b9190505590506120408382612393565b600081815260d660205260409020805483919060ff1916600183600281111561206b5761206b612fb6565b0217905550600081815260d760205260408120805460ff1916606417905560019060d8908460028111156120a1576120a1612fb6565b60028111156120b2576120b2612fb6565b815260200190815260200160002060008282546120cf91906139b8565b9091555050505050565b816001600160a01b0316836001600160a01b03160361213a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610aa4565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6121b2848484611b83565b6121be8484848461259a565b6115935760405162461bcd60e51b8152600401610aa4906139cb565b606060d3805461098690613411565b606060006121f683612698565b60010190506000816001600160401b0381111561221557612215612ffc565b6040519080825280601f01601f19166020018201604052801561223f576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461224957509392505050565b604080518082019091526000808252602082015260c9546040805160a0810190915263ffffffff871681526001600160a01b039091169063ddc28c5890602081016122c589611a10565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b81526004016122fa929190613821565b6040805180830381865afa158015612316573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061233a9190613a1d565b95945050505050565b60008082600281111561235857612358612fb6565b0361236557505060cc5490565b600182600281111561237957612379612fb6565b0361238657505060cd5490565b505060ce5490565b919050565b610e98828260405180602001604052806000815250612770565b60008134146123d1576040516304fb820960e51b8152346004820152602401610aa4565b5090565b60c9546040805163393f876560e21b815290516000926001600160a01b03169163e4fe1d949160048083019260209291908290030181865afa15801561241f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124439190613a39565b90506001600160a01b03811661246c576040516329b99a9560e11b815260040160405180910390fd5b60c954610e98906001600160a01b0383811691339116856127a3565b600054610100900460ff166124af5760405162461bcd60e51b8152600401610aa490613959565b60656124bb838261350e565b506066610b45828261350e565b60c980546001600160a01b0319166001600160a01b0384811691909117909155811661250757604051632d618d8160e21b815260040160405180910390fd5b60c95460405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b15801561254e57600080fd5b505af1158015612562573d6000803e3d6000fd5b505050505050565b600054610100900460ff166125915760405162461bcd60e51b8152600401610aa490613959565b610f9433611ec9565b60006001600160a01b0384163b1561269057604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906125de903390899088908890600401613a56565b6020604051808303816000875af1925050508015612619575060408051601f3d908101601f1916820190925261261691810190613a89565b60015b612676573d808015612647576040519150601f19603f3d011682016040523d82523d6000602084013e61264c565b606091505b50805160000361266e5760405162461bcd60e51b8152600401610aa4906139cb565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610e5b565b506001610e5b565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106126d75772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612703576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061272157662386f26fc10000830492506010015b6305f5e1008310612739576305f5e100830492506008015b612710831061274d57612710830492506004015b6064831061275f576064830492506002015b600a83106109715760010192915050565b61277a83836127fd565b612787600084848461259a565b610b455760405162461bcd60e51b8152600401610aa4906139cb565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611593908590612988565b6001600160a01b0382166128535760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610aa4565b6000818152606760205260409020546001600160a01b0316156128b85760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610aa4565b6000818152606760205260409020546001600160a01b03161561291d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610aa4565b6001600160a01b038216600081815260686020908152604080832080546001019055848352606790915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60006129dd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612a5d9092919063ffffffff16565b90508051600014806129fe5750808060200190518101906129fe9190613aa6565b610b455760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610aa4565b6060610e5b848460008585600080866001600160a01b03168587604051612a849190613ac3565b60006040518083038185875af1925050503d8060008114612ac1576040519150601f19603f3d011682016040523d82523d6000602084013e612ac6565b606091505b5091509150610e568783838760608315612b41578251600003612b3a576001600160a01b0385163b612b3a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610aa4565b5081610e5b565b610e5b8383815115612b565781518083602001fd5b8060405162461bcd60e51b8152600401610aa49190612cf3565b60405180606001604052806000801916815260200160006001600160401b03168152602001612bb2604051806040016040528060008152602001600081525090565b905290565b82805482825590600052602060002090601f01602090048101928215612c4d5791602002820160005b83821115612c1e57835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302612be0565b8015612c4b5782816101000a81549060ff0219169055600101602081600001049283019260010302612c1e565b505b506123d19291505b808211156123d15760008155600101612c55565b6001600160e01b03198116811461170557600080fd5b600060208284031215612c9157600080fd5b8135612c9c81612c69565b9392505050565b60005b83811015612cbe578181015183820152602001612ca6565b50506000910152565b60008151808452612cdf816020860160208601612ca3565b601f01601f19169290920160200192915050565b602081526000612c9c6020830184612cc7565b600060208284031215612d1857600080fd5b5035919050565b6001600160a01b038116811461170557600080fd5b60008060408385031215612d4757600080fd5b8235612d5281612d1f565b946020939093013593505050565b600060608284031215612d7257600080fd5b50919050565b60008083601f840112612d8a57600080fd5b5081356001600160401b03811115612da157600080fd5b602083019150836020828501011115612db957600080fd5b9250929050565b600080600080600080600060e0888a031215612ddb57600080fd5b612de58989612d60565b96506060880135955060808801356001600160401b0380821115612e0857600080fd5b612e148b838c01612d78565b909750955060a08a01359150612e2982612d1f565b90935060c08901359080821115612e3f57600080fd5b50612e4c8a828b01612d78565b989b979a50959850939692959293505050565b600080600060608486031215612e7457600080fd5b8335612e7f81612d1f565b92506020840135612e8f81612d1f565b929592945050506040919091013590565b803563ffffffff8116811461238e57600080fd5b60008060408385031215612ec757600080fd5b612d5283612ea0565b600080600060608486031215612ee557600080fd5b8335612ef081612d1f565b92506020840135612f0081612d1f565b91506040840135612f1081612d1f565b809150509250925092565b60008060008060608587031215612f3157600080fd5b612f3a85612ea0565b93506020850135925060408501356001600160401b03811115612f5c57600080fd5b612f6887828801612d78565b95989497509550505050565b6000608082019050825182526001600160401b0360208401511660208301526040830151612faf604084018280518252602090810151910152565b5092915050565b634e487b7160e01b600052602160045260246000fd5b60038110612fea57634e487b7160e01b600052602160045260246000fd5b9052565b602081016109718284612fcc565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261302357600080fd5b81356001600160401b038082111561303d5761303d612ffc565b604051601f8301601f19908116603f0116810190828211818310171561306557613065612ffc565b8160405283815286602085880101111561307e57600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000602082840312156130b057600080fd5b81356001600160401b038111156130c657600080fd5b610e5b84828501613012565b80356003811061238e57600080fd5b6000602082840312156130f357600080fd5b612c9c826130d2565b60006020828403121561310e57600080fd5b8135612c9c81612d1f565b60008083601f84011261312b57600080fd5b5081356001600160401b0381111561314257600080fd5b6020830191508360208260051b8501011115612db957600080fd5b600080600080600080600060a0888a03121561317857600080fd5b87356001600160401b038082111561318f57600080fd5b61319b8b838c01613119565b909950975060208a013591506131b082612d1f565b909550604089013590808211156131c657600080fd5b506131d38a828b01612d78565b90955093505060608801356131e781612d1f565b809250506080880135905092959891949750929550565b6000806000806040858703121561321457600080fd5b84356001600160401b038082111561322b57600080fd5b61323788838901613119565b9096509450602087013591508082111561325057600080fd5b50612f6887828801613119565b801515811461170557600080fd5b6000806040838503121561327e57600080fd5b823561328981612d1f565b915060208301356132998161325d565b809150509250929050565b600080600080608085870312156132ba57600080fd5b84356132c581612d1f565b935060208501356132d581612d1f565b92506040850135915060608501356001600160401b038111156132f757600080fd5b61330387828801613012565b91505092959194509250565b60006020828403121561332157600080fd5b612c9c82612ea0565b6000806040838503121561333d57600080fd5b823561334881612d1f565b9150602083013561329981612d1f565b6000806000806080858703121561336e57600080fd5b61337785612ea0565b935060208501356001600160401b038082111561339357600080fd5b61339f88838901613012565b945060408701359150808211156133b557600080fd5b506133c287828801613012565b92505060608501356133d38161325d565b939692955090935050565b815181526020808301519082015260408101610971565b60006060828403121561340757600080fd5b612c9c8383612d60565b600181811c9082168061342557607f821691505b602082108103612d7257634e487b7160e01b600052602260045260246000fd5b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b6001600160a01b038516815260208101849052608081016134b66040830185612fcc565b60ff8316606083015295945050505050565b601f821115610b4557600081815260208120601f850160051c810160208610156134ef5750805b601f850160051c820191505b81811015612562578281556001016134fb565b81516001600160401b0381111561352757613527612ffc565b61353b816135358454613411565b846134c8565b602080601f83116001811461357057600084156135585750858301515b600019600386901b1c1916600185901b178555612562565b600085815260208120601f198616915b8281101561359f57888601518255948401946001909101908401613580565b50858210156135bd5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b6001600160401b038311156135fa576135fa612ffc565b61360e836136088354613411565b836134c8565b6000601f841160018114613642576000851561362a5750838201355b600019600387901b1c1916600186901b17835561154f565b600083815260209020601f19861690835b828110156136735786850135825560209485019460019092019101613653565b50868210156136905760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052601160045260246000fd5b60ff8281168282160390811115610971576109716136a2565b60ff8181168382160190811115610971576109716136a2565b600060ff8216806136fd576136fd6136a2565b6000190192915050565b8082028115828204841417610971576109716136a2565b634e487b7160e01b600052601260045260246000fd5b6000826137435761374361371e565b500490565b60006001820161375a5761375a6136a2565b5060010190565b60008351613773818460208801612ca3565b835190830190613787818360208801612ca3565b01949350505050565b600080600080608085870312156137a657600080fd5b84356137b181612d1f565b9350602085013592506137c6604086016130d2565b9150606085013560ff811681146133d357600080fd5b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6040815263ffffffff8351166040820152602083015160608201526000604084015160a0608084015261385760e0840182612cc7565b90506060850151603f198483030160a08501526138748282612cc7565b60809690960151151560c08501525050506001600160a01b039190911660209091015290565b6000604082840312156138ac57600080fd5b604051604081018181106001600160401b03821117156138ce576138ce612ffc565b604052825181526020928301519281019290925250919050565b6000608082840312156138fa57600080fd5b604051606081016001600160401b03828210818311171561391d5761391d612ffc565b816040528451835260208501519150808216821461393a57600080fd5b50602082015261394d846040850161389a565b60408201529392505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000826139b3576139b361371e565b500690565b80820180821115610971576109716136a2565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060408284031215613a2f57600080fd5b612c9c838361389a565b600060208284031215613a4b57600080fd5b8151612c9c81612d1f565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061174c90830184612cc7565b600060208284031215613a9b57600080fd5b8151612c9c81612c69565b600060208284031215613ab857600080fd5b8151612c9c8161325d565b60008251613ad5818460208701612ca3565b919091019291505056fea26469706673582212206d8ce441a6895bf89d39725853d5e586df5db9ad44fac42c89f0bf9d8fd9593264736f6c63430008140033

Block Transaction Gas Used Reward
view all blocks sequenced

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

Validator Index Block Amount
View All Withdrawals

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