ETH Price: $2,863.54 (-2.71%)

Contract

0xCDA71d2F336Eb92341A9cd31E520a07C7eD99B89
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ManagedNFTManagerUpgradeable

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 2000 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.19;

import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import {BlastGovernorClaimableSetup} from "../integration/BlastGovernorClaimableSetup.sol";
import {IVotingEscrow} from "../core/interfaces/IVotingEscrow.sol";
import {IManagedNFTStrategy} from "./interfaces/IManagedNFTStrategy.sol";
import {IManagedNFTManager} from "./interfaces/IManagedNFTManager.sol";

/**
 * @title Managed NFT Manager Upgradeable
 * @dev Manages the lifecycle and access control for NFTs used in a managed strategy, leveraging governance and escrow functionalities.
 *      This contract serves as the central point for managing NFTs, their attachments to strategies, and authorized user interactions.
 */
contract ManagedNFTManagerUpgradeable is IManagedNFTManager, AccessControlUpgradeable, BlastGovernorClaimableSetup {
    /**
     * @dev Error indicating an unauthorized access attempt.
     */
    error AccessDenied();

    /**
     * @dev Error indicating an operation attempted on a managed NFT that is currently disabled.
     */
    error ManagedNFTIsDisabled();

    /**
     * @dev Error indicating that a required attachment action was not found or is missing.
     */
    error NotAttached();

    /**
     * @dev Error indicating that the specified token ID does not correspond to a managed NFT.
     */
    error NotManagedNFT();

    /**
     * @dev Error indicating an attempt to reattach an NFT that is already attached to a managed token.
     */
    error AlreadyAttached();

    /**
     * @dev Error indicating a mismatch or incorrect association between user NFTs and managed tokens.
     */
    error IncorrectUserNFT();
    /**
     * @dev Represents the state and association of a user's NFT within the management system.
     * @notice Stores details about an NFT's attachment status, which managed token it's linked to, and any associated amounts.
     */
    struct TokenInfo {
        bool isAttached; // Indicates if the NFT is currently attached to a managed strategy.
        uint256 attachedManagedTokenId; // The ID of the managed token to which this NFT is attached.
        uint256 amount; // The amount associated with this NFT in the context of the managed strategy.
    }

    /**
     * @dev Holds management details about a token within the managed NFT system.
     * @notice Keeps track of a managed token's operational status and authorized users.
     */
    struct ManagedTokenInfo {
        bool isManaged; // True if the token is recognized as a managed token.
        bool isDisabled; // Indicates if the token is currently disabled and not operational.
        address authorizedUser; // Address authorized to perform restricted operations for this managed token.
    }

    /**
     * @dev Role identifier for administrative functions within the NFT management context.
     */
    bytes32 public constant MANAGED_NFT_ADMIN = keccak256("MANAGED_NFT_ADMIN");

    /**
     * @notice Address of the Voting Escrow contract managing voting and staking mechanisms.
     */
    address public override votingEscrow;

    /**
     * @notice Address of the Voter contract responsible for handling governance actions related to managed NFTs.
     */
    address public override voter;

    /**
     * @notice Tracks detailed information about individual tokens.
     */
    mapping(uint256 => TokenInfo) public tokensInfo;

    /**
     * @notice Maintains management state for managed tokens.
     */
    mapping(uint256 => ManagedTokenInfo) public managedTokensInfo;

    /**
     * @notice Tracks whitelisting status of NFTs to control their eligibility within the system.
     */
    mapping(uint256 => bool) public override isWhitelistedNFT;

    /**
     * @dev Ensures that the function can only be called by the designated voter address.
     */
    modifier onlyVoter() {
        if (_msgSender() != voter) {
            revert AccessDenied();
        }
        _;
    }

    /**
     * @dev Constructor that disables initialization on implementation.
     */
    constructor(address blastGovernor_) {
        __BlastGovernorClaimableSetup_init(blastGovernor_);
        _disableInitializers();
    }

    /**
     * @notice Initializes the Managed NFT Manager contract
     * @param blastGovernor_ The address of the blast governor
     * @param votingEscrow_ The address of the voting escrow contract
     * @param voter_ The address of the voter contract
     */
    function initialize(address blastGovernor_, address votingEscrow_, address voter_) external initializer {
        __BlastGovernorClaimableSetup_init(blastGovernor_);
        __AccessControl_init();

        _checkAddressZero(votingEscrow_);
        _checkAddressZero(voter_);

        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(MANAGED_NFT_ADMIN, msg.sender);

        votingEscrow = votingEscrow_;
        voter = voter_;
    }

    /**
     * @notice Creates a managed NFT and attaches it to a strategy
     * @param strategy_ The strategy to which the managed NFT will be attached
     */
    function createManagedNFT(address strategy_) external onlyRole(MANAGED_NFT_ADMIN) returns (uint256 managedTokenId) {
        managedTokenId = IVotingEscrow(votingEscrow).createManagedNFT(strategy_);
        managedTokensInfo[managedTokenId] = ManagedTokenInfo(true, false, address(0));
        IManagedNFTStrategy(strategy_).attachManagedNFT(managedTokenId);
        emit CreateManagedNFT(msg.sender, strategy_, managedTokenId);
    }

    /**
     * @notice Authorizes a user for a specific managed token ID
     * @param managedTokenId_ The token ID to authorize
     * @param authorizedUser_ The user being authorized
     */
    function setAuthorizedUser(uint256 managedTokenId_, address authorizedUser_) external onlyRole(MANAGED_NFT_ADMIN) {
        if (!managedTokensInfo[managedTokenId_].isManaged) {
            revert NotManagedNFT();
        }
        managedTokensInfo[managedTokenId_].authorizedUser = authorizedUser_;
        emit SetAuthorizedUser(managedTokenId_, authorizedUser_);
    }

    /**
     * @notice Toggles the disabled state of a managed NFT
     * @param managedTokenId_ The ID of the managed token to toggle
     * @dev Enables or disables a managed token to control its operational status, with an event emitted for state change.
     */
    function toggleDisableManagedNFT(uint256 managedTokenId_) external onlyRole(MANAGED_NFT_ADMIN) {
        if (!managedTokensInfo[managedTokenId_].isManaged) {
            revert NotManagedNFT();
        }
        bool isDisable = !managedTokensInfo[managedTokenId_].isDisabled;
        managedTokensInfo[managedTokenId_].isDisabled = isDisable;
        emit ToggleDisableManagedNFT(msg.sender, managedTokenId_, isDisable);
    }

    /**
     * @notice Handler for attaching to a managed NFT
     * @param tokenId_ The token ID of the user's NFT
     * @param managedTokenId_ The managed token ID to attach to
     */
    function onAttachToManagedNFT(uint256 tokenId_, uint256 managedTokenId_) external onlyVoter {
        ManagedTokenInfo memory managedTokenInfo = managedTokensInfo[managedTokenId_];
        if (!managedTokenInfo.isManaged) {
            revert NotManagedNFT();
        }

        if (managedTokenInfo.isDisabled) {
            revert ManagedNFTIsDisabled();
        }

        if (managedTokensInfo[tokenId_].isManaged || tokensInfo[tokenId_].isAttached) {
            revert IncorrectUserNFT();
        }

        uint256 userBalance = IVotingEscrow(votingEscrow).onAttachToManagedNFT(tokenId_, managedTokenId_);
        tokensInfo[tokenId_] = TokenInfo(true, managedTokenId_, userBalance);

        IManagedNFTStrategy(IVotingEscrow(votingEscrow).ownerOf(managedTokenId_)).onAttach(tokenId_, userBalance);
    }

    /**
     * @notice Handler for detaching from a managed NFT
     * @param tokenId_ The token ID of the user's NFT
     */
    function onDettachFromManagedNFT(uint256 tokenId_) external onlyVoter {
        TokenInfo memory tokenInfo = tokensInfo[tokenId_];

        if (!tokenInfo.isAttached) {
            revert NotAttached();
        }

        assert(tokenInfo.attachedManagedTokenId != 0);

        uint256 lockedRewards = IManagedNFTStrategy(IVotingEscrow(votingEscrow).ownerOf(tokenInfo.attachedManagedTokenId)).onDettach(
            tokenId_,
            tokenInfo.amount
        );

        IVotingEscrow(votingEscrow).onDettachFromManagedNFT(tokenId_, tokenInfo.attachedManagedTokenId, tokenInfo.amount + lockedRewards);

        delete tokensInfo[tokenId_];
    }

    /**
     * @notice Sets or unsets an NFT as whitelisted
     * @param tokenId_ The token ID of the NFT
     * @param isWhitelisted_ True if whitelisting, false otherwise
     */
    function setWhitelistedNFT(uint256 tokenId_, bool isWhitelisted_) external onlyRole(MANAGED_NFT_ADMIN) {
        isWhitelistedNFT[tokenId_] = isWhitelisted_;
        emit SetWhitelistedNFT(tokenId_, isWhitelisted_);
    }

    /**
     * @notice Retrieves the managed token ID attached to a specific user NFT.
     * @dev Returns the managed token ID to which the user's NFT is currently attached.
     * @param tokenId_ The token ID of the user's NFT.
     * @return The ID of the managed token to which the NFT is attached.
     */
    function getAttachedManagedTokenId(uint256 tokenId_) external view returns (uint256) {
        return tokensInfo[tokenId_].attachedManagedTokenId;
    }

    /**
     * @notice Checks if a specific user NFT is currently attached to a managed token.
     * @dev Returns true if the user's NFT is attached to any managed token.
     * @param tokenId_ The token ID of the user's NFT.
     * @return True if the NFT is attached, false otherwise.
     */
    function isAttachedNFT(uint256 tokenId_) external view returns (bool) {
        return tokensInfo[tokenId_].isAttached;
    }

    /**
     * @notice Determines if a managed token is currently disabled.
     * @dev Checks the disabled status of a managed token to prevent operations during maintenance or shutdown periods.
     * @param managedTokenId_ The ID of the managed token.
     * @return True if the managed token is disabled, false otherwise.
     */
    function isDisabledNFT(uint256 managedTokenId_) external view returns (bool) {
        return managedTokensInfo[managedTokenId_].isDisabled;
    }

    /**
     * @notice Checks if a given address has administrative privileges.
     * @dev Determines whether an address holds the MANAGED_NFT_ADMIN role, granting administrative capabilities.
     * @param account_ The address to check for administrative privileges.
     * @return True if the address has administrative privileges, false otherwise.
     */
    function isAdmin(address account_) external view returns (bool) {
        return account_ == address(this) || super.hasRole(MANAGED_NFT_ADMIN, account_);
    }

    /**
     * @notice Checks if a user is authorized to interact with a specific managed token.
     * @dev Determines whether an address is the designated authorized user for a managed token.
     * @param managedTokenId_ The ID of the managed token.
     * @param account_ The address to verify authorization.
     * @return True if the address is authorized, false otherwise.
     */
    function isAuthorized(uint256 managedTokenId_, address account_) external view returns (bool) {
        return managedTokensInfo[managedTokenId_].authorizedUser == account_;
    }

    /**
     * @notice Determines if a token ID corresponds to a managed NFT within the system.
     * @dev Checks the management status of a token ID to validate its inclusion in managed operations.
     * @param managedTokenId_ The ID of the token to check.
     * @return True if the token is a managed NFT, false otherwise.
     */
    function isManagedNFT(uint256 managedTokenId_) external view override returns (bool) {
        return managedTokensInfo[managedTokenId_].isManaged;
    }

    /**
     * @dev Checked provided address on zero value, throw AddressZero error in case when addr_ is zero
     *
     * @param addr_ The address which will checked on zero
     */
    function _checkAddressZero(address addr_) internal pure {
        if (addr_ == address(0)) {
            revert AddressZero();
        }
    }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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 {Initializable} from "../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:
 *
 * ```solidity
 * 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}:
 *
 * ```solidity
 * 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. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    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);
        _;
    }

    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    /**
     * @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(account),
                        " 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;
}

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

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

pragma solidity ^0.8.2;

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

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

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";

/**
 * @title IVotingEscrow
 * @notice Interface for Voting Escrow, allowing users to lock tokens in exchange for veNFTs that are used in governance and other systems.
 */
