ETH Price: $3,454.96 (+1.46%)
Gas: 9 Gwei

Contract

0x3fb771B9F663CdbB31d65e6e85AD1cdC790C50de
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040202139922024-07-01 20:15:1115 days ago1719864911IN
 Create: ORAStakePool_OLM
0 ETH0.0231843510.00553227

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ORAStakePool_OLM

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 22 : ORAStakePool_OLM.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

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

import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {IERC7641} from "./interfaces/IERC7641.sol";
import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
import {IORAStakePoolPermit} from "./interfaces/IORAStakePoolPermit.sol";
import {ORAStakePoolPermit} from "./ORAStakePoolPermit.sol";
import {ISwapRouter} from "./interfaces/ISwapRouter.sol";

contract ORAStakePool_OLM is ORAStakePoolPermit {
    address WETH;
    address router;

    function poolRevenueClaimAndConvert(uint256 snapshotId, uint256 amountoutMin) public {
        poolRevenueClaim(snapshotId);
        poolRevenueConvert(amountoutMin);
    }

    function poolRevenueClaim(uint256 snapshotId) public {
        IERC7641(stakingTokenAddress).claim(snapshotId);
    }

    function poolRevenueConvert(uint256 amountoutMin) public onlyOwner {
        uint256 amountIn = address(this).balance;

        ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams({
            tokenIn: WETH,
            tokenOut: stakingTokenAddress,
            fee: 3000,
            recipient: address(this),
            amountIn: amountIn,
            amountOutMinimum: amountoutMin,
            sqrtPriceLimitX96: 0
        });

        ISwapRouter(router).exactInputSingle{value: amountIn}(params);
    }

    function setWETHAddress(address _WETH) external onlyOwner {
        WETH = _WETH;
    }

    function setSwapRouterAddress(address _router) external onlyOwner {
        router = _router;
    }

    receive() external payable {}
}

File 2 of 22 : ORAStakePoolBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";

import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {IORAStakePool} from "./interfaces/IORAStakePool.sol";
import {IORAStakeRouter} from "./interfaces/IORAStakeRouter.sol";

contract ORAStakePoolBase is OwnableUpgradeable, PausableUpgradeable, IORAStakePool, ERC20Upgradeable {
    using Math for uint256;

    address public stakingPoolRouter;
    address public permit2Address;
    address public stakingTokenAddress;

    bool public pauseWithdraw;

    mapping(address => mapping(uint256 => WithdrawRequest)) withdrawQueue;
    mapping(address => uint256) nextRequestID;
    mapping(address => uint256) public nextUnclaimedID; // visible for getting claim status

    modifier onlyRouter() {
        require(msg.sender == stakingPoolRouter, "Have to invoke from router");
        _;
    }

    modifier whenNotPausedWithdraw() {
        require(pauseWithdraw == false, "withdraw is paused.");
        _;
    }

    // **************** Setup Functions  ****************
    constructor() {
        _disableInitializers();
    }

    function initialize(address _router, address _owner, string memory _name, string memory _symbol)
        external
        initializer
    {
        __Ownable_init(_owner);
        __Pausable_init();
        __ERC20_init(_name, _symbol);

        _pause();

        _setRouter(_router);
        _setPauseWithdraw(true);
    }

    // **************** Write Functions  ****************
    function stake(address user, uint256 stakeAmount) external payable virtual onlyRouter whenNotPaused {
        _deposit(user, stakeAmount);
    }

    function requestWithdraw(address user, uint256 amount)
        external
        onlyRouter
        whenNotPausedWithdraw
        returns (uint256)
    {
        uint256 totalRequestedAmount = 0;
        for (uint256 i = nextUnclaimedID[user]; i < nextRequestID[user]; i++) {
            totalRequestedAmount += withdrawQueue[user][i].amount;
        }

        require(
            totalRequestedAmount + amount <= _convertToAssets(balanceOf(user), Math.Rounding.Floor), "invalid amount"
        );

        withdrawQueue[user][nextRequestID[user]] =
            WithdrawRequest(amount, _convertToShares(amount, Math.Rounding.Ceil, 0, false), block.timestamp);
        nextRequestID[user] = nextRequestID[user] + 1;

        return nextRequestID[user] - 1;
    }

    function claimWithdraw(address user) external onlyRouter returns (uint256) {
        require(nextRequestID[user] != 0, "No withdraw request found.");
        require(nextRequestID[user] != nextUnclaimedID[user], "No new withdraw request.");

        // TODO: which one is better?
        (uint256 claimableAmount, uint256 claimableShares) = _updateAndCalculateClaimable(user);
        _withdraw(user, _convertToAssets(claimableShares, Math.Rounding.Floor));

        return claimableAmount;
    }

    // ********* Write Internal Functions  ************
    //  https://docs.lido.fi/guides/lido-tokens-integration-guide/#1-2-wei-corner-case
    function _deposit(address user, uint256 amount) internal virtual {
        bool isETH = stakingTokenAddress == address(0);
        uint256 beforeBalance = isETH ? 0 : IERC20(stakingTokenAddress).balanceOf(address(this));

        _tokenTransferIn(user, amount);

        uint256 actualAmount = isETH ? msg.value : IERC20(stakingTokenAddress).balanceOf(address(this)) - beforeBalance;

        uint256 shares = _convertToShares(actualAmount, Math.Rounding.Floor, actualAmount, true);
        require(shares > 0, "invalid deposit amount");
        _mint(user, shares);
    }

    function _withdraw(address user, uint256 amount) internal virtual {
        uint256 shares = _convertToShares(amount, Math.Rounding.Ceil, msg.value, false);
        require(shares <= balanceOf(user), "invalid withdraw request");
        // we do not revert 0 amount withdraw in case user do batch withdraw from multiple pools
        if (amount > 0) {
            _burn(user, shares);
            _tokenTransferOut(user, amount);
        }
    }

    function _tokenTransferIn(address user, uint256 amount) internal virtual {
        require(msg.value == 0, "eth amount should be 0.");

        IERC20(stakingTokenAddress).transferFrom(user, address(this), amount);
    }

    function _tokenTransferOut(address user, uint256 amount) internal virtual {
        IERC20(stakingTokenAddress).transfer(user, amount);
    }

    function _updateAndCalculateClaimable(address user)
        internal
        returns (uint256 claimableAmount, uint256 claimableShares)
    {
        for (uint256 i = nextUnclaimedID[user]; i < nextRequestID[user]; i++) {
            WithdrawRequest storage request = withdrawQueue[user][i];
            if (block.timestamp > request.requestTimeStamp + IORAStakeRouter(stakingPoolRouter).withdrawGracePeriod()) {
                claimableAmount += request.amount;
                claimableShares += request.shares;
                nextUnclaimedID[user] = i + 1;
            } else {
                break;
            }
        }
    }

    function _setRouter(address _router) internal {
        stakingPoolRouter = _router;
    }

    function _setPauseWithdraw(bool pauseWithdrawRq) internal {
        pauseWithdraw = pauseWithdrawRq;
    }

    // **************** Read Functions ******************
    function withdrawStatus(address user) external view returns (uint256 claimableAmount, uint256 pendingAmount) {
        return _withdrawStatusAssets(user);
    }

    function _withdrawStatusAssets(address user)
        internal
        view
        returns (uint256 claimableAmount, uint256 pendingAmount)
    {
        for (uint256 i = nextUnclaimedID[user]; i < nextRequestID[user]; i++) {
            WithdrawRequest storage request = withdrawQueue[user][i];
            if (block.timestamp < request.requestTimeStamp + IORAStakeRouter(stakingPoolRouter).withdrawGracePeriod()) {
                pendingAmount += request.amount;
            } else {
                claimableAmount += request.amount;
            }
        }
    }

    function getWithdrawQueue(address user) external view returns (WithdrawRequest[] memory queue) {
        uint256 requestCount = nextRequestID[user];
        queue = new WithdrawRequest[](requestCount);

        for (uint256 i = 0; i < requestCount; i++) {
            queue[i] = withdrawQueue[user][i];
        }

        return queue;
    }

    function balanceOfAsset(address user) external view virtual returns (uint256) {
        return _convertToAssets(balanceOf(user), Math.Rounding.Floor);
    }

    function totalAssets() public view virtual returns (uint256) {
        return stakingTokenAddress == address(0)
            ? address(this).balance
            : IERC20(stakingTokenAddress).balanceOf(address(this));
    }

    function _decimalsOffset() internal view virtual returns (uint256) {
        return 8;
    }

    /**
     * @dev Internal conversion function (from assets to shares) with support for rounding direction.
     */
    function _convertToShares(uint256 assets, Math.Rounding rounding, uint256 depositedAmount, bool isAlreadyDeposited)
        internal
        view
        returns (uint256)
    {
        uint256 totalAsset = isAlreadyDeposited ? totalAssets() - depositedAmount : totalAssets();
        return assets.mulDiv(totalSupply() + 10 ** _decimalsOffset(), totalAsset + 1, rounding);
    }

    /**
     * @dev Internal conversion function (from shares to assets) with support for rounding direction.
     */
    function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view returns (uint256) {
        return shares.mulDiv(totalAssets() + 1, totalSupply() + 10 ** _decimalsOffset(), rounding);
    }

    // **************** Admin Functions *****************
    function setStakingPoolRouter(address router) external onlyOwner {
        _setRouter(router);
    }

    function setPauseWithdraw(bool pauseWithdrawRq) external onlyOwner {
        _setPauseWithdraw(pauseWithdrawRq);
    }

    function setPermit2Address(address _permit2Address) external onlyOwner {
        permit2Address = _permit2Address;
    }

    function setStakingTokenAddress(address _tokenAddress) external onlyOwner {
        stakingTokenAddress = _tokenAddress;
    }

    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }
}

