Contract Address Details

0x5776ba3FAa1894B3ab6938Ded9f83bc49712Ca54

Contract Name
GuildV2
Creator
0xa1bcfb–13c684 at 0xadcf8d–6979f4
Balance
0 ADIL
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
31817296
Contract name:
GuildV2




Optimization enabled
true
Compiler version
v0.8.2+commit.661d1103




Optimization runs
999999
Verified at
2024-06-25 06:37:11.913469Z

contracts/farm-v2/GuildV2.sol

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

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

import "../libraries/BytesLibrary.sol";
import "../libraries/StringLibrary.sol";
import "../interfaces/ITransporter.sol";

import "../abtracts/OwnerOperator.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

contract GuildV2 is ERC721Holder, OwnerOperator, PausableUpgradeable, ReentrancyGuardUpgradeable {
    using SafeERC20 for IERC20;
    using SafeMath for uint256;
    using StringLibrary for string;
    using BytesLibrary for bytes32;

    struct LeaseData {
        address owner;
        address horseAddress;
        uint256[] horseId;
        uint256 blockExpired;
        string nonce;
        uint8 v;
        bytes32 r;
        bytes32 s;
    }

    struct SavedLease {
        address owner;
        address horseAddress;
        uint256 horseId;
        uint256 blockExpired;
    }

    struct WithdrawData {
        address owner;
        address horseAddress;
        uint256[] horseId;
        uint256 blockExpired;
        string nonce;
        uint8 v;
        bytes32 r;
        bytes32 s;
    }

    struct SavedWithdraw {
        address owner;
        uint256 horseId;
        uint256 blockExpired;
    }

    // Mapping from nft token id to owner of token
    mapping(uint256 => address) public ownerOf;

    // Mapping from sign message to checking value
    mapping(bytes32 => bool) public leaseCompleted;
    // Mapping from nonce to leaseData
    mapping(string => SavedLease) public leaseData;
    // Mapping from user address to lease count
    mapping(address => uint256) public leaseCountOf;
    // Mapping from user address and lease index to lease nonce
    mapping(address => mapping(uint256 => string)) public leaseNoneOf;

    // Mapping from sign message to checking value
    mapping(bytes32 => bool) public withdrawCompleted;
    // Mapping from nonce to withdrawData
    mapping(string => SavedWithdraw) public withdrawData;
    // Mapping from user address to withdraw count
    mapping(address => uint256) public withdrawCountOf;
    // Mapping from user address and withdraw index to withdraw nonce
    mapping(address => mapping(uint256 => string)) public withdrawNoneOf;
    //Mapping verify horsenft
    mapping(address => bool) public isHorseNFT;

    event Lease(address indexed owner, address indexed signer, uint256[] indexed horseId, string nonce);
    event Withdraw(address indexed owner, address indexed signer, uint256[] indexed horseId, string nonce);
    event Signer(address signers);

    ITransporter public transporter;

    function init() external initializer {
        super.initialize();
        super.__Pausable_init();
    }
    function pause() external virtual onlyOwner {
        _pause();
    }

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

    function setTransporter(address _transporter) external virtual onlyOwner {
        transporter = ITransporter(_transporter);
    }

    function setHorseNFT(address _horseNFT) external virtual operatorOrOwner {
        isHorseNFT[_horseNFT] = true;
    }

    /**
     * @dev withdraw token that user mistakenly transferred.
     */
    function withdrawToken(address token) external virtual nonReentrant onlyOwner {
        uint256 amount = IERC20(token).balanceOf(address(this));
        require(amount > 0, "GuildV2: zero out amount");
        IERC20(token).safeTransfer(msg.sender, amount);
    }

    /**
     * @dev withdraw nft that user mistakenly transferred.
     */
    function withdrawNFT(address token, uint256 tokenId) external virtual onlyOwner {
        require(!isHorseNFT[token] || ownerOf[tokenId] == address(0), "GuildV2: horse belong to contract");
        IERC721(token).safeTransferFrom(address(this), msg.sender, tokenId);
    }

    /**
     * @dev user lease horse.
     */
    function lease(LeaseData memory data) external virtual whenNotPaused {
        require(isHorseNFT[data.horseAddress], "GuildV2: invalid horse address");
        (bytes32 message, address signer) = _verifyLease(data);
        leaseCompleted[message] = true;
        for (uint256 i = 0; i < data.horseId.length; i++) {
            require(msg.sender == IERC721(data.horseAddress).ownerOf(data.horseId[i]), "GuildV2: sender is not owner");
            leaseData[data.nonce] = SavedLease({
                owner: data.owner,
                horseAddress: data.horseAddress,
                horseId: data.horseId[i],
                blockExpired: data.blockExpired
            });
            leaseNoneOf[data.owner][leaseCountOf[data.owner]] = data.nonce;
            leaseCountOf[data.owner] = leaseCountOf[data.owner].add(1);

            ownerOf[data.horseId[i]] = data.owner;

            transporter.safeTransferNFT721From(data.horseAddress, data.owner, address(this), data.horseId[i]);
        }
        emit Lease(data.owner, signer, data.horseId, data.nonce);
    }

    function _verifyLease(LeaseData memory data) internal view returns (bytes32, address) {
        bytes32 message = keccak256(
            abi.encode(
                address(this),
                "Lease",
                data.owner,
                data.horseAddress,
                data.horseId,
                data.blockExpired,
                data.nonce
            )
        );
        address signer = message.toString().recover(data.v, data.r, data.s);
        require(operators[signer], "GuildV2: lease not verify");
        require(block.number < data.blockExpired, "GuildV2: lease expired");
        require(!leaseCompleted[message], "GuildV2: lease completed");
        require(leaseData[data.nonce].owner == address(0), "GuildV2: nonce existed");
        return (message, signer);
    }

    /**
     * @dev user withdraw horse.
     */
    function withdraw(WithdrawData memory data) external virtual nonReentrant whenNotPaused {
        require(msg.sender == data.owner, "GuildV2: sender is not owner");
        require(isHorseNFT[data.horseAddress], "GuildV2: invalid horse address");

        (bytes32 message, address signer) = _verifyWithdraw(data);
        for (uint256 i = 0; i < data.horseId.length; i++) {
            require(ownerOf[data.horseId[i]] != address(0), "GuildV2: horse withdrawed");
            require(msg.sender == ownerOf[data.horseId[i]], "GuildV2: sender is not horse owner");

            withdrawCompleted[message] = true;
            withdrawData[data.nonce] = SavedWithdraw({
                owner: data.owner,
                horseId: data.horseId[i],
                blockExpired: data.blockExpired
            });
            withdrawNoneOf[msg.sender][withdrawCountOf[msg.sender]] = data.nonce;
            withdrawCountOf[msg.sender] = withdrawCountOf[msg.sender].add(1);

            delete ownerOf[data.horseId[i]];

            IERC721(data.horseAddress).safeTransferFrom(address(this), msg.sender, data.horseId[i]);
        }
        emit Withdraw(msg.sender, signer, data.horseId, data.nonce);
    }

    function _verifyWithdraw(WithdrawData memory data) internal view returns (bytes32, address) {
        bytes32 message = keccak256(
            abi.encode(
                address(this),
                "Withdraw",
                data.owner,
                data.horseAddress,
                data.horseId,
                data.blockExpired,
                data.nonce
            )
        );
        address signer = message.toString().recover(data.v, data.r, data.s);
        require(operators[signer], "GuildV2: withdraw not verify");
        require(block.number < data.blockExpired, "GuildV2: withdraw expired");
        require(!withdrawCompleted[message], "GuildV2: withdraw completed");
        require(withdrawData[data.nonce].blockExpired == 0, "GuildV2: nonce existed");
        return (message, signer);
    }

    function leaseGarbageCollecting(string[] calldata nonce) external operatorOrOwner {
        for (uint256 i = 0; i < nonce.length; i++) {
            delete leaseData[nonce[i]];
        }
    }

    function withdrawGarbageCollecting(string[] calldata nonce) external operatorOrOwner {
        for (uint256 i = 0; i < nonce.length; i++) {
            delete withdrawData[nonce[i]];
        }
    }
}
        

