Contract 0x508e1c934775c28f216bdf6afcdbe94c0856a2a8

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x7e23b52d27f541f81192a5634ca50ad3dcba16a1b9be1e7440e03e132a1eca660x60806040234282562022-09-07 18:59:28568 days 2 mins ago0xb013abd83f0bd173e9f14ce7d6e420ad711483b4 IN  Contract Creation0 ETH0.00102538 0.1
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x2301c04b42423e9e1740718d95cf895e5ea5e6e4c3ea785edbd30b13355ac64f720863362023-03-21 10:17:30373 days 8 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0xcafa746c18cd84e8f0fb88350c56181eeffea590991d146e576d09b0fb091170720812852023-03-21 9:56:32373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0xabe09a69f18ee5c5079da67c3fb14836c1e08aa7b1ffe0a166a9578ee6cd0e35720811542023-03-21 9:55:59373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x4ccb7d5ed487e16abd5990c98be13f3ea9094e123802829968befeb0c9393289720810032023-03-21 9:55:21373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
0x704cd871e08aedbd38d561bdbc504b90234925328087487302c908003068858c720805992023-03-21 9:53:40373 days 9 hrs ago 0xd9a1e140399875c2ce9515c504baa7875f69fe88 0x508e1c934775c28f216bdf6afcdbe94c0856a2a80 ETH
[ Download CSV Export 
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x39290327cBf333974E909faa098dCbb43135e9cE
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
ExtractorStakingRules

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
File 1 of 19 : AccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlEnumerableUpgradeable.sol";
import "./AccessControlUpgradeable.sol";
import "../utils/structs/EnumerableSetUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {
    function __AccessControlEnumerable_init() internal onlyInitializing {
    }

    function __AccessControlEnumerable_init_unchained() internal onlyInitializing {
    }
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;

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

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }

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

File 2 of 19 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(uint160(account), 20),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }

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

File 3 of 19 : IAccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

File 4 of 19 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 5 of 19 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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

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

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

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

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

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

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

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

File 6 of 19 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

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

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

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

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

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

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

File 8 of 19 : CountersUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library CountersUpgradeable {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 9 of 19 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

File 10 of 19 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

pragma solidity ^0.8.0;

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

File 12 of 19 : EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }
}

File 13 of 19 : IHarvester.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../nfthandler/INftHandler.sol";

interface IHarvester {
    struct UserInfo {
        uint256 originalDepositAmount;
        uint256 depositAmount;
        uint256 lockLpAmount;
        uint256 lockedUntil;
        uint256 lock;
    }

    struct CapConfig {
        address parts;
        uint256 partsTokenId;
        uint256 capPerPart;
    }

    struct GlobalUserDeposit {
        uint256 globalDepositAmount;
        uint256 globalLockLpAmount;
        uint256 globalLpAmount;
        int256 globalRewardDebt;
    }

    struct Timelock {
        uint256 boost;
        uint256 timelock;
        uint256 vesting;
        bool enabled;
    }

    function init(address _admin, INftHandler _nftHandler, CapConfig memory _depositCapPerWallet) external;
    function disabled() external view returns (bool);
    function enable() external;
    function disable() external;
    function callUpdateRewards() external returns (bool);
    function isUserExceedingDepositCap(address _user) external view returns (bool);
    function updateNftBoost(address user) external returns (bool);
    function nftHandler() external view returns (INftHandler);
    function magicTotalDeposits() external view returns (uint256);
    function totalDepositCap() external view returns (uint256);
}

File 14 of 19 : ExtractorStakingRules.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import '@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol';

import "./IExtractorStakingRules.sol";

import "./StakingRulesBase.sol";

