ETH Price: $2,924.14 (+4.66%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Unstake NFT188505742023-12-23 19:23:59320 days ago1703359439IN
0x07b0bE85...79d2f1400
0 ETH0.0009761120.5905966
Transfer Ownersh...188403822023-12-22 9:05:59322 days ago1703235959IN
0x07b0bE85...79d2f1400
0 ETH0.0008984531.44313306
Transfer Ownersh...188398512023-12-22 7:18:35322 days ago1703229515IN
0x07b0bE85...79d2f1400
0 ETH0.001039136.35020558
Stake NFT184636082023-10-30 14:36:11374 days ago1698676571IN
0x07b0bE85...79d2f1400
0 ETH0.0022961129.71977132
Stake NFT184532352023-10-29 3:42:23376 days ago1698550943IN
0x07b0bE85...79d2f1400
0 ETH0.000863569.15189309
Recovery Stake N...184056412023-10-22 11:48:23382 days ago1697975303IN
0x07b0bE85...79d2f1400
0 ETH0.021675038.83946525
Stake NFT184042172023-10-22 7:01:23383 days ago1697958083IN
0x07b0bE85...79d2f1400
0 ETH0.000513856.65107094
Unstake NFT183980812023-10-21 10:26:47384 days ago1697884007IN
0x07b0bE85...79d2f1400
0 ETH0.000504396.51160015
Unstake NFT183934692023-10-20 18:57:47384 days ago1697828267IN
0x07b0bE85...79d2f1400
0 ETH0.0013164727.77019808
Unstake NFT183934672023-10-20 18:57:23384 days ago1697828243IN
0x07b0bE85...79d2f1400
0 ETH0.0014695831
Unstake NFT183850942023-10-19 14:53:23385 days ago1697727203IN
0x07b0bE85...79d2f1400
0 ETH0.0007890714.43121561
Recovery Stake N...183814772023-10-19 2:42:35386 days ago1697683355IN
0x07b0bE85...79d2f1400
0 ETH0.000246766.29252151
Recovery Stake N...183814752023-10-19 2:42:11386 days ago1697683331IN
0x07b0bE85...79d2f1400
0 ETH0.000253986.47643964
Unstake NFT183792052023-10-18 19:04:59386 days ago1697655899IN
0x07b0bE85...79d2f1400
0 ETH0.0007072114.92211423
Unstake NFT183760472023-10-18 8:27:23387 days ago1697617643IN
0x07b0bE85...79d2f1400
0 ETH0.000766297.62566314
Unstake NFT183660052023-10-16 22:44:35388 days ago1697496275IN
0x07b0bE85...79d2f1400
0 ETH0.000415878.77265289
Unstake NFT183646402023-10-16 18:10:47388 days ago1697479847IN
0x07b0bE85...79d2f1400
0 ETH0.000835417.62235923
Unstake NFT183646092023-10-16 18:04:23388 days ago1697479463IN
0x07b0bE85...79d2f1400
0 ETH0.0012745318.62268643
Unstake NFT183497432023-10-14 16:14:35390 days ago1697300075IN
0x07b0bE85...79d2f1400
0 ETH0.000262495.53858739
Unstake NFT183457042023-10-14 2:40:11391 days ago1697251211IN
0x07b0bE85...79d2f1400
0 ETH0.000319985.08991529
Unstake NFT183437262023-10-13 20:02:11391 days ago1697227331IN
0x07b0bE85...79d2f1400
0 ETH0.0007668411.55612707
Unstake NFT183364782023-10-12 19:39:59392 days ago1697139599IN
0x07b0bE85...79d2f1400
0 ETH0.000379238.00170476
Unstake NFT183339322023-10-12 11:07:11393 days ago1697108831IN
0x07b0bE85...79d2f1400
0 ETH0.000552117.04934508
Unstake NFT183338722023-10-12 10:54:59393 days ago1697108099IN
0x07b0bE85...79d2f1400
0 ETH0.001301118
Unstake NFT183281202023-10-11 15:32:59393 days ago1697038379IN
0x07b0bE85...79d2f1400
0 ETH0.0008810518.5852262
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TokenStaker

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion, MIT license
File 1 of 1 : TokenStaker.sol
/**
 *Submitted for verification at Etherscan.io on 2023-01-13
*/

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;
pragma abicoder v2;

/**
 * @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 direct9
 * 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 Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

/**
 * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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);
            }
        }
    }
}

// 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 generally not needed starting with Solidity 0.8, since 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 subtraction 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;
    }
    }
}

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

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

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

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

/**
 * @dev 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 Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

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

    constructor() {
        _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 make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

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

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

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must 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 Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

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

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

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

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

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

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

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints.
 *
 * Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..).
 *
 * Assumes the number of issuable tokens (collection size) is capped and fits in a uint128.
 *
 * Does not support burning tokens to address(0).
 */
contract ERC721X is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    struct TokenOwnership {
        address addr;
        uint64 startTimestamp;
    }

    struct AddressData {
        uint64 balance;
        uint64 numberMinted;
    }

    uint256 private currentIndex = 0;
    uint256 private burnedIndex = 0;

    uint256 internal immutable collectionSize;
    uint256 internal immutable maxBatchSize;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to ownership details
    // An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details.
    mapping(uint256 => TokenOwnership) private _ownerships;

    // Mapping owner address to address data
    mapping(address => AddressData) private _addressData;

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

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

    /**
    * @dev
    * `maxBatchSize` refers to how much a minter can mint at a time.
    * `collectionSize_` refers to how many tokens are in the collection.
    */
    constructor(
        string memory name_,
        string memory symbol_,
        uint256 maxBatchSize_,
        uint256 collectionSize_
    ) {
        require(collectionSize_ > 0, "ERC721X: collection must have a nonzero supply");
        require(maxBatchSize_ > 0, "ERC721X: max batch size must be nonzero");
        _name = name_;
        _symbol = symbol_;
        maxBatchSize = maxBatchSize_;
        collectionSize = collectionSize_;
    }

    /**
    * @dev See Remove store data in IERC721Enumerable {IERC721Enumerable-totalSupply}.
    */
    function totalSupply() public view returns (uint256) {
        return currentIndex - burnedIndex;
    }

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

    /**
    * @dev See {IERC721-balanceOf}.
    */
    function balanceOf(address owner) public view override returns (uint256) {
        require(owner != address(0), "ERC721X: balance query for the zero address");
        return uint256(_addressData[owner].balance);
    }

    function _numberMinted(address owner) internal view returns (uint256) {
        require(owner != address(0), "ERC721X: number minted query for the zero address");
        return uint256(_addressData[owner].numberMinted);
    }

    function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
        require(_exists(tokenId), "ERC721X: owner query for nonexistent token");
        uint256 lowestTokenToCheck;
        if (tokenId >= maxBatchSize) {
            lowestTokenToCheck = tokenId - maxBatchSize + 1;
        }

        for (uint256 curr = tokenId; curr >= lowestTokenToCheck; curr--) {
            TokenOwnership memory ownership = _ownerships[curr];
            if (ownership.addr != address(0)) {
                return ownership;
            }
        }
        revert("ERC721X: unable to determine the owner of token");
    }

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

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

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

    /**
    * @dev See {IERC721Metadata-tokenURI}.
    */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString(), ".json")): "";
    }

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

    /**
    * @dev See {IERC721-approve}.
    */
    function approve(address to, uint256 tokenId) public override {
        address owner = ERC721X.ownerOf(tokenId);
        require(to != owner, "ERC721X: approval to current owner");
        require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),"ERC721X: approve caller is not owner nor approved for all");
        _approve(to, tokenId, owner);
    }

    /**
    * @dev See {IERC721-getApproved}.
    */
    function getApproved(uint256 tokenId) public view override returns (address) {
        require(_exists(tokenId), "ERC721X: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
    * @dev See {IERC721-setApprovalForAll}.
    */
    function setApprovalForAll(address operator, bool approved) public override {
        require(operator != _msgSender(), "ERC721X: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

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

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

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

    /**
    * @dev See {IERC721-safeTransferFrom}.
    */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public override {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721X: transfer to non ERC721Receiver implementer");
    }

    /**
    * @dev Returns whether `tokenId` exists.
    *
    * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
    *
    * Tokens start existing when they are minted (`_mint`),
    */
    function _exists(uint256 tokenId) internal view returns (bool) {
        return tokenId < currentIndex;
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721X: operator query for nonexistent token");
        TokenOwnership memory prevOwnership = ownershipOf(tokenId);
        return(spender == prevOwnership.addr || getApproved(tokenId) == spender || isApprovedForAll(prevOwnership.addr, spender));
        //return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    function _safeMint(address to, uint256 quantity) internal {
        _safeMint(to, quantity, "");
    }

    /**
    * @dev Mints `quantity` tokens and transfers them to `to`.
    *
    * Requirements:
    *
    * - there must be `quantity` tokens remaining unminted in the total collection.
    * - `to` cannot be the zero address.
    * - `quantity` cannot be larger than the max batch size.
    *
    * Emits a {Transfer} event.
    */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal {
        uint256 startTokenId = currentIndex;
        require(to != address(0), "ERC721X: mint to the zero address");
        require(!_exists(startTokenId), "ERC721X: token already minted");
        require(quantity <= maxBatchSize, "ERC721X: quantity to mint over than max batch size");

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

    unchecked {
        _addressData[to].balance += uint64(quantity);
        _addressData[to].numberMinted += uint64(quantity);

        _ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp));

        uint256 updatedIndex = startTokenId;

        for (uint256 i = 0; i < quantity; i++) {
            emit Transfer(address(0), to, updatedIndex);
            require(_checkOnERC721Received(address(0), to, updatedIndex, _data), "ERC721X: transfer to non ERC721Receiver implementer");
            updatedIndex++;
        }
        currentIndex = updatedIndex;
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }
    }

    /**
    * @dev burn function Transfers `tokenId` from `from` to `unused address`.
    *
    * Requirements:
    *
    * - `to` cannot be the zero address and fix to unused address.
    * - `tokenId` token must be owned by `from`.
    *
    * Emits a {Transfer} event.
    */

    function _burn(
        address from,
        uint256 tokenId
    ) internal virtual {
        address to = 0x000000000000000000000000000000000000dEaD;
        TokenOwnership memory prevOwnership = ownershipOf(tokenId);

        //bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
        //getApproved(tokenId) == _msgSender() ||
        //isApprovedForAll(prevOwnership.addr, _msgSender()));

        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721X: burn caller is not owner nor approved");
        require(prevOwnership.addr == from, "ERC721X: burn from incorrect owner");

        _beforeTokenTransfers(from, to, tokenId, 1);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId, prevOwnership.addr);

        _addressData[from].balance -= 1;
        _addressData[to].balance += 1;
        _ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp));

        // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
        // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
        uint256 nextTokenId = tokenId + 1;
        if (_ownerships[nextTokenId].addr == address(0)) {
            if (_exists(nextTokenId)) {
                _ownerships[nextTokenId] = TokenOwnership(
                    prevOwnership.addr,
                    prevOwnership.startTimestamp
                );
            }
        }
        emit Transfer(from, to, tokenId);
        burnedIndex++;
        _afterTokenTransfers(from, to, tokenId, 1);
    }

    /**
    * @dev Transfers `tokenId` from `from` to `to`.
    *
    * Requirements:
    *
    * - `to` cannot be the zero address.
    * - `tokenId` token must be owned by `from`.
    *
    * Emits a {Transfer} event.
    */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        TokenOwnership memory prevOwnership = ownershipOf(tokenId);

        //bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
        //getApproved(tokenId) == _msgSender() ||
        //isApprovedForAll(prevOwnership.addr, _msgSender()));

        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721X: transfer caller is not owner nor approved");
        require(prevOwnership.addr == from, "ERC721X: transfer from incorrect owner");
        require(to != address(0), "ERC721X: transfer to the zero address");

        _beforeTokenTransfers(from, to, tokenId, 1);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId, prevOwnership.addr);

        _addressData[from].balance -= 1;
        _addressData[to].balance += 1;
        _ownerships[tokenId] = TokenOwnership(to, uint64(block.timestamp));

        // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
        // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
        uint256 nextTokenId = tokenId + 1;
        if (_ownerships[nextTokenId].addr == address(0)) {
            if (_exists(nextTokenId)) {
                _ownerships[nextTokenId] = TokenOwnership(
                    prevOwnership.addr,
                    prevOwnership.startTimestamp
                );
            }
        }

        emit Transfer(from, to, tokenId);
        _afterTokenTransfers(from, to, tokenId, 1);
    }

    /**
    * @dev Approve `to` to operate on `tokenId`
    *
    * Emits a {Approval} event.
    */
    function _approve(
        address to,
        uint256 tokenId,
        address owner
    ) private {
        _tokenApprovals[tokenId] = to;
        emit Approval(owner, to, tokenId);
    }

    uint256 public nextOwnerToExplicitlySet = 0;

    /**
    * @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf().
    */
    function _setOwnersExplicit(uint256 quantity) internal {
        uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet;
        require(quantity > 0, "quantity must be nonzero");
        uint256 endIndex = oldNextOwnerToSet + quantity - 1;
        if (endIndex > collectionSize - 1) {
            endIndex = collectionSize - 1;
        }
        // We know if the last one in the group exists, all in the group exist, due to serial ordering.
        require(_exists(endIndex), "not enough minted yet for this cleanup");
        for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) {
            if (_ownerships[i].addr == address(0)) {
                TokenOwnership memory ownership = ownershipOf(i);
                _ownerships[i] = TokenOwnership(
                    ownership.addr,
                    ownership.startTimestamp
                );
            }
        }
        nextOwnerToExplicitlySet = endIndex + 1;
    }

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

    /**
    * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
    *
    * startTokenId - the first token id to be transferred
    * quantity - the amount to be transferred
    *
    * Calling conditions:
    *
    * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
    * transferred to `to`.
    * - When `from` is zero, `tokenId` will be minted for `to`.
    */
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
    * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
    * minting.
    *
    * startTokenId - the first token id to be transferred
    * quantity - the amount to be transferred
    *
    * Calling conditions:
    *
    * - when `from` and `to` are both non-zero.
    * - `from` and `to` are never both zero.
    */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}
}

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        assembly {
            result := store
        }

        return result;
    }
}