@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol

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

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import {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;
}
          

@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol

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

pragma solidity ^0.8.2;

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

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

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

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

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

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

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

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

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

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

@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

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

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

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

@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol

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

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

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

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

    uint256 private _status;

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

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

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

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

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

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

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

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

@openzeppelin/contracts-upgradeable/token/ERC721/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);
}
          

@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol

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

pragma solidity ^0.8.0;

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

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

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

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

@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol

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

@openzeppelin/contracts/token/ERC20/IERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

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

@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC20.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;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

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

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    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");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @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");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}
          

@openzeppelin/contracts/token/ERC721/IERC721.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, 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 be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

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

@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol

// SPDX-License-Identifier: MIT

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 IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}
          

@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721Receiver.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721Holder is IERC721Receiver {
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}
          

@openzeppelin/contracts/utils/Address.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
          

@openzeppelin/contracts/utils/introspection/IERC165.sol

// SPDX-License-Identifier: MIT

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

@openzeppelin/contracts/utils/math/SafeMath.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

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

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

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

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}
          

contracts/abtracts/OwnerOperator.sol

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

abstract contract OwnerOperator is OwnableUpgradeable {
    mapping(address => bool) public operators;

    function initialize() public initializer {
        __Context_init_unchained();
        __Ownable_init_unchained();
    }

    modifier operatorOrOwner() {
        require(operators[msg.sender] || owner() == msg.sender, "OwnerOperator: !operator, !owner");
        _;
    }

    modifier onlyOperator() {
        require(operators[msg.sender], "OwnerOperator: !operator");
        _;
    }

    function addOperator(address operator) external virtual onlyOwner {
        require(operator != address(0), "OwnerOperator: operator is the zero address");
        operators[operator] = true;
    }

    function removeOperator(address operator) external virtual onlyOwner {
        require(operator != address(0), "OwnerOperator: operator is the zero address");
        operators[operator] = false;
    }
}
          