interface IVotingEscrow is IERC721Upgradeable {
    /**
     * @notice Enum representing the types of deposits that can be made.
     * @dev Defines the context in which a deposit is made:
     * - `DEPOSIT_FOR_TYPE`: Regular deposit for an existing lock.
     * - `CREATE_LOCK_TYPE`: Creating a new lock.
     * - `INCREASE_UNLOCK_TIME`: Increasing the unlock time for an existing lock.
     * - `MERGE_TYPE`: Merging two locks together.
     */
    enum DepositType {
        DEPOSIT_FOR_TYPE,
        CREATE_LOCK_TYPE,
        INCREASE_UNLOCK_TIME,
        MERGE_TYPE
    }

    /**
     * @notice Structure representing the state of a token.
     * @dev This includes information about the lock, voting status, attachment status, last transfer block, and point epoch.
     * @param locked The locked balance associated with the token.
     * @param isVoted Whether the token has been used to vote.
     * @param isAttached Whether the token is attached to a managed NFT.
     * @param lastTranferBlock The block number of the last transfer.
     * @param pointEpoch The epoch of the last point associated with the token.
     */
    struct TokenState {
        LockedBalance locked;
        bool isVoted;
        bool isAttached;
        uint256 lastTranferBlock;
        uint256 pointEpoch;
    }

    /**
     * @notice Structure representing a locked balance.
     * @dev Contains the amount locked, the end time of the lock, and whether the lock is permanent.
     * @param amount The amount of tokens locked.
     * @param end The timestamp when the lock ends.
     * @param isPermanentLocked Whether the lock is permanent.
     */
    struct LockedBalance {
        int128 amount;
        uint256 end;
        bool isPermanentLocked;
    }

    /**
     * @notice Structure representing a point in time for calculating voting power.
     * @dev Used for calculating the slope and bias for lock balances over time.
     * @param bias The bias of the lock, representing the remaining voting power.
     * @param slope The rate at which the voting power decreases.
     * @param ts The timestamp of the point.
     * @param blk The block number of the point.
     * @param permanent The permanent amount associated with the lock.
     */
    struct Point {
        int128 bias;
        int128 slope; // -dweight / dt
        uint256 ts;
        uint256 blk; // block
        int128 permanent;
    }

    /**
     * @notice Emitted when a boost is applied to a token's lock.
     * @param tokenId The ID of the token that received the boost.
     * @param value The value of the boost applied.
     */
    event Boost(uint256 indexed tokenId, uint256 value);

    /**
     * @notice Emitted when a deposit is made into a lock.
     * @param provider The address of the entity making the deposit.
     * @param tokenId The ID of the token associated with the deposit.
     * @param value The value of the deposit made.
     * @param locktime The time until which the lock is extended.
     * @param deposit_type The type of deposit being made.
     * @param ts The timestamp when the deposit was made.
     */
    event Deposit(address indexed provider, uint256 tokenId, uint256 value, uint256 indexed locktime, DepositType deposit_type, uint256 ts);

    /**
     * @notice Emitted when a withdrawal is made from a lock.
     * @param provider The address of the entity making the withdrawal.
     * @param tokenId The ID of the token associated with the withdrawal.
     * @param value The value of the withdrawal made.
     * @param ts The timestamp when the withdrawal was made.
     */
    event Withdraw(address indexed provider, uint256 tokenId, uint256 value, uint256 ts);

    /**
     * @notice Emitted when the total supply of voting power changes.
     * @param prevSupply The previous total supply of voting power.
     * @param supply The new total supply of voting power.
     */
    event Supply(uint256 prevSupply, uint256 supply);

    /**
     * @notice Emitted when an address associated with the contract is updated.
     * @param key The key representing the contract being updated.
     * @param value The new address of the contract.
     */
    event UpdateAddress(string key, address indexed value);

    /**
     * @notice Emitted when a token is permanently locked by a user.
     * @param sender The address of the user who initiated the lock.
     * @param tokenId The ID of the token that has been permanently locked.
     */
    event LockPermanent(address indexed sender, uint256 indexed tokenId);

    /**
     * @notice Emitted when a token is unlocked from a permanent lock state by a user.
     * @param sender The address of the user who initiated the unlock.
     * @param tokenId The ID of the token that has been unlocked from its permanent state.
     */
    event UnlockPermanent(address indexed sender, uint256 indexed tokenId);

    /**
     * @notice Returns the address of the token used in voting escrow.
     * @return The address of the token.
     */
    function token() external view returns (address);

    /**
     * @notice Returns the address of the voter.
     * @return The address of the voter.
     */
    function voter() external view returns (address);

    /**
     * @notice Checks if the specified address is approved or the owner of the given token.
     * @param sender The address to check.
     * @param tokenId The ID of the token to check against.
     * @return True if the sender is approved or the owner of the token, false otherwise.
     */
    function isApprovedOrOwner(address sender, uint256 tokenId) external view returns (bool);

    /**
     * @notice Retrieves the state of a specific NFT.
     * @param tokenId_ The ID of the NFT to query.
     * @return The current state of the specified NFT.
     */
    function getNftState(uint256 tokenId_) external view returns (TokenState memory);

    /**
     * @notice Returns the total supply of voting power at the current block timestamp.
     * @return The total supply of voting power.
     */
    function votingPowerTotalSupply() external view returns (uint256);

    /**
     * @notice Returns the balance of an NFT at the current block timestamp.
     * @param tokenId_ The ID of the NFT to query.
     * @return The balance of the NFT.
     */
    function balanceOfNFT(uint256 tokenId_) external view returns (uint256);

    /**
     * @notice Returns the balance of an NFT at the current block timestamp, ignoring ownership changes.
     * @param tokenId_ The ID of the NFT to query.
     * @return The balance of the NFT.
     */
    function balanceOfNftIgnoreOwnershipChange(uint256 tokenId_) external view returns (uint256);