File 3 of 22 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

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

File 4 of 22 : IERC7641.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import "@openzeppelin-contract/contracts/token/ERC20/IERC20.sol";

/**
 * @dev An interface for ERC-7641, an ERC-20 extension that integrates a revenue-sharing mechanism, ensuring tokens intrinsically represent a share of a communal revenue pool
 */
interface IERC7641 is IERC20 {
    /**
     * @dev A function to calculate the amount of ETH claimable by a token holder at certain snapshot.
     * @param account The address of the token holder
     * @param snapshotId The snapshot id
     * @return claimable The amount of revenue ETH claimable
     */
    function claimableRevenue(address account, uint256 snapshotId) external view returns (uint256);

    /**
     * @dev A function for token holder to claim ETH based on the token balance at certain snapshot.
     * @param snapshotId The snapshot id
     */
    function claim(uint256 snapshotId) external;

    /**
     * @dev A function to snapshot the token balance and the claimable revenue token balance
     * @return snapshotId The snapshot id
     * @notice Should have `require` to avoid ddos attack
     */
    function snapshot() external returns (uint256);

    /**
     * @dev A function to calculate the amount of ETH redeemable by a token holder upon burn
     * @param amount The amount of token to burn
     * @return redeemable The amount of revenue ETH redeemable
     */
    function redeemableOnBurn(uint256 amount) external view returns (uint256);

    /**
     * @dev A function to burn tokens and redeem the corresponding amount of revenue token
     * @param amount The amount of token to burn
     */
    function burn(uint256 amount) external;
}

File 5 of 22 : IERC20Permit.sol
// 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);
}

File 6 of 22 : IORAStakePoolPermit.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IORAStakePoolPermit {
    // **************** Write Functions  ****************
    function stakeWithPermit(
        address user,
        uint256 olmAmount,
        uint256 allowance,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

File 7 of 22 : ORAStakePoolPermit.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {ORAStakePoolBase} from "./ORAStakePoolBase.sol";
import {IORAStakePoolPermit} from "./interfaces/IORAStakePoolPermit.sol";
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";

contract ORAStakePoolPermit is ORAStakePoolBase, IORAStakePoolPermit {
    function stakeWithPermit(
        address user,
        uint256 stETHAmount,
        uint256 allowance,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external onlyRouter whenNotPaused {
        if (IERC20(stakingTokenAddress).allowance(user, address(this)) < stETHAmount) {
            IERC20Permit(stakingTokenAddress).permit(user, address(this), allowance, deadline, v, r, s);
        }
        _deposit(user, stETHAmount);
    }
}

File 8 of 22 : ISwapRouter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

interface ISwapRouter {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    struct ExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 amountOut;
        uint256 amountInMaximum;
        uint160 sqrtPriceLimitX96;
    }

    function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);
}

File 9 of 22 : OwnableUpgradeable.sol
// 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);
    }
}

File 10 of 22 : PausableUpgradeable.sol
// 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());
    }
}

File 11 of 22 : ERC20Upgradeable.sol
// 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);
            }
        }
    }
}

File 12 of 22 : Math.sol
// 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;
    }
}

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

interface IORAStakePool {
    // ******** Structures ************
    struct WithdrawRequest {
        uint256 amount;
        uint256 shares;
        uint256 requestTimeStamp;
    }

    // **************** Write Functions  ****************
    function stake(address user, uint256 amount) external payable;
    function requestWithdraw(address user, uint256 amount) external returns (uint256 requestID);
    function claimWithdraw(address user) external returns (uint256 amount);

    // **************** Read Functions ******************
    function withdrawStatus(address user) external view returns (uint256 claimableAmount, uint256 pendingAmount);
    function totalAssets() external view returns (uint256);
    function balanceOfAsset(address user) external view returns (uint256);
    function getWithdrawQueue(address user) external view returns (WithdrawRequest[] memory queue);

    // **************** Admin Functions *****************
    function setStakingPoolRouter(address router) external;

    // ******** Errors ************
    error InvalidRequestId(uint256 requestId);
    error StakingNotInitiated();
}

File 14 of 22 : IORAStakeRouter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {IORAStakePool} from "./IORAStakePool.sol";
import {IAllowanceTransfer} from "./IAllowanceTransfer.sol";

interface IORAStakeRouter {
    // ******** Structures ************
    struct PoolVault {
        address[] pools;
        uint256 maxTVL;
    }