contracts/interfaces/ITransporter.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface ITransporter {
    function safeTransferTokenFrom(
        address token_,
        address from_,
        address to_,
        uint256 amount_
    ) external;

    function safeTransferNFT721From(
        address token_,
        address from_,
        address to_,
        uint256 tokenId_
    ) external;

    function safeBurnNFT721From(address token_, uint256 tokenId_) external;

    function safeTransferNFT1155From(
        address token_,
        address from_,
        address to_,
        uint256 tokenId_,
        uint256 amount_
    ) external;

    function safeBurnNFT1155From(
        address token_,
        address from_,
        uint256 tokenId_,
        uint256 amount_
    ) external;

    function safeBurnBatchNFT1155From(
        address token_,
        address from_,
        uint256[] memory tokenId_,
        uint256[] memory amount_
    ) external;
}
          

contracts/libraries/BytesLibrary.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev BytesLibrary operations.
 */
library BytesLibrary {
    function toString(bytes32 value) internal pure returns (string memory) {
        bytes memory alphabet = "0123456789abcdef";
        bytes memory str = new bytes(64);
        for (uint256 i = 0; i < 32; i++) {
            str[i * 2] = alphabet[uint8(value[i] >> 4)];
            str[1 + i * 2] = alphabet[uint8(value[i] & 0x0f)];
        }
        return string(str);
    }
}
          

contracts/libraries/StringLibrary.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./UintLibrary.sol";

library StringLibrary {
    using UintLibrary for uint256;

    function append(string memory a, string memory b) internal pure returns (string memory) {
        bytes memory ba = bytes(a);
        bytes memory bb = bytes(b);
        bytes memory bab = new bytes(ba.length + bb.length);
        uint256 k = 0;
        for (uint256 i = 0; i < ba.length; i++) bab[k++] = ba[i];
        for (uint256 i = 0; i < bb.length; i++) bab[k++] = bb[i];
        return string(bab);
    }

    function append(
        string memory a,
        string memory b,
        string memory c
    ) internal pure returns (string memory) {
        bytes memory ba = bytes(a);
        bytes memory bb = bytes(b);
        bytes memory bc = bytes(c);
        bytes memory bbb = new bytes(ba.length + bb.length + bc.length);
        uint256 k = 0;
        for (uint256 i = 0; i < ba.length; i++) bbb[k++] = ba[i];
        for (uint256 i = 0; i < bb.length; i++) bbb[k++] = bb[i];
        for (uint256 i = 0; i < bc.length; i++) bbb[k++] = bc[i];
        return string(bbb);
    }

    function recover(
        string memory message,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        bytes memory msgBytes = bytes(message);
        bytes memory fullMessage = concat(
            bytes("\x19Ethereum Signed Message:\n"),
            bytes(msgBytes.length.toString()),
            msgBytes,
            new bytes(0),
            new bytes(0),
            new bytes(0),
            new bytes(0)
        );
        return ecrecover(keccak256(fullMessage), v, r, s);
    }

    function concat(
        bytes memory ba,
        bytes memory bb,
        bytes memory bc,
        bytes memory bd,
        bytes memory be,
        bytes memory bf,
        bytes memory bg
    ) internal pure returns (bytes memory) {
        bytes memory resultBytes = new bytes(ba.length + bb.length + bc.length + bd.length + be.length + bf.length + bg.length);
        uint256 k = 0;
        for (uint256 i = 0; i < ba.length; i++) resultBytes[k++] = ba[i];
        for (uint256 i = 0; i < bb.length; i++) resultBytes[k++] = bb[i];
        for (uint256 i = 0; i < bc.length; i++) resultBytes[k++] = bc[i];
        for (uint256 i = 0; i < bd.length; i++) resultBytes[k++] = bd[i];
        for (uint256 i = 0; i < be.length; i++) resultBytes[k++] = be[i];
        for (uint256 i = 0; i < bf.length; i++) resultBytes[k++] = bf[i];
        for (uint256 i = 0; i < bg.length; i++) resultBytes[k++] = bg[i];
        return resultBytes;
    }
}
          

contracts/libraries/UintLibrary.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";

library UintLibrary {
    using SafeMath for uint256;

    function toString(uint256 i) internal pure returns (string memory) {
        if (i == 0) {
            return "0";
        }

        uint256 j = i;
        uint256 len;

        while (j != 0) {
            len++;
            j /= 10;
        }

        bytes memory bstr = new bytes(len);

        for (uint256 k = len; k > 0; k--) {
            bstr[k - 1] = bytes1(uint8(48 + (i % 10)));
            i /= 10;
        }

        return string(bstr);
    }

    function bp(uint256 value, uint256 bpValue) internal pure returns (uint256) {
        return value.mul(bpValue).div(10000);
    }
}
          