    /**
     * @notice Updates the address of a specified contract.
     * @param key_ The key representing the contract.
     * @param value_ The new address of the contract.
     * @dev Reverts with `InvalidAddressKey` if the key does not match any known contracts.
     * Emits an {UpdateAddress} event on successful address update.
     */
    function updateAddress(string memory key_, address value_) external;

    /**
     * @notice Hooks the voting state for a specified NFT.
     * @param tokenId_ The ID of the NFT.
     * @param state_ The voting state to set.
     * @dev Reverts with `AccessDenied` if the caller is not the voter.
     */
    function votingHook(uint256 tokenId_, bool state_) external;

    /**
     * @notice Creates a new lock for a specified recipient.
     * @param amount_ The amount of tokens to lock.
     * @param lockDuration_ The duration for which the tokens will be locked.
     * @param to_ The address of the recipient who will receive the veNFT.
     * @param shouldBoosted_ Whether the deposit should be boosted.
     * @param withPermanentLock_ Whether the lock should be permanent.
     * @param managedTokenIdForAttach_ The ID of the managed NFT to attach, if any. 0 for ignore
     * @return The ID of the newly created veNFT.
     * @dev Reverts with `InvalidLockDuration` if the lock duration is invalid.
     * Emits a {Deposit} event on successful lock creation.
     */
    function createLockFor(
        uint256 amount_,
        uint256 lockDuration_,
        address to_,
        bool shouldBoosted_,
        bool withPermanentLock_,
        uint256 managedTokenIdForAttach_
    ) external returns (uint256);

    /**
     * @notice Deposits tokens for a specific NFT, increasing its locked balance.
     * @param tokenId_ The ID of the NFT.
     * @param amount_ The amount of tokens to deposit.
     * @param shouldBoosted_ Whether the deposit should be boosted.
     * @param withPermanentLock_ Whether to apply a permanent lock.
     * @dev Reverts with `InvalidAmount` if the amount is zero.
     * Emits a {Deposit} event on successful deposit.
     */
    function depositFor(uint256 tokenId_, uint256 amount_, bool shouldBoosted_, bool withPermanentLock_) external;

    /**
     * @notice Increases the unlock time for a specified NFT.
     * @param tokenId_ The ID of the NFT to increase unlock time for.
     * @param lockDuration_ The additional duration to add to the unlock time.
     * @dev Reverts with `InvalidLockDuration` if the new unlock time is invalid.
     * Reverts with `AccessDenied` if the caller is not approved or the owner of the NFT.
     * Emits a {Deposit} event on successful unlock time increase.
     */
    function increase_unlock_time(uint256 tokenId_, uint256 lockDuration_) external;

    /**
     * @notice Withdraws tokens from a specified NFT lock.
     * @param tokenId_ The ID of the NFT to withdraw tokens from.
     * @dev Reverts with `AccessDenied` if the caller is not approved or the owner of the NFT.
     * Emits a {Supply} event reflecting the change in total supply.
     */
    function withdraw(uint256 tokenId_) external;

    /**
     * @notice Merges two NFTs into one.
     * @param tokenFromId_ The ID of the NFT to merge from.
     * @param tokenToId_ The ID of the NFT to merge into.
     * @dev Reverts with `MergeTokenIdsTheSame` if the token IDs are the same.
     * Reverts with `AccessDenied` if the caller is not approved or the owner of both NFTs.
     * Emits a {Deposit} event reflecting the merge.
     */
    function merge(uint256 tokenFromId_, uint256 tokenToId_) external;

    /**
     * @notice Permanently locks a specified NFT.
     * @param tokenId_ The ID of the NFT to lock permanently.
     * @dev Reverts with `AccessDenied` if the caller is not approved or the owner of the NFT.
     * Emits a {LockPermanent} event on successful permanent lock.
     */
    function lockPermanent(uint256 tokenId_) external;

    /**
     * @notice Unlocks a permanently locked NFT.
     * @param tokenId_ The ID of the NFT to unlock.
     * @dev Reverts with `AccessDenied` if the caller is not approved or the owner of the NFT.
     * Emits an {UnlockPermanent} event on successful unlock.
     */
    function unlockPermanent(uint256 tokenId_) external;

    /**
     * @notice Creates a new managed NFT for a given recipient.
     * @param recipient_ The address of the recipient to receive the newly created managed NFT.
     * @return The ID of the newly created managed NFT.
     * @dev Reverts with `AccessDenied` if the caller is not the managed NFT manager.
     */
    function createManagedNFT(address recipient_) external returns (uint256);

    /**
     * @notice Attaches a token to a managed NFT.
     * @param tokenId_ The ID of the user's token being attached.
     * @param managedTokenId_ The ID of the managed token to which the user's token is being attached.
     * @return The amount of tokens locked during the attach operation.
     * @dev Reverts with `AccessDenied` if the caller is not the managed NFT manager.
     * Reverts with `ZeroVotingPower` if the NFT has no voting power.
     * Reverts with `NotManagedNft` if the target is not a managed NFT.
     */
    function onAttachToManagedNFT(uint256 tokenId_, uint256 managedTokenId_) external returns (uint256);

    /**
     * @notice Detaches a token from a managed NFT.
     * @param tokenId_ The ID of the user's token being detached.
     * @param managedTokenId_ The ID of the managed token from which the user's token is being detached.
     * @param newBalance_ The new balance to set for the user's token post detachment.
     * @dev Reverts with `AccessDenied` if the caller is not the managed NFT manager.
     * Reverts with `NotManagedNft` if the target is not a managed NFT.
     */
    function onDettachFromManagedNFT(uint256 tokenId_, uint256 managedTokenId_, uint256 newBalance_) external;
}

File 14 of 18 : BlastGovernorClaimableSetup.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.19;

import {IBlastFull, YieldMode, GasMode} from "./interfaces/IBlastFull.sol";
import {IBlastGovernor} from "./interfaces/IBlastGovernor.sol";

/**
 * @title Blast Governor Claiamble Setup
 * @dev Abstract contract for setting up a governor in the Blast ecosystem.
 * This contract provides an initialization function to configure a governor address
 * for the Blast protocol, utilizing the `IBlast` interface.
 */