    // **************** Write Functions  ****************
    function stake(address pool, uint256 amount) external payable;
    function stake(address pool, uint256 amount, uint256 allowance, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
        external;
    function stake(address pool, IAllowanceTransfer.PermitSingle calldata permitSingle, bytes calldata signature)
        external;
    function requestWithdraw(address pool, uint256 amount) external returns (address, uint256 requestId);
    function claimWithdraw(address pool) external;
    function claimWithdraw(address[] calldata pools) external;
    function getVaultCurrentTVL(uint256 vaultID) external returns (uint256);

    // **************** Read Functions ******************
    function withdrawStatus(address pool) external view returns (uint256, uint256);
    function getVaultMaxTVL(uint256 vaultID) external view returns (uint256);
    function getPoolTVL(address pool) external view returns (uint256);
    function getWithdrawQueue(address pool, address user)
        external
        view
        returns (IORAStakePool.WithdrawRequest[] memory);
    function getUserStakeAmount(address user, uint256 vaultID) external view returns (uint256);
    function getUserStakeAmountInPool(address user, address pool) external view returns (uint256 stakeAmount);

    // **************** Admin Functions *****************
    function addVault(address[] calldata pools, uint256 maxTVL) external;
    function updateVault(uint256 vaultID, uint256 maxTVL) external;
    function updatePool(address pool, uint256 vaultID) external;
    function removePool(address pool) external;
    function setPauseWithdraw(bool pauseWithdrawRq) external;
    function updateWithdrawGracePeriod(uint256 _newPeriod) external;
    function withdrawGracePeriod() external view returns (uint256);

    // ******** Events ************
    event NewVault(uint256 indexed vaultID, uint256 maxTVL);
    event Stake(address indexed user, uint256 indexed amount, uint256 vaultId, address pool);
    event RequestWithdraw(address indexed user, uint256 amount, uint256 requestID, address pool);
    event ClaimWithdraw(address indexed user, uint256 indexed amount, uint256 vaultId, address pool);

    // ******** Errors ************
    error ExceedingTVL();
}

File 15 of 22 : IERC20.sol
// 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);
}

File 16 of 22 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @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 amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 17 of 22 : ContextUpgradeable.sol
// 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;
    }
}

File 18 of 22 : Initializable.sol
// 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
        }
    }
}

File 19 of 22 : IERC20Metadata.sol
// 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);
}

File 20 of 22 : draft-IERC6093.sol
// 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);
}

File 21 of 22 : IAllowanceTransfer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

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

/// @title AllowanceTransfer
/// @notice Handles ERC20 token permissions through signature based allowance setting and ERC20 token transfers by checking allowed amounts
/// @dev Requires user's token approval on the Permit2 contract
interface IAllowanceTransfer is IEIP712 {
    /// @notice Thrown when an allowance on a token has expired.
    /// @param deadline The timestamp at which the allowed amount is no longer valid
    error AllowanceExpired(uint256 deadline);

    /// @notice Thrown when an allowance on a token has been depleted.
    /// @param amount The maximum amount allowed
    error InsufficientAllowance(uint256 amount);

    /// @notice Thrown when too many nonces are invalidated.
    error ExcessiveInvalidation();

    /// @notice Emits an event when the owner successfully invalidates an ordered nonce.
    event NonceInvalidation(
        address indexed owner, address indexed token, address indexed spender, uint48 newNonce, uint48 oldNonce
    );

    /// @notice Emits an event when the owner successfully sets permissions on a token for the spender.
    event Approval(
        address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration
    );

    /// @notice Emits an event when the owner successfully sets permissions using a permit signature on a token for the spender.
    event Permit(
        address indexed owner,
        address indexed token,
        address indexed spender,
        uint160 amount,
        uint48 expiration,
        uint48 nonce
    );

    /// @notice Emits an event when the owner sets the allowance back to 0 with the lockdown function.
    event Lockdown(address indexed owner, address token, address spender);

    /// @notice The permit data for a token
    struct PermitDetails {
        // ERC20 token address
        address token;
        // the maximum amount allowed to spend
        uint160 amount;
        // timestamp at which a spender's token allowances become invalid
        uint48 expiration;
        // an incrementing value indexed per owner,token,and spender for each signature
        uint48 nonce;
    }

    /// @notice The permit message signed for a single token allowance
    struct PermitSingle {
        // the permit data for a single token alownce
        PermitDetails details;
        // address permissioned on the allowed tokens
        address spender;
        // deadline on the permit signature
        uint256 sigDeadline;
    }

    /// @notice The permit message signed for multiple token allowances
    struct PermitBatch {
        // the permit data for multiple token allowances
        PermitDetails[] details;
        // address permissioned on the allowed tokens
        address spender;
        // deadline on the permit signature
        uint256 sigDeadline;
    }

    /// @notice The saved permissions
    /// @dev This info is saved per owner, per token, per spender and all signed over in the permit message
    /// @dev Setting amount to type(uint160).max sets an unlimited approval
    struct PackedAllowance {
        // amount allowed
        uint160 amount;
        // permission expiry
        uint48 expiration;
        // an incrementing value indexed per owner,token,and spender for each signature
        uint48 nonce;
    }

    /// @notice A token spender pair.
    struct TokenSpenderPair {
        // the token the spender is approved
        address token;
        // the spender address
        address spender;
    }

    /// @notice Details for a token transfer.
    struct AllowanceTransferDetails {
        // the owner of the token
        address from;
        // the recipient of the token
        address to;
        // the amount of the token
        uint160 amount;
        // the token to be transferred
        address token;
    }

    /// @notice A mapping from owner address to token address to spender address to PackedAllowance struct, which contains details and conditions of the approval.
    /// @notice The mapping is indexed in the above order see: allowance[ownerAddress][tokenAddress][spenderAddress]
    /// @dev The packed slot holds the allowed amount, expiration at which the allowed amount is no longer valid, and current nonce thats updated on any signature based approvals.
    function allowance(address user, address token, address spender)
        external
        view
        returns (uint160 amount, uint48 expiration, uint48 nonce);

    /// @notice Approves the spender to use up to amount of the specified token up until the expiration
    /// @param token The token to approve
    /// @param spender The spender address to approve
    /// @param amount The approved amount of the token
    /// @param expiration The timestamp at which the approval is no longer valid
    /// @dev The packed allowance also holds a nonce, which will stay unchanged in approve
    /// @dev Setting amount to type(uint160).max sets an unlimited approval
    function approve(address token, address spender, uint160 amount, uint48 expiration) external;

    /// @notice Permit a spender to a given amount of the owners token via the owner's EIP-712 signature
    /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce
    /// @param owner The owner of the tokens being approved
    /// @param permitSingle Data signed over by the owner specifying the terms of approval
    /// @param signature The owner's signature over the permit data
    function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external;

    /// @notice Permit a spender to the signed amounts of the owners tokens via the owner's EIP-712 signature
    /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce
    /// @param owner The owner of the tokens being approved
    /// @param permitBatch Data signed over by the owner specifying the terms of approval
    /// @param signature The owner's signature over the permit data
    function permit(address owner, PermitBatch memory permitBatch, bytes calldata signature) external;

    /// @notice Transfer approved tokens from one address to another
    /// @param from The address to transfer from
    /// @param to The address of the recipient
    /// @param amount The amount of the token to transfer
    /// @param token The token address to transfer
    /// @dev Requires the from address to have approved at least the desired amount
    /// of tokens to msg.sender.
    function transferFrom(address from, address to, uint160 amount, address token) external;

    /// @notice Transfer approved tokens in a batch
    /// @param transferDetails Array of owners, recipients, amounts, and tokens for the transfers
    /// @dev Requires the from addresses to have approved at least the desired amount
    /// of tokens to msg.sender.
    function transferFrom(AllowanceTransferDetails[] calldata transferDetails) external;

    /// @notice Enables performing a "lockdown" of the sender's Permit2 identity
    /// by batch revoking approvals
    /// @param approvals Array of approvals to revoke.
    function lockdown(TokenSpenderPair[] calldata approvals) external;

    /// @notice Invalidate nonces for a given (token, spender) pair
    /// @param token The token to invalidate nonces for
    /// @param spender The spender to invalidate nonces for
    /// @param newNonce The new nonce to set. Invalidates all nonces less than it.
    /// @dev Can't invalidate more than 2**16 nonces per transaction.
    function invalidateNonces(address token, address spender, uint48 newNonce) external;
}