Contract ABI

[{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"Lease","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":true},{"type":"uint256[]","name":"horseId","internalType":"uint256[]","indexed":true},{"type":"string","name":"nonce","internalType":"string","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Signer","inputs":[{"type":"address","name":"signers","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"signer","internalType":"address","indexed":true},{"type":"uint256[]","name":"horseId","internalType":"uint256[]","indexed":true},{"type":"string","name":"nonce","internalType":"string","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addOperator","inputs":[{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"init","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isHorseNFT","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"lease","inputs":[{"type":"tuple","name":"data","internalType":"struct GuildV2.LeaseData","components":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"horseAddress","internalType":"address"},{"type":"uint256[]","name":"horseId","internalType":"uint256[]"},{"type":"uint256","name":"blockExpired","internalType":"uint256"},{"type":"string","name":"nonce","internalType":"string"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"leaseCompleted","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"leaseCountOf","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"horseAddress","internalType":"address"},{"type":"uint256","name":"horseId","internalType":"uint256"},{"type":"uint256","name":"blockExpired","internalType":"uint256"}],"name":"leaseData","inputs":[{"type":"string","name":"","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"leaseGarbageCollecting","inputs":[{"type":"string[]","name":"nonce","internalType":"string[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"leaseNoneOf","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"onERC721Received","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"bytes","name":"","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"operators","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"ownerOf","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeOperator","inputs":[{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setHorseNFT","inputs":[{"type":"address","name":"_horseNFT","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTransporter","inputs":[{"type":"address","name":"_transporter","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ITransporter"}],"name":"transporter","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"tuple","name":"data","internalType":"struct GuildV2.WithdrawData","components":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"horseAddress","internalType":"address"},{"type":"uint256[]","name":"horseId","internalType":"uint256[]"},{"type":"uint256","name":"blockExpired","internalType":"uint256"},{"type":"string","name":"nonce","internalType":"string"},{"type":"uint8","name":"v","internalType":"uint8"},{"type":"bytes32","name":"r","internalType":"bytes32"},{"type":"bytes32","name":"s","internalType":"bytes32"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"withdrawCompleted","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdrawCountOf","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"horseId","internalType":"uint256"},{"type":"uint256","name":"blockExpired","internalType":"uint256"}],"name":"withdrawData","inputs":[{"type":"string","name":"","internalType":"string"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawGarbageCollecting","inputs":[{"type":"string[]","name":"nonce","internalType":"string[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawNFT","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"withdrawNoneOf","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawToken","inputs":[{"type":"address","name":"token","internalType":"address"}]}]
            

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106101e55760003560e01c8063715018a61161010f5780639c8dadae116100a2578063e1c7392a11610071578063e1c7392a146105df578063e42b0212146105e7578063f2f4062b14610607578063f2fde38b1461061a576101e5565b80639c8dadae14610583578063a8ed22a314610596578063ac8a584a146105b9578063b2613df1146105cc576101e5565b806389476069116100de578063894760691461051f5780638da5cb5b146105325780639870d7fe1461055057806399725af114610563576101e5565b8063715018a6146104745780637a2ef48b1461047c5780638129fc1c1461050f5780638456cb5914610517576101e5565b806332a46144116101875780636088e93a116101565780636088e93a146103e0578063629a8a9c146103f35780636352211e14610406578063711a8f4f14610461576101e5565b806332a46144146103275780633f4ba83a1461034a5780635c975abb14610352578063604ff5a41461035d576101e5565b806313e7c9d8116101c357806313e7c9d814610274578063150b7a021461029757806317c6395d146102ff5780631ed924f114610312576101e5565b8063037a4a4a146101ea57806304d45b491461021357806307d0ef9714610246575b600080fd5b6101fd6101f8366004613fc6565b61062d565b60405161020a9190614310565b60405180910390f35b610236610221366004614080565b60cb6020526000908152604090205460ff1681565b604051901515815260200161020a565b610266610254366004613f11565b60d16020526000908152604090205481565b60405190815260200161020a565b610236610282366004613f11565b60656020526000908152604090205460ff1681565b6102ce6102a5366004613f49565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff00000000000000000000000000000000000000000000000000000000909116815260200161020a565b6101fd61030d366004613fc6565b6106d2565b610325610320366004613f11565b6106f6565b005b610236610335366004613f11565b60d36020526000908152604090205460ff1681565b610325610801565b60665460ff16610236565b6103ae61036b366004614098565b805160208183018101805160d08252928201919093012091528054600182015460029092015473ffffffffffffffffffffffffffffffffffffffff909116919083565b6040805173ffffffffffffffffffffffffffffffffffffffff909416845260208401929092529082015260600161020a565b6103256103ee366004613fc6565b610813565b6103256104013660046140cb565b61098e565b61043c610414366004614080565b60ca6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161020a565b61032561046f3660046140cb565b61100d565b6103256116ed565b6104d761048a366004614098565b80518082016020908101805160cc82529282019190930120915280546001820154600283015460039093015473ffffffffffffffffffffffffffffffffffffffff92831693919092169184565b6040805173ffffffffffffffffffffffffffffffffffffffff958616815294909316602085015291830152606082015260800161020a565b6103256116ff565b61032561189f565b61032561052d366004613f11565b6118af565b60335473ffffffffffffffffffffffffffffffffffffffff1661043c565b61032561055e366004613f11565b6119f7565b610266610571366004613f11565b60cd6020526000908152604090205481565b610325610591366004613f11565b611af1565b6102366105a4366004614080565b60cf6020526000908152604090205460ff1681565b6103256105c7366004613f11565b611b40565b6103256105da366004613ff1565b611c37565b610325611daf565b60d45461043c9073ffffffffffffffffffffffffffffffffffffffff1681565b610325610615366004613ff1565b611eea565b610325610628366004613f11565b61206a565b60d260209081526000928352604080842090915290825290208054610651906144c1565b80601f016020809104026020016040519081016040528092919081815260200182805461067d906144c1565b80156106ca5780601f1061069f576101008083540402835291602001916106ca565b820191906000526020600020905b8154815290600101906020018083116106ad57829003601f168201915b505050505081565b60ce60209081526000928352604080842090915290825290208054610651906144c1565b3360009081526065602052604090205460ff168061074757503361072f60335473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16145b6107b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e65724f70657261746f723a20216f70657261746f722c20216f776e657260448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff16600090815260d36020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b61080961211e565b61081161219f565b565b61081b61211e565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260d3602052604090205460ff1615806108725750600081815260ca602052604090205473ffffffffffffffffffffffffffffffffffffffff16155b6108fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4775696c6456323a20686f7273652062656c6f6e6720746f20636f6e7472616360448201527f740000000000000000000000000000000000000000000000000000000000000060648201526084016107a9565b6040517f42842e0e0000000000000000000000000000000000000000000000000000000081523060048201523360248201526044810182905273ffffffffffffffffffffffffffffffffffffffff8316906342842e0e90606401600060405180830381600087803b15801561097257600080fd5b505af1158015610986573d6000803e3d6000fd5b505050505050565b61099661221c565b60208082015173ffffffffffffffffffffffffffffffffffffffff16600090815260d3909152604090205460ff16610a2a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4775696c6456323a20696e76616c696420686f7273652061646472657373000060448201526064016107a9565b600080610a3683612289565b600082815260cb6020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905591935091505b836040015151811015610f8057836020015173ffffffffffffffffffffffffffffffffffffffff16636352211e85604001518381518110610add577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516040518263ffffffff1660e01b8152600401610b0391815260200190565b60206040518083038186803b158015610b1b57600080fd5b505afa158015610b2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b539190613f2d565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610be7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4775696c6456323a2073656e646572206973206e6f74206f776e65720000000060448201526064016107a9565b6040518060800160405280856000015173ffffffffffffffffffffffffffffffffffffffff168152602001856020015173ffffffffffffffffffffffffffffffffffffffff16815260200185604001518381518110610c6f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101518152602001856060015181525060cc8560800151604051610c9891906141d0565b9081526040805160209281900383019020835181547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff92831617835585850151600184018054909216908316179055848301516002830155606090940151600390910155608087015187518416600090815260ce84528281208951909516815260cd845282812054815293835292208251610d519391929190910190613c82565b50835173ffffffffffffffffffffffffffffffffffffffff16600090815260cd6020526040902054610d84906001612535565b845173ffffffffffffffffffffffffffffffffffffffff16600090815260cd602052604080822092909255855191860151805160ca92919085908110610df3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060d460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a5bc64ca856020015186600001513088604001518681518110610ecd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101516040517fffffffff0000000000000000000000000000000000000000000000000000000060e087901b16815273ffffffffffffffffffffffffffffffffffffffff94851660048201529284166024840152921660448201526064810191909152608401600060405180830381600087803b158015610f5557600080fd5b505af1158015610f69573d6000803e3d6000fd5b505050508080610f7890614515565b915050610a73565b508260400151604051610f93919061419a565b60405180910390208173ffffffffffffffffffffffffffffffffffffffff16846000015173ffffffffffffffffffffffffffffffffffffffff167fc601abf905069e172d7a18616f010fb28b07d108a58f97364666967536f4122286608001516040516110009190614310565b60405180910390a4505050565b611015612548565b61101d61221c565b805173ffffffffffffffffffffffffffffffffffffffff16331461109d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4775696c6456323a2073656e646572206973206e6f74206f776e65720000000060448201526064016107a9565b60208082015173ffffffffffffffffffffffffffffffffffffffff16600090815260d3909152604090205460ff16611131576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4775696c6456323a20696e76616c696420686f7273652061646472657373000060448201526064016107a9565b60008061113d836125bc565b9150915060005b83604001515181101561165a57600073ffffffffffffffffffffffffffffffffffffffff1660ca6000866040015184815181106111aa577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910181015182528101919091526040016000205473ffffffffffffffffffffffffffffffffffffffff161415611243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4775696c6456323a20686f72736520776974686472617765640000000000000060448201526064016107a9565b60ca600085604001518381518110611284577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910181015182528101919091526040016000205473ffffffffffffffffffffffffffffffffffffffff163314611343576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4775696c6456323a2073656e646572206973206e6f7420686f727365206f776e60448201527f657200000000000000000000000000000000000000000000000000000000000060648201526084016107a9565b600083815260cf602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558151606081018352865173ffffffffffffffffffffffffffffffffffffffff16815291860151805191830191849081106113e1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101518152602001856060015181525060d0856080015160405161140a91906141d0565b9081526040805160209281900383019020835181547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90911617815583830151600182015592810151600290930192909255608086015133600090815260d2835283812060d1845284822054825283529290922082516114a69391929190910190613c82565b5033600090815260d160205260409020546114c2906001612535565b33600090815260d160205260408082209290925590850151805160ca92919084908110611518577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055836020015173ffffffffffffffffffffffffffffffffffffffff166342842e0e3033876040015185815181106115b0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60209081029190910101516040517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b16815273ffffffffffffffffffffffffffffffffffffffff93841660048201529290911660248301526044820152606401600060405180830381600087803b15801561162f57600080fd5b505af1158015611643573d6000803e3d6000fd5b50505050808061165290614515565b915050611144565b50826040015160405161166d919061419a565b60405180910390208173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe33d9381fffe36a88d02e5660b8002abde502aa4d0709f51f793bca6fc4fe23686608001516040516116d69190614310565b60405180910390a450506116ea6001609855565b50565b6116f561211e565b610811600061282c565b600054610100900460ff161580801561171f5750600054600160ff909116105b80611740575061172e306128a3565b158015611740575060005460ff166001145b6117cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016107a9565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561182a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6118326128c3565b61183a61295a565b80156116ea57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6118a761211e565b6108116129fa565b6118b7612548565b6118bf61211e565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a082319060240160206040518083038186803b15801561192757600080fd5b505afa15801561193b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195f91906140fe565b9050600081116119cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4775696c6456323a207a65726f206f757420616d6f756e74000000000000000060448201526064016107a9565b6119ec73ffffffffffffffffffffffffffffffffffffffff83163383612a55565b506116ea6001609855565b6119ff61211e565b73ffffffffffffffffffffffffffffffffffffffff8116611aa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4f776e65724f70657261746f723a206f70657261746f7220697320746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084016107a9565b73ffffffffffffffffffffffffffffffffffffffff16600090815260656020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b611af961211e565b60d480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b611b4861211e565b73ffffffffffffffffffffffffffffffffffffffff8116611beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4f776e65724f70657261746f723a206f70657261746f7220697320746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084016107a9565b73ffffffffffffffffffffffffffffffffffffffff16600090815260656020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b3360009081526065602052604090205460ff1680611c88575033611c7060335473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16145b611cee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e65724f70657261746f723a20216f70657261746f722c20216f776e657260448201526064016107a9565b60005b81811015611daa5760d0838383818110611d34577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050602002810190611d469190614323565b604051611d549291906141ec565b90815260405190819003602001902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016815560006001820181905560029091015580611da281614515565b915050611cf1565b505050565b600054610100900460ff1615808015611dcf5750600054600160ff909116105b80611df05750611dde306128a3565b158015611df0575060005460ff166001145b611e7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016107a9565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015611eda57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b611ee26116ff565b61183a612ae2565b3360009081526065602052604090205460ff1680611f3b575033611f2360335473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16145b611fa1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e65724f70657261746f723a20216f70657261746f722c20216f776e657260448201526064016107a9565b60005b81811015611daa5760cc838383818110611fe7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050602002810190611ff99190614323565b6040516120079291906141ec565b90815260405190819003602001902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000908116825560018201805490911690556000600282018190556003909101558061206281614515565b915050611fa4565b61207261211e565b73ffffffffffffffffffffffffffffffffffffffff8116612115576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107a9565b6116ea8161282c565b60335473ffffffffffffffffffffffffffffffffffffffff163314610811576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107a9565b6121a7612b81565b606680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b60665460ff1615610811576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a207061757365640000000000000000000000000000000060448201526064016107a9565b600080600030846000015185602001518660400151876060015188608001516040516020016122bd969594939291906141fc565b60405160208183030381529060405280519060200120905060006122fa8560a001518660c001518760e001516122f286612bed565b929190612ebc565b73ffffffffffffffffffffffffffffffffffffffff811660009081526065602052604090205490915060ff1661238c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4775696c6456323a206c65617365206e6f74207665726966790000000000000060448201526064016107a9565b846060015143106123f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4775696c6456323a206c6561736520657870697265640000000000000000000060448201526064016107a9565b600082815260cb602052604090205460ff1615612472576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4775696c6456323a206c6561736520636f6d706c65746564000000000000000060448201526064016107a9565b600073ffffffffffffffffffffffffffffffffffffffff1660cc866080015160405161249e91906141d0565b9081526040519081900360200190205473ffffffffffffffffffffffffffffffffffffffff161461252b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4775696c6456323a206e6f6e636520657869737465640000000000000000000060448201526064016107a9565b9092509050915091565b600061254182846143dc565b9392505050565b600260985414156125b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107a9565b6002609855565b600080600030846000015185602001518660400151876060015188608001516040516020016125f09695949392919061429a565b60405160208183030381529060405280519060200120905060006126258560a001518660c001518760e001516122f286612bed565b73ffffffffffffffffffffffffffffffffffffffff811660009081526065602052604090205490915060ff166126b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4775696c6456323a207769746864726177206e6f74207665726966790000000060448201526064016107a9565b84606001514310612724576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4775696c6456323a20776974686472617720657870697265640000000000000060448201526064016107a9565b600082815260cf602052604090205460ff161561279d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4775696c6456323a20776974686472617720636f6d706c65746564000000000060448201526064016107a9565b60d085608001516040516127b191906141d0565b90815260200160405180910390206002015460001461252b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4775696c6456323a206e6f6e636520657869737465640000000000000000000060448201526064016107a9565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b73ffffffffffffffffffffffffffffffffffffffff81163b15155b919050565b600054610100900460ff16610811576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016107a9565b600054610100900460ff166129f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016107a9565b6108113361282c565b612a0261221c565b606680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586121f23390565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052611daa908490612fcf565b600054610100900460ff16612b79576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016107a9565b6108116130db565b60665460ff16610811576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f742070617573656400000000000000000000000060448201526064016107a9565b604080518082018252601081527f30313233343536373839616263646566000000000000000000000000000000006020820152815182815260608181018452926000919060208201818036833701905050905060005b6020811015612eb457826004868360208110612c88577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916901c60f81c60ff1681518110612ced577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001682612d20836002614408565b81518110612d57577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082858260208110612dc0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b825191901a600f16908110612dfe577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff000000000000000000000000000000000000000000000000000000000000001682612e31836002614408565b612e3c9060016143dc565b81518110612e73577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080612eac81614515565b915050612c43565b509392505050565b6000808590506000612f346040518060400160405280601a81526020017f19457468657265756d205369676e6564204d6573736167653a0a000000000000815250612f07845161319c565b60408051600080825260208201818152828401828152606084019283526080840190945288939091613331565b90506001818051906020012087878760405160008152602001604052604051612f79949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa158015612f9b573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015198975050505050505050565b6000613031826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613a989092919063ffffffff16565b805190915015611daa578080602001905181019061304f9190614060565b611daa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107a9565b600054610100900460ff16613172576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016107a9565b606680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b6060816131dd575060408051808201909152600181527f300000000000000000000000000000000000000000000000000000000000000060208201526128be565b8160005b811561320757806131f181614515565b91506132009050600a836143f4565b91506131e1565b60008167ffffffffffffffff811115613249577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613273576020820181803683370190505b509050815b801561332857613289600a8761454e565b6132949060306143dc565b60f81b826132a3600184614445565b815181106132da577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350613314600a876143f4565b9550806133208161448c565b915050613278565b50949350505050565b6060600082518451865188518a518c518e5161334d91906143dc565b61335791906143dc565b61336191906143dc565b61336b91906143dc565b61337591906143dc565b61337f91906143dc565b67ffffffffffffffff8111156133be577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f1916602001820160405280156133e8576020820181803683370190505b5090506000805b8a518110156134dd578a8181518110613431577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361346381614515565b94508151811061349c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806134d581614515565b9150506133ef565b5060005b89518110156135cf57898181518110613523577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361355581614515565b94508151811061358e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806135c781614515565b9150506134e1565b5060005b88518110156136c157888181518110613615577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361364781614515565b945081518110613680577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806136b981614515565b9150506135d3565b5060005b87518110156137b357878181518110613707577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361373981614515565b945081518110613772577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806137ab81614515565b9150506136c5565b5060005b86518110156138a5578681815181106137f9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361382b81614515565b945081518110613864577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061389d81614515565b9150506137b7565b5060005b8551811015613997578581815181106138eb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff0000000000000000000000000000000000000000000000000000000000000016838361391d81614515565b945081518110613956577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061398f81614515565b9150506138a9565b5060005b8451811015613a89578481815181106139dd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b01602001517fff00000000000000000000000000000000000000000000000000000000000000168383613a0f81614515565b945081518110613a48577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080613a8181614515565b91505061399b565b50909998505050505050505050565b6060613aa78484600085613aaf565b949350505050565b606082471015613b41576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107a9565b843b613ba9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107a9565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613bd291906141d0565b60006040518083038185875af1925050503d8060008114613c0f576040519150601f19603f3d011682016040523d82523d6000602084013e613c14565b606091505b5091509150613c24828286613c2f565b979650505050505050565b60608315613c3e575081612541565b825115613c4e5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a99190614310565b828054613c8e906144c1565b90600052602060002090601f016020900481019282613cb05760008555613cf6565b82601f10613cc957805160ff1916838001178555613cf6565b82800160010185558215613cf6579182015b82811115613cf6578251825591602001919060010190613cdb565b50613d02929150613d06565b5090565b5b80821115613d025760008155600101613d07565b600067ffffffffffffffff831115613d3557613d356145c0565b613d6660207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8601160161438d565b9050828152838383011115613d7a57600080fd5b828260208301376000602084830101529392505050565b80356128be816145ef565b600082601f830112613dac578081fd5b8135602067ffffffffffffffff821115613dc857613dc86145c0565b808202613dd682820161438d565b838152828101908684018388018501891015613df0578687fd5b8693505b85841015613e12578035835260019390930192918401918401613df4565b50979650505050505050565b600082601f830112613e2e578081fd5b61254183833560208501613d1b565b6000610100808385031215613e50578182fd5b613e598161438d565b915050613e6582613d91565b8152613e7360208301613d91565b6020820152604082013567ffffffffffffffff80821115613e9357600080fd5b613e9f85838601613d9c565b6040840152606084013560608401526080840135915080821115613ec257600080fd5b50613ecf84828501613e1e565b608083015250613ee160a08301613f00565b60a082015260c082013560c082015260e082013560e082015292915050565b803560ff811681146128be57600080fd5b600060208284031215613f22578081fd5b8135612541816145ef565b600060208284031215613f3e578081fd5b8151612541816145ef565b60008060008060808587031215613f5e578283fd5b8435613f69816145ef565b93506020850135613f79816145ef565b925060408501359150606085013567ffffffffffffffff811115613f9b578182fd5b8501601f81018713613fab578182fd5b613fba87823560208401613d1b565b91505092959194509250565b60008060408385031215613fd8578182fd5b8235613fe3816145ef565b946020939093013593505050565b60008060208385031215614003578182fd5b823567ffffffffffffffff8082111561401a578384fd5b818501915085601f83011261402d578384fd5b81358181111561403b578485fd5b866020808302850101111561404e578485fd5b60209290920196919550909350505050565b600060208284031215614071578081fd5b81518015158114612541578182fd5b600060208284031215614091578081fd5b5035919050565b6000602082840312156140a9578081fd5b813567ffffffffffffffff8111156140bf578182fd5b613aa784828501613e1e565b6000602082840312156140dc578081fd5b813567ffffffffffffffff8111156140f2578182fd5b613aa784828501613e3d565b60006020828403121561410f578081fd5b5051919050565b6000815180845260208085019450808401835b8381101561414557815187529582019590820190600101614129565b509495945050505050565b6000815180845261416881602086016020860161445c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b815160009082906020808601845b838110156141c4578151855293820193908201906001016141a8565b50929695505050505050565b600082516141e281846020870161445c565b9190910192915050565b6000828483379101908152919050565b600073ffffffffffffffffffffffffffffffffffffffff808916835260e06020840152600560e08401527f4c656173650000000000000000000000000000000000000000000000000000006101008401526101208189166040850152818816606085015280608085015261427281850188614116565b9150508460a084015282810360c084015261428d8185614150565b9998505050505050505050565b600073ffffffffffffffffffffffffffffffffffffffff808916835260e06020840152600860e08401527f57697468647261770000000000000000000000000000000000000000000000006101008401526101208189166040850152818816606085015280608085015261427281850188614116565b6000602082526125416020830184614150565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614357578283fd5b83018035915067ffffffffffffffff821115614371578283fd5b60200191503681900382131561438657600080fd5b9250929050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156143d4576143d46145c0565b604052919050565b600082198211156143ef576143ef614562565b500190565b60008261440357614403614591565b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561444057614440614562565b500290565b60008282101561445757614457614562565b500390565b60005b8381101561447757818101518382015260200161445f565b83811115614486576000848401525b50505050565b60008161449b5761449b614562565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b6002810460018216806144d557607f821691505b6020821081141561450f577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561454757614547614562565b5060010190565b60008261455d5761455d614591565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146116ea57600080fdfea2646970667358221220534b1aa8fe181f580f95b715decca214500e9d7b35c7fef27a8a747a14281a7264736f6c63430008020033