ETH Price: $2,143.14 (+3.78%)

Contract

0x1B8468F0CD9724017E12D16042Ac16fF00a233F9
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

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

Contract Source Code Verified (Exact Match)

Contract Name:
Prestaking

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 100 runs

Other Settings:
paris EvmVersion
pragma solidity 0.8.20;

import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
import "./interfaces/IDepositTokenRegistry.sol";
import "./interfaces/IDepositManager.sol";
import "./interfaces/IPrestaking.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

contract Prestaking is
  Initializable,
  AccessControlUpgradeable,
  PausableUpgradeable,
  UUPSUpgradeable,
  ReentrancyGuardUpgradeable,
  IPrestaking
{
  using SafeERC20 for IERC20;
  using ECDSA for bytes32;
  using MessageHashUtils for bytes32;

  /// @notice Role identifier for administrative actions
  bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
  /// @notice Role identifier for operator actions like processing deposits
  bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
  /// @notice Role identifier for contract upgrade actions
  bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");
  /// @notice Role identifier for pausing contract functionality
  bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
  /// @notice Role identifier for emergency operations
  bytes32 public constant EMERGENCY_ROLE = keccak256("EMERGENCY_ROLE");

  /// @notice Structure containing deposit information
  /// @param token The token address being deposited
  /// @param amount The amount of tokens deposited
  /// @param timestamp When the deposit was made
  /// @param minShares Minimum shares expected from this deposit
  /// @param processed Whether the deposit has been processed
  /// @param cancelled Whether the deposit has been cancelled
  struct Deposit {
    address token;
    uint256 amount;
    uint256 timestamp;
    uint256 minShares;
    bool processed;
    bool cancelled;
  }

  /// @notice Registry contract for managing deposit token whitelist
  IDepositTokenRegistry public depositTokenRegistry;
  /// @notice Contract handling the actual deposit processing
  IDepositManager public insuranceCapitalLayer;
  /// @notice Mapping of user addresses to their deposits
  mapping(address => Deposit[]) public userDeposits;
  /// @notice Total number of deposits made
  uint256 public totalDeposits;
  /// @notice Number of deposits that have been processed
  uint256 public processedDeposits;
  /// @notice Number of deposits that have been cancelled
  uint256 public cancelledDeposits;

  /// @notice Address authorized to sign deposit requests
  address public verifier;
  /// @notice Time period after which signatures expire
  uint256 public signatureExpiration;

  /// @notice Internal state tracking whether deposits are currently enabled
  bool private _depositsEnabled;

  /// @notice Error for invalid admin address
  error InvalidAdminAddress();
  /// @notice Error for invalid deposit token registry address
  error InvalidDepositTokenRegistryAddress();
  /// @notice Error for invalid emergency admin address
  error InvalidEmergencyAdminAddress();
  /// @notice Error for invalid insurance capital layer address
  error InvalidInsuranceCapitalLayerAddress();
  /// @notice Error for invalid verifier address
  error InvalidVerifierAddress();
  /// @notice Error for deposits being disabled
  error DepositsDisabled();
  /// @notice Error for token not accepted for deposit
  error TokenNotAcceptedForDeposit();
  /// @notice Error for deposit amount must be greater than zero
  error DepositAmountMustBeGreaterThanZero();
  /// @notice Error for maximum deposits per user reached
  error MaximumDepositsPerUserReached();
  /// @notice Error for when there is no token balance to withdraw
  error NoTokenBalanceToWithdraw();
  /// @notice Error for signature expired
  error SignatureExpired();
  /// @notice Error for invalid signature
  error InvalidSignature();
  /// @notice Error for signature already used
  error SignatureAlreadyUsed();
  /// @notice Error for caller not authorized
  error CallerNotAuthorized();
  /// @notice Error for invalid deposit index
  error InvalidDepositIndex();
  /// @notice Error for deposit already processed
  error DepositAlreadyProcessed();
  /// @notice Error for deposit already cancelled
  error DepositAlreadyCancelled();
  /// @notice Error for cancellation period expired
  error CancellationPeriodExpired();
  /// @notice Error for signature expiration too short
  error SignatureExpirationTooShort();
  /// @notice Error for signature expiration too long
  error SignatureExpirationTooLong();

  /// @notice Error for invalid recovery wallet address
  error InvalidRecoveryWalletAddress();

  /// @notice Total number of deposits ever made by each user (including cancelled)
  mapping(address => uint256) public totalUserDeposits;

  /// @notice Emitted when a new deposit is received
  /// @param user Address of the depositor
  /// @param token Address of the deposited token
  /// @param amount Amount of tokens deposited
  /// @param index Position in the user's deposit array
  event DepositReceived(
    address indexed user,
    address indexed token,
    uint256 amount,
    uint256 index
  );

  /// @notice Emitted when a deposit is processed
  /// @param user Address of the depositor
  /// @param token Address of the processed token
  /// @param amount Amount of tokens processed
  /// @param index Position in the user's deposit array
  event DepositProcessed(
    address indexed user,
    address indexed token,
    uint256 amount,
    uint256 index
  );

  /// @notice Emitted when multiple deposits are processed for a user
  /// @param user Address of the depositor
  /// @param count Number of deposits processed
  event DepositsProcessed(address indexed user, uint256 count);

  /// @notice Emitted when a deposit is cancelled
  /// @param user Address of the depositor
  /// @param token Address of the cancelled token
  /// @param amount Amount of tokens returned
  /// @param index Position in the user's deposit array
  event DepositCancelled(
    address indexed user,
    address indexed token,
    uint256 amount,
    uint256 index
  );

  /// @notice Emitted when tokens are emergency withdrawn
  /// @param token Address of the withdrawn token
  /// @param amount Amount of tokens withdrawn
  event EmergencyWithdrawal(address indexed token, uint256 amount);

  /// @notice Emitted when the deposit token registry is updated
  /// @param newRegistry Address of the new registry
  event DepositTokenRegistryUpdated(address indexed newRegistry);

  /// @notice Emitted when the verifier address is updated
  /// @param newVerifier Address of the new verifier
  event VerifierUpdated(address indexed newVerifier);

  /// @notice Emitted when the signature expiration period is updated
  /// @param newExpiration New expiration period in seconds
  event SignatureExpirationUpdated(uint256 newExpiration);

  /// @notice Minimum allowed signature expiration period (1 hour)
  uint256 public constant MIN_SIGNATURE_EXPIRATION = 1 hours;
  /// @notice Maximum allowed signature expiration period (30 days)
  uint256 public constant MAX_SIGNATURE_EXPIRATION = 30 days;

  /// @notice Maximum number of deposits allowed per user
  uint256 public constant MAX_DEPOSITS_PER_USER = 10;

  /// @notice Error thrown when signature is not from the authorized verifier
  error InvalidVerifier(address signer);

  /// @notice Address that will receive tokens in case of emergency withdrawal
  address public recoveryWallet;

  /// @dev Gap for future upgrades
  uint256[50] private __gap;

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

  /// @notice Initializes the Prestaking contract
  /// @param _initialAdmin The address that will own the contract
  /// @param _depositTokenRegistry Address of the deposit token registry contract
  /// @param _insuranceCapitalLayer Address of the insurance capital layer contract
  /// @param _verifier Address authorized to sign deposit requests
  /// @param _recoveryWallet Address that will receive tokens in case of emergency withdrawal
  /// @param _emergencyAdmin Address that will have emergency withdrawal capabilities
  function initialize(
    address _initialAdmin,
    address _depositTokenRegistry,
    address _insuranceCapitalLayer,
    address _verifier,
    address _recoveryWallet,
    address _emergencyAdmin
  ) public initializer {
    if (_initialAdmin == address(0)) revert InvalidAdminAddress();
    if (_depositTokenRegistry == address(0))
      revert InvalidDepositTokenRegistryAddress();
    if (_insuranceCapitalLayer == address(0))
      revert InvalidInsuranceCapitalLayerAddress();
    if (_verifier == address(0)) revert InvalidVerifierAddress();
    if (_recoveryWallet == address(0)) revert InvalidRecoveryWalletAddress();
    if (_emergencyAdmin == address(0)) revert InvalidEmergencyAdminAddress();

    __AccessControl_init();
    __Pausable_init();
    __UUPSUpgradeable_init();
    __ReentrancyGuard_init();

    _grantRole(DEFAULT_ADMIN_ROLE, _initialAdmin);
    _grantRole(ADMIN_ROLE, _initialAdmin);
    _grantRole(UPGRADER_ROLE, _initialAdmin);
    _grantRole(PAUSER_ROLE, _initialAdmin);
    _grantRole(EMERGENCY_ROLE, _emergencyAdmin);

    depositTokenRegistry = IDepositTokenRegistry(_depositTokenRegistry);
    insuranceCapitalLayer = IDepositManager(_insuranceCapitalLayer);
    verifier = _verifier;
    signatureExpiration = 7 days;
    _depositsEnabled = false;
    recoveryWallet = _recoveryWallet;
  }

  /// @notice Requests a new deposit with a valid signature
  /// @param token The token address to deposit
  /// @param amount The amount of tokens to deposit
  /// @param minShares The minimum number of shares expected from this deposit
  /// @param timestamp The timestamp when the signature was created
  /// @param signature The signature from the verifier authorizing this deposit
  function requestDeposit(
    address token,
    uint256 amount,
    uint256 minShares,
    uint256 timestamp,
    bytes memory signature
  ) external whenNotPaused nonReentrant {
    if (!_depositsEnabled) revert DepositsDisabled();
    if (!depositTokenRegistry.isDepositEnabled(token))
      revert TokenNotAcceptedForDeposit();
    if (amount == 0) revert DepositAmountMustBeGreaterThanZero();
    if (userDeposits[msg.sender].length >= MAX_DEPOSITS_PER_USER)
      revert MaximumDepositsPerUserReached();
    if (block.timestamp > timestamp + signatureExpiration)
      revert SignatureExpired();

    bytes32 messageHash = getMessageHash(
      msg.sender,
      timestamp,
      totalUserDeposits[msg.sender]
    );

    bytes32 ethSignedMessageHash = messageHash.toEthSignedMessageHash();
    address signer = ECDSA.recover(ethSignedMessageHash, signature);
    if (signer != verifier) revert InvalidVerifier(signer);

    totalUserDeposits[msg.sender]++;

    userDeposits[msg.sender].push(
      Deposit({
        token: token,
        amount: amount,
        minShares: minShares,
        timestamp: block.timestamp,
        processed: false,
        cancelled: false
      })
    );

    totalDeposits++;

    IERC20(token).safeTransferFrom(msg.sender, address(this), amount);

    emit DepositReceived(
      msg.sender,
      token,
      amount,
      userDeposits[msg.sender].length - 1
    );
  }

  /// @notice Generates a message hash for signature verification
  /// @param _address The user address requesting the deposit
  /// @param _timestamp The timestamp of the request
  /// @param _totalDeposits The total number of deposits made by the user
  /// @return The keccak256 hash of the encoded parameters
  function getMessageHash(
    address _address,
    uint256 _timestamp,
    uint256 _totalDeposits
  ) public pure returns (bytes32) {
    return keccak256(abi.encode(_address, _timestamp, _totalDeposits));
  }

  /// @notice Allows a user or operator to cancel a deposit within the cancellation period
  /// @param user The address of the user whose deposit is being cancelled
  /// @param index The index of the deposit to cancel
  function cancelDeposit(address user, uint256 index) external whenNotPaused {
    if (msg.sender != user && !hasRole(OPERATOR_ROLE, msg.sender))
      revert CallerNotAuthorized();
    if (index >= userDeposits[user].length) revert InvalidDepositIndex();

    Deposit storage depositToCancel = userDeposits[user][index];
    if (depositToCancel.processed) revert DepositAlreadyProcessed();
    if (depositToCancel.cancelled) revert DepositAlreadyCancelled();

    depositToCancel.cancelled = true;
    cancelledDeposits++;

    IERC20(depositToCancel.token).safeTransfer(user, depositToCancel.amount);

    emit DepositCancelled(
      user,
      depositToCancel.token,
      depositToCancel.amount,
      index
    );
  }

  /// @notice Gets all pending deposits for a specific user
  /// @param user The address of the user
  /// @return An array of pending Deposit structs
  function getUserPendingDeposits(
    address user
  ) external view returns (Deposit[] memory) {
    Deposit[] storage deposits = userDeposits[user];
    uint256 count = 0;
    for (uint256 i = 0; i < deposits.length; i++) {
      if (!deposits[i].processed && !deposits[i].cancelled) {
        count++;
      }
    }

    Deposit[] memory pendingDeposits = new Deposit[](count);
    uint256 index = 0;
    for (uint256 i = 0; i < deposits.length; i++) {
      if (!deposits[i].processed && !deposits[i].cancelled) {
        pendingDeposits[index] = deposits[i];
        index++;
      }
    }

    return pendingDeposits;
  }

  /// @notice Processes all pending deposits for a specific user
  /// @param user The address of the user whose deposits should be processed
  function processDeposits(address user) external whenNotPaused nonReentrant {
    if (msg.sender != user && !hasRole(OPERATOR_ROLE, msg.sender))
      revert CallerNotAuthorized();

    Deposit[] storage deposits = userDeposits[user];
    uint256 processed = 0;

    for (uint256 i = 0; i < deposits.length; i++) {
      if (!deposits[i].processed && !deposits[i].cancelled) {
        deposits[i].processed = true;
        processedDeposits++;

        IERC20(deposits[i].token).forceApprove(
          address(insuranceCapitalLayer),
          deposits[i].amount
        );

        insuranceCapitalLayer.processPrestakedDeposit(
          deposits[i].token,
          deposits[i].amount,
          deposits[i].minShares,
          user
        );

        emit DepositProcessed(user, deposits[i].token, deposits[i].amount, i);
        processed++;
      }
    }

    if (processed > 0) {
      emit DepositsProcessed(user, processed);
    }
  }

  /// @notice Returns the total number of deposits that are still pending
  /// @return The count of pending deposits
  function getPendingDepositsCount() external view returns (uint256) {
    return totalDeposits - processedDeposits - cancelledDeposits;
  }

  /// @notice Updates the deposit token registry address
  /// @param _newRegistry The address of the new deposit token registry
  function setDepositTokenRegistry(
    address _newRegistry
  ) external onlyRole(ADMIN_ROLE) {
    if (_newRegistry == address(0)) revert InvalidDepositTokenRegistryAddress();
    depositTokenRegistry = IDepositTokenRegistry(_newRegistry);
    emit DepositTokenRegistryUpdated(_newRegistry);
  }

  /// @notice Updates the verifier address
  /// @param _newVerifier The address of the new verifier
  function setVerifier(address _newVerifier) external onlyRole(ADMIN_ROLE) {
    if (_newVerifier == address(0)) revert InvalidVerifierAddress();
    verifier = _newVerifier;
    emit VerifierUpdated(_newVerifier);
  }

  /// @notice Pauses the contract
  function pause() external onlyRole(PAUSER_ROLE) {
    _pause();
  }

  /// @notice Unpauses the contract
  function unpause() external onlyRole(PAUSER_ROLE) {
    _unpause();
  }

  /// @notice Authorizes the upgrade of the contract
  /// @param newImplementation The address of the new implementation
  function _authorizeUpgrade(
    address newImplementation
  ) internal override onlyRole(UPGRADER_ROLE) {}

  /// @notice Enables deposits for the contract
  function enableDeposits() external onlyRole(ADMIN_ROLE) {
    _depositsEnabled = true;
  }

  /// @notice Disables deposits for the contract
  function disableDeposits() external onlyRole(ADMIN_ROLE) {
    _depositsEnabled = false;
  }

  /// @notice Returns whether deposits are currently enabled
  /// @return true if deposits are enabled, false otherwise
  function depositsEnabled() external view returns (bool) {
    return _depositsEnabled;
  }

  /// @notice Updates the signature expiration period
  /// @param _newExpiration New expiration period in seconds
  /// @dev Must be between MIN_SIGNATURE_EXPIRATION and MAX_SIGNATURE_EXPIRATION
  function setSignatureExpiration(
    uint256 _newExpiration
  ) external onlyRole(ADMIN_ROLE) {
    if (_newExpiration < MIN_SIGNATURE_EXPIRATION)
      revert SignatureExpirationTooShort();
    if (_newExpiration > MAX_SIGNATURE_EXPIRATION)
      revert SignatureExpirationTooLong();
    signatureExpiration = _newExpiration;
    emit SignatureExpirationUpdated(_newExpiration);
  }

  /// @notice Allows emergency role to withdraw tokens in case of emergency
  /// @param token The token address to withdraw
  function emergencyWithdraw(
    address token
  ) external onlyRole(EMERGENCY_ROLE) whenPaused nonReentrant {
    uint256 balance = IERC20(token).balanceOf(address(this));
    if (balance == 0) revert NoTokenBalanceToWithdraw();

    IERC20(token).safeTransfer(recoveryWallet, balance);

    emit EmergencyWithdrawal(token, balance);
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {ERC165Upgradeable} from "../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, IAccessControl, ERC165Upgradeable {
    struct RoleData {
        mapping(address account => bool) hasRole;
        bytes32 adminRole;
    }

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;


    /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl
    struct AccessControlStorage {
        mapping(bytes32 role => RoleData) _roles;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800;

    function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) {
        assembly {
            $.slot := AccessControlStorageLocation
        }
    }

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    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(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

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

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @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 returns (bytes32) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        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 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 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 `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

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

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        if (!hasRole(role, account)) {
            $._roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        if (hasRole(role, account)) {
            $._roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable2Step
    struct Ownable2StepStorage {
        address _pendingOwner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable2Step")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant Ownable2StepStorageLocation = 0x237e158222e3e6968b72b9db0d8043aacf074ad9f650f0d1606b4d82ee432c00;

    function _getOwnable2StepStorage() private pure returns (Ownable2StepStorage storage $) {
        assembly {
            $.slot := Ownable2StepStorageLocation
        }
    }

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

    function __Ownable2Step_init() internal onlyInitializing {
    }

    function __Ownable2Step_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Returns the address of the pending owner.
     */
    function pendingOwner() public view virtual returns (address) {
        Ownable2StepStorage storage $ = _getOwnable2StepStorage();
        return $._pendingOwner;
    }

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        Ownable2StepStorage storage $ = _getOwnable2StepStorage();
        $._pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        Ownable2StepStorage storage $ = _getOwnable2StepStorage();
        delete $._pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

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

pragma solidity ^0.8.20;

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

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable
    struct OwnableStorage {
        address _owner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    function __Ownable_init(address initialOwner) internal onlyInitializing {
        __Ownable_init_unchained(initialOwner);
    }

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        OwnableStorage storage $ = _getOwnableStorage();
        address oldOwner = $._owner;
        $._owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

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

pragma solidity ^0.8.20;

/**
 * @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 Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._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 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._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() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @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 {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

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

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

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.20;

import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol";
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import {Initializable} from "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address private immutable __self = address(this);

    /**
     * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`
     * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
     * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.
     * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must
     * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
     * during an upgrade.
     */
    string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";

    /**
     * @dev The call is from an unauthorized context.
     */
    error UUPSUnauthorizedCallContext();

    /**
     * @dev The storage `slot` is unsupported as a UUID.
     */
    error UUPSUnsupportedProxiableUUID(bytes32 slot);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        _checkProxy();
        _;
    }

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        _checkNotDelegated();
        _;
    }

    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
     */
    function proxiableUUID() external view virtual notDelegated returns (bytes32) {
        return ERC1967Utils.IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data);
    }

    /**
     * @dev Reverts if the execution is not performed via delegatecall or the execution
     * context is not of a proxy with an ERC1967-compliant implementation pointing to self.
     * See {_onlyProxy}.
     */
    function _checkProxy() internal view virtual {
        if (
            address(this) == __self || // Must be called through delegatecall
            ERC1967Utils.getImplementation() != __self // Must be called through an active proxy
        ) {
            revert UUPSUnauthorizedCallContext();
        }
    }

    /**
     * @dev Reverts if the execution is performed via delegatecall.
     * See {notDelegated}.
     */
    function _checkNotDelegated() internal view virtual {
        if (address(this) != __self) {
            // Must not be called through delegatecall
            revert UUPSUnauthorizedCallContext();
        }
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;

    /**
     * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.
     *
     * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value
     * is expected to be the implementation slot in ERC1967.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {
        try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
            if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {
                revert UUPSUnsupportedProxiableUUID(slot);
            }
            ERC1967Utils.upgradeToAndCall(newImplementation, data);
        } catch {
            // The implementation is not UUPS
            revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol";
import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 */
abstract contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20, IERC20Metadata, IERC20Errors {
    /// @custom:storage-location erc7201:openzeppelin.storage.ERC20
    struct ERC20Storage {
        mapping(address account => uint256) _balances;

        mapping(address account => mapping(address spender => uint256)) _allowances;

        uint256 _totalSupply;

        string _name;
        string _symbol;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC20")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ERC20StorageLocation = 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00;

    function _getERC20Storage() private pure returns (ERC20Storage storage $) {
        assembly {
            $.slot := ERC20StorageLocation
        }
    }

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC20_init_unchained(name_, symbol_);
    }

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        ERC20Storage storage $ = _getERC20Storage();
        $._name = name_;
        $._symbol = symbol_;
    }

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

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

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

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        ERC20Storage storage $ = _getERC20Storage();
        return $._totalSupply;
    }

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

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

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

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

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

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        ERC20Storage storage $ = _getERC20Storage();
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            $._totalSupply += value;
        } else {
            uint256 fromBalance = $._balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                $._balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                $._totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                $._balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     * ```
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        ERC20Storage storage $ = _getERC20Storage();
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        $._allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}

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

pragma solidity ^0.8.20;
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;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.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);
 * }
 * ```
 */
abstract contract ERC165Upgradeable is Initializable, IERC165 {
    function __ERC165_init() internal onlyInitializing {
    }

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Pausable
    struct PausableStorage {
        bool _paused;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;

    function _getPausableStorage() private pure returns (PausableStorage storage $) {
        assembly {
            $.slot := PausableStorageLocation
        }
    }

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

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

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

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

    function __Pausable_init_unchained() internal onlyInitializing {
        PausableStorage storage $ = _getPausableStorage();
        $._paused = false;
    }

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

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

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

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

    /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard
    struct ReentrancyGuardStorage {
        uint256 _status;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;

    function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {
        assembly {
            $.slot := ReentrancyGuardStorageLocation
        }
    }

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

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

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        $._status = NOT_ENTERED;
    }

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

    function _nonReentrantBefore() private {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if ($._status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // Any calls to nonReentrant after this point will fail
        $._status = ENTERED;
    }

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @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.
     */
    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 `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}

File 13 of 31 : draft-IERC1822.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.20;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822Proxiable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeacon {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {UpgradeableBeacon} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)

pragma solidity ^0.8.20;

import {IBeacon} from "../beacon/IBeacon.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 */
library ERC1967Utils {
    // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.
    // This will be fixed in Solidity 0.8.21. At that point we should remove these events.
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev The `implementation` of the proxy is invalid.
     */
    error ERC1967InvalidImplementation(address implementation);

    /**
     * @dev The `admin` of the proxy is invalid.
     */
    error ERC1967InvalidAdmin(address admin);

    /**
     * @dev The `beacon` of the proxy is invalid.
     */
    error ERC1967InvalidBeacon(address beacon);

    /**
     * @dev An upgrade function sees `msg.value > 0` that may be lost.
     */
    error ERC1967NonPayable();

    /**
     * @dev Returns the current implementation address.
     */
    function getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        if (newImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(newImplementation);
        }
        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Performs implementation upgrade with additional setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);

        if (data.length > 0) {
            Address.functionDelegateCall(newImplementation, data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using
     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        if (newAdmin == address(0)) {
            revert ERC1967InvalidAdmin(address(0));
        }
        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {IERC1967-AdminChanged} event.
     */
    function changeAdmin(address newAdmin) internal {
        emit AdminChanged(getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        if (newBeacon.code.length == 0) {
            revert ERC1967InvalidBeacon(newBeacon);
        }

        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;

        address beaconImplementation = IBeacon(newBeacon).implementation();
        if (beaconImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(beaconImplementation);
        }
    }

    /**
     * @dev Change the beacon and trigger a setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-BeaconUpgraded} event.
     *
     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
     * efficiency.
     */
    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);

        if (data.length > 0) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
     * if an upgrade doesn't perform an initialization call.
     */
    function _checkNonPayable() private {
        if (msg.value > 0) {
            revert ERC1967NonPayable();
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

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

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) 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 FailedInnerCall();
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.20;

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

    /**
     * @dev The signature derives the `address(0)`.
     */
    error ECDSAInvalidSignature();

    /**
     * @dev The signature has an invalid length.
     */
    error ECDSAInvalidSignatureLength(uint256 length);

    /**
     * @dev The signature has an S value that is in the upper half order.
     */
    error ECDSAInvalidSignatureS(bytes32 s);

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
     * return address(0) without also returning an error description. Errors are documented using an enum (error type)
     * and a bytes32 providing additional information about the error.
     *
     * If no error is returned, then the address can be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
        }
    }

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

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
        unchecked {
            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
            // We do not check for an overflow here since the shift operation results in 0 or 1.
            uint8 v = uint8((uint256(vs) >> 255) + 27);
            return tryRecover(hash, v, r, s);
        }
    }

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

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

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

        return (signer, RecoverError.NoError, bytes32(0));
    }

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

    /**
     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
     */
    function _throwError(RecoverError error, bytes32 errorArg) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert ECDSAInvalidSignature();
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert ECDSAInvalidSignatureLength(uint256(errorArg));
        } else if (error == RecoverError.InvalidSignatureS) {
            revert ECDSAInvalidSignatureS(errorArg);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)

pragma solidity ^0.8.20;

import {Strings} from "../Strings.sol";

/**
 * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
 *
 * The library provides methods for generating a hash of a message that conforms to the
 * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
 * specifications.
 */
library MessageHashUtils {
    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x45` (`personal_sign` messages).
     *
     * The digest is calculated by prefixing a bytes32 `messageHash` with
     * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the
     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
     *
     * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
     * keccak256, although any bytes32 value can be safely used because the final digest will
     * be re-hashed.
     *
     * See {ECDSA-recover}.
     */
    function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash
            mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix
            digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)
        }
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x45` (`personal_sign` messages).
     *
     * The digest is calculated by prefixing an arbitrary `message` with
     * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the
     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
     *
     * See {ECDSA-recover}.
     */
    function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {
        return
            keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message));
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x00` (data with intended validator).
     *
     * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended
     * `validator` address. Then hashing the result.
     *
     * See {ECDSA-recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked(hex"19_00", validator, data));
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
     *
     * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
     * `\x19\x01` and hashing the result. It corresponds to the hash signed by the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
     *
     * See {ECDSA-recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, hex"19_01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            digest := keccak256(ptr, 0x42)
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

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

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

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

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

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

    /**
     * @dev Returns the 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 towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (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 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                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.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 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.

            uint256 twos = denominator & (0 - denominator);
            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 (unsignedRoundsUp(rounding) && 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
     * towards zero.
     *
     * 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

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

pragma solidity ^0.8.20;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @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 v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

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

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant HEX_DIGITS = "0123456789abcdef";
    uint8 private constant ADDRESS_LENGTH = 20;

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.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), HEX_DIGITS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(value < 0 ? "-" : "", toString(SignedMath.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, Math.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) {
        uint256 localValue = value;
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = HEX_DIGITS[localValue & 0xf];
            localValue >>= 4;
        }
        if (localValue != 0) {
            revert StringsInsufficientHexLength(value, length);
        }
        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 bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

//SPDX-License-Identifier:ISC
pragma solidity 0.8.20;

interface IDepositManager {
  function deposit(address token, uint256 amount, uint256 minShares) external;

  function processPrestakedDeposit(
    address token,
    uint amount,
    uint256 minShares,
    address receiver
  ) external;

  function previewDeposit(
    address token,
    uint256 amount
  )
    external
    view
    returns (
      uint256 shares,
      uint256 depositFees,
      bool isAllowed,
      string memory errorMessage
    );

  function previewMint(
    address token,
    uint256 shares
  )
    external
    view
    returns (
      uint256 amount,
      uint256 depositFees,
      bool isAllowed,
      string memory errorMessage
    );

  function setDepositEnabled(bool _depositEnabled) external;

  function depositEnabled() external view returns (bool);

  function convertToShares(
    address token,
    uint256 amount
  ) external view returns (uint256);

  function convertFromShares(
    address token,
    uint256 shares
  ) external view returns (uint256);
}

//SPDX-License-Identifier: ISC
pragma solidity 0.8.20;

interface IDepositTokenRegistry {
  struct TokenInfo {
    bool isAccepted;
    uint256 fixedDepositFee;
    uint256 percentageDepositFee;
    address priceOracle;
    bool paused;
    bool eligibleAsCollateral;
    uint8 decimals;
    string name;
    string symbol;
    uint256 defaultSlippageTolerance;
    uint256 minDeposit;
  }

  function isDepositEnabled(address token) external view returns (bool);
  function getTokenInfo(
    address token
  )
    external
    view
    returns (
      bool isAccepted,
      uint256 fixedDepositFee,
      uint256 percentageDepositFee,
      address priceOracle,
      bool paused,
      string memory name,
      string memory symbol,
      uint256 slippage,
      uint256 minDeposit,
      uint256 decimals,
      bool nativeToken
    );

  /// @notice Returns only the essential token information needed for share price calculations
  /// @param token The address of the token to query
  /// @return isAccepted Whether the token is accepted
  /// @return paused Whether the token is paused
  /// @return priceOracle The address of the price oracle for this token
  /// @return decimals The number of decimals for the token
  function getTokenPriceInfo(
    address token
  )
    external
    view
    returns (bool isAccepted, bool paused, address priceOracle, uint8 decimals);

  function getAcceptedTokens() external view returns (address[] memory);

  function previewMintFees(
    address token,
    uint256 amount
  ) external view returns (uint256);

  function previewDepositFees(
    address token,
    uint256 amount
  ) external view returns (uint256);

  function isEligibleAsCollateral(address token) external view returns (bool);

  function getCollateralTokens() external view returns (address[] memory);

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

pragma solidity 0.8.20;

interface IPrestaking {
  function requestDeposit(
    address token,
    uint256 amount,
    uint256 minShares,
    uint256 timestamp,
    bytes memory signature
  ) external;
  function cancelDeposit(address user, uint256 index) external; // only the user or whitelisted processor
  function processDeposits(address user) external;
  // Add other function signatures as needed
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"CallerNotAuthorized","type":"error"},{"inputs":[],"name":"CancellationPeriodExpired","type":"error"},{"inputs":[],"name":"DepositAlreadyCancelled","type":"error"},{"inputs":[],"name":"DepositAlreadyProcessed","type":"error"},{"inputs":[],"name":"DepositAmountMustBeGreaterThanZero","type":"error"},{"inputs":[],"name":"DepositsDisabled","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"ERC1967InvalidImplementation","type":"error"},{"inputs":[],"name":"ERC1967NonPayable","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidAdminAddress","type":"error"},{"inputs":[],"name":"InvalidDepositIndex","type":"error"},{"inputs":[],"name":"InvalidDepositTokenRegistryAddress","type":"error"},{"inputs":[],"name":"InvalidEmergencyAdminAddress","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidInsuranceCapitalLayerAddress","type":"error"},{"inputs":[],"name":"InvalidRecoveryWalletAddress","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"InvalidVerifier","type":"error"},{"inputs":[],"name":"InvalidVerifierAddress","type":"error"},{"inputs":[],"name":"MaximumDepositsPerUserReached","type":"error"},{"inputs":[],"name":"NoTokenBalanceToWithdraw","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SignatureAlreadyUsed","type":"error"},{"inputs":[],"name":"SignatureExpirationTooLong","type":"error"},{"inputs":[],"name":"SignatureExpirationTooShort","type":"error"},{"inputs":[],"name":"SignatureExpired","type":"error"},{"inputs":[],"name":"TokenNotAcceptedForDeposit","type":"error"},{"inputs":[],"name":"UUPSUnauthorizedCallContext","type":"error"},{"inputs":[{"internalType":"bytes32","name":"slot","type":"bytes32"}],"name":"UUPSUnsupportedProxiableUUID","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"DepositCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"DepositProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"DepositReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newRegistry","type":"address"}],"name":"DepositTokenRegistryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"}],"name":"DepositsProcessed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","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":false,"internalType":"uint256","name":"newExpiration","type":"uint256"}],"name":"SignatureExpirationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newVerifier","type":"address"}],"name":"VerifierUpdated","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EMERGENCY_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DEPOSITS_PER_USER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SIGNATURE_EXPIRATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_SIGNATURE_EXPIRATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_INTERFACE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"cancelDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelledDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositTokenRegistry","outputs":[{"internalType":"contract IDepositTokenRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositsEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"disableDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_timestamp","type":"uint256"},{"internalType":"uint256","name":"_totalDeposits","type":"uint256"}],"name":"getMessageHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getPendingDepositsCount","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":"address","name":"user","type":"address"}],"name":"getUserPendingDeposits","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"minShares","type":"uint256"},{"internalType":"bool","name":"processed","type":"bool"},{"internalType":"bool","name":"cancelled","type":"bool"}],"internalType":"struct Prestaking.Deposit[]","name":"","type":"tuple[]"}],"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":"_initialAdmin","type":"address"},{"internalType":"address","name":"_depositTokenRegistry","type":"address"},{"internalType":"address","name":"_insuranceCapitalLayer","type":"address"},{"internalType":"address","name":"_verifier","type":"address"},{"internalType":"address","name":"_recoveryWallet","type":"address"},{"internalType":"address","name":"_emergencyAdmin","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"insuranceCapitalLayer","outputs":[{"internalType":"contract IDepositManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"processDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"processedDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"recoveryWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minShares","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"requestDeposit","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":"address","name":"_newRegistry","type":"address"}],"name":"setDepositTokenRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newExpiration","type":"uint256"}],"name":"setSignatureExpiration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newVerifier","type":"address"}],"name":"setVerifier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signatureExpiration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalUserDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userDeposits","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"minShares","type":"uint256"},{"internalType":"bool","name":"processed","type":"bool"},{"internalType":"bool","name":"cancelled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"verifier","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a080604052346100cc57306080527ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a009081549060ff8260401c166100bd57506001600160401b036002600160401b031982821601610078575b6040516127fb90816100d2823960805181818161142901526114bb0152f35b6001600160401b031990911681179091556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a1388080610059565b63f92ee8a960e01b8152600490fd5b600080fdfe608060409080825260048036101561001657600080fd5b600091823560e01c90816301ffc9a714611c365750806308f4333314611ba35780630cd57f40146119305780630f7446151461190757806320df4359146118de578063247c69f0146118bf578063248a9ca314611886578063274262bd146118675780632b7ac3f31461183e5780632e08ebcd146117c45780632f2ff15d1461179b57806336568abe146117555780633ec954ed1461172c5780633f4ba83a146116c75780634f1ef2861461147b57806352d1902d146114135780635392fd1c146113ef5780635437988d146113735780635c975abb146113425780635e4c57a4146113195780636ff1c9bc146111c357806375b238fc1461119a5780637d8820971461117b5780638456cb59146111135780638b66329c14610fb457806391d1485414610f5f5780639dc1fb2714610f43578063a217fddf14610f28578063a981c7b414610f00578063ac67e1af14610eda578063ad3cb1cc14610e3e578063b51abde014610dbf578063b940b4f314610a32578063cada242b146109fa578063cc100fa7146109dc578063cc2a9a5b14610728578063ce85629314610709578063d2b0737b146106db578063d52a636c146106be578063d547741f1461066e578063e63ab1e914610645578063f5b541a61461061c578063f72c0d8b146105f3578063fa9c5f4d146105b85763fe5efc691461021357600080fd5b346105b45760a03660031901126105b45761022c611c8a565b906024938435916064356084356001600160401b03908181116105b0576102569036908501611d75565b9161025f6123ab565b6102676123d6565b60ff60085416156105a05760018060a01b03928391828a54169887519586916313a9822560e31b835216998a88830152818d60209889935afa908115610596578b91610569575b501561055957871561054957338a5260028552600a878b2054101561053957600754810180821161052757421161051757610334916102fc61032b92338d5260098852898d205490336125bf565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008c52601c52603c8b20612478565b9092919261253a565b81806006541691169081036105025750338852600983528488206103588154612379565b9055338852600283528488208886519261037184611ced565b8984528584018981528885019042825260608601926044358452608087019685885260a0810196868852805490600160401b8210156104ee57906103ba91600182018155611cbb565b9690966104d95750908a9594939291511660018060a01b031985541617845551600184015551600283015551600382015501915115159060ff61ff0084549251151560081b1692169061ffff191617179055610417600354612379565b60035583516323b872dd60e01b838201523389820152306044820152606480820187905281529060a08201908111828210176104c75784526104599086612406565b33865260028152828620546000198101929083116104b55750825193845283015233917fcf1f679e6fab15306c35a02f98bb653ccbe4b8863acf1d569d0e2232a6da5be89190a360016000805160206127868339815191525580f35b634e487b7160e01b8752601190528686fd5b634e487b7160e01b8852604184528888fd5b9150508e9150808a634e487b7160e01b825252fd5b5050634e487b7160e01b865260418b528f86fd5b848a9187519163226328af60e11b8352820152fd5b8651630819bdcd60e01b81528690fd5b634e487b7160e01b8b52601187528b8bfd5b8651633210d9db60e11b81528690fd5b86516332bba7b160e11b81528690fd5b865163e0ded41960e01b81528690fd5b6105899150863d881161058f575b6105818183611d39565b810190612361565b386102ae565b503d610577565b88513d8d823e3d90fd5b8451630e2f42c960e31b81528490fd5b8780fd5b5080fd5b509190346105f057806003193601126105f057506105e96105e060209360035490549061239e565b6005549061239e565b9051908152f35b80fd5b8284346105b457816003193601126105b457602090516000805160206126c68339815191528152f35b8284346105b457816003193601126105b457602090516000805160206127068339815191528152f35b8284346105b457816003193601126105b457602090516000805160206127268339815191528152f35b5082346106ba57806003193601126106ba576106b691356106b16001610692611ca5565b9383875260008051602061274683398151915260205286200154611e6e565b61220a565b5080f35b8280fd5b8284346105b457816003193601126105b45760209051610e108152f35b8284346105b45760603660031901126105b4576020906105e96106fc611c8a565b60443590602435906125bf565b508290346106ba57826003193601126106ba5760209250549051908152f35b508290346106ba5760c03660031901126106ba57610744611c8a565b61074c611ca5565b6001600160a01b0391604435838116908190036109d857606435918483168093036105b057608435928584168094036109d45760a43592868416938481036109d0577ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a009889549860ff8a8d1c1615986001600160401b038b169a8b15806109c9575b6001809d1490816109bf575b1590816109b6575b506109a65767ffffffffffffffff1981168c178d558a610987575b5081871615610977571695861561096857831561095957841561094a57871561093b571561092d57506108b090610832612320565b61083a612320565b610842612320565b6108aa60ff1995600080516020612766833981519152878154169055610866612320565b61086e612320565b610876612320565b8a6000805160206127868339815191525561089081611ea1565b5061089a81611f2f565b506108a481611fcd565b50612065565b506120fd565b5060018060a01b031993848b5416178a558387541617865582600654161760065562093a8060075560085416600855600a541617600a556108ef578380f35b815460ff60401b191690915590519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a18180808380f35b8a516305069be760e01b8152fd5b508a5163015899ed60e21b8152fd5b508a5163043103a360e21b8152fd5b508a51633f4c76c560e21b8152fd5b508a51633d3622af60e01b8152fd5b8c5163016ed19f60e21b81528390fd5b68ffffffffffffffffff191668010000000000000001178c558e6107fd565b8d5163f92ee8a960e01b81528490fd5b905015386107e2565b303b1591506107da565b508a6107ce565b8a80fd5b8880fd5b8680fd5b8284346105b457816003193601126105b4576020905162278d008152f35b8284346105b45760203660031901126105b45760209181906001600160a01b03610a22611c8a565b1681526009845220549051908152f35b5090346105f0576020806003193601126105b457610a4e611c8a565b93610a576123ab565b610a5f6123d6565b6001600160a01b03948516913383141580610d87575b610d775782845260028152818420938096815b8654811015610d265787610a9c8289611cbb565b50015460ff908116159081610d0b575b50610ac0575b610abb90612379565b610a88565b9787610acc8a89611cbb565b50016001908160ff19825416179055610ae58954612379565b89558783610af38c83611cbb565b5054168b83610b06878254169285611cbb565b5001549189519089820192898063095ea7b360e01b95868152610b5586610b4760249a878c840160209093929193604081019460018060a01b031681520152565b03601f198101885287611d39565b85519082865af1610b6461228d565b81610cdb575b5080610cd1575b15610c98575b505050508b858454166003610ba888610b908588611cbb565b5054169387610b9f8289611cbb565b50015496611cbb565b500154813b156109d4578d898094938e6084948f51998a978896632218f97160e21b885287015289860152604485015260648401525af18015610c8e578a938a938a938f93610c54575b50508492827f781d39e8507017fef6cbedd3e4ceb26e620688d8c807910f604fcbb7d2abbfed92610c39828b610c30610abb9c9a98610c4c9c611cbb565b50541697611cbb565b5001549082519182528b820152a3612379565b989050610ab2565b935093509350506001600160401b038211610c7d575086528790879087908c9082610abb610bf2565b634e487b7160e01b865260418b5285fd5b88513d88823e3d90fd5b610cc893610cc3918d51918d8301528682015260448b818301528152610cbd81611d1e565b82612406565b612406565b38808080610b77565b50813b1515610b71565b8051801592508d908315610cf3575b50505038610b6a565b610d039350820181019101612361565b388c81610cea565b905088610d18838a611cbb565b50015460081c161538610aac565b505093508580610d47575b8460016000805160206127868339815191525580f35b7ffb6c065aedb9f80db2a7c600754a071d9b16cdee761f37b7ecf1f3e68578b3229251908152a281808080610d31565b815163c183bcef60e01b81528590fd5b5060008051602061270683398151915284526000805160206127468339815191528152818420338552815260ff828520541615610a75565b5082346106ba5760203660031901126106ba57813591610ddd611dbc565b610e108310610e305762278d008311610e225750816020917f05a39c416bfb2bcceb8f33d6feba6089299c239a5300e70f492b017274170d4b9360075551908152a180f35b905163cd91296b60e01b8152fd5b9051637a823c7360e11b8152fd5b508290346106ba57826003193601126106ba57815190828201908282106001600160401b03831117610ec75750825260058152602090640352e302e360dc1b8282015282519382859384528251928382860152825b848110610eb157505050828201840152601f01601f19168101030190f35b8181018301518882018801528795508201610e93565b634e487b7160e01b855260419052602484fd5b82346105f057806003193601126105f057610ef3611dbc565b60ff196008541660085580f35b8284346105b457816003193601126105b457905490516001600160a01b039091168152602090f35b8284346105b457816003193601126105b45751908152602090f35b8284346105b457816003193601126105b45760209051600a8152f35b508290346106ba57816003193601126106ba578160209360ff92610f81611ca5565b9035825260008051602061274683398151915286528282206001600160a01b039091168252855220549151911615158152f35b5091346105b457806003193601126105b457610fce611c8a565b9060243590610fdb6123ab565b6001600160a01b03838116929033841415806110d9575b6110c9578386526002602052828620548210156110b957838652600260205261101d82848820611cbb565b5087810180549860ff8a166110ab5760ff8a60081c1661109d57506101007f627946b6a26beee83b76408c8e5af8b2ebb67bc0b7566767d80153797b98fd799697989961ff001916179055611073600554612379565b60055561108a8282541660018301988954916125f0565b541694549082519182526020820152a380f35b855163718bf32b60e01b8152fd5b8551631beb710560e11b8152fd5b82516336cbe6ed60e11b81528790fd5b825163c183bcef60e01b81528790fd5b50600080516020612706833981519152865260008051602061274683398151915260205282862033875260205260ff838720541615610ff2565b8284346105b457816003193601126105b45760207f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25891611151611e24565b6111596123ab565b600080516020612766833981519152805460ff1916600117905551338152a180f35b8284346105b457816003193601126105b4576020906003549051908152f35b8284346105b457816003193601126105b457602090516000805160206127a68339815191528152f35b5091346105b4576020806003193601126106ba576111df611c8a565b936000805160206126a68339815191528085526000805160206127468339815191528352838520338652835260ff8486205416156112fc5750611220612659565b6112286123d6565b82516370a0823160e01b815230828201526001600160a01b039586169390918383602481885afa9283156112f25786936112bf575b5082156112b15750611297827f23d6711a1d031134a36921253c75aa59e967d38e369ac625992824315e204f20959697600a5416876125f0565b51908152a260016000805160206127868339815191525580f35b9051632e51568160e01b8152fd5b9092508381813d83116112eb575b6112d78183611d39565b810103126112e75751913861125d565b8580fd5b503d6112cd565b82513d88823e3d90fd5b6044925083519163e2517d3f60e01b835233908301526024820152fd5b82346105f057806003193601126105f057611332611dbc565b600160ff19600854161760085580f35b8284346105b457816003193601126105b45760209060ff600080516020612766833981519152541690519015158152f35b508290346106ba5760203660031901126106ba5761138f611c8a565b611397611dbc565b6001600160a01b03169182156113e2575050600680546001600160a01b031916821790557fd24015cc99cc1700cafca3042840a1d8ac1e3964fd2e0e37ea29c654056ee3278280a280f35b5163043103a360e21b8152fd5b8284346105b457816003193601126105b45760209060ff6008541690519015158152f35b509190346105f057806003193601126105f057507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316300361146e57602090516000805160206126e68339815191528152f35b5163703e46dd60e11b8152fd5b5082806003193601126106ba57611490611c8a565b906024356001600160401b038111611672576114af9036908501611d75565b6001600160a01b0394907f000000000000000000000000000000000000000000000000000000000000000086163081149081156116ab575b5061169b576000805160206126c6833981519152958683526020966000805160206127468339815191528852848420338552885260ff85852054161561167d57508416938351966352d1902d60e01b885280888881895afa8098859961164a575b50611564578451634c9c8ce360e01b8152808801879052602490fd5b8686866000805160206126e68339815191528b7fc9f76b5ec45e5cdef99837d7b6d2467235c1df8933c8ca56df5c35afa2c7d44481016116345750853b1561161e5780546001600160a01b0319168317905551869392917fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8580a285511561160257505083516106b694839201845af46115fc61228d565b916122bd565b9350935050503461161257505080f35b63b398979f60e01b8152fd5b5051634c9c8ce360e01b81529182015260249150fd5b84602491845191632a87526960e21b8352820152fd5b9098508181813d8311611676575b6116628183611d39565b8101031261167257519789611548565b8480fd5b503d611658565b845163e2517d3f60e01b815233818901526024810191909152604490fd5b825163703e46dd60e11b81528590fd5b9050866000805160206126e683398151915254161415876114e7565b8284346105b457816003193601126105b45760207f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa91611705611e24565b61170d612659565b600080516020612766833981519152805460ff1916905551338152a180f35b8284346105b457816003193601126105b457600a5490516001600160a01b039091168152602090f35b5091346105b457806003193601126105b45761176f611ca5565b90336001600160a01b0383160361178c57506106b691923561220a565b5163334bd91960e11b81528390fd5b5082346106ba57806003193601126106ba576106b691356117bf6001610692611ca5565b612195565b508290346106ba5760203660031901126106ba576117e0611c8a565b6117e8611dbc565b6001600160a01b031691821561183157505081546001600160a01b031916811782557f59cfa3404429fc77a03870a4198af332d0217bd27c5c4a2f79ab0774b11d77ac8280a280f35b51633d3622af60e01b8152fd5b8284346105b457816003193601126105b45760065490516001600160a01b039091168152602090f35b8284346105b457816003193601126105b4576020906005549051908152f35b508290346106ba5760203660031901126106ba578160209360019235815260008051602061274683398151915285522001549051908152f35b8284346105b457816003193601126105b4576020906007549051908152f35b8284346105b457816003193601126105b457602090516000805160206126a68339815191528152f35b8284346105b457816003193601126105b45760015490516001600160a01b039091168152602090f35b50346105b4576020806003193601126106ba57916001600160a01b0380611955611c8a565b168252600280855285832090839484928054935b848110611b3c575061197a8761262e565b966119878a519889611d39565b808852611996601f199161262e565b01865b818110611afd5750508591865b858110611a275750505050505084519380850191818652845180935281878701950193905b8382106119d85786860387f35b8451805182168752808401518785015288810151898801526060808201519088015260808082015115159088015260a09081015115159087015260c090950194938201936001909101906119cb565b86828c611a3884879e9b9c9e611cbb565b5060ff9283910154161580611ae3575b611a62575b505050611a5990612379565b989695986119a6565b9183969185611ad894611a78611a59978a611cbb565b5090805194611a8686611ced565b825416855260018201548e8601528b820154908501526003810154606085015201548181161515608084015260081c16151560a0820152611ac7828d612645565b52611ad2818c612645565b50612379565b93905087388c611a4d565b508185611af08689611cbb565b50015460081c1615611a48565b98809697998b51611b0d81611ced565b8b81528b838201528b8d8201528b60608201528b60808201528b60a082015282828c0101520198969598611999565b82611b4b82849b98999b611cbb565b50015460ff908116159081611b88575b50611b73575b611b6a90612379565b97959497611969565b96611b80611b6a91612379565b979050611b61565b905083611b958385611cbb565b50015460081c161538611b5b565b5090346105f057826003193601126105f057611bbd611c8a565b6001600160a01b039081168252600260205283822080549192602435928310156105f0575091611bf260c0959260ff94611cbb565b5090815416936001820154926002830154916003840154930154938151968752602087015285015260608401528181161515608084015260081c16151560a0820152f35b919050346106ba5760203660031901126106ba573563ffffffff60e01b81168091036106ba5760209250637965db0b60e01b8114908115611c79575b5015158152f35b6301ffc9a760e01b14905083611c72565b600435906001600160a01b0382168203611ca057565b600080fd5b602435906001600160a01b0382168203611ca057565b8054821015611cd7576000526005602060002091020190600090565b634e487b7160e01b600052603260045260246000fd5b60c081019081106001600160401b03821117611d0857604052565b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b03821117611d0857604052565b90601f801991011681019081106001600160401b03821117611d0857604052565b6001600160401b038111611d0857601f01601f191660200190565b81601f82011215611ca057803590611d8c82611d5a565b92611d9a6040519485611d39565b82845260208383010111611ca057816000926020809301838601378301015290565b3360009081527fb16e88c42fd4e48df2dd6a2eabd6bc9aec654ec170056b470819f8892cc6431c60205260409020546000805160206127a68339815191529060ff1615611e065750565b6044906040519063e2517d3f60e01b82523360048301526024820152fd5b3360009081527f75442b0a96088b5456bc4ed01394c96a4feec0f883c9494257d76b96ab1c9b6b60205260409020546000805160206127268339815191529060ff1615611e065750565b8060005260008051602061274683398151915260205260406000203360005260205260ff6040600020541615611e065750565b6001600160a01b031660008181527fb7db2dd08fcb62d0c9e08c51941cae53c267786a0b75803fb7960902fc8ef97d60205260408120549091906000805160206127468339815191529060ff16611f2a578280526020526040822081835260205260408220600160ff1982541617905533916000805160206126868339815191528180a4600190565b505090565b6001600160a01b031660008181527fb16e88c42fd4e48df2dd6a2eabd6bc9aec654ec170056b470819f8892cc6431c60205260408120549091906000805160206127a6833981519152906000805160206127468339815191529060ff16611fc7578184526020526040832082845260205260408320600160ff19825416179055600080516020612686833981519152339380a4600190565b50505090565b6001600160a01b031660008181527fab71e3f32666744d246edff3f96e4bdafee2e9867098cdd118a979a7464786a860205260408120549091906000805160206126c6833981519152906000805160206127468339815191529060ff16611fc7578184526020526040832082845260205260408320600160ff19825416179055600080516020612686833981519152339380a4600190565b6001600160a01b031660008181527f75442b0a96088b5456bc4ed01394c96a4feec0f883c9494257d76b96ab1c9b6b6020526040812054909190600080516020612726833981519152906000805160206127468339815191529060ff16611fc7578184526020526040832082845260205260408320600160ff19825416179055600080516020612686833981519152339380a4600190565b6001600160a01b031660008181527f762c7c328dd70a077c65c77b60e4c38eed3d2f6aa056d4d0fa114aeff8234b5660205260408120549091906000805160206126a6833981519152906000805160206127468339815191529060ff16611fc7578184526020526040832082845260205260408320600160ff19825416179055600080516020612686833981519152339380a4600190565b9060009180835260008051602061274683398151915280602052604084209260018060a01b03169283855260205260ff60408520541615600014611fc7578184526020526040832082845260205260408320600160ff19825416179055600080516020612686833981519152339380a4600190565b9060009180835260008051602061274683398151915280602052604084209260018060a01b03169283855260205260ff604085205416600014611fc757818452602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4600190565b3d156122b8573d9061229e82611d5a565b916122ac6040519384611d39565b82523d6000602084013e565b606090565b906122e457508051156122d257805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580612317575b6122f5575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b156122ed565b60ff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460401c161561234f57565b604051631afcd79f60e31b8152600490fd5b90816020910312611ca057518015158103611ca05790565b60001981146123885760010190565b634e487b7160e01b600052601160045260246000fd5b9190820391821161238857565b60ff60008051602061276683398151915254166123c457565b60405163d93c066560e01b8152600490fd5b60008051602061278683398151915260028154146123f45760029055565b604051633ee5aeb560e01b8152600490fd5b60008061242f9260018060a01b03169360208151910182865af161242861228d565b90836122bd565b805190811515918261245d575b50506124455750565b60249060405190635274afe760e01b82526004820152fd5b6124709250602080918301019101612361565b15388061243c565b81519190604183036124a9576124a292506020820151906060604084015193015160001a906124b4565b9192909190565b505060009160029190565b91906fa2a8918ca85bafe22016d0b997e4df60600160ff1b03841161252e57926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa156125225780516001600160a01b0381161561251957918190565b50809160019190565b604051903d90823e3d90fd5b50505060009160039190565b60048110156125a9578061254c575050565b600181036125665760405163f645eedf60e01b8152600490fd5b600281036125875760405163fce698f760e01b815260048101839052602490fd5b6003146125915750565b602490604051906335e2f38360e21b82526004820152fd5b634e487b7160e01b600052602160045260246000fd5b9160405191602083019360018060a01b0316845260408301526060820152606081526125ea81611d1e565b51902090565b60405163a9059cbb60e01b60208201526001600160a01b0392909216602483015260448083019390935291815261262c91610cc3606483611d39565b565b6001600160401b038111611d085760051b60200190565b8051821015611cd75760209160051b010190565b60ff60008051602061276683398151915254161561267357565b604051638dfc202b60e01b8152600490fdfe2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0dbf233dd2aafeb4d50879c4aa5c81e96d92f6e6945c906a58f9f2d1c1631b4b26189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92965d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a2646970667358221220da9d9f41d0c5bb7f65ac1e3673eda01140f1da62326b6d295bc04aba9a8264de64736f6c63430008140033

Deployed Bytecode

0x608060409080825260048036101561001657600080fd5b600091823560e01c90816301ffc9a714611c365750806308f4333314611ba35780630cd57f40146119305780630f7446151461190757806320df4359146118de578063247c69f0146118bf578063248a9ca314611886578063274262bd146118675780632b7ac3f31461183e5780632e08ebcd146117c45780632f2ff15d1461179b57806336568abe146117555780633ec954ed1461172c5780633f4ba83a146116c75780634f1ef2861461147b57806352d1902d146114135780635392fd1c146113ef5780635437988d146113735780635c975abb146113425780635e4c57a4146113195780636ff1c9bc146111c357806375b238fc1461119a5780637d8820971461117b5780638456cb59146111135780638b66329c14610fb457806391d1485414610f5f5780639dc1fb2714610f43578063a217fddf14610f28578063a981c7b414610f00578063ac67e1af14610eda578063ad3cb1cc14610e3e578063b51abde014610dbf578063b940b4f314610a32578063cada242b146109fa578063cc100fa7146109dc578063cc2a9a5b14610728578063ce85629314610709578063d2b0737b146106db578063d52a636c146106be578063d547741f1461066e578063e63ab1e914610645578063f5b541a61461061c578063f72c0d8b146105f3578063fa9c5f4d146105b85763fe5efc691461021357600080fd5b346105b45760a03660031901126105b45761022c611c8a565b906024938435916064356084356001600160401b03908181116105b0576102569036908501611d75565b9161025f6123ab565b6102676123d6565b60ff60085416156105a05760018060a01b03928391828a54169887519586916313a9822560e31b835216998a88830152818d60209889935afa908115610596578b91610569575b501561055957871561054957338a5260028552600a878b2054101561053957600754810180821161052757421161051757610334916102fc61032b92338d5260098852898d205490336125bf565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008c52601c52603c8b20612478565b9092919261253a565b81806006541691169081036105025750338852600983528488206103588154612379565b9055338852600283528488208886519261037184611ced565b8984528584018981528885019042825260608601926044358452608087019685885260a0810196868852805490600160401b8210156104ee57906103ba91600182018155611cbb565b9690966104d95750908a9594939291511660018060a01b031985541617845551600184015551600283015551600382015501915115159060ff61ff0084549251151560081b1692169061ffff191617179055610417600354612379565b60035583516323b872dd60e01b838201523389820152306044820152606480820187905281529060a08201908111828210176104c75784526104599086612406565b33865260028152828620546000198101929083116104b55750825193845283015233917fcf1f679e6fab15306c35a02f98bb653ccbe4b8863acf1d569d0e2232a6da5be89190a360016000805160206127868339815191525580f35b634e487b7160e01b8752601190528686fd5b634e487b7160e01b8852604184528888fd5b9150508e9150808a634e487b7160e01b825252fd5b5050634e487b7160e01b865260418b528f86fd5b848a9187519163226328af60e11b8352820152fd5b8651630819bdcd60e01b81528690fd5b634e487b7160e01b8b52601187528b8bfd5b8651633210d9db60e11b81528690fd5b86516332bba7b160e11b81528690fd5b865163e0ded41960e01b81528690fd5b6105899150863d881161058f575b6105818183611d39565b810190612361565b386102ae565b503d610577565b88513d8d823e3d90fd5b8451630e2f42c960e31b81528490fd5b8780fd5b5080fd5b509190346105f057806003193601126105f057506105e96105e060209360035490549061239e565b6005549061239e565b9051908152f35b80fd5b8284346105b457816003193601126105b457602090516000805160206126c68339815191528152f35b8284346105b457816003193601126105b457602090516000805160206127068339815191528152f35b8284346105b457816003193601126105b457602090516000805160206127268339815191528152f35b5082346106ba57806003193601126106ba576106b691356106b16001610692611ca5565b9383875260008051602061274683398151915260205286200154611e6e565b61220a565b5080f35b8280fd5b8284346105b457816003193601126105b45760209051610e108152f35b8284346105b45760603660031901126105b4576020906105e96106fc611c8a565b60443590602435906125bf565b508290346106ba57826003193601126106ba5760209250549051908152f35b508290346106ba5760c03660031901126106ba57610744611c8a565b61074c611ca5565b6001600160a01b0391604435838116908190036109d857606435918483168093036105b057608435928584168094036109d45760a43592868416938481036109d0577ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a009889549860ff8a8d1c1615986001600160401b038b169a8b15806109c9575b6001809d1490816109bf575b1590816109b6575b506109a65767ffffffffffffffff1981168c178d558a610987575b5081871615610977571695861561096857831561095957841561094a57871561093b571561092d57506108b090610832612320565b61083a612320565b610842612320565b6108aa60ff1995600080516020612766833981519152878154169055610866612320565b61086e612320565b610876612320565b8a6000805160206127868339815191525561089081611ea1565b5061089a81611f2f565b506108a481611fcd565b50612065565b506120fd565b5060018060a01b031993848b5416178a558387541617865582600654161760065562093a8060075560085416600855600a541617600a556108ef578380f35b815460ff60401b191690915590519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a18180808380f35b8a516305069be760e01b8152fd5b508a5163015899ed60e21b8152fd5b508a5163043103a360e21b8152fd5b508a51633f4c76c560e21b8152fd5b508a51633d3622af60e01b8152fd5b8c5163016ed19f60e21b81528390fd5b68ffffffffffffffffff191668010000000000000001178c558e6107fd565b8d5163f92ee8a960e01b81528490fd5b905015386107e2565b303b1591506107da565b508a6107ce565b8a80fd5b8880fd5b8680fd5b8284346105b457816003193601126105b4576020905162278d008152f35b8284346105b45760203660031901126105b45760209181906001600160a01b03610a22611c8a565b1681526009845220549051908152f35b5090346105f0576020806003193601126105b457610a4e611c8a565b93610a576123ab565b610a5f6123d6565b6001600160a01b03948516913383141580610d87575b610d775782845260028152818420938096815b8654811015610d265787610a9c8289611cbb565b50015460ff908116159081610d0b575b50610ac0575b610abb90612379565b610a88565b9787610acc8a89611cbb565b50016001908160ff19825416179055610ae58954612379565b89558783610af38c83611cbb565b5054168b83610b06878254169285611cbb565b5001549189519089820192898063095ea7b360e01b95868152610b5586610b4760249a878c840160209093929193604081019460018060a01b031681520152565b03601f198101885287611d39565b85519082865af1610b6461228d565b81610cdb575b5080610cd1575b15610c98575b505050508b858454166003610ba888610b908588611cbb565b5054169387610b9f8289611cbb565b50015496611cbb565b500154813b156109d4578d898094938e6084948f51998a978896632218f97160e21b885287015289860152604485015260648401525af18015610c8e578a938a938a938f93610c54575b50508492827f781d39e8507017fef6cbedd3e4ceb26e620688d8c807910f604fcbb7d2abbfed92610c39828b610c30610abb9c9a98610c4c9c611cbb565b50541697611cbb565b5001549082519182528b820152a3612379565b989050610ab2565b935093509350506001600160401b038211610c7d575086528790879087908c9082610abb610bf2565b634e487b7160e01b865260418b5285fd5b88513d88823e3d90fd5b610cc893610cc3918d51918d8301528682015260448b818301528152610cbd81611d1e565b82612406565b612406565b38808080610b77565b50813b1515610b71565b8051801592508d908315610cf3575b50505038610b6a565b610d039350820181019101612361565b388c81610cea565b905088610d18838a611cbb565b50015460081c161538610aac565b505093508580610d47575b8460016000805160206127868339815191525580f35b7ffb6c065aedb9f80db2a7c600754a071d9b16cdee761f37b7ecf1f3e68578b3229251908152a281808080610d31565b815163c183bcef60e01b81528590fd5b5060008051602061270683398151915284526000805160206127468339815191528152818420338552815260ff828520541615610a75565b5082346106ba5760203660031901126106ba57813591610ddd611dbc565b610e108310610e305762278d008311610e225750816020917f05a39c416bfb2bcceb8f33d6feba6089299c239a5300e70f492b017274170d4b9360075551908152a180f35b905163cd91296b60e01b8152fd5b9051637a823c7360e11b8152fd5b508290346106ba57826003193601126106ba57815190828201908282106001600160401b03831117610ec75750825260058152602090640352e302e360dc1b8282015282519382859384528251928382860152825b848110610eb157505050828201840152601f01601f19168101030190f35b8181018301518882018801528795508201610e93565b634e487b7160e01b855260419052602484fd5b82346105f057806003193601126105f057610ef3611dbc565b60ff196008541660085580f35b8284346105b457816003193601126105b457905490516001600160a01b039091168152602090f35b8284346105b457816003193601126105b45751908152602090f35b8284346105b457816003193601126105b45760209051600a8152f35b508290346106ba57816003193601126106ba578160209360ff92610f81611ca5565b9035825260008051602061274683398151915286528282206001600160a01b039091168252855220549151911615158152f35b5091346105b457806003193601126105b457610fce611c8a565b9060243590610fdb6123ab565b6001600160a01b03838116929033841415806110d9575b6110c9578386526002602052828620548210156110b957838652600260205261101d82848820611cbb565b5087810180549860ff8a166110ab5760ff8a60081c1661109d57506101007f627946b6a26beee83b76408c8e5af8b2ebb67bc0b7566767d80153797b98fd799697989961ff001916179055611073600554612379565b60055561108a8282541660018301988954916125f0565b541694549082519182526020820152a380f35b855163718bf32b60e01b8152fd5b8551631beb710560e11b8152fd5b82516336cbe6ed60e11b81528790fd5b825163c183bcef60e01b81528790fd5b50600080516020612706833981519152865260008051602061274683398151915260205282862033875260205260ff838720541615610ff2565b8284346105b457816003193601126105b45760207f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25891611151611e24565b6111596123ab565b600080516020612766833981519152805460ff1916600117905551338152a180f35b8284346105b457816003193601126105b4576020906003549051908152f35b8284346105b457816003193601126105b457602090516000805160206127a68339815191528152f35b5091346105b4576020806003193601126106ba576111df611c8a565b936000805160206126a68339815191528085526000805160206127468339815191528352838520338652835260ff8486205416156112fc5750611220612659565b6112286123d6565b82516370a0823160e01b815230828201526001600160a01b039586169390918383602481885afa9283156112f25786936112bf575b5082156112b15750611297827f23d6711a1d031134a36921253c75aa59e967d38e369ac625992824315e204f20959697600a5416876125f0565b51908152a260016000805160206127868339815191525580f35b9051632e51568160e01b8152fd5b9092508381813d83116112eb575b6112d78183611d39565b810103126112e75751913861125d565b8580fd5b503d6112cd565b82513d88823e3d90fd5b6044925083519163e2517d3f60e01b835233908301526024820152fd5b82346105f057806003193601126105f057611332611dbc565b600160ff19600854161760085580f35b8284346105b457816003193601126105b45760209060ff600080516020612766833981519152541690519015158152f35b508290346106ba5760203660031901126106ba5761138f611c8a565b611397611dbc565b6001600160a01b03169182156113e2575050600680546001600160a01b031916821790557fd24015cc99cc1700cafca3042840a1d8ac1e3964fd2e0e37ea29c654056ee3278280a280f35b5163043103a360e21b8152fd5b8284346105b457816003193601126105b45760209060ff6008541690519015158152f35b509190346105f057806003193601126105f057507f0000000000000000000000001b8468f0cd9724017e12d16042ac16ff00a233f96001600160a01b0316300361146e57602090516000805160206126e68339815191528152f35b5163703e46dd60e11b8152fd5b5082806003193601126106ba57611490611c8a565b906024356001600160401b038111611672576114af9036908501611d75565b6001600160a01b0394907f0000000000000000000000001b8468f0cd9724017e12d16042ac16ff00a233f986163081149081156116ab575b5061169b576000805160206126c6833981519152958683526020966000805160206127468339815191528852848420338552885260ff85852054161561167d57508416938351966352d1902d60e01b885280888881895afa8098859961164a575b50611564578451634c9c8ce360e01b8152808801879052602490fd5b8686866000805160206126e68339815191528b7fc9f76b5ec45e5cdef99837d7b6d2467235c1df8933c8ca56df5c35afa2c7d44481016116345750853b1561161e5780546001600160a01b0319168317905551869392917fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8580a285511561160257505083516106b694839201845af46115fc61228d565b916122bd565b9350935050503461161257505080f35b63b398979f60e01b8152fd5b5051634c9c8ce360e01b81529182015260249150fd5b84602491845191632a87526960e21b8352820152fd5b9098508181813d8311611676575b6116628183611d39565b8101031261167257519789611548565b8480fd5b503d611658565b845163e2517d3f60e01b815233818901526024810191909152604490fd5b825163703e46dd60e11b81528590fd5b9050866000805160206126e683398151915254161415876114e7565b8284346105b457816003193601126105b45760207f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa91611705611e24565b61170d612659565b600080516020612766833981519152805460ff1916905551338152a180f35b8284346105b457816003193601126105b457600a5490516001600160a01b039091168152602090f35b5091346105b457806003193601126105b45761176f611ca5565b90336001600160a01b0383160361178c57506106b691923561220a565b5163334bd91960e11b81528390fd5b5082346106ba57806003193601126106ba576106b691356117bf6001610692611ca5565b612195565b508290346106ba5760203660031901126106ba576117e0611c8a565b6117e8611dbc565b6001600160a01b031691821561183157505081546001600160a01b031916811782557f59cfa3404429fc77a03870a4198af332d0217bd27c5c4a2f79ab0774b11d77ac8280a280f35b51633d3622af60e01b8152fd5b8284346105b457816003193601126105b45760065490516001600160a01b039091168152602090f35b8284346105b457816003193601126105b4576020906005549051908152f35b508290346106ba5760203660031901126106ba578160209360019235815260008051602061274683398151915285522001549051908152f35b8284346105b457816003193601126105b4576020906007549051908152f35b8284346105b457816003193601126105b457602090516000805160206126a68339815191528152f35b8284346105b457816003193601126105b45760015490516001600160a01b039091168152602090f35b50346105b4576020806003193601126106ba57916001600160a01b0380611955611c8a565b168252600280855285832090839484928054935b848110611b3c575061197a8761262e565b966119878a519889611d39565b808852611996601f199161262e565b01865b818110611afd5750508591865b858110611a275750505050505084519380850191818652845180935281878701950193905b8382106119d85786860387f35b8451805182168752808401518785015288810151898801526060808201519088015260808082015115159088015260a09081015115159087015260c090950194938201936001909101906119cb565b86828c611a3884879e9b9c9e611cbb565b5060ff9283910154161580611ae3575b611a62575b505050611a5990612379565b989695986119a6565b9183969185611ad894611a78611a59978a611cbb565b5090805194611a8686611ced565b825416855260018201548e8601528b820154908501526003810154606085015201548181161515608084015260081c16151560a0820152611ac7828d612645565b52611ad2818c612645565b50612379565b93905087388c611a4d565b508185611af08689611cbb565b50015460081c1615611a48565b98809697998b51611b0d81611ced565b8b81528b838201528b8d8201528b60608201528b60808201528b60a082015282828c0101520198969598611999565b82611b4b82849b98999b611cbb565b50015460ff908116159081611b88575b50611b73575b611b6a90612379565b97959497611969565b96611b80611b6a91612379565b979050611b61565b905083611b958385611cbb565b50015460081c161538611b5b565b5090346105f057826003193601126105f057611bbd611c8a565b6001600160a01b039081168252600260205283822080549192602435928310156105f0575091611bf260c0959260ff94611cbb565b5090815416936001820154926002830154916003840154930154938151968752602087015285015260608401528181161515608084015260081c16151560a0820152f35b919050346106ba5760203660031901126106ba573563ffffffff60e01b81168091036106ba5760209250637965db0b60e01b8114908115611c79575b5015158152f35b6301ffc9a760e01b14905083611c72565b600435906001600160a01b0382168203611ca057565b600080fd5b602435906001600160a01b0382168203611ca057565b8054821015611cd7576000526005602060002091020190600090565b634e487b7160e01b600052603260045260246000fd5b60c081019081106001600160401b03821117611d0857604052565b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b03821117611d0857604052565b90601f801991011681019081106001600160401b03821117611d0857604052565b6001600160401b038111611d0857601f01601f191660200190565b81601f82011215611ca057803590611d8c82611d5a565b92611d9a6040519485611d39565b82845260208383010111611ca057816000926020809301838601378301015290565b3360009081527fb16e88c42fd4e48df2dd6a2eabd6bc9aec654ec170056b470819f8892cc6431c60205260409020546000805160206127a68339815191529060ff1615611e065750565b6044906040519063e2517d3f60e01b82523360048301526024820152fd5b3360009081527f75442b0a96088b5456bc4ed01394c96a4feec0f883c9494257d76b96ab1c9b6b60205260409020546000805160206127268339815191529060ff1615611e065750565b8060005260008051602061274683398151915260205260406000203360005260205260ff6040600020541615611e065750565b6001600160a01b031660008181527fb7db2dd08fcb62d0c9e08c51941cae53c267786a0b75803fb7960902fc8ef97d60205260408120549091906000805160206127468339815191529060ff16611f2a578280526020526040822081835260205260408220600160ff1982541617905533916000805160206126868339815191528180a4600190565b505090565b6001600160a01b031660008181527fb16e88c42fd4e48df2dd6a2eabd6bc9aec654ec170056b470819f8892cc6431c60205260408120549091906000805160206127a6833981519152906000805160206127468339815191529060ff16611fc7578184526020526040832082845260205260408320600160ff19825416179055600080516020612686833981519152339380a4600190565b50505090565b6001600160a01b031660008181527fab71e3f32666744d246edff3f96e4bdafee2e9867098cdd118a979a7464786a860205260408120549091906000805160206126c6833981519152906000805160206127468339815191529060ff16611fc7578184526020526040832082845260205260408320600160ff19825416179055600080516020612686833981519152339380a4600190565b6001600160a01b031660008181527f75442b0a96088b5456bc4ed01394c96a4feec0f883c9494257d76b96ab1c9b6b6020526040812054909190600080516020612726833981519152906000805160206127468339815191529060ff16611fc7578184526020526040832082845260205260408320600160ff19825416179055600080516020612686833981519152339380a4600190565b6001600160a01b031660008181527f762c7c328dd70a077c65c77b60e4c38eed3d2f6aa056d4d0fa114aeff8234b5660205260408120549091906000805160206126a6833981519152906000805160206127468339815191529060ff16611fc7578184526020526040832082845260205260408320600160ff19825416179055600080516020612686833981519152339380a4600190565b9060009180835260008051602061274683398151915280602052604084209260018060a01b03169283855260205260ff60408520541615600014611fc7578184526020526040832082845260205260408320600160ff19825416179055600080516020612686833981519152339380a4600190565b9060009180835260008051602061274683398151915280602052604084209260018060a01b03169283855260205260ff604085205416600014611fc757818452602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4600190565b3d156122b8573d9061229e82611d5a565b916122ac6040519384611d39565b82523d6000602084013e565b606090565b906122e457508051156122d257805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580612317575b6122f5575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b156122ed565b60ff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460401c161561234f57565b604051631afcd79f60e31b8152600490fd5b90816020910312611ca057518015158103611ca05790565b60001981146123885760010190565b634e487b7160e01b600052601160045260246000fd5b9190820391821161238857565b60ff60008051602061276683398151915254166123c457565b60405163d93c066560e01b8152600490fd5b60008051602061278683398151915260028154146123f45760029055565b604051633ee5aeb560e01b8152600490fd5b60008061242f9260018060a01b03169360208151910182865af161242861228d565b90836122bd565b805190811515918261245d575b50506124455750565b60249060405190635274afe760e01b82526004820152fd5b6124709250602080918301019101612361565b15388061243c565b81519190604183036124a9576124a292506020820151906060604084015193015160001a906124b4565b9192909190565b505060009160029190565b91906fa2a8918ca85bafe22016d0b997e4df60600160ff1b03841161252e57926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa156125225780516001600160a01b0381161561251957918190565b50809160019190565b604051903d90823e3d90fd5b50505060009160039190565b60048110156125a9578061254c575050565b600181036125665760405163f645eedf60e01b8152600490fd5b600281036125875760405163fce698f760e01b815260048101839052602490fd5b6003146125915750565b602490604051906335e2f38360e21b82526004820152fd5b634e487b7160e01b600052602160045260246000fd5b9160405191602083019360018060a01b0316845260408301526060820152606081526125ea81611d1e565b51902090565b60405163a9059cbb60e01b60208201526001600160a01b0392909216602483015260448083019390935291815261262c91610cc3606483611d39565b565b6001600160401b038111611d085760051b60200190565b8051821015611cd75760209160051b010190565b60ff60008051602061276683398151915254161561267357565b604051638dfc202b60e01b8152600490fdfe2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0dbf233dd2aafeb4d50879c4aa5c81e96d92f6e6945c906a58f9f2d1c1631b4b26189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc97667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b92965d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a2646970667358221220da9d9f41d0c5bb7f65ac1e3673eda01140f1da62326b6d295bc04aba9a8264de64736f6c63430008140033

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
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.