ETH Price: $2,552.47 (-4.84%)

Token

$BUGS ($BUGS)
 

Overview

Max Total Supply

658,704.72662037037037033 $BUGS

Holders

86

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Balance
1,075.793055555555555555 $BUGS

Value
$0.00
0x95076ffc88040f6524c064b9c4d4575006eb270f
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
BUGS

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2022-03-11
*/

// SPDX-License-Identifier: MIT

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


// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

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

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

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

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

// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol


// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;


/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

// File: @openzeppelin/contracts/utils/Strings.sol


// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

// File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol


// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;


/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

// File: @openzeppelin/contracts/utils/Context.sol


// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

// File: @openzeppelin/contracts/access/Ownable.sol


// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;


/**
 * @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() {
        _transferOwnership(_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 {
        _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);
    }
}

// File: @openzeppelin/contracts/token/ERC20/ERC20.sol


// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;




/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, _allowances[owner][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = _allowances[owner][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Spend `amount` form the allowance of `owner` toward `spender`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

// File: @openzeppelin/contracts/utils/Address.sol


// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [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);
            }
        }
    }
}

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


// OpenZeppelin Contracts v4.4.1 (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 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);
}

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


// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface 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);
}

// File: @openzeppelin/contracts/utils/introspection/ERC165.sol


// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;


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

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


// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;


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

// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol


// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;


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

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

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

// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol


// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;


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

// File: @openzeppelin/contracts/token/ERC721/ERC721.sol


// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;








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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @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 virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

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

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

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

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

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

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

        _balances[to] += 1;
        _owners[tokenId] = to;

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

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

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

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

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

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

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

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

        _beforeTokenTransfer(from, to, tokenId);

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

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

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

    /**
     * @dev 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.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * 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`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

// File: @openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol


// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.0;



/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * 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`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

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

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

// File: contracts/staking.sol



pragma solidity ^0.8.12;







interface IStaking {
	function getBaseAmount(address _user) external view returns(uint256);
}

contract BUGS is ERC20("$BUGS", "$BUGS"), Ownable {
    uint256 public timeRate = 60 * 60 * 24;

	mapping(address => uint256) public rewards;
	mapping(address => uint256) public lastUpdate;

	IStaking public stakingContract;

	constructor(address _staking) {
		stakingContract = IStaking(_staking);
	}

    function setStakingContract(address _staking) external onlyOwner {
        stakingContract = IStaking(_staking);
    }

	function min(uint256 a, uint256 b) internal pure returns (uint256) {
		return a < b ? a : b;
	}

    function setTimeRate(uint256 _timeRate) external onlyOwner {
        timeRate = _timeRate;
    }

    function getNewReward(address _user) public view returns (uint256) {
        uint256 time = block.timestamp;
		uint256 timerUser = lastUpdate[_user];
		uint256 result = 0;
        if (timerUser > 0)
			result = rewards[_user] + stakingContract.getBaseAmount(_user) * (time - timerUser) / (timeRate);
        else
            result = rewards[_user];
        return result;
    }

	function calculateNewReward(address _user) public {
		uint256 time = block.timestamp;
        rewards[_user] = getNewReward(_user);
		lastUpdate[_user] = time;
	}

	function claimReward(address _to) external {
        calculateNewReward(_to);
		uint256 reward = rewards[_to];
		if (reward > 0) {
			rewards[_to] = 0;
			_mint(_to, reward);
		}
	}

    function giftTokens(address _to, uint256 giftAmount) external onlyOwner {
        _mint(_to, giftAmount);
    }
}

contract Staking is IERC721Receiver, Ownable {
    using Strings for uint256;

    BUGS public rewardToken;

    struct TokenInfo {
        string uri;
        uint256 contractIdx;
        uint256 tokenId;
        uint256 tokenRate;
    }

    address[] public collectionAddresses = [
        0xc652C1800e28ADD44224F2eE0C94cAC5e9264e9C, // genesis
        0x415f65ADFa35BC957507944554492C75FF1DC45F  // gen 1
    ];

    uint256[] public baseRates = [ 100 ether, 5 ether ];

    mapping(address => mapping(uint256 => uint256)) overrideBaseRate;

    // Mapping from owner to list of owned token [IDs, collectionIdx]
    mapping(address => mapping(uint256 => uint256[2])) public _ownedTokens;
    mapping(uint256 => address) _owners;
    mapping(address => uint256) public _balances;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) public _ownedTokensIndex;
    uint256 public numberOfStaked;

    uint256[] public _allTokens;
    mapping(uint256 => uint256) public _allTokensIndex;

    function setOverrideBaseRate(address collection, uint256 tokenId, uint256 baseRate) external onlyOwner {
        overrideBaseRate[collection][tokenId] = baseRate;
    }

    function setOverrideBaseRates(address collection, uint256[] memory tokenIds, uint256[] memory tokenBaseRates) external onlyOwner {
        require(tokenIds.length == baseRates.length, "Arrays must be the same length");
        for (uint256 i = 0; i < tokenIds.length; i++) {
            overrideBaseRate[collection][tokenIds[i]] = tokenBaseRates[i];
        }
    }

    function setCollectionAddress(uint256 idx, address to) external onlyOwner {
        collectionAddresses[idx] = to;
    }

    function setBaseRate(uint256 idx, uint256 rate) external onlyOwner {
        baseRates[idx] = rate;
    }

    function addCollection(address contractAddress, uint256 rate) external onlyOwner {
        collectionAddresses.push(contractAddress);
        baseRates.push(rate);
    }

    function onERC721Received(address, address, uint256, bytes calldata) pure external override(IERC721Receiver) returns(bytes4) {
        return IERC721Receiver.onERC721Received.selector;
    }

    function getCollectionAddresses() public view returns (address[] memory) {
        return collectionAddresses;
    }

    function getBaseRates() public view returns (uint256[] memory) {
        return baseRates;
    }

    // You can ignore the functions with _ at the start of their names
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }

    function _addTokenToOwnerEnumeration(address to, uint256 tokenId, uint256 collectionIdx) private {
        uint256 length = _balances[to];
        _ownedTokens[to][length][0] = tokenId;
        _ownedTokens[to][length][1] = collectionIdx;
        _ownedTokensIndex[tokenId] = length;
        _balances[to]++;
        _addTokenToAllTokensEnumeration(tokenId);
        numberOfStaked++;
    }

    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _balances[from] - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex][0];
            uint256 lastTokenContractIdx = _ownedTokens[from][lastTokenIndex][1];

            _ownedTokens[from][tokenIndex][0] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokens[from][tokenIndex][1] = lastTokenContractIdx;
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
        _balances[from]--;
        _removeTokenFromAllTokensEnumeration(tokenId);
        numberOfStaked--;
    }


    function getTokenRate(uint256 tokenId, uint256 collectionIdx) public view returns (uint256) {
        if (overrideBaseRate[collectionAddresses[collectionIdx]][tokenId] > 0) {
            return overrideBaseRate[collectionAddresses[collectionIdx]][tokenId];
        } else {
            return baseRates[collectionIdx];
        }
    }

    // Returns all the token uris and token ids for a given user address that are not staked
    // inside the contract
    function getUnstaked(address targetAddress) public view returns(TokenInfo[] memory) {
        uint256 totalBalance = 0;
        for(uint256 j = 0; j < collectionAddresses.length; j++){
            ERC721Enumerable collectionContract = ERC721Enumerable(collectionAddresses[j]);
            totalBalance += collectionContract.balanceOf(targetAddress);
        }

        TokenInfo[] memory tokenInfo = new TokenInfo[](totalBalance);
        uint256 currentIdx = 0;
        for(uint256 j = 0; j < collectionAddresses.length; j++){
            ERC721Enumerable collectionContract = ERC721Enumerable(collectionAddresses[j]);
            for(uint256 i = 0; i < collectionContract.balanceOf(targetAddress); i++){
                uint256 tokenId = collectionContract.tokenOfOwnerByIndex(targetAddress, i);
                tokenInfo[currentIdx].uri = collectionContract.tokenURI(tokenId);
                tokenInfo[currentIdx].tokenId = tokenId;
                tokenInfo[currentIdx].contractIdx = j;
                tokenInfo[currentIdx].tokenRate = getTokenRate(tokenInfo[currentIdx].tokenId, tokenInfo[currentIdx].contractIdx);
                currentIdx++;
            }
        }
        return tokenInfo;
    }

    // same as tokenUris but only for the staked
    function getStaked(address targetAddress) external view returns (TokenInfo[] memory) {
        TokenInfo[] memory tokenInfo = new TokenInfo[](_balances[targetAddress]); 
        for(uint256 i = 0; i < _balances[targetAddress]; i++){
            tokenInfo[i].tokenId = _ownedTokens[targetAddress][i][0];
            tokenInfo[i].contractIdx = _ownedTokens[targetAddress][i][1];
            tokenInfo[i].uri = ERC721Enumerable(collectionAddresses[tokenInfo[i].contractIdx]).tokenURI(tokenInfo[i].tokenId);
            tokenInfo[i].tokenRate = getTokenRate(tokenInfo[i].tokenId, tokenInfo[i].contractIdx );
        }
        return tokenInfo;
    }

    function setRewardToken(address _rewardToken) external onlyOwner {
        rewardToken = BUGS(_rewardToken);
    }

    function _min(uint256 a, uint256 b) private pure returns(uint256) {
        return a >= b ? b : a;
    }
       
    function getBaseAmount(address targetAddress) public view returns (uint256) {
        uint256 sum = 0;
        for(uint256 i = 0; i < _balances[targetAddress]; i++){
            uint256 tokenId = _ownedTokens[targetAddress][i][0];
            uint256 collectionIdx = _ownedTokens[targetAddress][i][1];
            sum += getTokenRate(tokenId, collectionIdx);
        }
        return sum;
    }

    // transfer tokens from user to the contract for staking
    function stakeToken(uint256[]calldata tokenIds, uint256[]calldata collectionIdx) external {
        require(tokenIds.length == collectionIdx.length, "Array lengths must match");
        rewardToken.calculateNewReward(msg.sender);
        for(uint256 i = 0; i < tokenIds.length; i++){
            ERC721Enumerable collectionContract = ERC721Enumerable(collectionAddresses[collectionIdx[i]]);
            collectionContract.transferFrom(msg.sender, address(this), tokenIds[i]);
            _addTokenToOwnerEnumeration(msg.sender, tokenIds[i], collectionIdx[i]);
            _owners[tokenIds[i]] = msg.sender;
        }
    }

    // tranfers the token back to the user from the contract
    function unstake(uint256[]calldata tokenIds, uint256[]calldata collectionIdx) external {
        require(tokenIds.length == collectionIdx.length, "Array lengths must match");
        for(uint256 i = 0; i < tokenIds.length; i++){
            require(_owners[tokenIds[i]] == msg.sender, "Trying to unstake unowned token");
            IERC721(collectionAddresses[collectionIdx[i]]).transferFrom(address(this), msg.sender, tokenIds[i]);
            _removeTokenFromOwnerEnumeration(msg.sender, tokenIds[i]);
            _owners[tokenIds[i]] = address(0);
        }
        rewardToken.calculateNewReward(msg.sender);
    }

    function withdraw() external onlyOwner {
        require(payable(msg.sender).send(address(this).balance));
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_staking","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"calculateNewReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getNewReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"giftAmount","type":"uint256"}],"name":"giftTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastUpdate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_staking","type":"address"}],"name":"setStakingContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_timeRate","type":"uint256"}],"name":"setTimeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingContract","outputs":[{"internalType":"contract IStaking","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052620151806006553480156200001857600080fd5b50604051620011de380380620011de8339810160408190526200003b91620001d0565b604080518082018252600580825264244255475360d81b6020808401828152855180870190965292855284015281519192916200007b916003916200012a565b508051620000919060049060208401906200012a565b505050620000ae620000a8620000d460201b60201c565b620000d8565b600980546001600160a01b0319166001600160a01b03929092169190911790556200023f565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620001389062000202565b90600052602060002090601f0160209004810192826200015c5760008555620001a7565b82601f106200017757805160ff1916838001178555620001a7565b82800160010185558215620001a7579182015b82811115620001a75782518255916020019190600101906200018a565b50620001b5929150620001b9565b5090565b5b80821115620001b55760008155600101620001ba565b600060208284031215620001e357600080fd5b81516001600160a01b0381168114620001fb57600080fd5b9392505050565b600181811c908216806200021757607f821691505b602082108114156200023957634e487b7160e01b600052602260045260246000fd5b50919050565b610f8f806200024f6000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c8063715018a6116100c3578063c4c50acf1161007c578063c4c50acf146102e4578063cb03fb1e146102f7578063d279c19114610317578063dd62ed3e1461032a578063ee99205c14610363578063f2fde38b1461037657600080fd5b8063715018a6146102765780638da5cb5b1461027e57806395d89b41146102a35780639dd373b9146102ab578063a457c2d7146102be578063a9059cbb146102d157600080fd5b80633401f64a116101155780633401f64a146101f657806339509351146101ff5780634c3855561461021257806352876497146102255780636ee14dfb1461023a57806370a082311461024d57600080fd5b806306fdde031461015d5780630700037d1461017b578063095ea7b3146101a957806318160ddd146101cc57806323b872dd146101d4578063313ce567146101e7575b600080fd5b610165610389565b6040516101729190610d05565b60405180910390f35b61019b610189366004610d76565b60076020526000908152604090205481565b604051908152602001610172565b6101bc6101b7366004610d98565b61041b565b6040519015158152602001610172565b60025461019b565b6101bc6101e2366004610dc2565b610433565b60405160128152602001610172565b61019b60065481565b6101bc61020d366004610d98565b610457565b61019b610220366004610d76565b610496565b610238610233366004610dfe565b610594565b005b610238610248366004610d76565b6105cc565b61019b61025b366004610d76565b6001600160a01b031660009081526020819052604090205490565b610238610601565b6005546001600160a01b03165b6040516001600160a01b039091168152602001610172565b610165610637565b6102386102b9366004610d76565b610646565b6101bc6102cc366004610d98565b610692565b6101bc6102df366004610d98565b610724565b6102386102f2366004610d98565b610732565b61019b610305366004610d76565b60086020526000908152604090205481565b610238610325366004610d76565b61076a565b61019b610338366004610e17565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60095461028b906001600160a01b031681565b610238610384366004610d76565b6107b5565b60606003805461039890610e4a565b80601f01602080910402602001604051908101604052809291908181526020018280546103c490610e4a565b80156104115780601f106103e657610100808354040283529160200191610411565b820191906000526020600020905b8154815290600101906020018083116103f457829003601f168201915b5050505050905090565b600033610429818585610850565b5060019392505050565b600033610441858285610974565b61044c858585610a06565b506001949350505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091906104299082908690610491908790610e9b565b610850565b6001600160a01b0381166000908152600860205260408120544290828115610571576006546104c58385610eb3565b60095460405163b34c8afb60e01b81526001600160a01b0389811660048301529091169063b34c8afb90602401602060405180830381865afa15801561050f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105339190610eca565b61053d9190610ee3565b6105479190610f02565b6001600160a01b03861660009081526007602052604090205461056a9190610e9b565b905061058c565b506001600160a01b0384166000908152600760205260409020545b949350505050565b6005546001600160a01b031633146105c75760405162461bcd60e51b81526004016105be90610f24565b60405180910390fd5b600655565b426105d682610496565b6001600160a01b03909216600090815260076020908152604080832094909455600890529190912055565b6005546001600160a01b0316331461062b5760405162461bcd60e51b81526004016105be90610f24565b6106356000610bd4565b565b60606004805461039890610e4a565b6005546001600160a01b031633146106705760405162461bcd60e51b81526004016105be90610f24565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156107175760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016105be565b61044c8286868403610850565b600033610429818585610a06565b6005546001600160a01b0316331461075c5760405162461bcd60e51b81526004016105be90610f24565b6107668282610c26565b5050565b610773816105cc565b6001600160a01b0381166000908152600760205260409020548015610766576001600160a01b0382166000908152600760205260408120556107668282610c26565b6005546001600160a01b031633146107df5760405162461bcd60e51b81526004016105be90610f24565b6001600160a01b0381166108445760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105be565b61084d81610bd4565b50565b6001600160a01b0383166108b25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105be565b6001600160a01b0382166109135760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105be565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114610a0057818110156109f35760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016105be565b610a008484848403610850565b50505050565b6001600160a01b038316610a6a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105be565b6001600160a01b038216610acc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105be565b6001600160a01b03831660009081526020819052604090205481811015610b445760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105be565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610b7b908490610e9b565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610bc791815260200190565b60405180910390a3610a00565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216610c7c5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105be565b8060026000828254610c8e9190610e9b565b90915550506001600160a01b03821660009081526020819052604081208054839290610cbb908490610e9b565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b600060208083528351808285015260005b81811015610d3257858101830151858201604001528201610d16565b81811115610d44576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610d7157600080fd5b919050565b600060208284031215610d8857600080fd5b610d9182610d5a565b9392505050565b60008060408385031215610dab57600080fd5b610db483610d5a565b946020939093013593505050565b600080600060608486031215610dd757600080fd5b610de084610d5a565b9250610dee60208501610d5a565b9150604084013590509250925092565b600060208284031215610e1057600080fd5b5035919050565b60008060408385031215610e2a57600080fd5b610e3383610d5a565b9150610e4160208401610d5a565b90509250929050565b600181811c90821680610e5e57607f821691505b60208210811415610e7f57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610eae57610eae610e85565b500190565b600082821015610ec557610ec5610e85565b500390565b600060208284031215610edc57600080fd5b5051919050565b6000816000190483118215151615610efd57610efd610e85565b500290565b600082610f1f57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fea2646970667358221220be2edff835ca7fb0ebbc318a9068695c71561b0ade484dc42fde5f821d39dd9464736f6c634300080c00330000000000000000000000001e70fde6dec595d0c9897f0296409a6dc5457560

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101585760003560e01c8063715018a6116100c3578063c4c50acf1161007c578063c4c50acf146102e4578063cb03fb1e146102f7578063d279c19114610317578063dd62ed3e1461032a578063ee99205c14610363578063f2fde38b1461037657600080fd5b8063715018a6146102765780638da5cb5b1461027e57806395d89b41146102a35780639dd373b9146102ab578063a457c2d7146102be578063a9059cbb146102d157600080fd5b80633401f64a116101155780633401f64a146101f657806339509351146101ff5780634c3855561461021257806352876497146102255780636ee14dfb1461023a57806370a082311461024d57600080fd5b806306fdde031461015d5780630700037d1461017b578063095ea7b3146101a957806318160ddd146101cc57806323b872dd146101d4578063313ce567146101e7575b600080fd5b610165610389565b6040516101729190610d05565b60405180910390f35b61019b610189366004610d76565b60076020526000908152604090205481565b604051908152602001610172565b6101bc6101b7366004610d98565b61041b565b6040519015158152602001610172565b60025461019b565b6101bc6101e2366004610dc2565b610433565b60405160128152602001610172565b61019b60065481565b6101bc61020d366004610d98565b610457565b61019b610220366004610d76565b610496565b610238610233366004610dfe565b610594565b005b610238610248366004610d76565b6105cc565b61019b61025b366004610d76565b6001600160a01b031660009081526020819052604090205490565b610238610601565b6005546001600160a01b03165b6040516001600160a01b039091168152602001610172565b610165610637565b6102386102b9366004610d76565b610646565b6101bc6102cc366004610d98565b610692565b6101bc6102df366004610d98565b610724565b6102386102f2366004610d98565b610732565b61019b610305366004610d76565b60086020526000908152604090205481565b610238610325366004610d76565b61076a565b61019b610338366004610e17565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60095461028b906001600160a01b031681565b610238610384366004610d76565b6107b5565b60606003805461039890610e4a565b80601f01602080910402602001604051908101604052809291908181526020018280546103c490610e4a565b80156104115780601f106103e657610100808354040283529160200191610411565b820191906000526020600020905b8154815290600101906020018083116103f457829003601f168201915b5050505050905090565b600033610429818585610850565b5060019392505050565b600033610441858285610974565b61044c858585610a06565b506001949350505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091906104299082908690610491908790610e9b565b610850565b6001600160a01b0381166000908152600860205260408120544290828115610571576006546104c58385610eb3565b60095460405163b34c8afb60e01b81526001600160a01b0389811660048301529091169063b34c8afb90602401602060405180830381865afa15801561050f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105339190610eca565b61053d9190610ee3565b6105479190610f02565b6001600160a01b03861660009081526007602052604090205461056a9190610e9b565b905061058c565b506001600160a01b0384166000908152600760205260409020545b949350505050565b6005546001600160a01b031633146105c75760405162461bcd60e51b81526004016105be90610f24565b60405180910390fd5b600655565b426105d682610496565b6001600160a01b03909216600090815260076020908152604080832094909455600890529190912055565b6005546001600160a01b0316331461062b5760405162461bcd60e51b81526004016105be90610f24565b6106356000610bd4565b565b60606004805461039890610e4a565b6005546001600160a01b031633146106705760405162461bcd60e51b81526004016105be90610f24565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156107175760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016105be565b61044c8286868403610850565b600033610429818585610a06565b6005546001600160a01b0316331461075c5760405162461bcd60e51b81526004016105be90610f24565b6107668282610c26565b5050565b610773816105cc565b6001600160a01b0381166000908152600760205260409020548015610766576001600160a01b0382166000908152600760205260408120556107668282610c26565b6005546001600160a01b031633146107df5760405162461bcd60e51b81526004016105be90610f24565b6001600160a01b0381166108445760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105be565b61084d81610bd4565b50565b6001600160a01b0383166108b25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105be565b6001600160a01b0382166109135760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105be565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114610a0057818110156109f35760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016105be565b610a008484848403610850565b50505050565b6001600160a01b038316610a6a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105be565b6001600160a01b038216610acc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105be565b6001600160a01b03831660009081526020819052604090205481811015610b445760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105be565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610b7b908490610e9b565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610bc791815260200190565b60405180910390a3610a00565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216610c7c5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105be565b8060026000828254610c8e9190610e9b565b90915550506001600160a01b03821660009081526020819052604081208054839290610cbb908490610e9b565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b600060208083528351808285015260005b81811015610d3257858101830151858201604001528201610d16565b81811115610d44576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b0381168114610d7157600080fd5b919050565b600060208284031215610d8857600080fd5b610d9182610d5a565b9392505050565b60008060408385031215610dab57600080fd5b610db483610d5a565b946020939093013593505050565b600080600060608486031215610dd757600080fd5b610de084610d5a565b9250610dee60208501610d5a565b9150604084013590509250925092565b600060208284031215610e1057600080fd5b5035919050565b60008060408385031215610e2a57600080fd5b610e3383610d5a565b9150610e4160208401610d5a565b90509250929050565b600181811c90821680610e5e57607f821691505b60208210811415610e7f57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610eae57610eae610e85565b500190565b600082821015610ec557610ec5610e85565b500390565b600060208284031215610edc57600080fd5b5051919050565b6000816000190483118215151615610efd57610efd610e85565b500290565b600082610f1f57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260408201526060019056fea2646970667358221220be2edff835ca7fb0ebbc318a9068695c71561b0ade484dc42fde5f821d39dd9464736f6c634300080c0033

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

0000000000000000000000001e70fde6dec595d0c9897f0296409a6dc5457560

-----Decoded View---------------
Arg [0] : _staking (address): 0x1E70FDe6dEc595d0c9897f0296409A6dc5457560

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000001e70fde6dec595d0c9897f0296409a6dc5457560


Deployed Bytecode Sourcemap

71763:1530:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;20876:100;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;71864:42;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;1131:25:1;;;1119:2;1104:18;71864:42:0;985:177:1;23227:201:0;;;;;;:::i;:::-;;:::i;:::-;;;1591:14:1;;1584:22;1566:41;;1554:2;1539:18;23227:201:0;1426:187:1;21996:108:0;22084:12;;21996:108;;24008:295;;;;;;:::i;:::-;;:::i;21838:93::-;;;21921:2;2093:36:1;;2081:2;2066:18;21838:93:0;1951:184:1;71820:38:0;;;;;;24712:240;;;;;;:::i;:::-;;:::i;72418:387::-;;;;;;:::i;:::-;;:::i;72312:98::-;;;;;;:::i;:::-;;:::i;:::-;;72810:166;;;;;;:::i;:::-;;:::i;22167:127::-;;;;;;:::i;:::-;-1:-1:-1;;;;;22268:18:0;22241:7;22268:18;;;;;;;;;;;;22167:127;17913:103;;;:::i;17262:87::-;17335:6;;-1:-1:-1;;;;;17335:6:0;17262:87;;;-1:-1:-1;;;;;2489:32:1;;;2471:51;;2459:2;2444:18;17262:87:0;2325:203:1;21095:104:0;;;:::i;72082:120::-;;;;;;:::i;:::-;;:::i;25455:438::-;;;;;;:::i;:::-;;:::i;22500:193::-;;;;;;:::i;:::-;;:::i;73177:113::-;;;;;;:::i;:::-;;:::i;71910:45::-;;;;;;:::i;:::-;;;;;;;;;;;;;;72981:188;;;;;;:::i;:::-;;:::i;22756:151::-;;;;;;:::i;:::-;-1:-1:-1;;;;;22872:18:0;;;22845:7;22872:18;;;:11;:18;;;;;;;;:27;;;;;;;;;;;;;22756:151;71961:31;;;;;-1:-1:-1;;;;;71961:31:0;;;18171:201;;;;;;:::i;:::-;;:::i;20876:100::-;20930:13;20963:5;20956:12;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;20876:100;:::o;23227:201::-;23310:4;16066:10;23366:32;16066:10;23382:7;23391:6;23366:8;:32::i;:::-;-1:-1:-1;23416:4:0;;23227:201;-1:-1:-1;;;23227:201:0:o;24008:295::-;24139:4;16066:10;24197:38;24213:4;16066:10;24228:6;24197:15;:38::i;:::-;24246:27;24256:4;24262:2;24266:6;24246:9;:27::i;:::-;-1:-1:-1;24291:4:0;;24008:295;-1:-1:-1;;;;24008:295:0:o;24712:240::-;16066:10;24800:4;24881:18;;;:11;:18;;;;;;;;-1:-1:-1;;;;;24881:27:0;;;;;;;;;;24800:4;;16066:10;24856:66;;16066:10;;24881:27;;:40;;24911:10;;24881:40;:::i;:::-;24856:8;:66::i;72418:387::-;-1:-1:-1;;;;;72551:17:0;;72476:7;72551:17;;;:10;:17;;;;;;72511:15;;72476:7;72606:13;;72602:171;;72712:8;;72691:16;72698:9;72691:4;:16;:::i;:::-;72651:15;;:36;;-1:-1:-1;;;72651:36:0;;-1:-1:-1;;;;;2489:32:1;;;72651:36:0;;;2471:51:1;72651:15:0;;;;:29;;2444:18:1;;72651:36:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:57;;;;:::i;:::-;:70;;;;:::i;:::-;-1:-1:-1;;;;;72634:14:0;;;;;;:7;:14;;;;;;:87;;;;:::i;:::-;72625:96;;72602:171;;;-1:-1:-1;;;;;;72759:14:0;;;;;;:7;:14;;;;;;72602:171;72791:6;72418:387;-1:-1:-1;;;;72418:387:0:o;72312:98::-;17335:6;;-1:-1:-1;;;;;17335:6:0;16066:10;17482:23;17474:68;;;;-1:-1:-1;;;17474:68:0;;;;;;;:::i;:::-;;;;;;;;;72382:8:::1;:20:::0;72312:98::o;72810:166::-;72880:15;72923:19;72936:5;72923:12;:19::i;:::-;-1:-1:-1;;;;;72906:14:0;;;;;;;:7;:14;;;;;;;;:36;;;;72947:10;:17;;;;;;:24;72810:166::o;17913:103::-;17335:6;;-1:-1:-1;;;;;17335:6:0;16066:10;17482:23;17474:68;;;;-1:-1:-1;;;17474:68:0;;;;;;;:::i;:::-;17978:30:::1;18005:1;17978:18;:30::i;:::-;17913:103::o:0;21095:104::-;21151:13;21184:7;21177:14;;;;;:::i;72082:120::-;17335:6;;-1:-1:-1;;;;;17335:6:0;16066:10;17482:23;17474:68;;;;-1:-1:-1;;;17474:68:0;;;;;;;:::i;:::-;72158:15:::1;:36:::0;;-1:-1:-1;;;;;;72158:36:0::1;-1:-1:-1::0;;;;;72158:36:0;;;::::1;::::0;;;::::1;::::0;;72082:120::o;25455:438::-;16066:10;25548:4;25631:18;;;:11;:18;;;;;;;;-1:-1:-1;;;;;25631:27:0;;;;;;;;;;25548:4;;16066:10;25677:35;;;;25669:85;;;;-1:-1:-1;;;25669:85:0;;4950:2:1;25669:85:0;;;4932:21:1;4989:2;4969:18;;;4962:30;5028:34;5008:18;;;5001:62;-1:-1:-1;;;5079:18:1;;;5072:35;5124:19;;25669:85:0;4748:401:1;25669:85:0;25790:60;25799:5;25806:7;25834:15;25815:16;:34;25790:8;:60::i;22500:193::-;22579:4;16066:10;22635:28;16066:10;22652:2;22656:6;22635:9;:28::i;73177:113::-;17335:6;;-1:-1:-1;;;;;17335:6:0;16066:10;17482:23;17474:68;;;;-1:-1:-1;;;17474:68:0;;;;;;;:::i;:::-;73260:22:::1;73266:3;73271:10;73260:5;:22::i;:::-;73177:113:::0;;:::o;72981:188::-;73035:23;73054:3;73035:18;:23::i;:::-;-1:-1:-1;;;;;73080:12:0;;73063:14;73080:12;;;:7;:12;;;;;;73101:10;;73097:68;;-1:-1:-1;;;;;73119:12:0;;73134:1;73119:12;;;:7;:12;;;;;:16;73141:18;73127:3;73152:6;73141:5;:18::i;18171:201::-;17335:6;;-1:-1:-1;;;;;17335:6:0;16066:10;17482:23;17474:68;;;;-1:-1:-1;;;17474:68:0;;;;;;;:::i;:::-;-1:-1:-1;;;;;18260:22:0;::::1;18252:73;;;::::0;-1:-1:-1;;;18252:73:0;;5356:2:1;18252:73:0::1;::::0;::::1;5338:21:1::0;5395:2;5375:18;;;5368:30;5434:34;5414:18;;;5407:62;-1:-1:-1;;;5485:18:1;;;5478:36;5531:19;;18252:73:0::1;5154:402:1::0;18252:73:0::1;18336:28;18355:8;18336:18;:28::i;:::-;18171:201:::0;:::o;29091:380::-;-1:-1:-1;;;;;29227:19:0;;29219:68;;;;-1:-1:-1;;;29219:68:0;;5763:2:1;29219:68:0;;;5745:21:1;5802:2;5782:18;;;5775:30;5841:34;5821:18;;;5814:62;-1:-1:-1;;;5892:18:1;;;5885:34;5936:19;;29219:68:0;5561:400:1;29219:68:0;-1:-1:-1;;;;;29306:21:0;;29298:68;;;;-1:-1:-1;;;29298:68:0;;6168:2:1;29298:68:0;;;6150:21:1;6207:2;6187:18;;;6180:30;6246:34;6226:18;;;6219:62;-1:-1:-1;;;6297:18:1;;;6290:32;6339:19;;29298:68:0;5966:398:1;29298:68:0;-1:-1:-1;;;;;29379:18:0;;;;;;;:11;:18;;;;;;;;:27;;;;;;;;;;;;;:36;;;29431:32;;1131:25:1;;;29431:32:0;;1104:18:1;29431:32:0;;;;;;;29091:380;;;:::o;29758:453::-;-1:-1:-1;;;;;22872:18:0;;;29893:24;22872:18;;;:11;:18;;;;;;;;:27;;;;;;;;;;-1:-1:-1;;29960:37:0;;29956:248;;30042:6;30022:16;:26;;30014:68;;;;-1:-1:-1;;;30014:68:0;;6571:2:1;30014:68:0;;;6553:21:1;6610:2;6590:18;;;6583:30;6649:31;6629:18;;;6622:59;6698:18;;30014:68:0;6369:353:1;30014:68:0;30126:51;30135:5;30142:7;30170:6;30151:16;:25;30126:8;:51::i;:::-;29882:329;29758:453;;;:::o;26372:671::-;-1:-1:-1;;;;;26503:18:0;;26495:68;;;;-1:-1:-1;;;26495:68:0;;6929:2:1;26495:68:0;;;6911:21:1;6968:2;6948:18;;;6941:30;7007:34;6987:18;;;6980:62;-1:-1:-1;;;7058:18:1;;;7051:35;7103:19;;26495:68:0;6727:401:1;26495:68:0;-1:-1:-1;;;;;26582:16:0;;26574:64;;;;-1:-1:-1;;;26574:64:0;;7335:2:1;26574:64:0;;;7317:21:1;7374:2;7354:18;;;7347:30;7413:34;7393:18;;;7386:62;-1:-1:-1;;;7464:18:1;;;7457:33;7507:19;;26574:64:0;7133:399:1;26574:64:0;-1:-1:-1;;;;;26724:15:0;;26702:19;26724:15;;;;;;;;;;;26758:21;;;;26750:72;;;;-1:-1:-1;;;26750:72:0;;7739:2:1;26750:72:0;;;7721:21:1;7778:2;7758:18;;;7751:30;7817:34;7797:18;;;7790:62;-1:-1:-1;;;7868:18:1;;;7861:36;7914:19;;26750:72:0;7537:402:1;26750:72:0;-1:-1:-1;;;;;26858:15:0;;;:9;:15;;;;;;;;;;;26876:20;;;26858:38;;26918:13;;;;;;;;:23;;26890:6;;26858:9;26918:23;;26890:6;;26918:23;:::i;:::-;;;;;;;;26974:2;-1:-1:-1;;;;;26959:26:0;26968:4;-1:-1:-1;;;;;26959:26:0;;26978:6;26959:26;;;;1131:25:1;;1119:2;1104:18;;985:177;26959:26:0;;;;;;;;26998:37;30811:125;18532:191;18625:6;;;-1:-1:-1;;;;;18642:17:0;;;-1:-1:-1;;;;;;18642:17:0;;;;;;;18675:40;;18625:6;;;18642:17;18625:6;;18675:40;;18606:16;;18675:40;18595:128;18532:191;:::o;27330:399::-;-1:-1:-1;;;;;27414:21:0;;27406:65;;;;-1:-1:-1;;;27406:65:0;;8146:2:1;27406:65:0;;;8128:21:1;8185:2;8165:18;;;8158:30;8224:33;8204:18;;;8197:61;8275:18;;27406:65:0;7944:355:1;27406:65:0;27562:6;27546:12;;:22;;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;;;27579:18:0;;:9;:18;;;;;;;;;;:28;;27601:6;;27579:9;:28;;27601:6;;27579:28;:::i;:::-;;;;-1:-1:-1;;27623:37:0;;1131:25:1;;;-1:-1:-1;;;;;27623:37:0;;;27640:1;;27623:37;;1119:2:1;1104:18;27623:37:0;;;;;;;73177:113;;:::o;14:597:1:-;126:4;155:2;184;173:9;166:21;216:6;210:13;259:6;254:2;243:9;239:18;232:34;284:1;294:140;308:6;305:1;302:13;294:140;;;403:14;;;399:23;;393:30;369:17;;;388:2;365:26;358:66;323:10;;294:140;;;452:6;449:1;446:13;443:91;;;522:1;517:2;508:6;497:9;493:22;489:31;482:42;443:91;-1:-1:-1;595:2:1;574:15;-1:-1:-1;;570:29:1;555:45;;;;602:2;551:54;;14:597;-1:-1:-1;;;14:597:1:o;616:173::-;684:20;;-1:-1:-1;;;;;733:31:1;;723:42;;713:70;;779:1;776;769:12;713:70;616:173;;;:::o;794:186::-;853:6;906:2;894:9;885:7;881:23;877:32;874:52;;;922:1;919;912:12;874:52;945:29;964:9;945:29;:::i;:::-;935:39;794:186;-1:-1:-1;;;794:186:1:o;1167:254::-;1235:6;1243;1296:2;1284:9;1275:7;1271:23;1267:32;1264:52;;;1312:1;1309;1302:12;1264:52;1335:29;1354:9;1335:29;:::i;:::-;1325:39;1411:2;1396:18;;;;1383:32;;-1:-1:-1;;;1167:254:1:o;1618:328::-;1695:6;1703;1711;1764:2;1752:9;1743:7;1739:23;1735:32;1732:52;;;1780:1;1777;1770:12;1732:52;1803:29;1822:9;1803:29;:::i;:::-;1793:39;;1851:38;1885:2;1874:9;1870:18;1851:38;:::i;:::-;1841:48;;1936:2;1925:9;1921:18;1908:32;1898:42;;1618:328;;;;;:::o;2140:180::-;2199:6;2252:2;2240:9;2231:7;2227:23;2223:32;2220:52;;;2268:1;2265;2258:12;2220:52;-1:-1:-1;2291:23:1;;2140:180;-1:-1:-1;2140:180:1:o;2533:260::-;2601:6;2609;2662:2;2650:9;2641:7;2637:23;2633:32;2630:52;;;2678:1;2675;2668:12;2630:52;2701:29;2720:9;2701:29;:::i;:::-;2691:39;;2749:38;2783:2;2772:9;2768:18;2749:38;:::i;:::-;2739:48;;2533:260;;;;;:::o;3023:380::-;3102:1;3098:12;;;;3145;;;3166:61;;3220:4;3212:6;3208:17;3198:27;;3166:61;3273:2;3265:6;3262:14;3242:18;3239:38;3236:161;;;3319:10;3314:3;3310:20;3307:1;3300:31;3354:4;3351:1;3344:15;3382:4;3379:1;3372:15;3236:161;;3023:380;;;:::o;3408:127::-;3469:10;3464:3;3460:20;3457:1;3450:31;3500:4;3497:1;3490:15;3524:4;3521:1;3514:15;3540:128;3580:3;3611:1;3607:6;3604:1;3601:13;3598:39;;;3617:18;;:::i;:::-;-1:-1:-1;3653:9:1;;3540:128::o;3673:125::-;3713:4;3741:1;3738;3735:8;3732:34;;;3746:18;;:::i;:::-;-1:-1:-1;3783:9:1;;3673:125::o;3803:184::-;3873:6;3926:2;3914:9;3905:7;3901:23;3897:32;3894:52;;;3942:1;3939;3932:12;3894:52;-1:-1:-1;3965:16:1;;3803:184;-1:-1:-1;3803:184:1:o;3992:168::-;4032:7;4098:1;4094;4090:6;4086:14;4083:1;4080:21;4075:1;4068:9;4061:17;4057:45;4054:71;;;4105:18;;:::i;:::-;-1:-1:-1;4145:9:1;;3992:168::o;4165:217::-;4205:1;4231;4221:132;;4275:10;4270:3;4266:20;4263:1;4256:31;4310:4;4307:1;4300:15;4338:4;4335:1;4328:15;4221:132;-1:-1:-1;4367:9:1;;4165:217::o;4387:356::-;4589:2;4571:21;;;4608:18;;;4601:30;4667:34;4662:2;4647:18;;4640:62;4734:2;4719:18;;4387:356::o

Swarm Source

ipfs://be2edff835ca7fb0ebbc318a9068695c71561b0ade484dc42fde5f821d39dd94
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.