abstract contract BlastGovernorClaimableSetup {
    /// @dev Error thrown when an operation involves a zero address where a valid address is required.
    error AddressZero();

    /**
     * @dev Initializes the governor and claimable configuration for the Blast protocol.
     * This internal function is meant to be called in the initialization process
     * of a derived contract that sets up governance.
     *
     * @param blastGovernor_ The address of the governor to be configured in the Blast protocol.
     * Must be a non-zero address.
     */
    function __BlastGovernorClaimableSetup_init(address blastGovernor_) internal {
        if (blastGovernor_ == address(0)) {
            revert AddressZero();
        }
        IBlastFull(0x4300000000000000000000000000000000000002).configure(YieldMode.CLAIMABLE, GasMode.CLAIMABLE, blastGovernor_);
        if (blastGovernor_.code.length > 0) {
            IBlastGovernor(blastGovernor_).addGasHolder(address(this));
        }
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

/**
 * @title IBlastFull Interface
 * @dev Interface for interacting with the Blast protocol, specifically for configuring
 * governance settings. This interface abstracts the function to set up a governor
 * within the Blast ecosystem.
 */

enum GasMode {
    VOID,
    CLAIMABLE
}

enum YieldMode {
    AUTOMATIC,
    VOID,
    CLAIMABLE
}

interface IBlastFull {
    // configure
    function configureContract(address contractAddress, YieldMode _yield, GasMode gasMode, address governor) external;

    function configure(YieldMode _yield, GasMode gasMode, address governor) external;

    // base configuration options
    function configureClaimableYield() external;

    function configureClaimableYieldOnBehalf(address contractAddress) external;

    function configureAutomaticYield() external;

    function configureAutomaticYieldOnBehalf(address contractAddress) external;

    function configureVoidYield() external;

    function configureVoidYieldOnBehalf(address contractAddress) external;

    function configureClaimableGas() external;

    function configureClaimableGasOnBehalf(address contractAddress) external;

    function configureVoidGas() external;

    function configureVoidGasOnBehalf(address contractAddress) external;

    function configureGovernor(address _governor) external;

    function configureGovernorOnBehalf(address _newGovernor, address contractAddress) external;

    // claim yield
    function claimYield(address contractAddress, address recipientOfYield, uint256 amount) external returns (uint256);

    function claimAllYield(address contractAddress, address recipientOfYield) external returns (uint256);

    // claim gas
    function claimAllGas(address contractAddress, address recipientOfGas) external returns (uint256);

    // NOTE: can be off by 1 bip
    function claimGasAtMinClaimRate(address contractAddress, address recipientOfGas, uint256 minClaimRateBips) external returns (uint256);

    function claimMaxGas(address contractAddress, address recipientOfGas) external returns (uint256);

    function claimGas(
        address contractAddress,
        address recipientOfGas,
        uint256 gasToClaim,
        uint256 gasSecondsToConsume
    ) external returns (uint256);

    // read functions
    function readClaimableYield(address contractAddress) external view returns (uint256);

    function readYieldConfiguration(address contractAddress) external view returns (uint8);

    function readGasParams(
        address contractAddress
    ) external view returns (uint256 etherSeconds, uint256 etherBalance, uint256 lastUpdated, GasMode);

    function isGovernor(address) external view returns (bool);

    function governorMap(address) external view returns (address);
}

// SPDX-License-Identifier: MIT
pragma solidity =0.8.19;

import {GasMode} from "./IBlastFull.sol";

/**
 * @title IBlastGovernor
 * @dev Interface for the BlastGovernor contract.
 */
interface IBlastGovernor {
    /**
     * @dev Structure representing gas parameters.
     * @param contractAddress Address of the gas holder contract.
     * @param etherSeconds Accumulated ether seconds.
     * @param etherBalance Ether balance.
     * @param lastUpdated Timestamp of the last update.
     * @param gasMode Current gas mode.
     */
    struct GasParamsResult {
        address contractAddress;
        uint256 etherSeconds;
        uint256 etherBalance;
        uint256 lastUpdated;
        GasMode gasMode;
    }

    /**
     * @dev Emitted when a gas holder is added.
     * @param contractAddress The address of the added gas holder contract.
     */
    event AddGasHolder(address indexed contractAddress);

    /**
     * @dev Emitted when gas is claimed.
     * @param caller The address of the caller who initiated the claim.
     * @param recipient The address of the recipient who receives the claimed gas.
     * @param gasHolders The addresses of the gas holders from which gas was claimed.
     * @param totalClaimedAmount The total amount of gas claimed.
     */
    event ClaimGas(address indexed caller, address indexed recipient, address[] gasHolders, uint256 totalClaimedAmount);

    /**
     * @notice Adds a gas holder.
     * @dev Adds a contract to the list of gas holders.
     * @param contractAddress_ The address of the gas holder contract.
     */
    function addGasHolder(address contractAddress_) external;

    /**
     * @notice Claims all gas for a recipient within the specified range.
     * @param recipient_ The address of the recipient.
     * @param offset_ The offset to start from.
     * @param limit_ The maximum number of gas holders to process.
     * @return totalClaimedGas The total amount of gas claimed.
     */
    function claimAllGas(address recipient_, uint256 offset_, uint256 limit_) external returns (uint256 totalClaimedGas);

    /**
     * @notice Claims all gas for a recipient from specified gas holders.
     * @param recipient_ The address of the recipient.
     * @param holders_ The addresses of the gas holders.
     * @return totalClaimedGas The total amount of gas claimed.
     */
    function claimAllGasFromSpecifiedGasHolders(address recipient_, address[] memory holders_) external returns (uint256 totalClaimedGas);

    /**
     * @notice Claims gas at minimum claim rate for a recipient within the specified range.
     * @param recipient_ The address of the recipient.
     * @param minClaimRateBips_ The minimum claim rate in basis points.
     * @param offset_ The offset to start from.
     * @param limit_ The maximum number of gas holders to process.
     * @return totalClaimedGas The total amount of gas claimed.
     */
    function claimGasAtMinClaimRate(
        address recipient_,
        uint256 minClaimRateBips_,
        uint256 offset_,
        uint256 limit_
    ) external returns (uint256 totalClaimedGas);

    /**
     * @notice Claims gas at minimum claim rate for a recipient from specified gas holders.
     * @param recipient_ The address of the recipient.
     * @param minClaimRateBips_ The minimum claim rate in basis points.
     * @param holders_ The addresses of the gas holders.
     * @return totalClaimedGas The total amount of gas claimed.
     */
    function claimGasAtMinClaimRateFromSpecifiedGasHolders(
        address recipient_,
        uint256 minClaimRateBips_,
        address[] memory holders_
    ) external returns (uint256 totalClaimedGas);

    /**
     * @notice Claims maximum gas for a recipient within the specified range.
     * @param recipient_ The address of the recipient.
     * @param offset_ The offset to start from.
     * @param limit_ The maximum number of gas holders to process.
     * @return totalClaimedGas The total amount of gas claimed.
     */
    function claimMaxGas(address recipient_, uint256 offset_, uint256 limit_) external returns (uint256 totalClaimedGas);

    /**
     * @notice Claims maximum gas for a recipient from specified gas holders.
     * @param recipient_ The address of the recipient.
     * @param holders_ The addresses of the gas holders.
     * @return totalClaimedGas The total amount of gas claimed.
     */
    function claimMaxGasFromSpecifiedGasHolders(address recipient_, address[] memory holders_) external returns (uint256 totalClaimedGas);

    /**
     * @notice Claims a specific amount of gas for a recipient within the specified range.
     * @param recipient_ The address of the recipient.
     * @param gasToClaim_ The amount of gas to claim.
     * @param gasSecondsToConsume_ The amount of gas seconds to consume.
     * @param offset_ The offset to start from.
     * @param limit_ The maximum number of gas holders to process.
     * @return totalClaimedGas The total amount of gas claimed.
     */
    function claimGas(
        address recipient_,
        uint256 gasToClaim_,
        uint256 gasSecondsToConsume_,
        uint256 offset_,
        uint256 limit_
    ) external returns (uint256 totalClaimedGas);

    /**
     * @notice Claims a specific amount of gas for a recipient from specified gas holders.
     * @param recipient_ The address of the recipient.
     * @param gasToClaim_ The amount of gas to claim.
     * @param gasSecondsToConsume_ The amount of gas seconds to consume.
     * @param holders_ The addresses of the gas holders.
     * @return totalClaimedGas The total amount of gas claimed.
     */
    function claimGasFromSpecifiedGasHolders(
        address recipient_,
        uint256 gasToClaim_,
        uint256 gasSecondsToConsume_,
        address[] memory holders_
    ) external returns (uint256 totalClaimedGas);

    /**
     * @notice Reads gas parameters within the specified range.
     * @param offset_ The offset to start from.
     * @param limit_ The maximum number of gas holders to process.
     * @return gasHoldersParams The gas parameters of the gas holders.
     */
    function readGasParams(uint256 offset_, uint256 limit_) external view returns (GasParamsResult[] memory gasHoldersParams);

    /**
     * @notice Reads gas parameters from specified gas holders.
     * @param holders_ The addresses of the gas holders.
     * @return gasHoldersParams The gas parameters of the gas holders.
     */
    function readGasParamsFromSpecifiedGasHolders(
        address[] memory holders_
    ) external view returns (GasParamsResult[] memory gasHoldersParams);

    /**
     * @notice Checks if a contract is a registered gas holder.
     * @param contractAddress_ The address of the contract.
     * @return isRegistered Whether the contract is a registered gas holder.
     */
    function isRegisteredGasHolder(address contractAddress_) external view returns (bool isRegistered);

    /**
     * @notice Lists gas holders within the specified range.
     * @param offset_ The offset to start from.
     * @param limit_ The maximum number of gas holders to process.
     * @return gasHolders The addresses of the gas holders.
     */
    function listGasHolders(uint256 offset_, uint256 limit_) external view returns (address[] memory gasHolders);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

/**
 * @title Interface for Managed NFT Manager
 * @dev Defines the functions and events for managing NFTs, including attaching/detaching to strategies, authorization, and administrative checks.
 */
interface IManagedNFTManager {
    /**
     * @dev Emitted when the disabled state of a managed NFT is toggled.
     * @param sender The address that triggered the state change.
     * @param tokenId The ID of the managed NFT affected.
     * @param isDisable True if the NFT is now disabled, false if it is enabled.
     */
    event ToggleDisableManagedNFT(address indexed sender, uint256 indexed tokenId, bool indexed isDisable);

    /**
     * @dev Emitted when a new managed NFT is created and attached to a strategy.
     * @param sender The address that performed the creation.
     * @param strategy The address of the strategy to which the NFT is attached.
     * @param tokenId The ID of the newly created managed NFT.
     */
    event CreateManagedNFT(address indexed sender, address indexed strategy, uint256 indexed tokenId);

    /**
     * @dev Emitted when an NFT is whitelisted or removed from the whitelist.
     * @param tokenId The ID of the NFT being modified.
     * @param isWhitelisted True if the NFT is being whitelisted, false if it is being removed from the whitelist.
     */
    event SetWhitelistedNFT(uint256 indexed tokenId, bool indexed isWhitelisted);

    /**
     * @dev Emitted when an authorized user is set for a managed NFT.
     * @param managedTokenId The ID of the managed NFT.
     * @param authorizedUser The address being authorized.
     */
    event SetAuthorizedUser(uint256 indexed managedTokenId, address authorizedUser);

    /**
     * @notice Checks if a managed NFT is currently disabled.
     * @param managedTokenId_ The ID of the managed NFT.
     * @return True if the managed NFT is disabled, false otherwise.
     */
    function isDisabledNFT(uint256 managedTokenId_) external view returns (bool);

    /**
     * @notice Determines if a token ID is recognized as a managed NFT within the system.
     * @param managedTokenId_ The ID of the token to check.
     * @return True if the token is a managed NFT, false otherwise.
     */
    function isManagedNFT(uint256 managedTokenId_) external view returns (bool);

    /**
     * @notice Checks if an NFT is whitelisted within the management system.
     * @param tokenId_ The ID of the NFT to check.
     * @return True if the NFT is whitelisted, false otherwise.
     */
    function isWhitelistedNFT(uint256 tokenId_) external view returns (bool);

    /**
     * @notice Verifies if a user's NFT is attached to any managed NFT.
     * @param tokenId_ The ID of the user's NFT.
     * @return True if the NFT is attached, false otherwise.
     */
    function isAttachedNFT(uint256 tokenId_) external view returns (bool);

    /**
     * @notice Checks if a given account is an administrator of the managed NFT system.
     * @param account_ The address to check.
     * @return True if the address is an admin, false otherwise.
     */
    function isAdmin(address account_) external view returns (bool);

    /**
     * @notice Retrieves the managed token ID that a user's NFT is attached to.
     * @param tokenId_ The ID of the user's NFT.
     * @return The ID of the managed token to which the NFT is attached.
     */
    function getAttachedManagedTokenId(uint256 tokenId_) external view returns (uint256);

    /**
     * @notice Address of the Voting Escrow contract managing voting and staking mechanisms.
     */
    function votingEscrow() external view returns (address);

    /**
     * @notice Address of the Voter contract responsible for handling governance actions related to managed NFTs.
     */
    function voter() external view returns (address);

    /**
     * @notice Verifies if a given address is authorized to manage a specific managed NFT.
     * @param managedTokenId_ The ID of the managed NFT.
     * @param account_ The address to verify.
     * @return True if the address is authorized, false otherwise.
     */
    function isAuthorized(uint256 managedTokenId_, address account_) external view returns (bool);

    /**
     * @notice Assigns an authorized user for a managed NFT.
     * @param managedTokenId_ The ID of the managed NFT.
     * @param authorizedUser_ The address to authorize.
     */
    function setAuthorizedUser(uint256 managedTokenId_, address authorizedUser_) external;

    /**
     * @notice Creates a managed NFT and attaches it to a strategy
     * @param strategy_ The strategy to which the managed NFT will be attached
     */
    function createManagedNFT(address strategy_) external returns (uint256 managedTokenId);

    /**
     * @notice Toggles the disabled state of a managed NFT
     * @param managedTokenId_ The ID of the managed token to toggle
     * @dev Enables or disables a managed token to control its operational status, with an event emitted for state change.
     */
    function toggleDisableManagedNFT(uint256 managedTokenId_) external;

    /**
     * @notice Attaches a user's NFT to a managed NFT, enabling it within a specific strategy.
     * @param tokenId_ The user's NFT token ID.
     * @param managedTokenId The managed NFT token ID.
     */
    function onAttachToManagedNFT(uint256 tokenId_, uint256 managedTokenId) external;

    /**
     * @notice Detaches a user's NFT from a managed NFT, disabling it within the strategy.
     * @param tokenId_ The user's NFT token ID.
     */
    function onDettachFromManagedNFT(uint256 tokenId_) external;
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

/**
 * @title IManagedNFTStrategy
 * @dev Interface for strategies managing NFTs ,
 *      participate in voting, and claim rewards.
 */
interface IManagedNFTStrategy {
    /**
     * @dev Emitted when the name of the strategy is changed.
     * @param newName The new name that has been set for the strategy.
     */
    event SetName(string newName);

    /**
     * @dev Emitted when the description of the strategy is changed.
     * @param newDescription The new description that has been set for the strategy.
     */
    event SetDescription(string newDescription);

    /**
     * @dev Emitted when the description of the strategy is changed.
     * @param newCreator The new description that has been set for the strategy.
     */
    event SetCreator(string newCreator);

    /**
     * @dev Emitted when a new managed NFT is successfully attached to the strategy.
     * @param managedTokenId The ID of the managed NFT that has been attached.
     */
    event AttachedManagedNFT(uint256 indexed managedTokenId);

    /**
     * @notice Called when an NFT is attached to a strategy.
     * @dev Allows the strategy to perform initial setup or balance tracking when an NFT is first attached.
     * @param tokenId The ID of the NFT being attached.
     * @param userBalance The balance of governance tokens associated with the NFT at the time of attachment.
     */
    function onAttach(uint256 tokenId, uint256 userBalance) external;

    /**
     * @notice Called when an NFT is detached from a strategy.
     * @dev Allows the strategy to clean up or update records when an NFT is removed.
     * @param tokenId The ID of the NFT being detached.
     * @param userBalance The remaining balance of governance tokens associated with the NFT at the time of detachment.
     */
    function onDettach(uint256 tokenId, uint256 userBalance) external returns (uint256 lockedRewards);

    /**
     * @notice Gets the address of the managed NFT manager contract.
     * @return The address of the managed NFT manager.
     */
    function managedNFTManager() external view returns (address);

    /**
     * @notice Gets the address of the voting escrow contract used for locking governance tokens.
     * @return The address of the voting escrow contract.
     */
    function votingEscrow() external view returns (address);

    /**
     * @notice Gets the address of the voter contract that coordinates governance actions.
     * @return The address of the voter contract.
     */
    function voter() external view returns (address);

    /**
     * @notice Retrieves the name of the strategy.
     * @return A string representing the name of the strategy.
     */
    function name() external view returns (string memory);

    /**
     * @notice Retrieves the creator name of the strategy.
     * Empty string by default
     * @return A string representing the name of the strategy.
     */
    function creator() external view returns (string memory);

    /**
     * @notice Retrieves the description of the strategy.
     * Empty string by default
     * @return A string representing the name of the strategy.
     */
    function description() external view returns (string memory);

    /**
     * @notice Retrieves the ID of the managed token.
     * @return The token ID used by the strategy.
     */
    function managedTokenId() external view returns (uint256);

    /**
     * @notice Submits a governance vote on behalf of the strategy.
     * @param poolVote_ An array of addresses representing the pools to vote on.
     * @param weights_ An array of weights corresponding to each pool vote.
     */
    function vote(address[] calldata poolVote_, uint256[] calldata weights_) external;

    /**
     * @notice Claims rewards allocated to the managed NFTs from specified gauges.
     * @param gauges_ An array of addresses representing the gauges from which rewards are to be claimed.
     */
    function claimRewards(address[] calldata gauges_) external;

    /**
     * @notice Claims bribes allocated to the managed NFTs for specific tokens and pools.
     * @param bribes_ An array of addresses representing the bribe pools.
     * @param tokens_ An array of token addresses for each bribe pool where rewards can be claimed.
     */
    function claimBribes(address[] calldata bribes_, address[][] calldata tokens_) external;

    /**
     * @notice Attaches a specific managed NFT to this strategy, setting up necessary governance or reward mechanisms.
     * @dev This function can only be called by administrators. It sets the `managedTokenId` and ensures that the token is
     *      valid and owned by this contract. Emits an `AttachedManagedNFT` event upon successful attachment.
     * @param managedTokenId_ The token ID of the NFT to be managed by this strategy.
     * throws AlreadyAttached if the strategy is already attached to a managed NFT.
     * throws IncorrectManagedTokenId if the provided token ID is not managed or not owned by this contract.
     */
    function attachManagedNFT(uint256 managedTokenId_) external;
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"blastGovernor_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessDenied","type":"error"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[],"name":"AlreadyAttached","type":"error"},{"inputs":[],"name":"IncorrectUserNFT","type":"error"},{"inputs":[],"name":"ManagedNFTIsDisabled","type":"error"},{"inputs":[],"name":"NotAttached","type":"error"},{"inputs":[],"name":"NotManagedNFT","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"strategy","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"CreateManagedNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"managedTokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"authorizedUser","type":"address"}],"name":"SetAuthorizedUser","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"SetWhitelistedNFT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"bool","name":"isDisable","type":"bool"}],"name":"ToggleDisableManagedNFT","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGED_NFT_ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"strategy_","type":"address"}],"name":"createManagedNFT","outputs":[{"internalType":"uint256","name":"managedTokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"getAttachedManagedTokenId","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":"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":"blastGovernor_","type":"address"},{"internalType":"address","name":"votingEscrow_","type":"address"},{"internalType":"address","name":"voter_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account_","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"isAttachedNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"managedTokenId_","type":"uint256"},{"internalType":"address","name":"account_","type":"address"}],"name":"isAuthorized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"managedTokenId_","type":"uint256"}],"name":"isDisabledNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"managedTokenId_","type":"uint256"}],"name":"isManagedNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"isWhitelistedNFT","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"managedTokensInfo","outputs":[{"internalType":"bool","name":"isManaged","type":"bool"},{"internalType":"bool","name":"isDisabled","type":"bool"},{"internalType":"address","name":"authorizedUser","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"uint256","name":"managedTokenId_","type":"uint256"}],"name":"onAttachToManagedNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"}],"name":"onDettachFromManagedNFT","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":"managedTokenId_","type":"uint256"},{"internalType":"address","name":"authorizedUser_","type":"address"}],"name":"setAuthorizedUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"bool","name":"isWhitelisted_","type":"bool"}],"name":"setWhitelistedNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"managedTokenId_","type":"uint256"}],"name":"toggleDisableManagedNFT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokensInfo","outputs":[{"internalType":"bool","name":"isAttached","type":"bool"},{"internalType":"uint256","name":"attachedManagedTokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"votingEscrow","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6080346200022c57601f62001d2538819003918201601f191683019260009290916001600160401b0385118386101762000218578160209284926040978852833981010312620001db57516001600160a01b03811690818103620002145781156200020357734300000000000000000000000000000000000002803b15620001ff57838091606487518094819363c8992e6160e01b835260026004840152600160248401528860448401525af18015620001f557620001df575b503b6200017a575b50805460ff8160081c16620001265760ff80821603620000eb575b8251611ac990816200025c8239f35b60ff908119161790557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024986020825160ff8152a13880620000dc565b825162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b6064820152608490fd5b803b15620001db5781809160248551809481936305573b1760e31b83523060048401525af18015620001d157908291620001b6575b50620000c1565b620001c19062000231565b620001ce578038620001af565b80fd5b83513d84823e3d90fd5b5080fd5b620001ed9093919362000231565b9138620000b9565b85513d86823e3d90fd5b8380fd5b8351639fabe1c160e01b8152600490fd5b8280fd5b634e487b7160e01b84526041600452602484fd5b600080fd5b6001600160401b0381116200024557604052565b634e487b7160e01b600052604160045260246000fdfe6080604081815260048036101561001557600080fd5b600092833560e01c90816301ffc9a7146113d05750806305574c5e1461115157806310be5d90146110e15780631321852b14610de35780631e529a6c14610db45780631e60c38b14610d8a578063248a9ca314610d6057806324d7806c14610ce25780632f2ff15d14610c2f57806336568abe14610b8f5780633a497cd214610b545780633b83245a14610b2857806346c96aac14610b005780634f2bfe5b14610ad8578063609c6d7f14610a9857806369448b6d14610a5657806378abe5a7146109d3578063905ab2791461098657806391d1485414610940578063a217fddf14610925578063c0c53b8b146104d2578063d4e2616f146104a6578063d547741f14610468578063e4e64f601461025c578063eefff5d5146102305763f49d3b081461014157600080fd5b3461022c578160031936011261022c5780359161015c611485565b9161016561149b565b838552609a60205260ff82862054161561020557507fb663263c4e8e3e081832c34eb5808107ce9fbf4ba52cc79aafb19c15a1527b08916001600160a01b03602092858752609a84526101fc83828920907fffffffffffffffffffff0000000000000000000000000000000000000000ffff75ffffffffffffffffffffffffffffffffffffffff000083549260101b169116179055565b5191168152a280f35b90517fa963c020000000000000000000000000000000000000000000000000000000008152fd5b8280fd5b503461022c57602060031936011261022c578160209360ff92358152609a855220541690519015158152f35b50829034610464576020928360031936011261022c5790829161027d61146f565b9161028661149b565b6001600160a01b0386816024816097541696865198899384927fe4e64f60000000000000000000000000000000000000000000000000000000008452169889888401525af194851561045a578695610424575b50825161037f916102e982611835565b60018252888201888152610338868401918a8352898b52609a8c52610321888c2095511515869060ff60ff1983541691151516179055565b51845461ff00191690151560081b61ff0016178455565b5182547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16911660101b75ffffffffffffffffffffffffffffffffffffffff000016179055565b823b1561042057838251917f4b985845000000000000000000000000000000000000000000000000000000008352820152848160248183875af18015610416578493929186916103f7575b505051937f1ec88629262a427f794361e94fdf7d2afb0f49eb9f142e5a818299015f661d0e339180a48152f35b6104049192939450611867565b6104125790829184876103ca565b8380fd5b82513d87823e3d90fd5b8480fd5b9094508681813d8311610453575b61043c8183611897565b8101031261044e57519361037f6102d9565b600080fd5b503d610432565b83513d88823e3d90fd5b5080fd5b50903461022c578060031936011261022c576104a3913561049e600161048c611485565b938387526065602052862001546116eb565b6118ba565b80f35b503461022c57602060031936011261022c578160209360ff92358152609b855220541690519015158152f35b503461022c57606060031936011261022c576104ec61146f565b6104f4611485565b91604435926001600160a01b038085169283860361044e5787549560ff91828860081c161596878098610919575b8015610903575b1561089a5760ff19988860018b8316178d5561086c575b5084811690811561084457908b91734300000000000000000000000000000000000002803b156104125783809160648f51809481937fc8992e6100000000000000000000000000000000000000000000000000000000835260028b840152600160248401528860448401525af190811561083a578491610826575b50503b6107bd575b505460081c83161561075457506105e2906105dd85611a82565b611a82565b6000805260209560658752876000203360005287528188600020541615610708575b7fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a491826000526065885288600020336000528852886000205416156106b9575b50507fffffffffffffffffffffffff000000000000000000000000000000000000000091168160975416176097556098541617609855610682578280f35b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff001984541684555160018152a138808280f35b81600052606587528760002033600052875260018860002091825416179055339033907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a43880610644565b60008052606587528760002033600052875287600020600182825416179055333360007f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4610604565b60849060208a519162461bcd60e51b8352820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b803b156104645781809160248d51809481937f2ab9d8b800000000000000000000000000000000000000000000000000000000835230898401525af1801561081c57156105c35761080d90611867565b6108185789386105c3565b8980fd5b8b513d84823e3d90fd5b61082f90611867565b61022c5782386105bb565b8d513d86823e3d90fd5b828b517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000016610101178b5538610540565b60848260208c519162461bcd60e51b8352820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b15801561052957506001848a1614610529565b506001848a1610610522565b50503461046457816003193601126104645751908152602090f35b503461022c578160031936011261022c576001600160a01b0382602094610965611485565b9335815260658652209116600052825260ff81600020541690519015158152f35b503461022c57602060031936011261022c576060928291358152609a6020522054906001600160a01b0381519260ff81161515845260ff8160081c161515602085015260101c1690820152f35b50903461022c57602060031936011261022c578135916109f161149b565b828452609a60205260ff8285205416156102055750818352609a6020528220805461ff00198116600891821c60ff16159182901b61ff00161790915590337f1039c16e7b51187f290e4dcbf3207771138eb7bc5bc0414e7e26377acd1a4bd78480a480f35b503461022c57602060031936011261022c57606092829135815260996020522060ff815416916002600183015492015491815193151584526020840152820152f35b50903461022c578060031936011261022c5780602093610ab6611485565b93358152609a85526001600160a01b03918291205460101c1691519216148152f35b5050346104645781600319360112610464576020906001600160a01b03609754169051908152f35b5050346104645781600319360112610464576020906001600160a01b03609854169051908152f35b503461022c57602060031936011261022c578160209360ff923581526099855220541690519015158152f35b505034610464578160031936011261046457602090517fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a48152f35b50829034610464578260031936011261046457610baa611485565b90336001600160a01b03831603610bc657906104a391356118ba565b608490602085519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152fd5b503461022c578160031936011261022c573590610c4a611485565b908284526065602052610c62600182862001546116eb565b8260005260656020526001600160a01b03816000209216918260005260205260ff81600020541615610c92578380f35b8260005260656020528060002082600052602052600020600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a43880808380f35b505034610464576020600319360112610464576020916001600160a01b03610d0861146f565b16308114918215610d1f575b505090519015158152f35b839192507fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a48152606585522090600052825260ff8160002054163880610d14565b503461022c57602060031936011261022c5781602093600192358152606585522001549051908152f35b503461022c57602060031936011261022c5781602093600192358152609985522001549051908152f35b503461022c57602060031936011261022c578160209360ff92358152609a8552205460081c1690519015158152f35b503461022c578160031936011261022c5780356024356001600160a01b0390816098541633036110b957808652602090609a8252858720865190610e2682611835565b549060ff821615908115815288868683019460ff8160081c161515865260101c16910152611091575161106957838752609a825260ff86882054168015611058575b6110305791818796949293879694836097541660448851809a81937f1321852b000000000000000000000000000000000000000000000000000000008352898b8401528660248401525af1968715610ff4578897610ffe575b508551610ecd81611835565b600181526002838201838152888301908a8252878c5260998652610f048a8d2094511515859060ff60ff1983541691151516179055565b516001840155519101558183609754169160248851809481937f6352211e0000000000000000000000000000000000000000000000000000000083528a8301525afa918215610ff4578892610fc7575b505016803b15610fc357859283604492865197889586947f7f36b27600000000000000000000000000000000000000000000000000000000865285015260248401525af1908115610fba5750610fa75750f35b610fb090611867565b610fb75780f35b80fd5b513d84823e3d90fd5b8580fd5b610fe69250803d10610fed575b610fde8183611897565b810190611a63565b3880610f54565b503d610fd4565b86513d8a823e3d90fd5b975095508087813d8111611029575b6110178183611897565b8101031261044e578796519538610ec1565b503d61100d565b8486517fb97b4fe2000000000000000000000000000000000000000000000000000000008152fd5b506099825260ff8688205416610e68565b8486517fcdad3405000000000000000000000000000000000000000000000000000000008152fd5b8587517fa963c020000000000000000000000000000000000000000000000000000000008152fd5b8385517f4ca88867000000000000000000000000000000000000000000000000000000008152fd5b503461022c578160031936011261022c573560243591821515928381036104205761112a9161110e61149b565b838652609b60205285209060ff60ff1983541691151516179055565b7fe5c9fc09446cbb1388f8bb0f51a07b6459282099f6087798d09e9f05cff2c8ad8380a380f35b50919034610464576020928360031936011261022c578035906001600160a01b0390816098541633036113a9578285526099865283852084519261119484611835565b60ff82541615801585528660026001850154948b8801958652015495019485526113815781511561136e57806097541688835160248951809481937f6352211e000000000000000000000000000000000000000000000000000000008352898301525afa9081156113475782918a918a91611351575b50604487518b8b5196879485937ff83a20680000000000000000000000000000000000000000000000000000000085528d8c8601526024850152165af1918215611347578892611314575b50609754169151935190810180911161130157813b156112fd578692838693606493895197889687957f4a0b5818000000000000000000000000000000000000000000000000000000008752860152602485015260448401525af180156112f0576112d7575b5090609983946002938552528220828155826001820155015580f35b60029291936112e7609992611867565b939192506112bb565b50505051903d90823e3d90fd5b8680fd5b602487601185634e487b7160e01b835252fd5b9091508881813d8311611340575b61132c8183611897565b8101031261133c57519038611255565b8780fd5b503d611322565b87513d8a823e3d90fd5b6113689150823d8411610fed57610fde8183611897565b3861120a565b602487600185634e487b7160e01b835252fd5b8286517fd6e7efb0000000000000000000000000000000000000000000000000000000008152fd5b83517f4ca88867000000000000000000000000000000000000000000000000000000008152fd5b9250503461022c57602060031936011261022c57357fffffffff00000000000000000000000000000000000000000000000000000000811680910361022c57602092507f7965db0b000000000000000000000000000000000000000000000000000000008114908115611445575b5015158152f35b7f01ffc9a7000000000000000000000000000000000000000000000000000000009150143861143e565b600435906001600160a01b038216820361044e57565b602435906001600160a01b038216820361044e57565b3360009081527fb9dd0f678759a46c1781332d0dd2e78b1fae2d6bbb349488ed28bf95807cdb8c60209081526040808320547fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a4919060ff16156114fe5750505050565b61150733611958565b918151906115148261187b565b604282528482019560603688378251156116d757603087538251906001918210156116d75790607860218501536041915b81831161165c5750505061161a5760449392611611836115ed6048601f95601f1997519a8b916115de8b8401987f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a526115a98d8251928391603789019101611812565b8401917f206973206d697373696e6720726f6c6520000000000000000000000000000000603784015251809386840190611812565b0103602881018b520189611897565b5196879562461bcd60e51b8752600487015251809281602488015287870190611812565b01168101030190fd5b60648483519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f811660108110156116c3577f3031323334353637383961626364656600000000000000000000000000000000901a6116998587611931565b5360041c9280156116af57600019019190611545565b602482634e487b7160e01b81526011600452fd5b602483634e487b7160e01b81526032600452fd5b80634e487b7160e01b602492526032600452fd5b600090808252602090606582526040808420338552835260ff8185205416156117145750505050565b61171d33611958565b9181519061172a8261187b565b604282528482019560603688378251156116d757603087538251906001918210156116d75790607860218501536041915b8183116117bf5750505061161a5760449392611611836115ed6048601f95601f1997519a8b916115de8b8401987f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a526115a98d8251928391603789019101611812565b909192600f811660108110156116c3577f3031323334353637383961626364656600000000000000000000000000000000901a6117fc8587611931565b5360041c9280156116af5760001901919061175b565b60005b8381106118255750506000910152565b8181015183820152602001611815565b6060810190811067ffffffffffffffff82111761185157604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff811161185157604052565b6080810190811067ffffffffffffffff82111761185157604052565b90601f601f19910116810190811067ffffffffffffffff82111761185157604052565b9060009180835260656020526001600160a01b036040842092169182845260205260ff6040842054166118ec57505050565b8083526065602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b908151811015611942570160200190565b634e487b7160e01b600052603260045260246000fd5b6040519061196582611835565b602a82526020820160403682378251156119425760309053815160019081101561194257607860218401536029905b8082116119e85750506119a45790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015611a4e577f3031323334353637383961626364656600000000000000000000000000000000901a611a248486611931565b5360041c918015611a39576000190190611994565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b9081602091031261044e57516001600160a01b038116810361044e5790565b6001600160a01b031615611a9257565b60046040517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fdfea164736f6c6343000813000a00000000000000000000000072e47b1eaaaac6c07ea4071f1d0d355f603e1cc1