abstract contract TokenStake is Ownable, ERC721X {
    using EnumerableSet for EnumerableSet.AddressSet;

    EnumerableSet.AddressSet private _tokenStakers;
    mapping(uint256 => address) private _stakedTokens;

    event TokenStaked(address indexed tokenStaker, uint256 tokenId);
    event TokenUnstaked(address indexed tokenStaker, uint256 tokenId);
    event TokenRecoverUnstaked(uint256 tokenId);
    event BatchUpdateTokenStaked(address indexed newTokenStaker, uint256[] tokenIds);

    event TokenStakerAdded(address indexed tokenStaker);
    event TokenStakerRemoved(address indexed tokenStaker);

    modifier tokenStakersOnly() {
        require(_tokenStakers.contains(_msgSender()), "TokenStake: Not staker");
        _;
    }

    modifier whenTokenNotStaked(uint256 tokenId) {
        require(_stakedTokens[tokenId] == address(0), "TokenStake: Token is staked");
        _;
    }

    modifier whenTokenStaked(uint256 tokenId) {
        require(_stakedTokens[tokenId] != address(0), "TokenStake: Token is not staked");
        _;
    }

    /**
     * @notice Returns `true` if token is staked and can't be transfered
     */
    function isTokenStaked(uint256 tokenId) public view returns (bool) {
        return _stakedTokens[tokenId] != address(0);
    }

    /**
     * @notice Returns the address of the staker for a specific `tokenId``
     * Returns 0x0 if token is not staked
     */
    function stakerForToken(uint256 tokenId) public view returns (address) {
        return _stakedTokens[tokenId];
    }

    /**
     * @notice Lock a token for staking
     * only callable by members of the `tokenStakers` list
     * The owner of the token must approve the staking contract prior to call this method
     */
    function stakeToken(uint256 tokenId) external tokenStakersOnly whenTokenNotStaked(tokenId) {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "TokenStake: Staker not approved");
        _stakedTokens[tokenId] = _msgSender();
        emit TokenStaked(_msgSender(), tokenId);
    }

    /**
     * @notice Lock a token for staking
     * only callable by the staker
     */
    function unstakeToken(uint256 tokenId) external whenTokenStaked(tokenId) {
        require(_msgSender() == _stakedTokens[tokenId], "TokenStake: Token not stake by account");
        require(_msgSender() != address(0), "TokenStake: can't unstake from zero address");
        _stakedTokens[tokenId] = address(0);
        emit TokenUnstaked(_msgSender(), tokenId);
    }

    /**
     * @notice Recover a staked token
     * only callable by the owner
     */
    function recoverStakeToken(uint256 tokenId) external onlyOwner whenTokenStaked(tokenId) {
        _stakedTokens[tokenId] = address(0);
        emit TokenRecoverUnstaked(tokenId);
    }

    /**
     * @dev Change the token staker for a list of tokenIds
     * only callable by the owner
     * this is usefull if the staker contract must be updated
     * if `newStaker` is set to 0x0, tokens will be unstaked
     */
    function batchUpdateTokenStake(address newStaker, uint256[] calldata tokenIds) external onlyOwner {
        for (uint256 i = 0; i < tokenIds.length; i++) {
            require(_stakedTokens[tokenIds[i]] != address(0), "TokenStake: not restakeable");
            if (newStaker != address(0)) {
                require(_isApprovedOrOwner(newStaker, tokenIds[i]), "TokenStake: Staker not approved");
            }
            _stakedTokens[tokenIds[i]] = newStaker;
        }
        emit BatchUpdateTokenStaked(newStaker, tokenIds);
    }

    /**
     * @dev returns true if `account` is a member of the staker group
     */
    function isTokenStaker(address account) public view returns (bool) {
        return _tokenStakers.contains(account);
    }

    /**
     * @dev Add `tokenStaker` to the list of allowed stakers
     * only callable by the owner
     */
    function addTokenStaker(address tokenStaker) external onlyOwner {
        require(!_tokenStakers.contains(tokenStaker), "TokenStake: Already TokenStaker");
        _tokenStakers.add(tokenStaker);
        emit TokenStakerAdded(tokenStaker);
    }

    /**
     * @dev Remove `tokenStaker` from the list of allowed stakers
     * only callable by the owner
     */
    function removeTokenStaker(address tokenStaker) external onlyOwner {
        require(_tokenStakers.contains(tokenStaker), "TokenStake: Not TokenStaker");
        _tokenStakers.remove(tokenStaker);
        emit TokenStakerRemoved(tokenStaker);
    }
}