contract ExtractorStakingRules is IExtractorStakingRules, ERC165Upgradeable, StakingRulesBase {
    using CountersUpgradeable for CountersUpgradeable.Counter;

    struct ExtractorData {
        address user;
        uint256 tokenId;
        uint256 stakedTimestamp;
    }

    uint256 public constant MAX_SPOTS = 75;

    uint256 public maxStakeable;

    /// @dev time in seconds during which extractor is live
    uint256 public lifetime;

    /// @dev address of NFT extractor token
    address public extractorAddress;

    /// @dev latest spot Id
    CountersUpgradeable.Counter public extractorCount;
    /// @dev maps spot Id to ExtractorData
    mapping(uint256 => ExtractorData) public stakedExtractor;

    /// @dev maps token Id => boost value
    mapping(uint256 => uint256) public extractorBoost;

    event MaxStakeable(uint256 maxStakeable);
    event ExtractorBoost(uint256 tokenId, uint256 boost);
    event ExtractorStaked(address user, uint256 tokenId, uint256 spotId, uint256 amount);
    event ExtractorReplaced(address user, uint256 tokenId, uint256 replacedSpotId);
    event Lifetime(uint256 lifetime);
    event ExtractorAddress(address extractorAddress);

    error InvalidAddress();
    error ZeroAmount();
    error MustReplaceOne();
    error InvalidSpotId();
    error MustReplaceWithHigherBoost();
    error ZeroBoost();
    error MaxStakeableReached();
    error CannotUnstake();
    error TooManyStakeableSpots();

    modifier validateInput(address _nft, uint256 _amount) {
        if (_nft != extractorAddress) revert InvalidAddress();
        if (_amount == 0) revert ZeroAmount();

        _;
    }

    function init(
        address _admin,
        address _harvesterFactory,
        address _extractorAddress,
        uint256 _maxStakeable,
        uint256 _lifetime
    ) external initializer {
        __ERC165_init();

        _initStakingRulesBase(_admin, _harvesterFactory);

        _setExtractorAddress(_extractorAddress);
        _setMaxStakeable(_maxStakeable);
        _setExtractorLifetime(_lifetime);
    }

    function supportsInterface(bytes4 interfaceId) public view override(ERC165Upgradeable, AccessControlEnumerableUpgradeable) returns (bool) {
        return
            interfaceId == type(IExtractorStakingRules).interfaceId ||
            interfaceId == type(IERC165Upgradeable).interfaceId ||
            interfaceId == type(IAccessControlUpgradeable).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    function isExtractorActive(uint256 _spotId) public view returns (bool) {
        return block.timestamp <= stakedExtractor[_spotId].stakedTimestamp + lifetime;
    }

    function getExtractorCount() public view returns (uint256) {
        return extractorCount.current();
    }

    /// @return extractors array of all staked extractors
    function getExtractors() external view returns (ExtractorData[] memory extractors) {
        extractors = new ExtractorData[](extractorCount.current());

        for (uint256 i = 0; i < extractors.length; i++) {
            extractors[i] = stakedExtractor[i];
        }
    }

    /// @return totalBoost boost sum of all active extractors
    function getExtractorsTotalBoost() public view returns (uint256 totalBoost) {
        for (uint256 i = 0; i < extractorCount.current(); i++) {
            if (isExtractorActive(i)) {
                totalBoost += extractorBoost[stakedExtractor[i].tokenId];
            }
        }
    }

    /// @inheritdoc IStakingRules
    function getUserBoost(address, address, uint256, uint256) external pure override returns (uint256) {
        return 0;
    }

    /// @inheritdoc IStakingRules
    function getHarvesterBoost() external view returns (uint256) {
        return Constant.ONE + getExtractorsTotalBoost();
    }

    /// @inheritdoc IExtractorStakingRules
    function canReplace(address _user, address _nft, uint256 _tokenId, uint256 _amount, uint256 _replacedSpotId)
        external
        override
        onlyRole(SR_NFT_HANDLER)
        validateInput(_nft, _amount)
        returns (address user, uint256 replacedTokenId, uint256 replacedAmount)
    {
        if (_amount != 1) revert MustReplaceOne();
        if (_replacedSpotId >= maxStakeable) revert InvalidSpotId();

        user = stakedExtractor[_replacedSpotId].user;
        replacedTokenId = stakedExtractor[_replacedSpotId].tokenId;
        replacedAmount = _amount;

        if (isExtractorActive(_replacedSpotId)) {
            uint256 oldBoost = extractorBoost[replacedTokenId];
            uint256 newBoost = extractorBoost[_tokenId];
            if (oldBoost >= newBoost) revert MustReplaceWithHigherBoost();
        }

        stakedExtractor[_replacedSpotId] = ExtractorData(_user, _tokenId, block.timestamp);
        emit ExtractorReplaced(_user, _tokenId, _replacedSpotId);
    }

    function _processStake(address _user, address _nft, uint256 _tokenId, uint256 _amount)
        internal
        override
        validateInput(_nft, _amount)
    {
        if (extractorBoost[_tokenId] == 0) revert ZeroBoost();
        if (extractorCount.current() + _amount > maxStakeable) revert MaxStakeableReached();

        uint256 spotId;

        for (uint256 i = 0; i < _amount; i++) {
            spotId = extractorCount.current();

            stakedExtractor[spotId] = ExtractorData(_user, _tokenId, block.timestamp);
            extractorCount.increment();
        }

        emit ExtractorStaked(_user, _tokenId, spotId, _amount);
    }

    function _processUnstake(address, address, uint256, uint256) internal pure override {
        revert CannotUnstake();
    }

    // ADMIN

    function setMaxStakeable(uint256 _maxStakeable) external onlyRole(SR_ADMIN) {
        _setMaxStakeable(_maxStakeable);
    }

    function setExtractorBoost(uint256 _tokenId, uint256 _boost) external onlyRole(SR_ADMIN) {
        nftHandler.harvester().callUpdateRewards();

        extractorBoost[_tokenId] = _boost;
        emit ExtractorBoost(_tokenId, _boost);
    }

    function setExtractorLifetime(uint256 _lifetime) external onlyRole(SR_ADMIN) {
        nftHandler.harvester().callUpdateRewards();

        _setExtractorLifetime(_lifetime);
    }

    function _setMaxStakeable(uint256 _maxStakeable) internal {
        // disallow number higher than MAX_SPOTS because of loops
        if (_maxStakeable > MAX_SPOTS) revert TooManyStakeableSpots();

        maxStakeable = _maxStakeable;
        emit MaxStakeable(_maxStakeable);
    }

    function _setExtractorAddress(address _extractorAddress) internal {
        extractorAddress = _extractorAddress;
        emit ExtractorAddress(_extractorAddress);
    }

    function _setExtractorLifetime(uint256 _lifetime) internal {
        lifetime = _lifetime;
        emit Lifetime(_lifetime);
    }
}

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

import "./IStakingRules.sol";

interface IExtractorStakingRules is IStakingRules {
    /// @notice Checks if extractor can be replaced
    /// @param _tokenId token Id of new extractor
    /// @param _amount must be 1, only 1 extractor at a time can be replaced
    /// @param _replacedSpotId index of stakedExtractor mapping for replaced extractor
    /// @return user wallet address that staked replaced NFT
    /// @return replacedTokenId tokenId of replaced NFT
    /// @return replacedAmount amount of replaced NFT, must be 1 for ERC721
    function canReplace(address _user, address _nft, uint256 _tokenId, uint256 _amount, uint256 _replacedSpotId)
        external
        returns (address user, uint256 replacedTokenId, uint256 replacedAmount);
}

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

interface IStakingRules {
    /// @notice Checks if NFT can be staked
    /// @param _user wallet that is staking the NFT
    /// @param _nft NFT address, can be either ERC721 or ERC1155
    /// @param _tokenId token Id of staked NFT
    /// @param _amount number of NFTs staked, must be 1 for ERC721
    function processStake(address _user, address _nft, uint256 _tokenId, uint256 _amount) external;

    /// @notice Checks if NFT can be unstaked
    /// @param _user wallet that is unstaking the NFT
    /// @param _nft NFT address, can be either ERC721 or ERC1155
    /// @param _tokenId token Id of unstaked NFT
    /// @param _amount number of NFTs unstaked, must be 1 for ERC721
    function processUnstake(address _user, address _nft, uint256 _tokenId, uint256 _amount) external;

    /// @notice Gets amount of boost that user gets by staking given NFT
    /// @param _user wallet for which to calculate boost
    /// @param _nft NFT address, can be either ERC721 or ERC1155
    /// @param _tokenId token Id of NFT
    /// @param _amount number of NFTs for which to calculate boost, must be 1 for ERC721
    /// @return boost amount that user gets by staking NFT(s)
    function getUserBoost(address _user, address _nft, uint256 _tokenId, uint256 _amount) external view returns (uint256);

    /// @notice Gets amount of boost that harvester gets for all staked NFTs
    /// @return amount of boost that harvester gets for all staked NFTs
    function getHarvesterBoost() external view returns (uint256);

    /// @notice Set nftHandler address
    /// @param _nftHandler address
    function setNftHandler(address _nftHandler) external;

}

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

import '@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol';

import './IStakingRules.sol';
import '../nfthandler/INftHandler.sol';

import '../middleman/Constant.sol';

abstract contract StakingRulesBase is IStakingRules, AccessControlEnumerableUpgradeable {
    bytes32 public constant SR_ADMIN = keccak256("SR_ADMIN");
    bytes32 public constant SR_NFT_HANDLER = keccak256("SR_NFT_HANDLER");
    /// @dev temporary role assigned to harvester factory to setup nftHandler after it's deployed
    ///      (solves circular dependency)
    bytes32 public constant SR_HARVESTER_FACTORY = keccak256("SR_HARVESTER_FACTORY");

    INftHandler public nftHandler;

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

    function _initStakingRulesBase(address _admin, address _harvesterFactory) internal onlyInitializing {
        __AccessControlEnumerable_init();

        _setRoleAdmin(SR_ADMIN, SR_ADMIN);
        _setRoleAdmin(SR_NFT_HANDLER, SR_ADMIN);
        _setRoleAdmin(SR_HARVESTER_FACTORY, SR_ADMIN);

        _grantRole(SR_ADMIN, _admin);
        // SR_NFT_HANDLER must be a contract that implements harvester() getter
        _grantRole(SR_HARVESTER_FACTORY, _harvesterFactory);
    }

    /// @inheritdoc IStakingRules
    function processStake(address _user, address _nft, uint256 _tokenId, uint256 _amount)
        external
        override
        onlyRole(SR_NFT_HANDLER)
    {
        _processStake(_user, _nft, _tokenId, _amount);
    }

    /// @inheritdoc IStakingRules
    function processUnstake(address _user, address _nft, uint256 _tokenId, uint256 _amount)
        external
        override
        onlyRole(SR_NFT_HANDLER)
    {
        _processUnstake(_user, _nft, _tokenId, _amount);
    }

    /// @inheritdoc IStakingRules
    function setNftHandler(address _nftHandler) external onlyRole(SR_HARVESTER_FACTORY) {
        nftHandler = INftHandler(_nftHandler);

        _grantRole(SR_NFT_HANDLER, _nftHandler);
        _revokeRole(SR_HARVESTER_FACTORY, msg.sender);
    }

    /// @dev it's meant to be overridden by staking rules implementation
    function _processStake(address, address, uint256, uint256) internal virtual {}

    /// @dev it's meant to be overridden by staking rules implementation
    function _processUnstake(address, address, uint256, uint256) internal virtual {}
}

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

library Constant {
    uint256 public constant ONE = 1e18;
}

File 19 of 19 : INftHandler.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "../harvester/IHarvester.sol";
import '../harvesterrules/IStakingRules.sol';

interface INftHandler {
    enum Interfaces { Unsupported, ERC721, ERC1155 }

    struct NftConfig {
        Interfaces supportedInterface;
        /// @dev contract address which calculates boost for this NFT
        IStakingRules stakingRules;
    }

    /// @notice Initialize contract
    /// @param _admin wallet address to be set as contract's admin
    /// @param _harvester harvester address for which INftHandler is deployed
    /// @param _nfts array of NFTs allowed to be staked
    /// @param _tokenIds array of tokenIds allowed to be staked, it should correspond to `_nfts`
    /// @param _nftConfigs array of configs for each NFT
    function init(
        address _admin,
        address _harvester,
        address[] memory _nfts,
        uint256[] memory _tokenIds,
        INftHandler.NftConfig[] memory _nftConfigs
    ) external;

    /// @notice Gets harvester address linked to this contract
    /// @return Harvester interface
    function harvester() external view returns (IHarvester);

    /// @notice Gets staking rules contract address
    /// @param _nft NFT contract address for which to read staking rules contract address
    /// @param _tokenId token id for which to read staking rules contract address
    /// @return staking rules contract address
    function getStakingRules(address _nft, uint256 _tokenId) external view returns (IStakingRules);

    /// @notice Gets cached user boost
    /// @dev Cached boost is re-calculated on the fly on stake and unstake NFT by user
    /// @param _user user's wallet address
    /// @return cached user boost as percentage, 1e18 == 100%
    function getUserBoost(address _user) external view returns (uint256);

    /// @notice Gets given NFT boost for user
    /// @param _user user's wallet address
    /// @param _nft address of NFT contract
    /// @param _tokenId token Id of NFT for which to calculate the boost
    /// @param _amount amount of tokens for which to calculate boost, must be 1 for ERC721
    /// @return calculated boost for given NFT for given user as percentage, 1e18 == 100%
    function getNftBoost(address _user, address _nft, uint256 _tokenId, uint256 _amount) external view returns (uint256);

    /// @notice Gets harvester boost to calculate rewards allocation
    /// @return boost calculated harvester boost to calculate rewards allocation
    function getHarvesterTotalBoost() external view returns (uint256 boost);
}

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

Contract ABI

[{"inputs":[],"name":"CannotUnstake","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"InvalidSpotId","type":"error"},{"inputs":[],"name":"MaxStakeableReached","type":"error"},{"inputs":[],"name":"MustReplaceOne","type":"error"},{"inputs":[],"name":"MustReplaceWithHigherBoost","type":"error"},{"inputs":[],"name":"TooManyStakeableSpots","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"inputs":[],"name":"ZeroBoost","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"extractorAddress","type":"address"}],"name":"ExtractorAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"boost","type":"uint256"}],"name":"ExtractorBoost","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"replacedSpotId","type":"uint256"}],"name":"ExtractorReplaced","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"spotId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ExtractorStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"lifetime","type":"uint256"}],"name":"Lifetime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxStakeable","type":"uint256"}],"name":"MaxStakeable","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SPOTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SR_ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SR_HARVESTER_FACTORY","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SR_NFT_HANDLER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_nft","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_replacedSpotId","type":"uint256"}],"name":"canReplace","outputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"replacedTokenId","type":"uint256"},{"internalType":"uint256","name":"replacedAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"extractorAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"extractorBoost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"extractorCount","outputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getExtractorCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getExtractors","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"stakedTimestamp","type":"uint256"}],"internalType":"struct ExtractorStakingRules.ExtractorData[]","name":"extractors","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getExtractorsTotalBoost","outputs":[{"internalType":"uint256","name":"totalBoost","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHarvesterBoost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"getUserBoost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_harvesterFactory","type":"address"},{"internalType":"address","name":"_extractorAddress","type":"address"},{"internalType":"uint256","name":"_maxStakeable","type":"uint256"},{"internalType":"uint256","name":"_lifetime","type":"uint256"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_spotId","type":"uint256"}],"name":"isExtractorActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lifetime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxStakeable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftHandler","outputs":[{"internalType":"contract INftHandler","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_nft","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"processStake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_nft","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"processUnstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_boost","type":"uint256"}],"name":"setExtractorBoost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lifetime","type":"uint256"}],"name":"setExtractorLifetime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxStakeable","type":"uint256"}],"name":"setMaxStakeable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftHandler","type":"address"}],"name":"setNftHandler","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakedExtractor","outputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"stakedTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102065760003560e01c806369d24f631161011a5780639a35b648116100ad578063ca39f5c01161007c578063ca39f5c0146104ac578063d547741f146104c1578063e2287780146104d4578063f64ee4f3146104dd578063f84713fb146104e757600080fd5b80639a35b64814610467578063a217fddf1461047c578063abe9310014610484578063ca15c8731461049957600080fd5b80638155ca4d116100e95780638155ca4d1461041b578063831d6d841461042e5780639010d07c1461044157806391d148541461045457600080fd5b806369d24f63146103ef5780636c7849c5146103f857806377d1dc67146104005780637ce71b3a1461040857600080fd5b80632ee5b4821161019d5780633c84e3b61161016c5780633c84e3b61461038e5780634e758966146103a15780635509ec5e146103b457806357dd662c146103d45780635c604a87146103e757600080fd5b80632ee5b482146103405780632f2ff15d1461035557806330d467e21461036857806336568abe1461037b57600080fd5b806313d968b1116101d957806313d968b1146102cc57806317babda1146102f7578063221715491461030a578063248a9ca31461031d57600080fd5b80630145e3331461020b57806301ffc9a71461022057806305078a93146102485780630e9f5d30146102a6575b600080fd5b61021e61021936600461177f565b6104ef565b005b61023361022e3660046117da565b61062f565b60405190151581526020015b60405180910390f35b610281610256366004611804565b60ce602052600090815260409020805460018201546002909201546001600160a01b03909116919083565b604080516001600160a01b03909416845260208401929092529082015260600161023f565b6102be6102b436600461181d565b6000949350505050565b60405190815260200161023f565b60cc546102df906001600160a01b031681565b6040516001600160a01b03909116815260200161023f565b61021e610305366004611804565b610690565b60c9546102df906001600160a01b031681565b6102be61032b366004611804565b60009081526065602052604090206001015490565b6102be600080516020611bde83398151915281565b61021e610363366004611863565b6106b5565b61021e61037636600461181d565b6106df565b61021e610389366004611863565b61070a565b61021e61039c366004611893565b610784565b6102336103af366004611804565b6108c7565b6102be6103c2366004611804565b60cf6020526000908152604090205481565b6102816103e23660046118b5565b6108f0565b6102be610ab6565b6102be60cb5481565b6102be610ac6565b6102be604b81565b61021e610416366004611906565b610b24565b61021e610429366004611804565b610b87565b61021e61043c36600461181d565b610c83565b6102df61044f366004611893565b610ca7565b610233610462366004611863565b610cc6565b6102be600080516020611bfe83398151915281565b6102be600081565b6102be600080516020611bbe83398151915281565b6102be6104a7366004611804565b610cf1565b6104b4610d08565b60405161023f9190611923565b61021e6104cf366004611863565b610e08565b6102be60ca5481565b60cd546102be9081565b6102be610e2d565b600054610100900460ff161580801561050f5750600054600160ff909116105b806105295750303b158015610529575060005460ff166001145b6105915760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156105b4576000805461ff0019166101001790555b6105bc610e58565b6105c68686610e81565b6105cf84610f44565b6105d883610f99565b6105e182610ff0565b8015610627576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b60006001600160e01b031982166315f7598b60e21b148061066057506001600160e01b031982166301ffc9a760e01b145b8061067b57506001600160e01b03198216637965db0b60e01b145b8061068a575061068a82611025565b92915050565b600080516020611bde8339815191526106a88161104a565b6106b182610f99565b5050565b6000828152606560205260409020600101546106d08161104a565b6106da8383611057565b505050565b600080516020611bfe8339815191526106f78161104a565b61070385858585611079565b5050505050565b6001600160a01b038116331461077a5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610588565b6106b18282611092565b600080516020611bde83398151915261079c8161104a565b60c960009054906101000a90046001600160a01b03166001600160a01b0316634bdaeac16040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108139190611985565b6001600160a01b03166364eebd326040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610852573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087691906119a2565b50600083815260cf602090815260409182902084905581518581529081018490527fa6503c2bb8d5930e7ccd7545a07dbfff31cf54e6c960f4a03088f503ab65a45f910160405180910390a1505050565b60cb54600082815260ce602052604081206002015490916108e7916119da565b42111592915050565b6000806000600080516020611bfe83398151915261090d8161104a565b60cc54889087906001600160a01b0380841691161461093f5760405163e6c4247b60e01b815260040160405180910390fd5b8060000361096057604051631f2a200560e01b815260040160405180910390fd5b876001146109815760405163051f5c4560e51b815260040160405180910390fd5b60ca5487106109a3576040516363630e5960e11b815260040160405180910390fd5b600087815260ce6020526040902080546001909101546001600160a01b03909116965094508793506109d4876108c7565b15610a1257600085815260cf6020526040808220548b8352912054808210610a0f57604051631d08539760e11b815260040160405180910390fd5b50505b60408051606080820183526001600160a01b038e811680845260208085018f81524286880190815260008f815260ce8452889020965187546001600160a01b03191695169490941786555160018601559151600290940193909355835192835282018c90529181018990527f451422c6cbcdd632c1e0a1216353322746ca6fb720be6bf0b58af61c6ca63cb5910160405180910390a1505050955095509592505050565b6000610ac160cd5490565b905090565b6000805b60cd54811015610b2057610add816108c7565b15610b0e57600081815260ce6020908152604080832060010154835260cf909152902054610b0b90836119da565b91505b80610b18816119f2565b915050610aca565b5090565b600080516020611bbe833981519152610b3c8161104a565b60c980546001600160a01b0319166001600160a01b038416179055610b6f600080516020611bfe83398151915283611057565b6106b1600080516020611bbe83398151915233611092565b600080516020611bde833981519152610b9f8161104a565b60c960009054906101000a90046001600160a01b03166001600160a01b0316634bdaeac16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610bf2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c169190611985565b6001600160a01b03166364eebd326040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610c55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7991906119a2565b506106b182610ff0565b600080516020611bfe833981519152610c9b8161104a565b610703858585856110b4565b6000828152609760205260408120610cbf9083611251565b9392505050565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600081815260976020526040812061068a9061125d565b6060610d1360cd5490565b67ffffffffffffffff811115610d2b57610d2b611a0b565b604051908082528060200260200182016040528015610d8957816020015b610d76604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b815260200190600190039081610d495790505b50905060005b8151811015610b2057600081815260ce6020908152604091829020825160608101845281546001600160a01b0316815260018201549281019290925260020154918101919091528251839083908110610dea57610dea611a21565b60200260200101819052508080610e00906119f2565b915050610d8f565b600082815260656020526040902060010154610e238161104a565b6106da8383611092565b6000610e37610ac6565b610ac190670de0b6b3a76400006119da565b6001600160a01b03163b151590565b600054610100900460ff16610e7f5760405162461bcd60e51b815260040161058890611a37565b565b600054610100900460ff16610ea85760405162461bcd60e51b815260040161058890611a37565b610eb0610e58565b610ec8600080516020611bde83398151915280611267565b610eee600080516020611bfe833981519152600080516020611bde833981519152611267565b610f14600080516020611bbe833981519152600080516020611bde833981519152611267565b610f2c600080516020611bde83398151915283611057565b6106b1600080516020611bbe83398151915282611057565b60cc80546001600160a01b0319166001600160a01b0383169081179091556040519081527f86781e9914d8effd3fd8ea09a1957ac578610daf5a03c99c558bfb5201daaf68906020015b60405180910390a150565b604b811115610fbb576040516320e2ae3b60e21b815260040160405180910390fd5b60ca8190556040518181527f5d6d24b687db064d1bf535e48e6754c28bf14f8156f9fd01cd400d09232aa24790602001610f8e565b60cb8190556040518181527fe417bbceba87990a82f2afa5e76625613d0a98f56454d4821098dc64f260497e90602001610f8e565b60006001600160e01b03198216635a05180f60e01b148061068a575061068a826112b2565b61105481336112e7565b50565b611061828261134b565b60008281526097602052604090206106da90826113d1565b6040516338ae6ae760e11b815260040160405180910390fd5b61109c82826113e6565b60008281526097602052604090206106da908261144d565b60cc54839082906001600160a01b038084169116146110e65760405163e6c4247b60e01b815260040160405180910390fd5b8060000361110757604051631f2a200560e01b815260040160405180910390fd5b600084815260cf602052604081205490036111355760405163d04f15a360e01b815260040160405180910390fd5b60ca548361114260cd5490565b61114c91906119da565b111561116b57604051630dfb349560e41b815260040160405180910390fd5b6000805b848110156111f65760cd54604080516060810182526001600160a01b03808c16825260208083018b815242848601908152600087815260ce909352949091209251835492166001600160a01b0319909216919091178255516001820155905160029091015591506111e460cd80546001019055565b806111ee816119f2565b91505061116f565b50604080516001600160a01b038916815260208101879052908101829052606081018590527f932467f17df4165cc5e1399a3b989077641755fc6b56cbe2875335489e266e0e9060800160405180910390a150505050505050565b6000610cbf8383611462565b600061068a825490565b600082815260656020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b60006001600160e01b03198216637965db0b60e01b148061068a57506301ffc9a760e01b6001600160e01b031983161461068a565b6112f18282610cc6565b6106b157611309816001600160a01b0316601461148c565b61131483602061148c565b604051602001611325929190611ab2565b60408051601f198184030181529082905262461bcd60e51b825261058891600401611b27565b6113558282610cc6565b6106b15760008281526065602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561138d3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610cbf836001600160a01b038416611628565b6113f08282610cc6565b156106b15760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610cbf836001600160a01b038416611677565b600082600001828154811061147957611479611a21565b9060005260206000200154905092915050565b6060600061149b836002611b5a565b6114a69060026119da565b67ffffffffffffffff8111156114be576114be611a0b565b6040519080825280601f01601f1916602001820160405280156114e8576020820181803683370190505b509050600360fc1b8160008151811061150357611503611a21565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061153257611532611a21565b60200101906001600160f81b031916908160001a9053506000611556846002611b5a565b6115619060016119da565b90505b60018111156115d9576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061159557611595611a21565b1a60f81b8282815181106115ab576115ab611a21565b60200101906001600160f81b031916908160001a90535060049490941c936115d281611b79565b9050611564565b508315610cbf5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610588565b600081815260018301602052604081205461166f5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561068a565b50600061068a565b6000818152600183016020526040812054801561176057600061169b600183611b90565b85549091506000906116af90600190611b90565b90508181146117145760008660000182815481106116cf576116cf611a21565b90600052602060002001549050808760000184815481106116f2576116f2611a21565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061172557611725611ba7565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061068a565b600091505061068a565b6001600160a01b038116811461105457600080fd5b600080600080600060a0868803121561179757600080fd5b85356117a28161176a565b945060208601356117b28161176a565b935060408601356117c28161176a565b94979396509394606081013594506080013592915050565b6000602082840312156117ec57600080fd5b81356001600160e01b031981168114610cbf57600080fd5b60006020828403121561181657600080fd5b5035919050565b6000806000806080858703121561183357600080fd5b843561183e8161176a565b9350602085013561184e8161176a565b93969395505050506040820135916060013590565b6000806040838503121561187657600080fd5b8235915060208301356118888161176a565b809150509250929050565b600080604083850312156118a657600080fd5b50508035926020909101359150565b600080600080600060a086880312156118cd57600080fd5b85356118d88161176a565b945060208601356118e88161176a565b94979496505050506040830135926060810135926080909101359150565b60006020828403121561191857600080fd5b8135610cbf8161176a565b602080825282518282018190526000919060409081850190868401855b8281101561197857815180516001600160a01b0316855286810151878601528501518585015260609093019290850190600101611940565b5091979650505050505050565b60006020828403121561199757600080fd5b8151610cbf8161176a565b6000602082840312156119b457600080fd5b81518015158114610cbf57600080fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156119ed576119ed6119c4565b500190565b600060018201611a0457611a046119c4565b5060010190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60005b83811015611a9d578181015183820152602001611a85565b83811115611aac576000848401525b50505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611aea816017850160208801611a82565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611b1b816028840160208801611a82565b01602801949350505050565b6020815260008251806020840152611b46816040850160208701611a82565b601f01601f19169190910160400192915050565b6000816000190483118215151615611b7457611b746119c4565b500290565b600081611b8857611b886119c4565b506000190190565b600082821015611ba257611ba26119c4565b500390565b634e487b7160e01b600052603160045260246000fdfe20703a9c051938d58ac868a3bc39ca1f8830a3ccdc9cf1c86dbfaa3c19cef97f0c0cebec9570e6aeacead22df38f21276b792305549f224fe7934e317149b2b9168a55d58626433a0d3385a652fbce4ab6a8959aa86d117b2bcf384bcf1eafc4a26469706673582212202f68375778fc5cdf6d86119c018a12ecea9a34de87c912f2212dee06aee3020464736f6c634300080d0033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.