Deployed Bytecode

0x6080604081815260048036101561001557600080fd5b600092833560e01c90816301ffc9a7146113d05750806305574c5e1461115157806310be5d90146110e15780631321852b14610de35780631e529a6c14610db45780631e60c38b14610d8a578063248a9ca314610d6057806324d7806c14610ce25780632f2ff15d14610c2f57806336568abe14610b8f5780633a497cd214610b545780633b83245a14610b2857806346c96aac14610b005780634f2bfe5b14610ad8578063609c6d7f14610a9857806369448b6d14610a5657806378abe5a7146109d3578063905ab2791461098657806391d1485414610940578063a217fddf14610925578063c0c53b8b146104d2578063d4e2616f146104a6578063d547741f14610468578063e4e64f601461025c578063eefff5d5146102305763f49d3b081461014157600080fd5b3461022c578160031936011261022c5780359161015c611485565b9161016561149b565b838552609a60205260ff82862054161561020557507fb663263c4e8e3e081832c34eb5808107ce9fbf4ba52cc79aafb19c15a1527b08916001600160a01b03602092858752609a84526101fc83828920907fffffffffffffffffffff0000000000000000000000000000000000000000ffff75ffffffffffffffffffffffffffffffffffffffff000083549260101b169116179055565b5191168152a280f35b90517fa963c020000000000000000000000000000000000000000000000000000000008152fd5b8280fd5b503461022c57602060031936011261022c578160209360ff92358152609a855220541690519015158152f35b50829034610464576020928360031936011261022c5790829161027d61146f565b9161028661149b565b6001600160a01b0386816024816097541696865198899384927fe4e64f60000000000000000000000000000000000000000000000000000000008452169889888401525af194851561045a578695610424575b50825161037f916102e982611835565b60018252888201888152610338868401918a8352898b52609a8c52610321888c2095511515869060ff60ff1983541691151516179055565b51845461ff00191690151560081b61ff0016178455565b5182547fffffffffffffffffffff0000000000000000000000000000000000000000ffff16911660101b75ffffffffffffffffffffffffffffffffffffffff000016179055565b823b1561042057838251917f4b985845000000000000000000000000000000000000000000000000000000008352820152848160248183875af18015610416578493929186916103f7575b505051937f1ec88629262a427f794361e94fdf7d2afb0f49eb9f142e5a818299015f661d0e339180a48152f35b6104049192939450611867565b6104125790829184876103ca565b8380fd5b82513d87823e3d90fd5b8480fd5b9094508681813d8311610453575b61043c8183611897565b8101031261044e57519361037f6102d9565b600080fd5b503d610432565b83513d88823e3d90fd5b5080fd5b50903461022c578060031936011261022c576104a3913561049e600161048c611485565b938387526065602052862001546116eb565b6118ba565b80f35b503461022c57602060031936011261022c578160209360ff92358152609b855220541690519015158152f35b503461022c57606060031936011261022c576104ec61146f565b6104f4611485565b91604435926001600160a01b038085169283860361044e5787549560ff91828860081c161596878098610919575b8015610903575b1561089a5760ff19988860018b8316178d5561086c575b5084811690811561084457908b91734300000000000000000000000000000000000002803b156104125783809160648f51809481937fc8992e6100000000000000000000000000000000000000000000000000000000835260028b840152600160248401528860448401525af190811561083a578491610826575b50503b6107bd575b505460081c83161561075457506105e2906105dd85611a82565b611a82565b6000805260209560658752876000203360005287528188600020541615610708575b7fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a491826000526065885288600020336000528852886000205416156106b9575b50507fffffffffffffffffffffffff000000000000000000000000000000000000000091168160975416176097556098541617609855610682578280f35b7f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989161ff001984541684555160018152a138808280f35b81600052606587528760002033600052875260018860002091825416179055339033907f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a43880610644565b60008052606587528760002033600052875287600020600182825416179055333360007f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8180a4610604565b60849060208a519162461bcd60e51b8352820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152fd5b803b156104645781809160248d51809481937f2ab9d8b800000000000000000000000000000000000000000000000000000000835230898401525af1801561081c57156105c35761080d90611867565b6108185789386105c3565b8980fd5b8b513d84823e3d90fd5b61082f90611867565b61022c5782386105bb565b8d513d86823e3d90fd5b828b517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000016610101178b5538610540565b60848260208c519162461bcd60e51b8352820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152fd5b50303b15801561052957506001848a1614610529565b506001848a1610610522565b50503461046457816003193601126104645751908152602090f35b503461022c578160031936011261022c576001600160a01b0382602094610965611485565b9335815260658652209116600052825260ff81600020541690519015158152f35b503461022c57602060031936011261022c576060928291358152609a6020522054906001600160a01b0381519260ff81161515845260ff8160081c161515602085015260101c1690820152f35b50903461022c57602060031936011261022c578135916109f161149b565b828452609a60205260ff8285205416156102055750818352609a6020528220805461ff00198116600891821c60ff16159182901b61ff00161790915590337f1039c16e7b51187f290e4dcbf3207771138eb7bc5bc0414e7e26377acd1a4bd78480a480f35b503461022c57602060031936011261022c57606092829135815260996020522060ff815416916002600183015492015491815193151584526020840152820152f35b50903461022c578060031936011261022c5780602093610ab6611485565b93358152609a85526001600160a01b03918291205460101c1691519216148152f35b5050346104645781600319360112610464576020906001600160a01b03609754169051908152f35b5050346104645781600319360112610464576020906001600160a01b03609854169051908152f35b503461022c57602060031936011261022c578160209360ff923581526099855220541690519015158152f35b505034610464578160031936011261046457602090517fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a48152f35b50829034610464578260031936011261046457610baa611485565b90336001600160a01b03831603610bc657906104a391356118ba565b608490602085519162461bcd60e51b8352820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152fd5b503461022c578160031936011261022c573590610c4a611485565b908284526065602052610c62600182862001546116eb565b8260005260656020526001600160a01b03816000209216918260005260205260ff81600020541615610c92578380f35b8260005260656020528060002082600052602052600020600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d600080a43880808380f35b505034610464576020600319360112610464576020916001600160a01b03610d0861146f565b16308114918215610d1f575b505090519015158152f35b839192507fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a48152606585522090600052825260ff8160002054163880610d14565b503461022c57602060031936011261022c5781602093600192358152606585522001549051908152f35b503461022c57602060031936011261022c5781602093600192358152609985522001549051908152f35b503461022c57602060031936011261022c578160209360ff92358152609a8552205460081c1690519015158152f35b503461022c578160031936011261022c5780356024356001600160a01b0390816098541633036110b957808652602090609a8252858720865190610e2682611835565b549060ff821615908115815288868683019460ff8160081c161515865260101c16910152611091575161106957838752609a825260ff86882054168015611058575b6110305791818796949293879694836097541660448851809a81937f1321852b000000000000000000000000000000000000000000000000000000008352898b8401528660248401525af1968715610ff4578897610ffe575b508551610ecd81611835565b600181526002838201838152888301908a8252878c5260998652610f048a8d2094511515859060ff60ff1983541691151516179055565b516001840155519101558183609754169160248851809481937f6352211e0000000000000000000000000000000000000000000000000000000083528a8301525afa918215610ff4578892610fc7575b505016803b15610fc357859283604492865197889586947f7f36b27600000000000000000000000000000000000000000000000000000000865285015260248401525af1908115610fba5750610fa75750f35b610fb090611867565b610fb75780f35b80fd5b513d84823e3d90fd5b8580fd5b610fe69250803d10610fed575b610fde8183611897565b810190611a63565b3880610f54565b503d610fd4565b86513d8a823e3d90fd5b975095508087813d8111611029575b6110178183611897565b8101031261044e578796519538610ec1565b503d61100d565b8486517fb97b4fe2000000000000000000000000000000000000000000000000000000008152fd5b506099825260ff8688205416610e68565b8486517fcdad3405000000000000000000000000000000000000000000000000000000008152fd5b8587517fa963c020000000000000000000000000000000000000000000000000000000008152fd5b8385517f4ca88867000000000000000000000000000000000000000000000000000000008152fd5b503461022c578160031936011261022c573560243591821515928381036104205761112a9161110e61149b565b838652609b60205285209060ff60ff1983541691151516179055565b7fe5c9fc09446cbb1388f8bb0f51a07b6459282099f6087798d09e9f05cff2c8ad8380a380f35b50919034610464576020928360031936011261022c578035906001600160a01b0390816098541633036113a9578285526099865283852084519261119484611835565b60ff82541615801585528660026001850154948b8801958652015495019485526113815781511561136e57806097541688835160248951809481937f6352211e000000000000000000000000000000000000000000000000000000008352898301525afa9081156113475782918a918a91611351575b50604487518b8b5196879485937ff83a20680000000000000000000000000000000000000000000000000000000085528d8c8601526024850152165af1918215611347578892611314575b50609754169151935190810180911161130157813b156112fd578692838693606493895197889687957f4a0b5818000000000000000000000000000000000000000000000000000000008752860152602485015260448401525af180156112f0576112d7575b5090609983946002938552528220828155826001820155015580f35b60029291936112e7609992611867565b939192506112bb565b50505051903d90823e3d90fd5b8680fd5b602487601185634e487b7160e01b835252fd5b9091508881813d8311611340575b61132c8183611897565b8101031261133c57519038611255565b8780fd5b503d611322565b87513d8a823e3d90fd5b6113689150823d8411610fed57610fde8183611897565b3861120a565b602487600185634e487b7160e01b835252fd5b8286517fd6e7efb0000000000000000000000000000000000000000000000000000000008152fd5b83517f4ca88867000000000000000000000000000000000000000000000000000000008152fd5b9250503461022c57602060031936011261022c57357fffffffff00000000000000000000000000000000000000000000000000000000811680910361022c57602092507f7965db0b000000000000000000000000000000000000000000000000000000008114908115611445575b5015158152f35b7f01ffc9a7000000000000000000000000000000000000000000000000000000009150143861143e565b600435906001600160a01b038216820361044e57565b602435906001600160a01b038216820361044e57565b3360009081527fb9dd0f678759a46c1781332d0dd2e78b1fae2d6bbb349488ed28bf95807cdb8c60209081526040808320547fd935e9208022e6e646ddd50a845526e117f46138161ae5cf6c7ee44a6263d0a4919060ff16156114fe5750505050565b61150733611958565b918151906115148261187b565b604282528482019560603688378251156116d757603087538251906001918210156116d75790607860218501536041915b81831161165c5750505061161a5760449392611611836115ed6048601f95601f1997519a8b916115de8b8401987f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a526115a98d8251928391603789019101611812565b8401917f206973206d697373696e6720726f6c6520000000000000000000000000000000603784015251809386840190611812565b0103602881018b520189611897565b5196879562461bcd60e51b8752600487015251809281602488015287870190611812565b01168101030190fd5b60648483519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f811660108110156116c3577f3031323334353637383961626364656600000000000000000000000000000000901a6116998587611931565b5360041c9280156116af57600019019190611545565b602482634e487b7160e01b81526011600452fd5b602483634e487b7160e01b81526032600452fd5b80634e487b7160e01b602492526032600452fd5b600090808252602090606582526040808420338552835260ff8185205416156117145750505050565b61171d33611958565b9181519061172a8261187b565b604282528482019560603688378251156116d757603087538251906001918210156116d75790607860218501536041915b8183116117bf5750505061161a5760449392611611836115ed6048601f95601f1997519a8b916115de8b8401987f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008a526115a98d8251928391603789019101611812565b909192600f811660108110156116c3577f3031323334353637383961626364656600000000000000000000000000000000901a6117fc8587611931565b5360041c9280156116af5760001901919061175b565b60005b8381106118255750506000910152565b8181015183820152602001611815565b6060810190811067ffffffffffffffff82111761185157604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff811161185157604052565b6080810190811067ffffffffffffffff82111761185157604052565b90601f601f19910116810190811067ffffffffffffffff82111761185157604052565b9060009180835260656020526001600160a01b036040842092169182845260205260ff6040842054166118ec57505050565b8083526065602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b908151811015611942570160200190565b634e487b7160e01b600052603260045260246000fd5b6040519061196582611835565b602a82526020820160403682378251156119425760309053815160019081101561194257607860218401536029905b8082116119e85750506119a45790565b606460405162461bcd60e51b815260206004820152602060248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b9091600f81166010811015611a4e577f3031323334353637383961626364656600000000000000000000000000000000901a611a248486611931565b5360041c918015611a39576000190190611994565b60246000634e487b7160e01b81526011600452fd5b60246000634e487b7160e01b81526032600452fd5b9081602091031261044e57516001600160a01b038116810361044e5790565b6001600160a01b031615611a9257565b60046040517f9fabe1c1000000000000000000000000000000000000000000000000000000008152fdfea164736f6c6343000813000a

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

00000000000000000000000072e47b1eaaaac6c07ea4071f1d0d355f603e1cc1

-----Decoded View---------------
Arg [0] : blastGovernor_ (address): 0x72e47b1eaAAaC6c07Ea4071f1d0d355f603E1cc1

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000072e47b1eaaaac6c07ea4071f1d0d355f603e1cc1


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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