File 22 of 22 : IEIP712.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

interface IEIP712 {
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

Settings
{
  "remappings": [
    "@openzeppelin-contract/contracts/=lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"}],"name":"InvalidRequestId","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"StakingNotInitiated","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"balanceOfAsset","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"claimWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getWithdrawQueue","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"requestTimeStamp","type":"uint256"}],"internalType":"struct IORAStakePool.WithdrawRequest[]","name":"queue","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nextUnclaimedID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pauseWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"permit2Address","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"snapshotId","type":"uint256"}],"name":"poolRevenueClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"snapshotId","type":"uint256"},{"internalType":"uint256","name":"amountoutMin","type":"uint256"}],"name":"poolRevenueClaimAndConvert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountoutMin","type":"uint256"}],"name":"poolRevenueConvert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"requestWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"pauseWithdrawRq","type":"bool"}],"name":"setPauseWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_permit2Address","type":"address"}],"name":"setPermit2Address","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"router","type":"address"}],"name":"setStakingPoolRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"name":"setStakingTokenAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"}],"name":"setSwapRouterAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_WETH","type":"address"}],"name":"setWETHAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"stakeAmount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"stETHAmount","type":"uint256"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"stakeWithPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingPoolRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"withdrawStatus","outputs":[{"internalType":"uint256","name":"claimableAmount","type":"uint256"},{"internalType":"uint256","name":"pendingAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b506200001c62000022565b620000d6565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620000735760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620000d35780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b61287980620000e66000396000f3fe6080604052600436106102295760003560e01c806365960fe2116101235780639abaef77116100ab578063c52249831161006f578063c52249831461069d578063dd62ed3e146106bd578063df01febc146106dd578063f2fde38b14610712578063fcff8e9d1461073257600080fd5b80639abaef771461060a578063a154f1bb1461062a578063a9059cbb1461064a578063adc9772e1461066a578063c1d899411461067d57600080fd5b80638456cb59116100f25780638456cb5914610563578063892a810a146105785780638da5cb5b1461059857806395d89b41146105d557806398378485146105ea57600080fd5b806365960fe2146104ee5780636a4234eb1461050e57806370a082311461052e578063715018a61461054e57600080fd5b806323b872dd116101b1578063516c49d911610175578063516c49d9146104305780635249961b146104505780635298b869146104705780635c975abb146104a85780636155e3de146104cd57600080fd5b806323b872dd1461039f57806325c89156146103bf578063313ce567146103df578063397a1b28146103fb5780633f4ba83a1461041b57600080fd5b806311cfd210116101f857806311cfd210146102d1578063124d0d01146102f1578063132cc7a71461031e57806318160ddd1461034b5780632016a0d21461037f57600080fd5b8063016271021461023557806301e1d1141461025757806306fdde031461027f578063095ea7b3146102a157600080fd5b3661023057005b600080fd5b34801561024157600080fd5b50610255610250366004612149565b610752565b005b34801561026357600080fd5b5061026c61084e565b6040519081526020015b60405180910390f35b34801561028b57600080fd5b506102946108d8565b6040516102769190612162565b3480156102ad57600080fd5b506102c16102bc3660046121c8565b61099b565b6040519015158152602001610276565b3480156102dd57600080fd5b506102556102ec3660046121f2565b6109b5565b3480156102fd57600080fd5b5061026c61030c36600461225e565b60056020526000908152604090205481565b34801561032a57600080fd5b5061033e61033936600461225e565b610b08565b6040516102769190612279565b34801561035757600080fd5b507f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace025461026c565b34801561038b57600080fd5b5061025561039a366004612375565b610c15565b3480156103ab57600080fd5b506102c16103ba3660046123fa565b610d55565b3480156103cb57600080fd5b506102556103da36600461225e565b610d7b565b3480156103eb57600080fd5b5060405160128152602001610276565b34801561040757600080fd5b5061026c6104163660046121c8565b610d8f565b34801561042757600080fd5b50610255610f8a565b34801561043c57600080fd5b5061026c61044b36600461225e565b610f9c565b34801561045c57600080fd5b5061025561046b36600461225e565b6110cd565b34801561047c57600080fd5b50600254610490906001600160a01b031681565b6040516001600160a01b039091168152602001610276565b3480156104b457600080fd5b506000805160206128248339815191525460ff166102c1565b3480156104d957600080fd5b506002546102c190600160a01b900460ff1681565b3480156104fa57600080fd5b50610255610509366004612149565b6110f7565b34801561051a57600080fd5b5061025561052936600461225e565b611158565b34801561053a57600080fd5b5061026c61054936600461225e565b611182565b34801561055a57600080fd5b506102556111aa565b34801561056f57600080fd5b506102556111bc565b34801561058457600080fd5b50600054610490906001600160a01b031681565b3480156105a457600080fd5b507f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b0316610490565b3480156105e157600080fd5b506102946111cc565b3480156105f657600080fd5b5061025561060536600461225e565b61120b565b34801561061657600080fd5b50610255610625366004612436565b611235565b34801561063657600080fd5b5061025561064536600461225e565b61124b565b34801561065657600080fd5b506102c16106653660046121c8565b611275565b6102556106783660046121c8565b611283565b34801561068957600080fd5b5061026c61069836600461225e565b6112bf565b3480156106a957600080fd5b50600154610490906001600160a01b031681565b3480156106c957600080fd5b5061026c6106d8366004612458565b6112cd565b3480156106e957600080fd5b506106fd6106f836600461225e565b611317565b60408051928352602083019190915201610276565b34801561071e57600080fd5b5061025561072d36600461225e565b61132c565b34801561073e57600080fd5b5061025561074d366004612499565b611367565b61075a611378565b6040805160e0810182526006546001600160a01b039081168252600254811660208301908152610bb88385019081523060608501908152476080860181815260a08701898152600060c0890190815260075499516304e45aaf60e01b8152895189166004820152965188166024880152945162ffffff166044870152925186166064860152516084850152905160a48401529051831660c483015293909116906304e45aaf90849060e40160206040518083038185885af1158015610823573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061084891906124b6565b50505050565b6002546000906001600160a01b0316156108d3576002546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156108aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ce91906124b6565b905090565b504790565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace03805460609160008051602061280483398151915291610917906124cf565b80601f0160208091040260200160405190810160405280929190818152602001828054610943906124cf565b80156109905780601f1061096557610100808354040283529160200191610990565b820191906000526020600020905b81548152906001019060200180831161097357829003601f168201915b505050505091505090565b6000336109a98185856113d3565b60019150505b92915050565b6000546001600160a01b031633146109e85760405162461bcd60e51b81526004016109df90612509565b60405180910390fd5b6109f06113e5565b600254604051636eb1769f60e11b81526001600160a01b0389811660048301523060248301528892169063dd62ed3e90604401602060405180830381865afa158015610a40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6491906124b6565b1015610af55760025460405163d505accf60e01b81526001600160a01b038981166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c482018490529091169063d505accf9060e401600060405180830381600087803b158015610adc57600080fd5b505af1158015610af0573d6000803e3d6000fd5b505050505b610aff8787611416565b50505050505050565b6001600160a01b0381166000908152600460205260409020546060908067ffffffffffffffff811115610b3d57610b3d6122d2565b604051908082528060200260200182016040528015610b9257816020015b610b7f60405180606001604052806000815260200160008152602001600081525090565b815260200190600190039081610b5b5790505b50915060005b81811015610c0e576001600160a01b038416600090815260036020908152604080832084845282529182902082516060810184528154815260018201549281019290925260020154918101919091528351849083908110610bfb57610bfb612540565b6020908102919091010152600101610b98565b5050919050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff16600081158015610c5b5750825b905060008267ffffffffffffffff166001148015610c785750303b155b905081158015610c86575080155b15610ca45760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610cce57845460ff60401b1916600160401b1785555b610cd78861159d565b610cdf6115ae565b610ce987876115be565b610cf16115d0565b610cfa89611633565b610d046001611655565b8315610d4a57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050505050565b600033610d63858285611673565b610d6e8585856116d3565b60019150505b9392505050565b610d83611378565b610d8c81611633565b50565b600080546001600160a01b03163314610dba5760405162461bcd60e51b81526004016109df90612509565b600254600160a01b900460ff1615610e0a5760405162461bcd60e51b81526020600482015260136024820152723bb4ba34323930bb9034b9903830bab9b2b21760691b60448201526064016109df565b6001600160a01b0383166000908152600560205260408120545b6001600160a01b038516600090815260046020526040902054811015610e7c576001600160a01b0385166000908152600360209081526040808320848452909152902054610e72908361256c565b9150600101610e24565b50610e90610e8985611182565b6000611732565b610e9a848361256c565b1115610ed95760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a5908185b5bdd5b9d60921b60448201526064016109df565b6040518060600160405280848152602001610ef885600160008061178b565b8152426020918201526001600160a01b0386166000818152600383526040808220600480865282842080548552918652828420875181558787015160018083019190915597909301516002909301929092559290915290915254610f5b9161256c565b6001600160a01b0385166000908152600460205260409020819055610f829060019061257f565b949350505050565b610f92611378565b610f9a61180e565b565b600080546001600160a01b03163314610fc75760405162461bcd60e51b81526004016109df90612509565b6001600160a01b038216600090815260046020526040812054900361102e5760405162461bcd60e51b815260206004820152601a60248201527f4e6f207769746864726177207265717565737420666f756e642e00000000000060448201526064016109df565b6001600160a01b038216600090815260056020908152604080832054600490925290912054036110a05760405162461bcd60e51b815260206004820152601860248201527f4e6f206e657720776974686472617720726571756573742e000000000000000060448201526064016109df565b6000806110ac84611854565b915091506110c4846110bf836000611732565b611988565b5090505b919050565b6110d5611378565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60025460405163379607f560e01b8152600481018390526001600160a01b039091169063379607f590602401600060405180830381600087803b15801561113d57600080fd5b505af1158015611151573d6000803e3d6000fd5b5050505050565b611160611378565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03166000908152600080516020612804833981519152602052604090205490565b6111b2611378565b610f9a6000611a0c565b6111c4611378565b610f9a6115d0565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace04805460609160008051602061280483398151915291610917906124cf565b611213611378565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b61123e826110f7565b61124781610752565b5050565b611253611378565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000336109a98185856116d3565b6000546001600160a01b031633146112ad5760405162461bcd60e51b81526004016109df90612509565b6112b56113e5565b6112478282611416565b60006109af610e8983611182565b6001600160a01b0391821660009081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace016020908152604080832093909416825291909152205490565b60008061132383611a7d565b91509150915091565b611334611378565b6001600160a01b03811661135e57604051631e4fbdf760e01b8152600060048201526024016109df565b610d8c81611a0c565b61136f611378565b610d8c81611655565b336113aa7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b031614610f9a5760405163118cdaa760e01b81523360048201526024016109df565b6113e08383836001611b7e565b505050565b6000805160206128248339815191525460ff1615610f9a5760405163d93c066560e01b815260040160405180910390fd5b6002546001600160a01b03161560008161149b576002546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611472573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149691906124b6565b61149e565b60005b90506114aa8484611c65565b60008261152c576002546040516370a0823160e01b815230600482015283916001600160a01b0316906370a0823190602401602060405180830381865afa1580156114f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151d91906124b6565b611527919061257f565b61152e565b345b9050600061154082600084600161178b565b90506000811161158b5760405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a590819195c1bdcda5d08185b5bdd5b9d60521b60448201526064016109df565b6115958682611d31565b505050505050565b6115a5611d67565b610d8c81611db0565b6115b6611d67565b610f9a611db8565b6115c6611d67565b6112478282611dd9565b6115d86113e5565b600080516020612824833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258335b6040516001600160a01b03909116815260200160405180910390a150565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60028054911515600160a01b0260ff60a01b19909216919091179055565b600061167f84846112cd565b9050600019811461084857818110156116c457604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064016109df565b61084884848484036000611b7e565b6001600160a01b0383166116fd57604051634b637e8f60e11b8152600060048201526024016109df565b6001600160a01b0382166117275760405163ec442f0560e01b8152600060048201526024016109df565b6113e0838383611e2a565b6000610d7461173f61084e565b61174a90600161256c565b6117566008600a612676565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0254611782919061256c565b85919085611f68565b600080826117a05761179b61084e565b6117b3565b836117a961084e565b6117b3919061257f565b90506118046117c46008600a612676565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace02546117f0919061256c565b6117fb83600161256c565b88919088611f68565b9695505050505050565b611816611fb9565b600080516020612824833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611615565b6001600160a01b03811660009081526005602052604081205481905b6001600160a01b038416600090815260046020526040902054811015611982576001600160a01b038085166000908152600360209081526040808320858452825280832092548151632c00b8ef60e21b815291519394169263b002e3bc926004808401939192918290030181865afa1580156118f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191491906124b6565b8160020154611923919061256c565b421115611973578054611936908561256c565b9350806001015483611948919061256c565b925061195582600161256c565b6001600160a01b038616600090815260056020526040902055611979565b50611982565b50600101611870565b50915091565b600061199882600134600061178b565b90506119a383611182565b8111156119f25760405162461bcd60e51b815260206004820152601860248201527f696e76616c69642077697468647261772072657175657374000000000000000060448201526064016109df565b81156113e057611a028382611fe9565b6113e0838361201f565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b6001600160a01b03811660009081526005602052604081205481905b6001600160a01b038416600090815260046020526040902054811015611982576001600160a01b038085166000908152600360209081526040808320858452825280832092548151632c00b8ef60e21b815291519394169263b002e3bc926004808401939192918290030181865afa158015611b19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b3d91906124b6565b8160020154611b4c919061256c565b421015611b66578054611b5f908461256c565b9250611b75565b8054611b72908561256c565b93505b50600101611a99565b6000805160206128048339815191526001600160a01b038516611bb75760405163e602df0560e01b8152600060048201526024016109df565b6001600160a01b038416611be157604051634a1406b160e11b8152600060048201526024016109df565b6001600160a01b0380861660009081526001830160209081526040808320938816835292905220839055811561115157836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051611c5691815260200190565b60405180910390a35050505050565b3415611cb35760405162461bcd60e51b815260206004820152601760248201527f65746820616d6f756e742073686f756c6420626520302e00000000000000000060448201526064016109df565b6002546040516323b872dd60e01b81526001600160a01b03848116600483015230602483015260448201849052909116906323b872dd906064015b6020604051808303816000875af1158015611d0d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e09190612682565b6001600160a01b038216611d5b5760405163ec442f0560e01b8152600060048201526024016109df565b61124760008383611e2a565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610f9a57604051631afcd79f60e31b815260040160405180910390fd5b611334611d67565b611dc0611d67565b600080516020612824833981519152805460ff19169055565b611de1611d67565b6000805160206128048339815191527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace03611e1b84826126e7565b506004810161084883826126e7565b6000805160206128048339815191526001600160a01b038416611e665781816002016000828254611e5b919061256c565b90915550611ed89050565b6001600160a01b03841660009081526020829052604090205482811015611eb95760405163391434e360e21b81526001600160a01b038616600482015260248101829052604481018490526064016109df565b6001600160a01b03851660009081526020839052604090209083900390555b6001600160a01b038316611ef6576002810180548390039055611f15565b6001600160a01b03831660009081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611f5a91815260200190565b60405180910390a350505050565b600080611f76868686612058565b9050611f818361211c565b8015611f9d575060008480611f9857611f986127a7565b868809115b15611fb057611fad60018261256c565b90505b95945050505050565b6000805160206128248339815191525460ff16610f9a57604051638dfc202b60e01b815260040160405180910390fd5b6001600160a01b03821661201357604051634b637e8f60e11b8152600060048201526024016109df565b61124782600083611e2a565b60025460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb90604401611cee565b600083830281600019858709828110838203039150508060000361208f57838281612085576120856127a7565b0492505050610d74565b8084116120af5760405163227bc15360e01b815260040160405180910390fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b60006002826003811115612132576121326127bd565b61213c91906127d3565b60ff166001149050919050565b60006020828403121561215b57600080fd5b5035919050565b60006020808352835180602085015260005b8181101561219057858101830151858201604001528201612174565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146110c857600080fd5b600080604083850312156121db57600080fd5b6121e4836121b1565b946020939093013593505050565b600080600080600080600060e0888a03121561220d57600080fd5b612216886121b1565b9650602088013595506040880135945060608801359350608088013560ff8116811461224157600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60006020828403121561227057600080fd5b610d74826121b1565b602080825282518282018190526000919060409081850190868401855b828110156122c55781518051855286810151878601528501518585015260609093019290850190600101612296565b5091979650505050505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126122f957600080fd5b813567ffffffffffffffff80821115612314576123146122d2565b604051601f8301601f19908116603f0116810190828211818310171561233c5761233c6122d2565b8160405283815286602085880101111561235557600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561238b57600080fd5b612394856121b1565b93506123a2602086016121b1565b9250604085013567ffffffffffffffff808211156123bf57600080fd5b6123cb888389016122e8565b935060608701359150808211156123e157600080fd5b506123ee878288016122e8565b91505092959194509250565b60008060006060848603121561240f57600080fd5b612418846121b1565b9250612426602085016121b1565b9150604084013590509250925092565b6000806040838503121561244957600080fd5b50508035926020909101359150565b6000806040838503121561246b57600080fd5b612474836121b1565b9150612482602084016121b1565b90509250929050565b8015158114610d8c57600080fd5b6000602082840312156124ab57600080fd5b8135610d748161248b565b6000602082840312156124c857600080fd5b5051919050565b600181811c908216806124e357607f821691505b60208210810361250357634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601a908201527f4861766520746f20696e766f6b652066726f6d20726f75746572000000000000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156109af576109af612556565b818103818111156109af576109af612556565b600181815b808511156125cd5781600019048211156125b3576125b3612556565b808516156125c057918102915b93841c9390800290612597565b509250929050565b6000826125e4575060016109af565b816125f1575060006109af565b816001811461260757600281146126115761262d565b60019150506109af565b60ff84111561262257612622612556565b50506001821b6109af565b5060208310610133831016604e8410600b8410161715612650575081810a6109af565b61265a8383612592565b806000190482111561266e5761266e612556565b029392505050565b6000610d7483836125d5565b60006020828403121561269457600080fd5b8151610d748161248b565b601f8211156113e0576000816000526020600020601f850160051c810160208610156126c85750805b601f850160051c820191505b81811015611595578281556001016126d4565b815167ffffffffffffffff811115612701576127016122d2565b6127158161270f84546124cf565b8461269f565b602080601f83116001811461274a57600084156127325750858301515b600019600386901b1c1916600185901b178555611595565b600085815260208120601f198616915b828110156127795788860151825594840194600190910190840161275a565b50858210156127975787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b600060ff8316806127f457634e487b7160e01b600052601260045260246000fd5b8060ff8416069150509291505056fe52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300a2646970667358221220ff0f379577e77ddb39d04f8fea00358c6cad9aab4dd28c827862ad35ec4fa57264736f6c63430008180033

Deployed Bytecode

0x6080604052600436106102295760003560e01c806365960fe2116101235780639abaef77116100ab578063c52249831161006f578063c52249831461069d578063dd62ed3e146106bd578063df01febc146106dd578063f2fde38b14610712578063fcff8e9d1461073257600080fd5b80639abaef771461060a578063a154f1bb1461062a578063a9059cbb1461064a578063adc9772e1461066a578063c1d899411461067d57600080fd5b80638456cb59116100f25780638456cb5914610563578063892a810a146105785780638da5cb5b1461059857806395d89b41146105d557806398378485146105ea57600080fd5b806365960fe2146104ee5780636a4234eb1461050e57806370a082311461052e578063715018a61461054e57600080fd5b806323b872dd116101b1578063516c49d911610175578063516c49d9146104305780635249961b146104505780635298b869146104705780635c975abb146104a85780636155e3de146104cd57600080fd5b806323b872dd1461039f57806325c89156146103bf578063313ce567146103df578063397a1b28146103fb5780633f4ba83a1461041b57600080fd5b806311cfd210116101f857806311cfd210146102d1578063124d0d01146102f1578063132cc7a71461031e57806318160ddd1461034b5780632016a0d21461037f57600080fd5b8063016271021461023557806301e1d1141461025757806306fdde031461027f578063095ea7b3146102a157600080fd5b3661023057005b600080fd5b34801561024157600080fd5b50610255610250366004612149565b610752565b005b34801561026357600080fd5b5061026c61084e565b6040519081526020015b60405180910390f35b34801561028b57600080fd5b506102946108d8565b6040516102769190612162565b3480156102ad57600080fd5b506102c16102bc3660046121c8565b61099b565b6040519015158152602001610276565b3480156102dd57600080fd5b506102556102ec3660046121f2565b6109b5565b3480156102fd57600080fd5b5061026c61030c36600461225e565b60056020526000908152604090205481565b34801561032a57600080fd5b5061033e61033936600461225e565b610b08565b6040516102769190612279565b34801561035757600080fd5b507f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace025461026c565b34801561038b57600080fd5b5061025561039a366004612375565b610c15565b3480156103ab57600080fd5b506102c16103ba3660046123fa565b610d55565b3480156103cb57600080fd5b506102556103da36600461225e565b610d7b565b3480156103eb57600080fd5b5060405160128152602001610276565b34801561040757600080fd5b5061026c6104163660046121c8565b610d8f565b34801561042757600080fd5b50610255610f8a565b34801561043c57600080fd5b5061026c61044b36600461225e565b610f9c565b34801561045c57600080fd5b5061025561046b36600461225e565b6110cd565b34801561047c57600080fd5b50600254610490906001600160a01b031681565b6040516001600160a01b039091168152602001610276565b3480156104b457600080fd5b506000805160206128248339815191525460ff166102c1565b3480156104d957600080fd5b506002546102c190600160a01b900460ff1681565b3480156104fa57600080fd5b50610255610509366004612149565b6110f7565b34801561051a57600080fd5b5061025561052936600461225e565b611158565b34801561053a57600080fd5b5061026c61054936600461225e565b611182565b34801561055a57600080fd5b506102556111aa565b34801561056f57600080fd5b506102556111bc565b34801561058457600080fd5b50600054610490906001600160a01b031681565b3480156105a457600080fd5b507f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b0316610490565b3480156105e157600080fd5b506102946111cc565b3480156105f657600080fd5b5061025561060536600461225e565b61120b565b34801561061657600080fd5b50610255610625366004612436565b611235565b34801561063657600080fd5b5061025561064536600461225e565b61124b565b34801561065657600080fd5b506102c16106653660046121c8565b611275565b6102556106783660046121c8565b611283565b34801561068957600080fd5b5061026c61069836600461225e565b6112bf565b3480156106a957600080fd5b50600154610490906001600160a01b031681565b3480156106c957600080fd5b5061026c6106d8366004612458565b6112cd565b3480156106e957600080fd5b506106fd6106f836600461225e565b611317565b60408051928352602083019190915201610276565b34801561071e57600080fd5b5061025561072d36600461225e565b61132c565b34801561073e57600080fd5b5061025561074d366004612499565b611367565b61075a611378565b6040805160e0810182526006546001600160a01b039081168252600254811660208301908152610bb88385019081523060608501908152476080860181815260a08701898152600060c0890190815260075499516304e45aaf60e01b8152895189166004820152965188166024880152945162ffffff166044870152925186166064860152516084850152905160a48401529051831660c483015293909116906304e45aaf90849060e40160206040518083038185885af1158015610823573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061084891906124b6565b50505050565b6002546000906001600160a01b0316156108d3576002546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156108aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ce91906124b6565b905090565b504790565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace03805460609160008051602061280483398151915291610917906124cf565b80601f0160208091040260200160405190810160405280929190818152602001828054610943906124cf565b80156109905780601f1061096557610100808354040283529160200191610990565b820191906000526020600020905b81548152906001019060200180831161097357829003601f168201915b505050505091505090565b6000336109a98185856113d3565b60019150505b92915050565b6000546001600160a01b031633146109e85760405162461bcd60e51b81526004016109df90612509565b60405180910390fd5b6109f06113e5565b600254604051636eb1769f60e11b81526001600160a01b0389811660048301523060248301528892169063dd62ed3e90604401602060405180830381865afa158015610a40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6491906124b6565b1015610af55760025460405163d505accf60e01b81526001600160a01b038981166004830152306024830152604482018890526064820187905260ff8616608483015260a4820185905260c482018490529091169063d505accf9060e401600060405180830381600087803b158015610adc57600080fd5b505af1158015610af0573d6000803e3d6000fd5b505050505b610aff8787611416565b50505050505050565b6001600160a01b0381166000908152600460205260409020546060908067ffffffffffffffff811115610b3d57610b3d6122d2565b604051908082528060200260200182016040528015610b9257816020015b610b7f60405180606001604052806000815260200160008152602001600081525090565b815260200190600190039081610b5b5790505b50915060005b81811015610c0e576001600160a01b038416600090815260036020908152604080832084845282529182902082516060810184528154815260018201549281019290925260020154918101919091528351849083908110610bfb57610bfb612540565b6020908102919091010152600101610b98565b5050919050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff16600081158015610c5b5750825b905060008267ffffffffffffffff166001148015610c785750303b155b905081158015610c86575080155b15610ca45760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610cce57845460ff60401b1916600160401b1785555b610cd78861159d565b610cdf6115ae565b610ce987876115be565b610cf16115d0565b610cfa89611633565b610d046001611655565b8315610d4a57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050505050565b600033610d63858285611673565b610d6e8585856116d3565b60019150505b9392505050565b610d83611378565b610d8c81611633565b50565b600080546001600160a01b03163314610dba5760405162461bcd60e51b81526004016109df90612509565b600254600160a01b900460ff1615610e0a5760405162461bcd60e51b81526020600482015260136024820152723bb4ba34323930bb9034b9903830bab9b2b21760691b60448201526064016109df565b6001600160a01b0383166000908152600560205260408120545b6001600160a01b038516600090815260046020526040902054811015610e7c576001600160a01b0385166000908152600360209081526040808320848452909152902054610e72908361256c565b9150600101610e24565b50610e90610e8985611182565b6000611732565b610e9a848361256c565b1115610ed95760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a5908185b5bdd5b9d60921b60448201526064016109df565b6040518060600160405280848152602001610ef885600160008061178b565b8152426020918201526001600160a01b0386166000818152600383526040808220600480865282842080548552918652828420875181558787015160018083019190915597909301516002909301929092559290915290915254610f5b9161256c565b6001600160a01b0385166000908152600460205260409020819055610f829060019061257f565b949350505050565b610f92611378565b610f9a61180e565b565b600080546001600160a01b03163314610fc75760405162461bcd60e51b81526004016109df90612509565b6001600160a01b038216600090815260046020526040812054900361102e5760405162461bcd60e51b815260206004820152601a60248201527f4e6f207769746864726177207265717565737420666f756e642e00000000000060448201526064016109df565b6001600160a01b038216600090815260056020908152604080832054600490925290912054036110a05760405162461bcd60e51b815260206004820152601860248201527f4e6f206e657720776974686472617720726571756573742e000000000000000060448201526064016109df565b6000806110ac84611854565b915091506110c4846110bf836000611732565b611988565b5090505b919050565b6110d5611378565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60025460405163379607f560e01b8152600481018390526001600160a01b039091169063379607f590602401600060405180830381600087803b15801561113d57600080fd5b505af1158015611151573d6000803e3d6000fd5b5050505050565b611160611378565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03166000908152600080516020612804833981519152602052604090205490565b6111b2611378565b610f9a6000611a0c565b6111c4611378565b610f9a6115d0565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace04805460609160008051602061280483398151915291610917906124cf565b611213611378565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b61123e826110f7565b61124781610752565b5050565b611253611378565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000336109a98185856116d3565b6000546001600160a01b031633146112ad5760405162461bcd60e51b81526004016109df90612509565b6112b56113e5565b6112478282611416565b60006109af610e8983611182565b6001600160a01b0391821660009081527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace016020908152604080832093909416825291909152205490565b60008061132383611a7d565b91509150915091565b611334611378565b6001600160a01b03811661135e57604051631e4fbdf760e01b8152600060048201526024016109df565b610d8c81611a0c565b61136f611378565b610d8c81611655565b336113aa7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b031614610f9a5760405163118cdaa760e01b81523360048201526024016109df565b6113e08383836001611b7e565b505050565b6000805160206128248339815191525460ff1615610f9a5760405163d93c066560e01b815260040160405180910390fd5b6002546001600160a01b03161560008161149b576002546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611472573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061149691906124b6565b61149e565b60005b90506114aa8484611c65565b60008261152c576002546040516370a0823160e01b815230600482015283916001600160a01b0316906370a0823190602401602060405180830381865afa1580156114f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151d91906124b6565b611527919061257f565b61152e565b345b9050600061154082600084600161178b565b90506000811161158b5760405162461bcd60e51b81526020600482015260166024820152751a5b9d985b1a590819195c1bdcda5d08185b5bdd5b9d60521b60448201526064016109df565b6115958682611d31565b505050505050565b6115a5611d67565b610d8c81611db0565b6115b6611d67565b610f9a611db8565b6115c6611d67565b6112478282611dd9565b6115d86113e5565b600080516020612824833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258335b6040516001600160a01b03909116815260200160405180910390a150565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b60028054911515600160a01b0260ff60a01b19909216919091179055565b600061167f84846112cd565b9050600019811461084857818110156116c457604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064016109df565b61084884848484036000611b7e565b6001600160a01b0383166116fd57604051634b637e8f60e11b8152600060048201526024016109df565b6001600160a01b0382166117275760405163ec442f0560e01b8152600060048201526024016109df565b6113e0838383611e2a565b6000610d7461173f61084e565b61174a90600161256c565b6117566008600a612676565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace0254611782919061256c565b85919085611f68565b600080826117a05761179b61084e565b6117b3565b836117a961084e565b6117b3919061257f565b90506118046117c46008600a612676565b7f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace02546117f0919061256c565b6117fb83600161256c565b88919088611f68565b9695505050505050565b611816611fb9565b600080516020612824833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611615565b6001600160a01b03811660009081526005602052604081205481905b6001600160a01b038416600090815260046020526040902054811015611982576001600160a01b038085166000908152600360209081526040808320858452825280832092548151632c00b8ef60e21b815291519394169263b002e3bc926004808401939192918290030181865afa1580156118f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191491906124b6565b8160020154611923919061256c565b421115611973578054611936908561256c565b9350806001015483611948919061256c565b925061195582600161256c565b6001600160a01b038616600090815260056020526040902055611979565b50611982565b50600101611870565b50915091565b600061199882600134600061178b565b90506119a383611182565b8111156119f25760405162461bcd60e51b815260206004820152601860248201527f696e76616c69642077697468647261772072657175657374000000000000000060448201526064016109df565b81156113e057611a028382611fe9565b6113e0838361201f565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b6001600160a01b03811660009081526005602052604081205481905b6001600160a01b038416600090815260046020526040902054811015611982576001600160a01b038085166000908152600360209081526040808320858452825280832092548151632c00b8ef60e21b815291519394169263b002e3bc926004808401939192918290030181865afa158015611b19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b3d91906124b6565b8160020154611b4c919061256c565b421015611b66578054611b5f908461256c565b9250611b75565b8054611b72908561256c565b93505b50600101611a99565b6000805160206128048339815191526001600160a01b038516611bb75760405163e602df0560e01b8152600060048201526024016109df565b6001600160a01b038416611be157604051634a1406b160e11b8152600060048201526024016109df565b6001600160a01b0380861660009081526001830160209081526040808320938816835292905220839055811561115157836001600160a01b0316856001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051611c5691815260200190565b60405180910390a35050505050565b3415611cb35760405162461bcd60e51b815260206004820152601760248201527f65746820616d6f756e742073686f756c6420626520302e00000000000000000060448201526064016109df565b6002546040516323b872dd60e01b81526001600160a01b03848116600483015230602483015260448201849052909116906323b872dd906064015b6020604051808303816000875af1158015611d0d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e09190612682565b6001600160a01b038216611d5b5760405163ec442f0560e01b8152600060048201526024016109df565b61124760008383611e2a565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16610f9a57604051631afcd79f60e31b815260040160405180910390fd5b611334611d67565b611dc0611d67565b600080516020612824833981519152805460ff19169055565b611de1611d67565b6000805160206128048339815191527f52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace03611e1b84826126e7565b506004810161084883826126e7565b6000805160206128048339815191526001600160a01b038416611e665781816002016000828254611e5b919061256c565b90915550611ed89050565b6001600160a01b03841660009081526020829052604090205482811015611eb95760405163391434e360e21b81526001600160a01b038616600482015260248101829052604481018490526064016109df565b6001600160a01b03851660009081526020839052604090209083900390555b6001600160a01b038316611ef6576002810180548390039055611f15565b6001600160a01b03831660009081526020829052604090208054830190555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611f5a91815260200190565b60405180910390a350505050565b600080611f76868686612058565b9050611f818361211c565b8015611f9d575060008480611f9857611f986127a7565b868809115b15611fb057611fad60018261256c565b90505b95945050505050565b6000805160206128248339815191525460ff16610f9a57604051638dfc202b60e01b815260040160405180910390fd5b6001600160a01b03821661201357604051634b637e8f60e11b8152600060048201526024016109df565b61124782600083611e2a565b60025460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb90604401611cee565b600083830281600019858709828110838203039150508060000361208f57838281612085576120856127a7565b0492505050610d74565b8084116120af5760405163227bc15360e01b815260040160405180910390fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b60006002826003811115612132576121326127bd565b61213c91906127d3565b60ff166001149050919050565b60006020828403121561215b57600080fd5b5035919050565b60006020808352835180602085015260005b8181101561219057858101830151858201604001528201612174565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146110c857600080fd5b600080604083850312156121db57600080fd5b6121e4836121b1565b946020939093013593505050565b600080600080600080600060e0888a03121561220d57600080fd5b612216886121b1565b9650602088013595506040880135945060608801359350608088013560ff8116811461224157600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60006020828403121561227057600080fd5b610d74826121b1565b602080825282518282018190526000919060409081850190868401855b828110156122c55781518051855286810151878601528501518585015260609093019290850190600101612296565b5091979650505050505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126122f957600080fd5b813567ffffffffffffffff80821115612314576123146122d2565b604051601f8301601f19908116603f0116810190828211818310171561233c5761233c6122d2565b8160405283815286602085880101111561235557600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561238b57600080fd5b612394856121b1565b93506123a2602086016121b1565b9250604085013567ffffffffffffffff808211156123bf57600080fd5b6123cb888389016122e8565b935060608701359150808211156123e157600080fd5b506123ee878288016122e8565b91505092959194509250565b60008060006060848603121561240f57600080fd5b612418846121b1565b9250612426602085016121b1565b9150604084013590509250925092565b6000806040838503121561244957600080fd5b50508035926020909101359150565b6000806040838503121561246b57600080fd5b612474836121b1565b9150612482602084016121b1565b90509250929050565b8015158114610d8c57600080fd5b6000602082840312156124ab57600080fd5b8135610d748161248b565b6000602082840312156124c857600080fd5b5051919050565b600181811c908216806124e357607f821691505b60208210810361250357634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601a908201527f4861766520746f20696e766f6b652066726f6d20726f75746572000000000000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156109af576109af612556565b818103818111156109af576109af612556565b600181815b808511156125cd5781600019048211156125b3576125b3612556565b808516156125c057918102915b93841c9390800290612597565b509250929050565b6000826125e4575060016109af565b816125f1575060006109af565b816001811461260757600281146126115761262d565b60019150506109af565b60ff84111561262257612622612556565b50506001821b6109af565b5060208310610133831016604e8410600b8410161715612650575081810a6109af565b61265a8383612592565b806000190482111561266e5761266e612556565b029392505050565b6000610d7483836125d5565b60006020828403121561269457600080fd5b8151610d748161248b565b601f8211156113e0576000816000526020600020601f850160051c810160208610156126c85750805b601f850160051c820191505b81811015611595578281556001016126d4565b815167ffffffffffffffff811115612701576127016122d2565b6127158161270f84546124cf565b8461269f565b602080601f83116001811461274a57600084156127325750858301515b600019600386901b1c1916600185901b178555611595565b600085815260208120601f198616915b828110156127795788860151825594840194600190910190840161275a565b50858210156127975787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b600060ff8316806127f457634e487b7160e01b600052601260045260246000fd5b8060ff8416069150509291505056fe52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300a2646970667358221220ff0f379577e77ddb39d04f8fea00358c6cad9aab4dd28c827862ad35ec4fa57264736f6c63430008180033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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