contract TokenStaker is Ownable {
    TokenStake public tokenContract;
    using SafeMath for uint256;

    struct StakerInfo {
        uint256 point;
    }

    struct TokenInfo {
        uint256 NFTtype;
    }

    mapping(address => StakerInfo) private _stakerInfo;
    mapping(uint256 => TokenInfo) private _tokenInfo;

    uint256 private controllerKey;
    uint256 public totalStaked;

    event NFTstake(string stakingStatus, uint256 tokenID, address stakerOf);
    event NFTunstake(string stakingStatus, uint256 tokenID, address stakerOf);

    constructor(TokenStake _tokenContract, uint256 _key){
        tokenContract = _tokenContract;
        controllerKey = _key;
        totalStaked = 0;
    }

    function stakeNFT(uint256[] calldata tokenIds, uint256 _key) external {
        require(controllerKey == _key, "Called with incorrect controller key");
        for (uint256 i = 0; i < tokenIds.length; i++) {
            require(msg.sender == tokenContract.ownerOf(tokenIds[i]) , "stake caller is not owner");
            tokenContract.stakeToken(tokenIds[i]);
            totalStaked++;
            emit NFTstake("stake", tokenIds[i], msg.sender);
        }
    }

    function unstakeNFT(uint256[] calldata tokenIds, uint256 _key) external {
        require(controllerKey == _key, "Called with incorrect controller key");
        for (uint256 i = 0; i < tokenIds.length; i++) {
            require(msg.sender == tokenContract.ownerOf(tokenIds[i]) , "stake caller is not owner");
            tokenContract.unstakeToken(tokenIds[i]);
            totalStaked--;
            emit NFTunstake("unstake", tokenIds[i], msg.sender);
        }
    }

    function recoveryStakeNFT(uint256[] calldata tokenIds) external onlyOwner{
        for (uint256 i = 0; i < tokenIds.length; i++) {
            tokenContract.unstakeToken(tokenIds[i]);
            totalStaked--;
            emit NFTunstake("unstake", tokenIds[i], msg.sender);
        }
    }

    function isNFTStaked(uint256 tokenId) public view returns (bool) {
        return tokenContract.isTokenStaked(tokenId);
    }

    function stakerOfToken(uint256 tokenId) public view returns (address) {
        return tokenContract.stakerForToken(tokenId);
    }

    function setControllerKey(uint256 _key) external onlyOwner {
        controllerKey = _key;
    }
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 800
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract TokenStake","name":"_tokenContract","type":"address"},{"internalType":"uint256","name":"_key","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"stakingStatus","type":"string"},{"indexed":false,"internalType":"uint256","name":"tokenID","type":"uint256"},{"indexed":false,"internalType":"address","name":"stakerOf","type":"address"}],"name":"NFTstake","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"stakingStatus","type":"string"},{"indexed":false,"internalType":"uint256","name":"tokenID","type":"uint256"},{"indexed":false,"internalType":"address","name":"stakerOf","type":"address"}],"name":"NFTunstake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isNFTStaked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"recoveryStakeNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_key","type":"uint256"}],"name":"setControllerKey","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256","name":"_key","type":"uint256"}],"name":"stakeNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"stakerOfToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenContract","outputs":[{"internalType":"contract TokenStake","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256","name":"_key","type":"uint256"}],"name":"unstakeNFT","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50604051610e21380380610e2183398101604081905261002f916100b6565b61003833610066565b600180546001600160a01b0319166001600160a01b03939093169290921790915560045560006005556100f0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156100c957600080fd5b82516001600160a01b03811681146100e057600080fd5b6020939093015192949293505050565b610d22806100ff6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80638da5cb5b11610081578063ac8bb71d1161005b578063ac8bb71d1461017c578063b3c722e51461019f578063f2fde38b146101b257600080fd5b80638da5cb5b146101455780639d11987e14610156578063a79df9531461016957600080fd5b806355a373d6116100b257806355a373d614610113578063715018a614610126578063817b1cd21461012e57600080fd5b80630adad7bd146100ce578063433b30a1146100fe575b600080fd5b6100e16100dc366004610b25565b6101c5565b6040516001600160a01b0390911681526020015b60405180910390f35b61011161010c366004610b8a565b610239565b005b6001546100e1906001600160a01b031681565b6101116104ab565b61013760055481565b6040519081526020016100f5565b6000546001600160a01b03166100e1565b610111610164366004610b8a565b610511565b610111610177366004610bd6565b61078e565b61018f61018a366004610b25565b61090e565b60405190151581526020016100f5565b6101116101ad366004610b25565b61097c565b6101116101c0366004610c2d565b6109db565b600154604051631049418b60e21b8152600481018390526000916001600160a01b031690634125062c90602401602060405180830381865afa15801561020f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102339190610c51565b92915050565b806004541461029b5760405162461bcd60e51b8152602060048201526024808201527f43616c6c6564207769746820696e636f727265637420636f6e74726f6c6c6572604482015263206b657960e01b60648201526084015b60405180910390fd5b60005b828110156104a5576001546001600160a01b0316636352211e8585848181106102c9576102c9610c6e565b905060200201356040518263ffffffff1660e01b81526004016102ee91815260200190565b602060405180830381865afa15801561030b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032f9190610c51565b6001600160a01b0316336001600160a01b03161461038f5760405162461bcd60e51b815260206004820152601960248201527f7374616b652063616c6c6572206973206e6f74206f776e6572000000000000006044820152606401610292565b6001546001600160a01b0316632cfb66888585848181106103b2576103b2610c6e565b905060200201356040518263ffffffff1660e01b81526004016103d791815260200190565b600060405180830381600087803b1580156103f157600080fd5b505af1158015610405573d6000803e3d6000fd5b50506005805492509050600061041a83610c9a565b91905055507f029d5b5d1bb52f7dd88e0b473cccd9271586c2ac57235f5f200a161a50417d0784848381811061045257610452610c6e565b60408051606080825260079082015266756e7374616b6560c81b6080820152602092830294909401359184019190915233908301525060a00160405180910390a18061049d81610cb1565b91505061029e565b50505050565b6000546001600160a01b031633146105055760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610292565b61050f6000610abd565b565b806004541461056e5760405162461bcd60e51b8152602060048201526024808201527f43616c6c6564207769746820696e636f727265637420636f6e74726f6c6c6572604482015263206b657960e01b6064820152608401610292565b60005b828110156104a5576001546001600160a01b0316636352211e85858481811061059c5761059c610c6e565b905060200201356040518263ffffffff1660e01b81526004016105c191815260200190565b602060405180830381865afa1580156105de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106029190610c51565b6001600160a01b0316336001600160a01b0316146106625760405162461bcd60e51b815260206004820152601960248201527f7374616b652063616c6c6572206973206e6f74206f776e6572000000000000006044820152606401610292565b6001546001600160a01b031663cda6b84785858481811061068557610685610c6e565b905060200201356040518263ffffffff1660e01b81526004016106aa91815260200190565b600060405180830381600087803b1580156106c457600080fd5b505af11580156106d8573d6000803e3d6000fd5b5050600580549250905060006106ed83610cb1565b91905055507fc358df2c57d882759eeb0f6c0ad4fc43809541226464f11a89506d9c1c2db94a84848381811061072557610725610c6e565b6040805160608082526005908201527f7374616b650000000000000000000000000000000000000000000000000000006080820152602092830294909401359184019190915233908301525060a00160405180910390a18061078681610cb1565b915050610571565b6000546001600160a01b031633146107e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610292565b60005b81811015610909576001546001600160a01b0316632cfb668884848481811061081657610816610c6e565b905060200201356040518263ffffffff1660e01b815260040161083b91815260200190565b600060405180830381600087803b15801561085557600080fd5b505af1158015610869573d6000803e3d6000fd5b50506005805492509050600061087e83610c9a565b91905055507f029d5b5d1bb52f7dd88e0b473cccd9271586c2ac57235f5f200a161a50417d078383838181106108b6576108b6610c6e565b60408051606080825260079082015266756e7374616b6560c81b6080820152602092830294909401359184019190915233908301525060a00160405180910390a18061090181610cb1565b9150506107eb565b505050565b600154604051633c29490960e21b8152600481018390526000916001600160a01b03169063f0a5242490602401602060405180830381865afa158015610958573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102339190610cca565b6000546001600160a01b031633146109d65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610292565b600455565b6000546001600160a01b03163314610a355760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610292565b6001600160a01b038116610ab15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610292565b610aba81610abd565b50565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215610b3757600080fd5b5035919050565b60008083601f840112610b5057600080fd5b50813567ffffffffffffffff811115610b6857600080fd5b6020830191508360208260051b8501011115610b8357600080fd5b9250929050565b600080600060408486031215610b9f57600080fd5b833567ffffffffffffffff811115610bb657600080fd5b610bc286828701610b3e565b909790965060209590950135949350505050565b60008060208385031215610be957600080fd5b823567ffffffffffffffff811115610c0057600080fd5b610c0c85828601610b3e565b90969095509350505050565b6001600160a01b0381168114610aba57600080fd5b600060208284031215610c3f57600080fd5b8135610c4a81610c18565b9392505050565b600060208284031215610c6357600080fd5b8151610c4a81610c18565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600081610ca957610ca9610c84565b506000190190565b600060018201610cc357610cc3610c84565b5060010190565b600060208284031215610cdc57600080fd5b81518015158114610c4a57600080fdfea2646970667358221220f533a6483510e833ce24463cb80a14f2d45f71938a169f78effaa71b502fecca64736f6c634300080d0033000000000000000000000000a88b82af76ecf08cf652846d10857eaeeca40c9700000000000000000000000000000000000000000000000000000004b62860ca

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100c95760003560e01c80638da5cb5b11610081578063ac8bb71d1161005b578063ac8bb71d1461017c578063b3c722e51461019f578063f2fde38b146101b257600080fd5b80638da5cb5b146101455780639d11987e14610156578063a79df9531461016957600080fd5b806355a373d6116100b257806355a373d614610113578063715018a614610126578063817b1cd21461012e57600080fd5b80630adad7bd146100ce578063433b30a1146100fe575b600080fd5b6100e16100dc366004610b25565b6101c5565b6040516001600160a01b0390911681526020015b60405180910390f35b61011161010c366004610b8a565b610239565b005b6001546100e1906001600160a01b031681565b6101116104ab565b61013760055481565b6040519081526020016100f5565b6000546001600160a01b03166100e1565b610111610164366004610b8a565b610511565b610111610177366004610bd6565b61078e565b61018f61018a366004610b25565b61090e565b60405190151581526020016100f5565b6101116101ad366004610b25565b61097c565b6101116101c0366004610c2d565b6109db565b600154604051631049418b60e21b8152600481018390526000916001600160a01b031690634125062c90602401602060405180830381865afa15801561020f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102339190610c51565b92915050565b806004541461029b5760405162461bcd60e51b8152602060048201526024808201527f43616c6c6564207769746820696e636f727265637420636f6e74726f6c6c6572604482015263206b657960e01b60648201526084015b60405180910390fd5b60005b828110156104a5576001546001600160a01b0316636352211e8585848181106102c9576102c9610c6e565b905060200201356040518263ffffffff1660e01b81526004016102ee91815260200190565b602060405180830381865afa15801561030b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032f9190610c51565b6001600160a01b0316336001600160a01b03161461038f5760405162461bcd60e51b815260206004820152601960248201527f7374616b652063616c6c6572206973206e6f74206f776e6572000000000000006044820152606401610292565b6001546001600160a01b0316632cfb66888585848181106103b2576103b2610c6e565b905060200201356040518263ffffffff1660e01b81526004016103d791815260200190565b600060405180830381600087803b1580156103f157600080fd5b505af1158015610405573d6000803e3d6000fd5b50506005805492509050600061041a83610c9a565b91905055507f029d5b5d1bb52f7dd88e0b473cccd9271586c2ac57235f5f200a161a50417d0784848381811061045257610452610c6e565b60408051606080825260079082015266756e7374616b6560c81b6080820152602092830294909401359184019190915233908301525060a00160405180910390a18061049d81610cb1565b91505061029e565b50505050565b6000546001600160a01b031633146105055760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610292565b61050f6000610abd565b565b806004541461056e5760405162461bcd60e51b8152602060048201526024808201527f43616c6c6564207769746820696e636f727265637420636f6e74726f6c6c6572604482015263206b657960e01b6064820152608401610292565b60005b828110156104a5576001546001600160a01b0316636352211e85858481811061059c5761059c610c6e565b905060200201356040518263ffffffff1660e01b81526004016105c191815260200190565b602060405180830381865afa1580156105de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106029190610c51565b6001600160a01b0316336001600160a01b0316146106625760405162461bcd60e51b815260206004820152601960248201527f7374616b652063616c6c6572206973206e6f74206f776e6572000000000000006044820152606401610292565b6001546001600160a01b031663cda6b84785858481811061068557610685610c6e565b905060200201356040518263ffffffff1660e01b81526004016106aa91815260200190565b600060405180830381600087803b1580156106c457600080fd5b505af11580156106d8573d6000803e3d6000fd5b5050600580549250905060006106ed83610cb1565b91905055507fc358df2c57d882759eeb0f6c0ad4fc43809541226464f11a89506d9c1c2db94a84848381811061072557610725610c6e565b6040805160608082526005908201527f7374616b650000000000000000000000000000000000000000000000000000006080820152602092830294909401359184019190915233908301525060a00160405180910390a18061078681610cb1565b915050610571565b6000546001600160a01b031633146107e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610292565b60005b81811015610909576001546001600160a01b0316632cfb668884848481811061081657610816610c6e565b905060200201356040518263ffffffff1660e01b815260040161083b91815260200190565b600060405180830381600087803b15801561085557600080fd5b505af1158015610869573d6000803e3d6000fd5b50506005805492509050600061087e83610c9a565b91905055507f029d5b5d1bb52f7dd88e0b473cccd9271586c2ac57235f5f200a161a50417d078383838181106108b6576108b6610c6e565b60408051606080825260079082015266756e7374616b6560c81b6080820152602092830294909401359184019190915233908301525060a00160405180910390a18061090181610cb1565b9150506107eb565b505050565b600154604051633c29490960e21b8152600481018390526000916001600160a01b03169063f0a5242490602401602060405180830381865afa158015610958573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102339190610cca565b6000546001600160a01b031633146109d65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610292565b600455565b6000546001600160a01b03163314610a355760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610292565b6001600160a01b038116610ab15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610292565b610aba81610abd565b50565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215610b3757600080fd5b5035919050565b60008083601f840112610b5057600080fd5b50813567ffffffffffffffff811115610b6857600080fd5b6020830191508360208260051b8501011115610b8357600080fd5b9250929050565b600080600060408486031215610b9f57600080fd5b833567ffffffffffffffff811115610bb657600080fd5b610bc286828701610b3e565b909790965060209590950135949350505050565b60008060208385031215610be957600080fd5b823567ffffffffffffffff811115610c0057600080fd5b610c0c85828601610b3e565b90969095509350505050565b6001600160a01b0381168114610aba57600080fd5b600060208284031215610c3f57600080fd5b8135610c4a81610c18565b9392505050565b600060208284031215610c6357600080fd5b8151610c4a81610c18565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600081610ca957610ca9610c84565b506000190190565b600060018201610cc357610cc3610c84565b5060010190565b600060208284031215610cdc57600080fd5b81518015158114610c4a57600080fdfea2646970667358221220f533a6483510e833ce24463cb80a14f2d45f71938a169f78effaa71b502fecca64736f6c634300080d0033

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

000000000000000000000000a88b82af76ecf08cf652846d10857eaeeca40c9700000000000000000000000000000000000000000000000000000004b62860ca

-----Decoded View---------------
Arg [0] : _tokenContract (address): 0xA88b82AF76ecF08cf652846D10857eAeeCa40C97
Arg [1] : _key (uint256): 20235968714

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000a88b82af76ecf08cf652846d10857eaeeca40c97
Arg [1] : 00000000000000000000000000000000000000000000000000000004b62860ca


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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