ETH Price: $3,094.40 (+0.27%)

Contract

0x58fd0AE1550ec7F52B2C3fB2f15f9C933E438275
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x61018060208359952024-09-26 16:29:5952 days ago1727368199IN
 Create: EzRVault
0 ETH0.1895273543.0200559

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
EzRVault

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion, BSL 1.1 license
File 1 of 35 : EzRVault.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "./EzRvaultStorage.sol";
import "../Errors/Errors.sol";
import "../EigenLayer/interfaces/IStrategyManager.sol";
import "../EigenLayer/interfaces/IDelegationManager.sol";
import "../EigenLayer/interfaces/IRewardsCoordinator.sol";
import {
    OwnableUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

contract EzRVault is
    ERC20Upgradeable,
    OwnableUpgradeable,
    ReentrancyGuardUpgradeable,
    EzRVaultStorageV1
{
    using SafeERC20 for IERC20;

    uint256 public constant BASIS_POINTS = 10000; // BASIS_POINTS used for percentage (10000 basis points equal 100%)
    uint256 public constant SHARE_OFFSET = 1e3;
    uint256 public constant BALANCE_OFFSET = 1e3;

    // EigenLayer configs
    IStrategyManager public immutable strategyManager;
    IDelegationManager public immutable delegationManager;
    IRewardsCoordinator public immutable rewardsCoordinator;
    IERC20 public immutable EIGEN;
    IERC20 public immutable B_EIGEN;

    // Protocol fee on rewards
    uint256 public immutable protocolFee;
    address public immutable protocolTreasury;

    // 7 days in blocks number (60*60*24*7 / 12)
    uint256 public constant SEVEN_DAYS_BLOCKS = 50_400;

    // Max cooldown blocks basis points
    uint256 public immutable maxCooldownBlocksBasisPoints;

    event DelegationAddressUpdated(address delegateAddress);

    event VaultCooldownUpdated(uint256 oldVaultCooldown, uint256 newVaultCooldown);

    event Deposit(address user, uint256 underlyingAmount, uint256 lpMinted);

    event WithdrawStarted(
        bytes32 withdrawRoot,
        address user,
        address staker,
        address delegatedTo,
        address withdrawer,
        uint nonce,
        uint startBlock,
        IStrategy[] strategies,
        uint256[] shares
    );

    event WithdrawRequestClaimed(
        bytes32 withdrawalRoot,
        address user,
        uint256 underlyingClaimAmount,
        IDelegationManager.Withdrawal withdrawal
    );

    event EmergencyWithdrawalTracked(IDelegationManager.Withdrawal withdrawal);
    event EmergencyWithdrawalCompleted(IDelegationManager.Withdrawal withdrawal);
    event IncentiveDeposited(uint256 amount);
    event Paused(bool paused);
    event PauserUpdated(address oldPauser, address newPauser);

    /// @dev Only allows deposit when Delegated
    modifier onlyWhenDelegated() {
        if (delegationManager.delegatedTo(address(this)) == address(0)) revert VaultNotDelegated();
        _;
    }

    /// @dev Only allows deposit and withdraw when not paused
    modifier whenNotPaused() {
        if (paused) revert VaultPaused();
        _;
    }

    /// @dev Only allowed pauser and owner to change pause state
    modifier onlyPauser() {
        if (msg.sender != owner() && msg.sender != pauser) revert NotPauser();
        _;
    }

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor(
        IStrategyManager _strategyManager,
        IDelegationManager _delegationManager,
        IRewardsCoordinator _rewardsCoordinator,
        IERC20 _eigen,
        IERC20 _bEigen,
        uint256 _protocolFee,
        address _protocolTreasury,
        uint256 _maxCooldownBlocksBasisPoints
    ) {
        if (
            address(_strategyManager) == address(0) ||
            address(_delegationManager) == address(0) ||
            address(_rewardsCoordinator) == address(0) ||
            address(_eigen) == address(0) ||
            address(_bEigen) == address(0) ||
            _protocolFee == 0 ||
            _protocolTreasury == address(0) ||
            _maxCooldownBlocksBasisPoints == 0
        ) revert InvalidZeroInput();

        // verify protocol fee
        if (_protocolFee > BASIS_POINTS) revert InvalidFee();
        if (_maxCooldownBlocksBasisPoints > BASIS_POINTS)
            revert InvalidMaxCooldownBlocksBasisPoints();

        strategyManager = _strategyManager;
        delegationManager = _delegationManager;
        rewardsCoordinator = _rewardsCoordinator;
        protocolFee = _protocolFee;
        protocolTreasury = _protocolTreasury;
        maxCooldownBlocksBasisPoints = _maxCooldownBlocksBasisPoints;
        EIGEN = _eigen;
        B_EIGEN = _bEigen;
        _disableInitializers();
    }

    function initialize(
        string memory _name,
        string memory _symbol,
        IERC20 _underlying,
        IStrategy _strategy,
        address vaultOwner,
        uint256 _cooldownBlocks,
        uint256 _vaultFee,
        address _vaultFeeDestination,
        address _rewardsDestination
    ) public initializer {
        // check for zero values
        if (
            address(_underlying) == address(0) ||
            address(_strategy) == address(0) ||
            vaultOwner == address(0) ||
            _vaultFeeDestination == address(0) ||
            _rewardsDestination == address(0) ||
            bytes(_name).length == 0 ||
            bytes(_symbol).length == 0
        ) revert InvalidZeroInput();

        // verify vault fee
        if (_vaultFee + protocolFee > BASIS_POINTS) revert InvalidFee();

        // check strategy whitelisted,
        // Note: beaconStrategy will fail as it is not whitelisted under strategyManager
        if (!strategyManager.strategyIsWhitelistedForDeposit(_strategy)) revert InvalidStrategy();

        // check if underlying token is EIGEN
        if (_underlying == EIGEN || _underlying == B_EIGEN) {
            // revert if strategy underlying is not bEIGEN
            if (IStrategy(_strategy).underlyingToken() != B_EIGEN) revert InvalidUnderlyingToken();
        } else {
            // check underlying token
            if (IStrategy(_strategy).underlyingToken() != _underlying)
                revert InvalidUnderlyingToken();
        }

        // check for cooldown blocks
        IStrategy[] memory _strategies = new IStrategy[](1);
        _strategies[0] = _strategy;
        if (_cooldownBlocks < delegationManager.getWithdrawalDelay(_strategies))
            revert InvalidWithdrawalCooldown();

        __ERC20_init(_name, _symbol);

        // ReentrancyGuard init
        __ReentrancyGuard_init();

        // transfer ownership to vaultOwner
        _transferOwnership(vaultOwner);

        // set underlying asset and strategy
        underlying = _underlying;
        underlyingStrategy = _strategy;
        underlyingDecimals = ERC20(address(_underlying)).decimals();
        vaultCooldownBlocks = _cooldownBlocks;
        cooldownBlocksUpdatedAt = block.number;
        vaultFee = _vaultFee;
        vaultFeeDestination = _vaultFeeDestination;
        vaultRewardsDestination = _rewardsDestination;
    }

    function decimals() public view override returns (uint8) {
        return underlyingDecimals;
    }

    /// @dev Sets the address to delegate tokens to in EigenLayer - Can only delegate to Single Operator
    function setDelegateAddress(
        address _delegateAddress,
        ISignatureUtils.SignatureWithExpiry memory approverSignatureAndExpiry,
        bytes32 approverSalt
    ) external nonReentrant onlyOwner {
        if (address(_delegateAddress) == address(0x0)) revert InvalidZeroInput();
        // check the delegation status on EigenLayer
        // Note: In case of force undelegation by delegatedOperator delegatedTo will be updated to address(0)
        if (delegationManager.delegatedTo(address(this)) != address(0)) revert AlreadyDelegated();

        delegationManager.delegateTo(_delegateAddress, approverSignatureAndExpiry, approverSalt);

        emit DelegationAddressUpdated(_delegateAddress);
    }

    function setCooldownBlocks(uint256 _cooldownBlocks) external nonReentrant onlyOwner {
        IStrategy[] memory _strategies = new IStrategy[](1);
        _strategies[0] = underlyingStrategy;
        uint256 minCooldownBlocks = delegationManager.getWithdrawalDelay(_strategies);
        // check for cooldown blocks
        if (_cooldownBlocks < minCooldownBlocks || _cooldownBlocks == 0)
            revert InvalidWithdrawalCooldown();
        // check for valid cooldownBlocks config
        if (_cooldownBlocks > minCooldownBlocks) {
            uint256 maxCooldownBlocksAllowed = minCooldownBlocks +
                (minCooldownBlocks * maxCooldownBlocksBasisPoints) /
                BASIS_POINTS;
            // check for max cooldownblocks allowed
            if (_cooldownBlocks > maxCooldownBlocksAllowed) revert ExceedMaxCooldownBlocks();

            // check for cooldown config last updated
            _checkCooldownBlocksUpdateDelay();
        }
        emit VaultCooldownUpdated(vaultCooldownBlocks, _cooldownBlocks);
        vaultCooldownBlocks = _cooldownBlocks;
        cooldownBlocksUpdatedAt = block.number;
    }

    /**
     * @notice  Pause the vault
     * @dev     permissioned call (onlyPuaser)
     */
    function pause() external onlyPauser {
        paused = true;
        emit Paused(true);
    }

    /**
     * @notice  UnPause the vault
     * @dev     permissioned call (onlyOwner)
     */
    function unpause() external onlyOwner {
        paused = false;
        emit Paused(false);
    }

    /**
     * @notice  Update pauser address
     * @dev     permissioned call (onlyOwner)
     * @param   _pauser  new pauser address
     */
    function setPauser(address _pauser) external onlyOwner {
        if (_pauser == address(0)) revert InvalidZeroInput();
        emit PauserUpdated(pauser, _pauser);
        pauser = _pauser;
    }

    /// @dev Deposit tokens into the EigenLayer.  This call assumes any balance of tokens in this contract will be delegated
    /// so do not directly send tokens here or they will be delegated and attributed to the next caller.
    /// @return shares The amount of new shares in the `strategy` created as part of the action.
    function deposit(
        uint256 tokenAmount
    ) external nonReentrant onlyWhenDelegated whenNotPaused returns (uint256 shares) {
        if (tokenAmount == 0) revert InvalidZeroInput();

        // Move the tokens into vault
        underlying.safeTransferFrom(msg.sender, address(this), tokenAmount);

        // calculate mint amount
        // if totalSupply of LP token is 0 mint the initial amount at 1:1
        uint256 mintAmount = (tokenAmount * scaleFactor()) / getRate();

        // sanity check
        if (mintAmount == 0) revert InvalidTokenAmount();
        _mint(msg.sender, mintAmount);
        shares = _deposit(tokenAmount);

        emit Deposit(msg.sender, tokenAmount, mintAmount);
    }

    /**
     * @notice  Perform necessary checks on input data and deposits into EigenLayer
     * @param   _tokenAmount  amount of given token to deposit
     * @return  shares  shares for deposited amount
     */
    function _deposit(uint256 _tokenAmount) internal returns (uint256 shares) {
        // Approve the strategy manager to spend the tokens
        underlying.safeIncreaseAllowance(address(strategyManager), _tokenAmount);

        // Deposit the tokens via the strategy manager
        return strategyManager.depositIntoStrategy(underlyingStrategy, underlying, _tokenAmount);
    }

    /**
     * @notice  Tracks the pending queued withdrawal shares cause by Operator force undelegating the Vault
     * @dev     permissioned call (onlyOwner of Vault),
     *          EigenLayer link - https://github.com/Layr-Labs/eigenlayer-contracts/blob/dev/src/contracts/core/DelegationManager.sol#L242
     * @param   withdrawal  Withdrawal struct needs to be tracked
     */
    function emergencyTrackQueuedWithdrawal(
        IDelegationManager.Withdrawal memory withdrawal
    ) external onlyOwner {
        if (withdrawal.strategies[0] != underlyingStrategy) revert InvalidStrategy();
        bytes32 withdrawalRoot = delegationManager.calculateWithdrawalRoot(withdrawal);

        // verify withdrawal is not user initiated
        if (withdrawRequest[withdrawalRoot].withdrawer != address(0))
            revert UserWithdrawalAlreadyTracked();

        // verify emergency withdrawal is not tracked
        if (emergencyWithdrawal[withdrawalRoot]) revert WithdrawalAlreadyTracked();

        // verify withdrawal is pending and vault not double counting
        if (!delegationManager.pendingWithdrawals(withdrawalRoot))
            revert WithdrawalAlreadyCompleted();

        // track queued shares for the token
        queuedShares += withdrawal.shares[0];

        // track in emergencyWithdrawal
        emergencyWithdrawal[withdrawalRoot] = true;

        emit EmergencyWithdrawalTracked(withdrawal);
    }

    /**
     * @notice  Complete Emergency queued withdrwal initiated by force undelegation by OperatorDelegator
     * @dev     permissioned call by OnlyOwner of vault
     * @param   withdrawal  Withdrawal struct for EigenLayer
     */
    function completeEmergencyTrackedWithdrawal(
        IDelegationManager.Withdrawal memory withdrawal
    ) external onlyOwner {
        bytes32 withdrawalRoot = delegationManager.calculateWithdrawalRoot(withdrawal);

        if (!emergencyWithdrawal[withdrawalRoot]) revert InvalidWithdrawal();
        IERC20[] memory tokens = new IERC20[](1);
        tokens[0] = underlying;

        // complete the queued Withdrawal
        delegationManager.completeQueuedWithdrawal(withdrawal, tokens, 0, true);

        // reduce queuedShares to avoid double counting
        queuedShares -= withdrawal.shares[0];

        // reset emergencyQueuedWithdrawal
        delete emergencyWithdrawal[withdrawalRoot];

        // redeposit funds to strategy
        _deposit(underlying.balanceOf(address(this)));

        emit EmergencyWithdrawalCompleted(withdrawal);
    }

    /**
     * @notice  Creates a withdraw request for user and queueWithdrawal on EigenLayer
     * @param   tokenAmount  amount of LP token to withdraw
     */
    function withdraw(
        uint256 tokenAmount
    ) external nonReentrant onlyWhenDelegated whenNotPaused returns (bytes32) {
        if (tokenAmount == 0) revert InvalidZeroInput();
        // Move LP tokens to vault
        this.transferFrom(msg.sender, address(this), tokenAmount);

        // get rate of LP tokens -> underlying tokens
        uint256 underlyingAmount = (tokenAmount * getRate()) / scaleFactor();

        // create queuedWithdrawalParams struct for withdrawRequest
        IDelegationManager.QueuedWithdrawalParams[]
            memory queuedWithdrawalParams = _getQueuedWithdrawalParam(underlyingAmount);

        // track queued shares
        queuedShares += queuedWithdrawalParams[0].shares[0];

        // Save the nonce before starting the withdrawal
        uint96 nonce = uint96(delegationManager.cumulativeWithdrawalsQueued(address(this)));

        // queue withdrawal in EigenLayer
        bytes32 withdrawalRoot = delegationManager.queueWithdrawals(queuedWithdrawalParams)[0];

        // track user withdraw request
        withdrawRequest[withdrawalRoot] = UserWithdrawRequest(
            msg.sender,
            tokenAmount,
            block.number
        );

        // Emit the withdrawal started event
        emit WithdrawStarted(
            withdrawalRoot,
            msg.sender,
            address(this),
            delegationManager.delegatedTo(address(this)),
            address(this),
            nonce,
            block.number,
            queuedWithdrawalParams[0].strategies,
            queuedWithdrawalParams[0].shares
        );

        return withdrawalRoot;
    }

    /**
     * @notice  Claim the requested withdraw
     * @dev     only the withdrawer can claim the request after vault cooldownBlocks
     * @param   withdrawal  Withdrawal struct for EigenLayer completeQueuedWithdrawal
     */
    function claim(
        IDelegationManager.Withdrawal calldata withdrawal
    ) external nonReentrant onlyWhenDelegated whenNotPaused {
        bytes32 withdrawalRoot = delegationManager.calculateWithdrawalRoot(withdrawal);

        if (msg.sender != withdrawRequest[withdrawalRoot].withdrawer || msg.sender == address(0))
            revert UnAuthorizedClaimer();

        if (block.number - withdrawRequest[withdrawalRoot].createdAt < cooldownBlocks())
            revert EarlyClaim();

        IERC20[] memory tokens = new IERC20[](1);
        tokens[0] = underlying;

        // burn LP token
        _burn(address(this), withdrawRequest[withdrawalRoot].lpTokenAmountLocked);

        // reduce queued Shares for this request
        queuedShares -= withdrawal.shares[0];

        // check balance before completing queuedWithdrawal
        uint256 balanceBefore = underlying.balanceOf(address(this));

        // complete withdrawal on EigenLayer
        delegationManager.completeQueuedWithdrawal(withdrawal, tokens, 0, true);

        uint256 underlyingClaimAmount = underlying.balanceOf(address(this)) - balanceBefore;

        // transfer received amount of underlying to msg.sender
        underlying.safeTransfer(msg.sender, underlyingClaimAmount);

        emit WithdrawRequestClaimed(withdrawalRoot, msg.sender, underlyingClaimAmount, withdrawal);

        // delete recorded withdrawRequest
        delete withdrawRequest[withdrawalRoot];
    }

    /**
     * @notice  Claim ERC20 rewards from EigenLayer
     * @dev     permissioned call (onlyOwner)
     * @param   _claim  RewardsMerkleClaim object to process claim
     */
    function processRewards(
        IRewardsCoordinator.RewardsMerkleClaim calldata _claim
    ) external onlyOwner {
        // check rewards Destination is configured
        if (vaultRewardsDestination == address(0)) revert RewardsDestinationNotConfigured();

        rewardsCoordinator.processClaim(_claim, address(this));

        for (uint256 i = 0; i < _claim.tokenLeaves.length; ) {
            // deduct fee for each rewards token
            uint256 remainingRewards = _processRewardsFee(_claim.tokenLeaves[i].token);
            // process the rewards
            _processRewards(_claim.tokenLeaves[i].token, remainingRewards);
            unchecked {
                ++i;
            }
        }
    }

    /**
     * @notice  Allows anyone to incentivize the vault by donating underlying
     * @dev     does not mint LP token for the incentive deposited
     * @param   amount  amount of underlying tokens
     */
    function depositIncentive(uint256 amount) external nonReentrant {
        if (amount == 0) revert InvalidZeroInput();

        // transfer underlying from caller to vault
        underlying.safeTransferFrom(msg.sender, address(this), amount);

        // deposit the underlying in underlyingStrategy
        _deposit(amount);

        emit IncentiveDeposited(amount);
    }

    /**
     * @notice  sweep any ERC20 token from vault contract
     * @dev     considers any token balance in vault as rewards, permissioned call (onlyOwner)
     * @param   token  token contract to perform sweep
     */
    function sweepERC20(IERC20 token) external nonReentrant onlyOwner {
        // revert if owner tries to sweep lp tokens
        if (address(token) == address(this)) revert InvalidTokenSweep();
        uint256 tokenBalance = token.balanceOf(address(this));
        if (tokenBalance == 0) revert InvalidZeroBalance();

        uint256 remainingBalance = _processRewardsFee(token);
        _processRewards(token, remainingBalance);
    }

    /// @dev getter for vault cooldown blocks. returns max cooldown blocks for strategy
    function cooldownBlocks() public view returns (uint256) {
        IStrategy[] memory strategies = new IStrategy[](1);
        strategies[0] = underlyingStrategy;
        return
            (delegationManager.getWithdrawalDelay(strategies) > vaultCooldownBlocks)
                ? delegationManager.getWithdrawalDelay(strategies)
                : vaultCooldownBlocks;
    }

    /// @dev Gets the underlying token amount from the amount of shares + queued withdrawal shares
    function getUnderlyingBalanceFromStrategy() public view returns (uint256) {
        return
            queuedShares == 0
                ? underlyingStrategy.userUnderlyingView(address(this))
                : underlyingStrategy.userUnderlyingView(address(this)) +
                    underlyingStrategy.sharesToUnderlyingView(queuedShares);
    }

    /// @dev returns the scale factor according to underlying decimals
    function scaleFactor() public view returns (uint256) {
        return (10 ** underlyingDecimals);
    }

    /// @dev Gets the current rate of LP token
    function getRate() public view returns (uint256) {
        return
            ((getUnderlyingBalanceFromStrategy() + BALANCE_OFFSET) * scaleFactor()) /
            (totalSupply() + SHARE_OFFSET);
    }

    /// @dev process the rewards received for specified token
    function _processRewards(IERC20 token, uint256 rewardsAmount) internal {
        // if reward token is underlying then redeposit
        if (token == underlying) {
            // redeposit into strategy
            _deposit(rewardsAmount);
        } else {
            // if reward token is not underlying then forward to RewardsDestination
            token.safeTransfer(vaultRewardsDestination, rewardsAmount);
        }
    }

    /// @dev process fee for the rewards received
    function _processRewardsFee(IERC20 token) internal returns (uint256) {
        uint256 totalRewards = token.balanceOf(address(this));
        // transfer protocol fee to protocol treasury
        uint256 protocolFeeShare = (totalRewards * protocolFee) / BASIS_POINTS;
        token.safeTransfer(protocolTreasury, protocolFeeShare);

        // transfer vault fee to configured vault fee destination
        uint256 vaultFeeShare = (totalRewards * vaultFee) / BASIS_POINTS;
        token.safeTransfer(vaultFeeDestination, vaultFeeShare);

        return totalRewards - (protocolFeeShare + vaultFeeShare);
    }

    /// @dev build the QueuedWithdrawalParam struct for EigenLayer withdrawals
    function _getQueuedWithdrawalParam(
        uint256 underlyingAmount
    )
        internal
        view
        returns (IDelegationManager.QueuedWithdrawalParams[] memory queuedWithdrawalParams)
    {
        // create queuedWithdrawalParams struct for withdrawRequest
        queuedWithdrawalParams = new IDelegationManager.QueuedWithdrawalParams[](1);
        // set vault strategy for 0th index only
        queuedWithdrawalParams[0].strategies = new IStrategy[](1);
        queuedWithdrawalParams[0].strategies[0] = underlyingStrategy;

        // set shares to withdraw for underlying
        queuedWithdrawalParams[0].shares = new uint256[](1);
        queuedWithdrawalParams[0].shares[0] = underlyingStrategy.underlyingToSharesView(
            underlyingAmount
        );

        // set withdrawer as this contract address
        queuedWithdrawalParams[0].withdrawer = address(this);
    }

    /// @dev ensures users have 7 days window to withdraw funds before owner can update the vaulCooldownBlocks
    function _checkCooldownBlocksUpdateDelay() internal view {
        if (block.number - cooldownBlocksUpdatedAt < vaultCooldownBlocks + SEVEN_DAYS_BLOCKS)
            revert EarlyCooldownBlocksUpdate();
    }
}

File 2 of 35 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../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.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

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

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @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 {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

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

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

pragma solidity ^0.8.2;

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

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

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

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

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

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

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

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

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

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

File 4 of 35 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

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

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

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

    uint256 private _status;

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

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

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

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

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

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

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

File 5 of 35 : ERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.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}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * 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.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20Upgradeable is
    Initializable,
    ContextUpgradeable,
    IERC20Upgradeable,
    IERC20MetadataUpgradeable
{
    mapping(address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * 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 {
        _name = name_;
        _symbol = symbol_;
    }

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

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

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the 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 override returns (uint8) {
        return 18;
    }

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

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

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

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

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

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

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

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

        return true;
    }

    /**
     * @dev Moves `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.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

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

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

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

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

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

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

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

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

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

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

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

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

File 6 of 35 : IERC20Upgradeable.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 IERC20Upgradeable {
    /**
     * @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 7 of 35 : IERC20MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
    /**
     * @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 8 of 35 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 9 of 35 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

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

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

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

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

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

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

File 10 of 35 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.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.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev 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) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @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 {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

File 11 of 35 : IBeacon.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.0;

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

File 12 of 35 : UpgradeableBeacon.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/UpgradeableBeacon.sol)

pragma solidity ^0.8.0;

import "./IBeacon.sol";
import "../../access/Ownable.sol";
import "../../utils/Address.sol";

/**
 * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their
 * implementation contract, which is where they will delegate all function calls.
 *
 * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.
 */
contract UpgradeableBeacon is IBeacon, Ownable {
    address private _implementation;

    /**
     * @dev Emitted when the implementation returned by the beacon is changed.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the
     * beacon.
     */
    constructor(address implementation_) {
        _setImplementation(implementation_);
    }

    /**
     * @dev Returns the current implementation address.
     */
    function implementation() public view virtual override returns (address) {
        return _implementation;
    }

    /**
     * @dev Upgrades the beacon to a new implementation.
     *
     * Emits an {Upgraded} event.
     *
     * Requirements:
     *
     * - msg.sender must be the owner of the contract.
     * - `newImplementation` must be a contract.
     */
    function upgradeTo(address newImplementation) public virtual onlyOwner {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Sets the implementation contract address for this beacon
     *
     * Requirements:
     *
     * - `newImplementation` must be a contract.
     */
    function _setImplementation(address newImplementation) private {
        require(Address.isContract(newImplementation), "UpgradeableBeacon: implementation is not a contract");
        _implementation = newImplementation;
    }
}

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

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.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}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * 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.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the 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 override returns (uint8) {
        return 18;
    }

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

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

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

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

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

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

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

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

        return true;
    }

    /**
     * @dev Moves `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.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

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

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

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

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

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

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

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

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

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

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

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

File 14 of 35 : 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 15 of 35 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

File 16 of 35 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @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 17 of 35 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

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

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

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

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

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

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

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

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

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

File 20 of 35 : IDelegationManager.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

import "./IStrategy.sol";
import "./ISignatureUtils.sol";
import "./IStrategyManager.sol";

/**
 * @title DelegationManager
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 * @notice  This is the contract for delegation in EigenLayer. The main functionalities of this contract are
 * - enabling anyone to register as an operator in EigenLayer
 * - allowing operators to specify parameters related to stakers who delegate to them
 * - enabling any staker to delegate its stake to the operator of its choice (a given staker can only delegate to a single operator at a time)
 * - enabling a staker to undelegate its assets from the operator it is delegated to (performed as part of the withdrawal process, initiated through the StrategyManager)
 */
interface IDelegationManager is ISignatureUtils {
    // Access to public vars - hack locally
    function beaconChainETHStrategy() external returns (IStrategy);
    function pendingWithdrawals(bytes32 withdrawalRoot) external view returns (bool);
    function getDelegatableShares(
        address staker
    ) external view returns (IStrategy[] memory, uint256[] memory);

    // @notice Struct used for storing information about a single operator who has registered with EigenLayer
    struct OperatorDetails {
        // @notice address to receive the rewards that the operator earns via serving applications built on EigenLayer.
        address earningsReceiver;
        /**
         * @notice Address to verify signatures when a staker wishes to delegate to the operator, as well as controlling "forced undelegations".
         * @dev Signature verification follows these rules:
         * 1) If this address is left as address(0), then any staker will be free to delegate to the operator, i.e. no signature verification will be performed.
         * 2) If this address is an EOA (i.e. it has no code), then we follow standard ECDSA signature verification for delegations to the operator.
         * 3) If this address is a contract (i.e. it has code) then we forward a call to the contract and verify that it returns the correct EIP-1271 "magic value".
         */
        address delegationApprover;
        /**
         * @notice A minimum delay -- measured in blocks -- enforced between:
         * 1) the operator signalling their intent to register for a service, via calling `Slasher.optIntoSlashing`
         * and
         * 2) the operator completing registration for the service, via the service ultimately calling `Slasher.recordFirstStakeUpdate`
         * @dev note that for a specific operator, this value *cannot decrease*, i.e. if the operator wishes to modify their OperatorDetails,
         * then they are only allowed to either increase this value or keep it the same.
         */
        uint32 stakerOptOutWindowBlocks;
    }

    /**
     * @notice Abstract struct used in calculating an EIP712 signature for a staker to approve that they (the staker themselves) delegate to a specific operator.
     * @dev Used in computing the `STAKER_DELEGATION_TYPEHASH` and as a reference in the computation of the stakerDigestHash in the `delegateToBySignature` function.
     */
    struct StakerDelegation {
        // the staker who is delegating
        address staker;
        // the operator being delegated to
        address operator;
        // the staker's nonce
        uint256 nonce;
        // the expiration timestamp (UTC) of the signature
        uint256 expiry;
    }

    /**
     * @notice Abstract struct used in calculating an EIP712 signature for an operator's delegationApprover to approve that a specific staker delegate to the operator.
     * @dev Used in computing the `DELEGATION_APPROVAL_TYPEHASH` and as a reference in the computation of the approverDigestHash in the `_delegate` function.
     */
    struct DelegationApproval {
        // the staker who is delegating
        address staker;
        // the operator being delegated to
        address operator;
        // the operator's provided salt
        bytes32 salt;
        // the expiration timestamp (UTC) of the signature
        uint256 expiry;
    }

    /**
     * Struct type used to specify an existing queued withdrawal. Rather than storing the entire struct, only a hash is stored.
     * In functions that operate on existing queued withdrawals -- e.g. completeQueuedWithdrawal`, the data is resubmitted and the hash of the submitted
     * data is computed by `calculateWithdrawalRoot` and checked against the stored hash in order to confirm the integrity of the submitted data.
     */
    struct Withdrawal {
        // The address that originated the Withdrawal
        address staker;
        // The address that the staker was delegated to at the time that the Withdrawal was created
        address delegatedTo;
        // The address that can complete the Withdrawal + will receive funds when completing the withdrawal
        address withdrawer;
        // Nonce used to guarantee that otherwise identical withdrawals have unique hashes
        uint256 nonce;
        // Block number when the Withdrawal was created
        uint32 startBlock;
        // Array of strategies that the Withdrawal contains
        IStrategy[] strategies;
        // Array containing the amount of shares in each Strategy in the `strategies` array
        uint256[] shares;
    }

    struct QueuedWithdrawalParams {
        // Array of strategies that the QueuedWithdrawal contains
        IStrategy[] strategies;
        // Array containing the amount of shares in each Strategy in the `strategies` array
        uint256[] shares;
        // The address of the withdrawer
        address withdrawer;
    }

    // @notice Emitted when a new operator registers in EigenLayer and provides their OperatorDetails.
    event OperatorRegistered(address indexed operator, OperatorDetails operatorDetails);

    /// @notice Emitted when an operator updates their OperatorDetails to @param newOperatorDetails
    event OperatorDetailsModified(address indexed operator, OperatorDetails newOperatorDetails);

    /**
     * @notice Emitted when @param operator indicates that they are updating their MetadataURI string
     * @dev Note that these strings are *never stored in storage* and are instead purely emitted in events for off-chain indexing
     */
    event OperatorMetadataURIUpdated(address indexed operator, string metadataURI);

    /// @notice Emitted whenever an operator's shares are increased for a given strategy. Note that shares is the delta in the operator's shares.
    event OperatorSharesIncreased(
        address indexed operator,
        address staker,
        IStrategy strategy,
        uint256 shares
    );

    /// @notice Emitted whenever an operator's shares are decreased for a given strategy. Note that shares is the delta in the operator's shares.
    event OperatorSharesDecreased(
        address indexed operator,
        address staker,
        IStrategy strategy,
        uint256 shares
    );

    /// @notice Emitted when @param staker delegates to @param operator.
    event StakerDelegated(address indexed staker, address indexed operator);

    /// @notice Emitted when @param staker undelegates from @param operator.
    event StakerUndelegated(address indexed staker, address indexed operator);

    /// @notice Emitted when @param staker is undelegated via a call not originating from the staker themself
    event StakerForceUndelegated(address indexed staker, address indexed operator);

    /**
     * @notice Emitted when a new withdrawal is queued.
     * @param withdrawalRoot Is the hash of the `withdrawal`.
     * @param withdrawal Is the withdrawal itself.
     */
    event WithdrawalQueued(bytes32 withdrawalRoot, Withdrawal withdrawal);

    /// @notice Emitted when a queued withdrawal is completed
    event WithdrawalCompleted(bytes32 withdrawalRoot);

    /// @notice Emitted when a queued withdrawal is *migrated* from the StrategyManager to the DelegationManager
    event WithdrawalMigrated(bytes32 oldWithdrawalRoot, bytes32 newWithdrawalRoot);

    /// @notice Emitted when the `minWithdrawalDelayBlocks` variable is modified from `previousValue` to `newValue`.
    event MinWithdrawalDelayBlocksSet(uint256 previousValue, uint256 newValue);

    /// @notice Emitted when the `strategyWithdrawalDelayBlocks` variable is modified from `previousValue` to `newValue`.
    event StrategyWithdrawalDelayBlocksSet(
        IStrategy strategy,
        uint256 previousValue,
        uint256 newValue
    );

    /**
     * @notice Registers the caller as an operator in EigenLayer.
     * @param registeringOperatorDetails is the `OperatorDetails` for the operator.
     * @param metadataURI is a URI for the operator's metadata, i.e. a link providing more details on the operator.
     *
     * @dev Once an operator is registered, they cannot 'deregister' as an operator, and they will forever be considered "delegated to themself".
     * @dev This function will revert if the caller attempts to set their `earningsReceiver` to address(0).
     * @dev Note that the `metadataURI` is *never stored * and is only emitted in the `OperatorMetadataURIUpdated` event
     */
    function registerAsOperator(
        OperatorDetails calldata registeringOperatorDetails,
        string calldata metadataURI
    ) external;

    /**
     * @notice Updates an operator's stored `OperatorDetails`.
     * @param newOperatorDetails is the updated `OperatorDetails` for the operator, to replace their current OperatorDetails`.
     *
     * @dev The caller must have previously registered as an operator in EigenLayer.
     * @dev This function will revert if the caller attempts to set their `earningsReceiver` to address(0).
     */
    function modifyOperatorDetails(OperatorDetails calldata newOperatorDetails) external;

    /**
     * @notice Called by an operator to emit an `OperatorMetadataURIUpdated` event indicating the information has updated.
     * @param metadataURI The URI for metadata associated with an operator
     * @dev Note that the `metadataURI` is *never stored * and is only emitted in the `OperatorMetadataURIUpdated` event
     */
    function updateOperatorMetadataURI(string calldata metadataURI) external;

    /**
     * @notice Caller delegates their stake to an operator.
     * @param operator The account (`msg.sender`) is delegating its assets to for use in serving applications built on EigenLayer.
     * @param approverSignatureAndExpiry Verifies the operator approves of this delegation
     * @param approverSalt A unique single use value tied to an individual signature.
     * @dev The approverSignatureAndExpiry is used in the event that:
     *          1) the operator's `delegationApprover` address is set to a non-zero value.
     *                  AND
     *          2) neither the operator nor their `delegationApprover` is the `msg.sender`, since in the event that the operator
     *             or their delegationApprover is the `msg.sender`, then approval is assumed.
     * @dev In the event that `approverSignatureAndExpiry` is not checked, its content is ignored entirely; it's recommended to use an empty input
     * in this case to save on complexity + gas costs
     */
    function delegateTo(
        address operator,
        SignatureWithExpiry memory approverSignatureAndExpiry,
        bytes32 approverSalt
    ) external;

    /**
     * @notice Caller delegates a staker's stake to an operator with valid signatures from both parties.
     * @param staker The account delegating stake to an `operator` account
     * @param operator The account (`staker`) is delegating its assets to for use in serving applications built on EigenLayer.
     * @param stakerSignatureAndExpiry Signed data from the staker authorizing delegating stake to an operator
     * @param approverSignatureAndExpiry is a parameter that will be used for verifying that the operator approves of this delegation action in the event that:
     * @param approverSalt Is a salt used to help guarantee signature uniqueness. Each salt can only be used once by a given approver.
     *
     * @dev If `staker` is an EOA, then `stakerSignature` is verified to be a valid ECDSA stakerSignature from `staker`, indicating their intention for this action.
     * @dev If `staker` is a contract, then `stakerSignature` will be checked according to EIP-1271.
     * @dev the operator's `delegationApprover` address is set to a non-zero value.
     * @dev neither the operator nor their `delegationApprover` is the `msg.sender`, since in the event that the operator or their delegationApprover
     * is the `msg.sender`, then approval is assumed.
     * @dev This function will revert if the current `block.timestamp` is equal to or exceeds the expiry
     * @dev In the case that `approverSignatureAndExpiry` is not checked, its content is ignored entirely; it's recommended to use an empty input
     * in this case to save on complexity + gas costs
     */
    function delegateToBySignature(
        address staker,
        address operator,
        SignatureWithExpiry memory stakerSignatureAndExpiry,
        SignatureWithExpiry memory approverSignatureAndExpiry,
        bytes32 approverSalt
    ) external;

    /**
     * @notice Undelegates the staker from the operator who they are delegated to. Puts the staker into the "undelegation limbo" mode of the EigenPodManager
     * and queues a withdrawal of all of the staker's shares in the StrategyManager (to the staker), if necessary.
     * @param staker The account to be undelegated.
     * @return withdrawalRoot The root of the newly queued withdrawal, if a withdrawal was queued. Otherwise just bytes32(0).
     *
     * @dev Reverts if the `staker` is also an operator, since operators are not allowed to undelegate from themselves.
     * @dev Reverts if the caller is not the staker, nor the operator who the staker is delegated to, nor the operator's specified "delegationApprover"
     * @dev Reverts if the `staker` is already undelegated.
     */
    function undelegate(address staker) external returns (bytes32[] memory withdrawalRoot);

    /**
     * Allows a staker to withdraw some shares. Withdrawn shares/strategies are immediately removed
     * from the staker. If the staker is delegated, withdrawn shares/strategies are also removed from
     * their operator.
     *
     * All withdrawn shares/strategies are placed in a queue and can be fully withdrawn after a delay.
     */
    function queueWithdrawals(
        QueuedWithdrawalParams[] calldata queuedWithdrawalParams
    ) external returns (bytes32[] memory);

    /**
     * @notice Used to complete the specified `withdrawal`. The caller must match `withdrawal.withdrawer`
     * @param withdrawal The Withdrawal to complete.
     * @param tokens Array in which the i-th entry specifies the `token` input to the 'withdraw' function of the i-th Strategy in the `withdrawal.strategies` array.
     * This input can be provided with zero length if `receiveAsTokens` is set to 'false' (since in that case, this input will be unused)
     * @param middlewareTimesIndex is the index in the operator that the staker who triggered the withdrawal was delegated to's middleware times array
     * @param receiveAsTokens If true, the shares specified in the withdrawal will be withdrawn from the specified strategies themselves
     * and sent to the caller, through calls to `withdrawal.strategies[i].withdraw`. If false, then the shares in the specified strategies
     * will simply be transferred to the caller directly.
     * @dev middlewareTimesIndex should be calculated off chain before calling this function by finding the first index that satisfies `slasher.canWithdraw`
     * @dev beaconChainETHStrategy shares are non-transferrable, so if `receiveAsTokens = false` and `withdrawal.withdrawer != withdrawal.staker`, note that
     * any beaconChainETHStrategy shares in the `withdrawal` will be _returned to the staker_, rather than transferred to the withdrawer, unlike shares in
     * any other strategies, which will be transferred to the withdrawer.
     */
    function completeQueuedWithdrawal(
        Withdrawal calldata withdrawal,
        IERC20[] calldata tokens,
        uint256 middlewareTimesIndex,
        bool receiveAsTokens
    ) external;

    /**
     * @notice Array-ified version of `completeQueuedWithdrawal`.
     * Used to complete the specified `withdrawals`. The function caller must match `withdrawals[...].withdrawer`
     * @param withdrawals The Withdrawals to complete.
     * @param tokens Array of tokens for each Withdrawal. See `completeQueuedWithdrawal` for the usage of a single array.
     * @param middlewareTimesIndexes One index to reference per Withdrawal. See `completeQueuedWithdrawal` for the usage of a single index.
     * @param receiveAsTokens Whether or not to complete each withdrawal as tokens. See `completeQueuedWithdrawal` for the usage of a single boolean.
     * @dev See `completeQueuedWithdrawal` for relevant dev tags
     */
    function completeQueuedWithdrawals(
        Withdrawal[] calldata withdrawals,
        IERC20[][] calldata tokens,
        uint256[] calldata middlewareTimesIndexes,
        bool[] calldata receiveAsTokens
    ) external;

    /**
     * @notice Increases a staker's delegated share balance in a strategy.
     * @param staker The address to increase the delegated shares for their operator.
     * @param strategy The strategy in which to increase the delegated shares.
     * @param shares The number of shares to increase.
     *
     * @dev *If the staker is actively delegated*, then increases the `staker`'s delegated shares in `strategy` by `shares`. Otherwise does nothing.
     * @dev Callable only by the StrategyManager or EigenPodManager.
     */
    function increaseDelegatedShares(address staker, IStrategy strategy, uint256 shares) external;

    /**
     * @notice Decreases a staker's delegated share balance in a strategy.
     * @param staker The address to increase the delegated shares for their operator.
     * @param strategy The strategy in which to decrease the delegated shares.
     * @param shares The number of shares to decrease.
     *
     * @dev *If the staker is actively delegated*, then decreases the `staker`'s delegated shares in `strategy` by `shares`. Otherwise does nothing.
     * @dev Callable only by the StrategyManager or EigenPodManager.
     */
    function decreaseDelegatedShares(address staker, IStrategy strategy, uint256 shares) external;

    /**
     * @notice returns the address of the operator that `staker` is delegated to.
     * @notice Mapping: staker => operator whom the staker is currently delegated to.
     * @dev Note that returning address(0) indicates that the staker is not actively delegated to any operator.
     */
    function delegatedTo(address staker) external view returns (address);

    /**
     * @notice Returns the OperatorDetails struct associated with an `operator`.
     */
    function operatorDetails(address operator) external view returns (OperatorDetails memory);

    /*
     * @notice Returns the earnings receiver address for an operator
     */
    function earningsReceiver(address operator) external view returns (address);

    /**
     * @notice Returns the delegationApprover account for an operator
     */
    function delegationApprover(address operator) external view returns (address);

    /**
     * @notice Returns the stakerOptOutWindowBlocks for an operator
     */
    function stakerOptOutWindowBlocks(address operator) external view returns (uint256);

    /**
     * @notice Given array of strategies, returns array of shares for the operator
     */
    function getOperatorShares(
        address operator,
        IStrategy[] memory strategies
    ) external view returns (uint256[] memory);

    /**
     * @notice Given a list of strategies, return the minimum number of blocks that must pass to withdraw
     * from all the inputted strategies. Return value is >= minWithdrawalDelayBlocks as this is the global min withdrawal delay.
     * @param strategies The strategies to check withdrawal delays for
     */
    function getWithdrawalDelay(IStrategy[] calldata strategies) external view returns (uint256);

    /**
     * @notice returns the total number of shares in `strategy` that are delegated to `operator`.
     * @notice Mapping: operator => strategy => total number of shares in the strategy delegated to the operator.
     * @dev By design, the following invariant should hold for each Strategy:
     * (operator's shares in delegation manager) = sum (shares above zero of all stakers delegated to operator)
     * = sum (delegateable shares of all stakers delegated to the operator)
     */
    function operatorShares(address operator, IStrategy strategy) external view returns (uint256);

    /**
     * @notice Returns 'true' if `staker` *is* actively delegated, and 'false' otherwise.
     */
    function isDelegated(address staker) external view returns (bool);

    /**
     * @notice Returns true is an operator has previously registered for delegation.
     */
    function isOperator(address operator) external view returns (bool);

    /// @notice Mapping: staker => number of signed delegation nonces (used in `delegateToBySignature`) from the staker that the contract has already checked
    function stakerNonce(address staker) external view returns (uint256);

    /**
     * @notice Mapping: delegationApprover => 32-byte salt => whether or not the salt has already been used by the delegationApprover.
     * @dev Salts are used in the `delegateTo` and `delegateToBySignature` functions. Note that these functions only process the delegationApprover's
     * signature + the provided salt if the operator being delegated to has specified a nonzero address as their `delegationApprover`.
     */
    function delegationApproverSaltIsSpent(
        address _delegationApprover,
        bytes32 salt
    ) external view returns (bool);

    /**
     * @notice Minimum delay enforced by this contract for completing queued withdrawals. Measured in blocks, and adjustable by this contract's owner,
     * up to a maximum of `MAX_WITHDRAWAL_DELAY_BLOCKS`. Minimum value is 0 (i.e. no delay enforced).
     * Note that strategies each have a separate withdrawal delay, which can be greater than this value. So the minimum number of blocks that must pass
     * to withdraw a strategy is MAX(minWithdrawalDelayBlocks, strategyWithdrawalDelayBlocks[strategy])
     */
    function minWithdrawalDelayBlocks() external view returns (uint256);

    /**
     * @notice Minimum delay enforced by this contract per Strategy for completing queued withdrawals. Measured in blocks, and adjustable by this contract's owner,
     * up to a maximum of `MAX_WITHDRAWAL_DELAY_BLOCKS`. Minimum value is 0 (i.e. no delay enforced).
     */
    function strategyWithdrawalDelayBlocks(IStrategy strategy) external view returns (uint256);

    /**
     * @notice Calculates the digestHash for a `staker` to sign to delegate to an `operator`
     * @param staker The signing staker
     * @param operator The operator who is being delegated to
     * @param expiry The desired expiry time of the staker's signature
     */
    function calculateCurrentStakerDelegationDigestHash(
        address staker,
        address operator,
        uint256 expiry
    ) external view returns (bytes32);

    /**
     * @notice Calculates the digest hash to be signed and used in the `delegateToBySignature` function
     * @param staker The signing staker
     * @param _stakerNonce The nonce of the staker. In practice we use the staker's current nonce, stored at `stakerNonce[staker]`
     * @param operator The operator who is being delegated to
     * @param expiry The desired expiry time of the staker's signature
     */
    function calculateStakerDelegationDigestHash(
        address staker,
        uint256 _stakerNonce,
        address operator,
        uint256 expiry
    ) external view returns (bytes32);

    /**
     * @notice Calculates the digest hash to be signed by the operator's delegationApprove and used in the `delegateTo` and `delegateToBySignature` functions.
     * @param staker The account delegating their stake
     * @param operator The account receiving delegated stake
     * @param _delegationApprover the operator's `delegationApprover` who will be signing the delegationHash (in general)
     * @param approverSalt A unique and single use value associated with the approver signature.
     * @param expiry Time after which the approver's signature becomes invalid
     */
    function calculateDelegationApprovalDigestHash(
        address staker,
        address operator,
        address _delegationApprover,
        bytes32 approverSalt,
        uint256 expiry
    ) external view returns (bytes32);

    /// @notice The EIP-712 typehash for the contract's domain
    function DOMAIN_TYPEHASH() external view returns (bytes32);

    /// @notice The EIP-712 typehash for the StakerDelegation struct used by the contract
    function STAKER_DELEGATION_TYPEHASH() external view returns (bytes32);

    /// @notice The EIP-712 typehash for the DelegationApproval struct used by the contract
    function DELEGATION_APPROVAL_TYPEHASH() external view returns (bytes32);

    /**
     * @notice Getter function for the current EIP-712 domain separator for this contract.
     *
     * @dev The domain separator will change in the event of a fork that changes the ChainID.
     * @dev By introducing a domain separator the DApp developers are guaranteed that there can be no signature collision.
     * for more detailed information please read EIP-712.
     */
    function domainSeparator() external view returns (bytes32);

    /// @notice Mapping: staker => cumulative number of queued withdrawals they have ever initiated.
    /// @dev This only increments (doesn't decrement), and is used to help ensure that otherwise identical withdrawals have unique hashes.
    function cumulativeWithdrawalsQueued(address staker) external view returns (uint256);

    /// @notice Returns the keccak256 hash of `withdrawal`.
    function calculateWithdrawalRoot(Withdrawal memory withdrawal) external pure returns (bytes32);

    function migrateQueuedWithdrawals(
        IStrategyManager.DeprecatedStruct_QueuedWithdrawal[] memory withdrawalsToQueue
    ) external;
}

File 21 of 35 : IETHPOSDeposit.sol
// ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━
// ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓
// ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛
// ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━
// ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓
// ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

// SPDX-License-Identifier: CC0-1.0

pragma solidity >=0.5.0;

// This interface is designed to be compatible with the Vyper version.
/// @notice This is the Ethereum 2.0 deposit contract interface.
/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs
interface IETHPOSDeposit {
    /// @notice A processed deposit event.
    event DepositEvent(
        bytes pubkey,
        bytes withdrawal_credentials,
        bytes amount,
        bytes signature,
        bytes index
    );

    /// @notice Submit a Phase 0 DepositData object.
    /// @param pubkey A BLS12-381 public key.
    /// @param withdrawal_credentials Commitment to a public key for withdrawals.
    /// @param signature A BLS12-381 signature.
    /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.
    /// Used as a protection against malformed input.
    function deposit(
        bytes calldata pubkey,
        bytes calldata withdrawal_credentials,
        bytes calldata signature,
        bytes32 deposit_data_root
    ) external payable;

    /// @notice Query the current deposit root hash.
    /// @return The deposit root hash.
    function get_deposit_root() external view returns (bytes32);

    /// @notice Query the current deposit count.
    /// @return The deposit count encoded as a little endian 64-bit number.
    function get_deposit_count() external view returns (bytes memory);
}

File 22 of 35 : IEigenPod.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

import "../libraries/BeaconChainProofs.sol";
import "./IEigenPodManager.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/**
 * @title The implementation contract used for restaking beacon chain ETH on EigenLayer
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 * @dev Note that all beacon chain balances are stored as gwei within the beacon chain datastructures. We choose
 *   to account balances in terms of gwei in the EigenPod contract and convert to wei when making calls to other contracts
 */
interface IEigenPod {
    /*******************************************************************************
                                   STRUCTS / ENUMS
    *******************************************************************************/

    enum VALIDATOR_STATUS {
        INACTIVE, // doesnt exist
        ACTIVE, // staked on ethpos and withdrawal credentials are pointed to the EigenPod
        WITHDRAWN // withdrawn from the Beacon Chain
    }

    struct ValidatorInfo {
        // index of the validator in the beacon chain
        uint64 validatorIndex;
        // amount of beacon chain ETH restaked on EigenLayer in gwei
        uint64 restakedBalanceGwei;
        //timestamp of the validator's most recent balance update
        uint64 lastCheckpointedAt;
        // status of the validator
        VALIDATOR_STATUS status;
    }

    struct Checkpoint {
        bytes32 beaconBlockRoot;
        uint24 proofsRemaining;
        uint64 podBalanceGwei;
        int128 balanceDeltasGwei;
    }

    /*******************************************************************************
                                       EVENTS
    *******************************************************************************/

    /// @notice Emitted when an ETH validator stakes via this eigenPod
    event EigenPodStaked(bytes pubkey);

    /// @notice Emitted when a pod owner updates the proof submitter address
    event ProofSubmitterUpdated(address prevProofSubmitter, address newProofSubmitter);

    /// @notice Emitted when an ETH validator's withdrawal credentials are successfully verified to be pointed to this eigenPod
    event ValidatorRestaked(uint40 validatorIndex);

    /// @notice Emitted when an ETH validator's  balance is proven to be updated.  Here newValidatorBalanceGwei
    //  is the validator's balance that is credited on EigenLayer.
    event ValidatorBalanceUpdated(
        uint40 validatorIndex,
        uint64 balanceTimestamp,
        uint64 newValidatorBalanceGwei
    );

    /// @notice Emitted when restaked beacon chain ETH is withdrawn from the eigenPod.
    event RestakedBeaconChainETHWithdrawn(address indexed recipient, uint256 amount);

    /// @notice Emitted when ETH is received via the `receive` fallback
    event NonBeaconChainETHReceived(uint256 amountReceived);

    /// @notice Emitted when a checkpoint is created
    event CheckpointCreated(
        uint64 indexed checkpointTimestamp,
        bytes32 indexed beaconBlockRoot,
        uint256 validatorCount
    );

    /// @notice Emitted when a checkpoint is finalized
    event CheckpointFinalized(uint64 indexed checkpointTimestamp, int256 totalShareDeltaWei);

    /// @notice Emitted when a validator is proven for a given checkpoint
    event ValidatorCheckpointed(uint64 indexed checkpointTimestamp, uint40 indexed validatorIndex);

    /// @notice Emitted when a validaor is proven to have 0 balance at a given checkpoint
    event ValidatorWithdrawn(uint64 indexed checkpointTimestamp, uint40 indexed validatorIndex);

    /*******************************************************************************
                          EXTERNAL STATE-CHANGING METHODS
    *******************************************************************************/

    /// @notice Used to initialize the pointers to contracts crucial to the pod's functionality, in beacon proxy construction from EigenPodManager
    function initialize(address owner) external;

    /// @notice Called by EigenPodManager when the owner wants to create another ETH validator.
    function stake(
        bytes calldata pubkey,
        bytes calldata signature,
        bytes32 depositDataRoot
    ) external payable;

    /**
     * @notice Transfers `amountWei` in ether from this contract to the specified `recipient` address
     * @notice Called by EigenPodManager to withdrawBeaconChainETH that has been added to the EigenPod's balance due to a withdrawal from the beacon chain.
     * @dev The podOwner must have already proved sufficient withdrawals, so that this pod's `withdrawableRestakedExecutionLayerGwei` exceeds the
     * `amountWei` input (when converted to GWEI).
     * @dev Reverts if `amountWei` is not a whole Gwei amount
     */
    function withdrawRestakedBeaconChainETH(address recipient, uint256 amount) external;

    /**
     * @dev Create a checkpoint used to prove this pod's active validator set. Checkpoints are completed
     * by submitting one checkpoint proof per ACTIVE validator. During the checkpoint process, the total
     * change in ACTIVE validator balance is tracked, and any validators with 0 balance are marked `WITHDRAWN`.
     * @dev Once finalized, the pod owner is awarded shares corresponding to:
     * - the total change in their ACTIVE validator balances
     * - any ETH in the pod not already awarded shares
     * @dev A checkpoint cannot be created if the pod already has an outstanding checkpoint. If
     * this is the case, the pod owner MUST complete the existing checkpoint before starting a new one.
     * @param revertIfNoBalance Forces a revert if the pod ETH balance is 0. This allows the pod owner
     * to prevent accidentally starting a checkpoint that will not increase their shares
     */
    function startCheckpoint(bool revertIfNoBalance) external;

    /**
     * @dev Progress the current checkpoint towards completion by submitting one or more validator
     * checkpoint proofs. Anyone can call this method to submit proofs towards the current checkpoint.
     * For each validator proven, the current checkpoint's `proofsRemaining` decreases.
     * @dev If the checkpoint's `proofsRemaining` reaches 0, the checkpoint is finalized.
     * (see `_updateCheckpoint` for more details)
     * @dev This method can only be called when there is a currently-active checkpoint.
     * @param balanceContainerProof proves the beacon's current balance container root against a checkpoint's `beaconBlockRoot`
     * @param proofs Proofs for one or more validator current balances against the `balanceContainerRoot`
     */
    function verifyCheckpointProofs(
        BeaconChainProofs.BalanceContainerProof calldata balanceContainerProof,
        BeaconChainProofs.BalanceProof[] calldata proofs
    ) external;

    /**
     * @dev Verify one or more validators have their withdrawal credentials pointed at this EigenPod, and award
     * shares based on their effective balance. Proven validators are marked `ACTIVE` within the EigenPod, and
     * future checkpoint proofs will need to include them.
     * @dev Withdrawal credential proofs MUST NOT be older than `currentCheckpointTimestamp`.
     * @dev Validators proven via this method MUST NOT have an exit epoch set already.
     * @param beaconTimestamp the beacon chain timestamp sent to the 4788 oracle contract. Corresponds
     * to the parent beacon block root against which the proof is verified.
     * @param stateRootProof proves a beacon state root against a beacon block root
     * @param validatorIndices a list of validator indices being proven
     * @param validatorFieldsProofs proofs of each validator's `validatorFields` against the beacon state root
     * @param validatorFields the fields of the beacon chain "Validator" container. See consensus specs for
     * details: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator
     */
    function verifyWithdrawalCredentials(
        uint64 beaconTimestamp,
        BeaconChainProofs.StateRootProof calldata stateRootProof,
        uint40[] calldata validatorIndices,
        bytes[] calldata validatorFieldsProofs,
        bytes32[][] calldata validatorFields
    ) external;

    /**
     * @dev Prove that one of this pod's active validators was slashed on the beacon chain. A successful
     * staleness proof allows the caller to start a checkpoint.
     *
     * @dev Note that in order to start a checkpoint, any existing checkpoint must already be completed!
     * (See `_startCheckpoint` for details)
     *
     * @dev Note that this method allows anyone to start a checkpoint as soon as a slashing occurs on the beacon
     * chain. This is intended to make it easier to external watchers to keep a pod's balance up to date.
     *
     * @dev Note too that beacon chain slashings are not instant. There is a delay between the initial slashing event
     * and the validator's final exit back to the execution layer. During this time, the validator's balance may or
     * may not drop further due to a correlation penalty. This method allows proof of a slashed validator
     * to initiate a checkpoint for as long as the validator remains on the beacon chain. Once the validator
     * has exited and been checkpointed at 0 balance, they are no longer "checkpoint-able" and cannot be proven
     * "stale" via this method.
     * See https://eth2book.info/capella/part3/transition/epoch/#slashings for more info.
     *
     * @param beaconTimestamp the beacon chain timestamp sent to the 4788 oracle contract. Corresponds
     * to the parent beacon block root against which the proof is verified.
     * @param stateRootProof proves a beacon state root against a beacon block root
     * @param proof the fields of the beacon chain "Validator" container, along with a merkle proof against
     * the beacon state root. See the consensus specs for more details:
     * https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator
     *
     * @dev Staleness conditions:
     * - Validator's last checkpoint is older than `beaconTimestamp`
     * - Validator MUST be in `ACTIVE` status in the pod
     * - Validator MUST be slashed on the beacon chain
     */
    function verifyStaleBalance(
        uint64 beaconTimestamp,
        BeaconChainProofs.StateRootProof calldata stateRootProof,
        BeaconChainProofs.ValidatorProof calldata proof
    ) external;

    /// @notice called by owner of a pod to remove any ERC20s deposited in the pod
    function recoverTokens(
        IERC20[] memory tokenList,
        uint256[] memory amountsToWithdraw,
        address recipient
    ) external;

    /// @notice Allows the owner of a pod to update the proof submitter, a permissioned
    /// address that can call `startCheckpoint` and `verifyWithdrawalCredentials`.
    /// @dev Note that EITHER the podOwner OR proofSubmitter can access these methods,
    /// so it's fine to set your proofSubmitter to 0 if you want the podOwner to be the
    /// only address that can call these methods.
    /// @param newProofSubmitter The new proof submitter address. If set to 0, only the
    /// pod owner will be able to call `startCheckpoint` and `verifyWithdrawalCredentials`
    function setProofSubmitter(address newProofSubmitter) external;

    /*******************************************************************************
                                   VIEW METHODS
    *******************************************************************************/

    /// @notice An address with permissions to call `startCheckpoint` and `verifyWithdrawalCredentials`, set
    /// by the podOwner. This role exists to allow a podOwner to designate a hot wallet that can call
    /// these methods, allowing the podOwner to remain a cold wallet that is only used to manage funds.
    /// @dev If this address is NOT set, only the podOwner can call `startCheckpoint` and `verifyWithdrawalCredentials`
    function proofSubmitter() external view returns (address);

    /// @notice the amount of execution layer ETH in this contract that is staked in EigenLayer (i.e. withdrawn from beaconchain but not EigenLayer),
    function withdrawableRestakedExecutionLayerGwei() external view returns (uint64);

    /// @notice The single EigenPodManager for EigenLayer
    function eigenPodManager() external view returns (IEigenPodManager);

    /// @notice The owner of this EigenPod
    function podOwner() external view returns (address);

    /// @notice Returns the validatorInfo struct for the provided pubkeyHash
    function validatorPubkeyHashToInfo(
        bytes32 validatorPubkeyHash
    ) external view returns (ValidatorInfo memory);

    /// @notice Returns the validatorInfo struct for the provided pubkey
    function validatorPubkeyToInfo(
        bytes calldata validatorPubkey
    ) external view returns (ValidatorInfo memory);

    /// @notice This returns the status of a given validator
    function validatorStatus(bytes32 pubkeyHash) external view returns (VALIDATOR_STATUS);

    /// @notice This returns the status of a given validator pubkey
    function validatorStatus(
        bytes calldata validatorPubkey
    ) external view returns (VALIDATOR_STATUS);

    /// @notice Number of validators with proven withdrawal credentials, who do not have proven full withdrawals
    function activeValidatorCount() external view returns (uint256);

    /// @notice The timestamp of the last checkpoint finalized
    function lastCheckpointTimestamp() external view returns (uint64);

    /// @notice The timestamp of the currently-active checkpoint. Will be 0 if there is not active checkpoint
    function currentCheckpointTimestamp() external view returns (uint64);

    /// @notice Returns the currently-active checkpoint
    function currentCheckpoint() external view returns (Checkpoint memory);

    /// @notice For each checkpoint, the total balance attributed to exited validators, in gwei
    ///
    /// NOTE that the values added to this mapping are NOT guaranteed to capture the entirety of a validator's
    /// exit - rather, they capture the total change in a validator's balance when a checkpoint shows their
    /// balance change from nonzero to zero. While a change from nonzero to zero DOES guarantee that a validator
    /// has been fully exited, it is possible that the magnitude of this change does not capture what is
    /// typically thought of as a "full exit."
    ///
    /// For example:
    /// 1. Consider a validator was last checkpointed at 32 ETH before exiting. Once the exit has been processed,
    /// it is expected that the validator's exited balance is calculated to be `32 ETH`.
    /// 2. However, before `startCheckpoint` is called, a deposit is made to the validator for 1 ETH. The beacon
    /// chain will automatically withdraw this ETH, but not until the withdrawal sweep passes over the validator
    /// again. Until this occurs, the validator's current balance (used for checkpointing) is 1 ETH.
    /// 3. If `startCheckpoint` is called at this point, the balance delta calculated for this validator will be
    /// `-31 ETH`, and because the validator has a nonzero balance, it is not marked WITHDRAWN.
    /// 4. After the exit is processed by the beacon chain, a subsequent `startCheckpoint` and checkpoint proof
    /// will calculate a balance delta of `-1 ETH` and attribute a 1 ETH exit to the validator.
    ///
    /// If this edge case impacts your usecase, it should be possible to mitigate this by monitoring for deposits
    /// to your exited validators, and waiting to call `startCheckpoint` until those deposits have been automatically
    /// exited.
    ///
    /// Additional edge cases this mapping does not cover:
    /// - If a validator is slashed, their balance exited will reflect their original balance rather than the slashed amount
    /// - The final partial withdrawal for an exited validator will be likely be included in this mapping.
    ///   i.e. if a validator was last checkpointed at 32.1 ETH before exiting, the next checkpoint will calculate their
    ///   "exited" amount to be 32.1 ETH rather than 32 ETH.
    function checkpointBalanceExitedGwei(uint64) external view returns (uint64);

    /// @notice Query the 4788 oracle to get the parent block root of the slot with the given `timestamp`
    /// @param timestamp of the block for which the parent block root will be returned. MUST correspond
    /// to an existing slot within the last 24 hours. If the slot at `timestamp` was skipped, this method
    /// will revert.
    function getParentBlockRoot(uint64 timestamp) external view returns (bytes32);
}

File 23 of 35 : IEigenPodManager.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

import "@openzeppelin/contracts/proxy/beacon/IBeacon.sol";
import "./IETHPOSDeposit.sol";
import "./IStrategyManager.sol";
import "./IEigenPod.sol";
import "./IPausable.sol";
import "./ISlasher.sol";
import "./IStrategy.sol";

/**
 * @title Interface for factory that creates and manages solo staking pods that have their withdrawal credentials pointed to EigenLayer.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 */

interface IEigenPodManager is IPausable {
    /// @notice Emitted to notify the deployment of an EigenPod
    event PodDeployed(address indexed eigenPod, address indexed podOwner);

    /// @notice Emitted to notify a deposit of beacon chain ETH recorded in the strategy manager
    event BeaconChainETHDeposited(address indexed podOwner, uint256 amount);

    /// @notice Emitted when the balance of an EigenPod is updated
    event PodSharesUpdated(address indexed podOwner, int256 sharesDelta);

    /// @notice Emitted when a withdrawal of beacon chain ETH is completed
    event BeaconChainETHWithdrawalCompleted(
        address indexed podOwner,
        uint256 shares,
        uint96 nonce,
        address delegatedAddress,
        address withdrawer,
        bytes32 withdrawalRoot
    );

    /**
     * @notice Creates an EigenPod for the sender.
     * @dev Function will revert if the `msg.sender` already has an EigenPod.
     * @dev Returns EigenPod address
     */
    function createPod() external returns (address);

    /**
     * @notice Stakes for a new beacon chain validator on the sender's EigenPod.
     * Also creates an EigenPod for the sender if they don't have one already.
     * @param pubkey The 48 bytes public key of the beacon chain validator.
     * @param signature The validator's signature of the deposit data.
     * @param depositDataRoot The root/hash of the deposit data for the validator's deposit.
     */
    function stake(
        bytes calldata pubkey,
        bytes calldata signature,
        bytes32 depositDataRoot
    ) external payable;

    /**
     * @notice Changes the `podOwner`'s shares by `sharesDelta` and performs a call to the DelegationManager
     * to ensure that delegated shares are also tracked correctly
     * @param podOwner is the pod owner whose balance is being updated.
     * @param sharesDelta is the change in podOwner's beaconChainETHStrategy shares
     * @dev Callable only by the podOwner's EigenPod contract.
     * @dev Reverts if `sharesDelta` is not a whole Gwei amount
     */
    function recordBeaconChainETHBalanceUpdate(address podOwner, int256 sharesDelta) external;

    /// @notice Returns the address of the `podOwner`'s EigenPod if it has been deployed.
    function ownerToPod(address podOwner) external view returns (IEigenPod);

    /// @notice Returns the address of the `podOwner`'s EigenPod (whether it is deployed yet or not).
    function getPod(address podOwner) external view returns (IEigenPod);

    /// @notice The ETH2 Deposit Contract
    function ethPOS() external view returns (IETHPOSDeposit);

    /// @notice Beacon proxy to which the EigenPods point
    function eigenPodBeacon() external view returns (IBeacon);

    /// @notice EigenLayer's StrategyManager contract
    function strategyManager() external view returns (IStrategyManager);

    /// @notice EigenLayer's Slasher contract
    function slasher() external view returns (ISlasher);

    /// @notice Returns 'true' if the `podOwner` has created an EigenPod, and 'false' otherwise.
    function hasPod(address podOwner) external view returns (bool);

    /// @notice Returns the number of EigenPods that have been created
    function numPods() external view returns (uint256);

    /**
     * @notice Mapping from Pod owner owner to the number of shares they have in the virtual beacon chain ETH strategy.
     * @dev The share amount can become negative. This is necessary to accommodate the fact that a pod owner's virtual beacon chain ETH shares can
     * decrease between the pod owner queuing and completing a withdrawal.
     * When the pod owner's shares would otherwise increase, this "deficit" is decreased first _instead_.
     * Likewise, when a withdrawal is completed, this "deficit" is decreased and the withdrawal amount is decreased; We can think of this
     * as the withdrawal "paying off the deficit".
     */
    function podOwnerShares(address podOwner) external view returns (int256);

    /// @notice returns canonical, virtual beaconChainETH strategy
    function beaconChainETHStrategy() external view returns (IStrategy);

    /**
     * @notice Used by the DelegationManager to remove a pod owner's shares while they're in the withdrawal queue.
     * Simply decreases the `podOwner`'s shares by `shares`, down to a minimum of zero.
     * @dev This function reverts if it would result in `podOwnerShares[podOwner]` being less than zero, i.e. it is forbidden for this function to
     * result in the `podOwner` incurring a "share deficit". This behavior prevents a Staker from queuing a withdrawal which improperly removes excessive
     * shares from the operator to whom the staker is delegated.
     * @dev Reverts if `shares` is not a whole Gwei amount
     */
    function removeShares(address podOwner, uint256 shares) external;

    /**
     * @notice Increases the `podOwner`'s shares by `shares`, paying off deficit if possible.
     * Used by the DelegationManager to award a pod owner shares on exiting the withdrawal queue
     * @dev Returns the number of shares added to `podOwnerShares[podOwner]` above zero, which will be less than the `shares` input
     * in the event that the podOwner has an existing shares deficit (i.e. `podOwnerShares[podOwner]` starts below zero)
     * @dev Reverts if `shares` is not a whole Gwei amount
     */
    function addShares(address podOwner, uint256 shares) external returns (uint256);

    /**
     * @notice Used by the DelegationManager to complete a withdrawal, sending tokens to some destination address
     * @dev Prioritizes decreasing the podOwner's share deficit, if they have one
     * @dev Reverts if `shares` is not a whole Gwei amount
     */
    function withdrawSharesAsTokens(address podOwner, address destination, uint256 shares) external;
}

File 24 of 35 : IPausable.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

import "../interfaces/IPauserRegistry.sol";

/**
 * @title Adds pausability to a contract, with pausing & unpausing controlled by the `pauser` and `unpauser` of a PauserRegistry contract.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 * @notice Contracts that inherit from this contract may define their own `pause` and `unpause` (and/or related) functions.
 * These functions should be permissioned as "onlyPauser" which defers to a `PauserRegistry` for determining access control.
 * @dev Pausability is implemented using a uint256, which allows up to 256 different single bit-flags; each bit can potentially pause different functionality.
 * Inspiration for this was taken from the NearBridge design here https://etherscan.io/address/0x3FEFc5A4B1c02f21cBc8D3613643ba0635b9a873#code.
 * For the `pause` and `unpause` functions we've implemented, if you pause, you can only flip (any number of) switches to on/1 (aka "paused"), and if you unpause,
 * you can only flip (any number of) switches to off/0 (aka "paused").
 * If you want a pauseXYZ function that just flips a single bit / "pausing flag", it will:
 * 1) 'bit-wise and' (aka `&`) a flag with the current paused state (as a uint256)
 * 2) update the paused state to this new value
 * @dev We note as well that we have chosen to identify flags by their *bit index* as opposed to their numerical value, so, e.g. defining `DEPOSITS_PAUSED = 3`
 * indicates specifically that if the *third bit* of `_paused` is flipped -- i.e. it is a '1' -- then deposits should be paused
 */

interface IPausable {
    /// @notice Emitted when the `pauserRegistry` is set to `newPauserRegistry`.
    event PauserRegistrySet(IPauserRegistry pauserRegistry, IPauserRegistry newPauserRegistry);

    /// @notice Emitted when the pause is triggered by `account`, and changed to `newPausedStatus`.
    event Paused(address indexed account, uint256 newPausedStatus);

    /// @notice Emitted when the pause is lifted by `account`, and changed to `newPausedStatus`.
    event Unpaused(address indexed account, uint256 newPausedStatus);

    /// @notice Address of the `PauserRegistry` contract that this contract defers to for determining access control (for pausing).
    function pauserRegistry() external view returns (IPauserRegistry);

    /**
     * @notice This function is used to pause an EigenLayer contract's functionality.
     * It is permissioned to the `pauser` address, which is expected to be a low threshold multisig.
     * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once.
     * @dev This function can only pause functionality, and thus cannot 'unflip' any bit in `_paused` from 1 to 0.
     */
    function pause(uint256 newPausedStatus) external;

    /**
     * @notice Alias for `pause(type(uint256).max)`.
     */
    function pauseAll() external;

    /**
     * @notice This function is used to unpause an EigenLayer contract's functionality.
     * It is permissioned to the `unpauser` address, which is expected to be a high threshold multisig or governance contract.
     * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once.
     * @dev This function can only unpause functionality, and thus cannot 'flip' any bit in `_paused` from 0 to 1.
     */
    function unpause(uint256 newPausedStatus) external;

    /// @notice Returns the current paused status as a uint256.
    function paused() external view returns (uint256);

    /// @notice Returns 'true' if the `indexed`th bit of `_paused` is 1, and 'false' otherwise
    function paused(uint8 index) external view returns (bool);

    /// @notice Allows the unpauser to set a new pauser registry
    function setPauserRegistry(IPauserRegistry newPauserRegistry) external;
}

File 25 of 35 : IPauserRegistry.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

/**
 * @title Interface for the `PauserRegistry` contract.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 */
interface IPauserRegistry {
    event PauserStatusChanged(address pauser, bool canPause);

    event UnpauserChanged(address previousUnpauser, address newUnpauser);

    /// @notice Mapping of addresses to whether they hold the pauser role.
    function isPauser(address pauser) external view returns (bool);

    /// @notice Unique address that holds the unpauser role. Capable of changing *both* the pauser and unpauser addresses.
    function unpauser() external view returns (address);
}

File 26 of 35 : IRewardsCoordinator.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.12;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./IStrategy.sol";
import "./IPauserRegistry.sol";

/**
 * @title Interface for the `IRewardsCoordinator` contract.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 * @notice Allows AVSs to make "Rewards Submissions", which get distributed amongst the AVSs' confirmed
 * Operators and the Stakers delegated to those Operators.
 * Calculations are performed based on the completed RewardsSubmission, with the results posted in
 * a Merkle root against which Stakers & Operators can make claims.
 */
interface IRewardsCoordinator {
    /// STRUCTS ///
    /**
     * @notice A linear combination of strategies and multipliers for AVSs to weigh
     * EigenLayer strategies.
     * @param strategy The EigenLayer strategy to be used for the rewards submission
     * @param multiplier The weight of the strategy in the rewards submission
     */
    struct StrategyAndMultiplier {
        IStrategy strategy;
        uint96 multiplier;
    }

    /**
     * Sliding Window for valid RewardsSubmission startTimestamp
     *
     * Scenario A: GENESIS_REWARDS_TIMESTAMP IS WITHIN RANGE
     *         <-----MAX_RETROACTIVE_LENGTH-----> t (block.timestamp) <---MAX_FUTURE_LENGTH--->
     *             <--------------------valid range for startTimestamp------------------------>
     *             ^
     *         GENESIS_REWARDS_TIMESTAMP
     *
     *
     * Scenario B: GENESIS_REWARDS_TIMESTAMP IS OUT OF RANGE
     *         <-----MAX_RETROACTIVE_LENGTH-----> t (block.timestamp) <---MAX_FUTURE_LENGTH--->
     *         <------------------------valid range for startTimestamp------------------------>
     *     ^
     * GENESIS_REWARDS_TIMESTAMP
     * @notice RewardsSubmission struct submitted by AVSs when making rewards for their operators and stakers
     * RewardsSubmission can be for a time range within the valid window for startTimestamp and must be within max duration.
     * See `createAVSRewardsSubmission()` for more details.
     * @param strategiesAndMultipliers The strategies and their relative weights
     * cannot have duplicate strategies and need to be sorted in ascending address order
     * @param token The rewards token to be distributed
     * @param amount The total amount of tokens to be distributed
     * @param startTimestamp The timestamp (seconds) at which the submission range is considered for distribution
     * could start in the past or in the future but within a valid range. See the diagram above.
     * @param duration The duration of the submission range in seconds. Must be <= MAX_REWARDS_DURATION
     */
    struct RewardsSubmission {
        StrategyAndMultiplier[] strategiesAndMultipliers;
        IERC20 token;
        uint256 amount;
        uint32 startTimestamp;
        uint32 duration;
    }

    /**
     * @notice A distribution root is a merkle root of the distribution of earnings for a given period.
     * The RewardsCoordinator stores all historical distribution roots so that earners can claim their earnings against older roots
     * if they wish but the merkle tree contains the cumulative earnings of all earners and tokens for a given period so earners (or their claimers if set)
     * only need to claim against the latest root to claim all available earnings.
     * @param root The merkle root of the distribution
     * @param rewardsCalculationEndTimestamp The timestamp (seconds) until which rewards have been calculated
     * @param activatedAt The timestamp (seconds) at which the root can be claimed against
     */
    struct DistributionRoot {
        bytes32 root;
        uint32 rewardsCalculationEndTimestamp;
        uint32 activatedAt;
    }

    /**
     * @notice Internal leaf in the merkle tree for the earner's account leaf
     * @param earner The address of the earner
     * @param earnerTokenRoot The merkle root of the earner's token subtree
     * Each leaf in the earner's token subtree is a TokenTreeMerkleLeaf
     */

    struct EarnerTreeMerkleLeaf {
        address earner;
        bytes32 earnerTokenRoot;
    }

    /**
     * @notice The actual leaves in the distribution merkle tree specifying the token earnings
     * for the respective earner's subtree. Each leaf is a claimable amount of a token for an earner.
     * @param token The token for which the earnings are being claimed
     * @param cumulativeEarnings The cumulative earnings of the earner for the token
     */
    struct TokenTreeMerkleLeaf {
        IERC20 token;
        uint256 cumulativeEarnings;
    }

    /**
     * @notice A claim against a distribution root called by an
     * earners claimer (could be the earner themselves). Each token claim will claim the difference
     * between the cumulativeEarnings of the earner and the cumulativeClaimed of the claimer.
     * Each claim can specify which of the earner's earned tokens they want to claim.
     * See `processClaim()` for more details.
     * @param rootIndex The index of the root in the list of DistributionRoots
     * @param earnerIndex The index of the earner's account root in the merkle tree
     * @param earnerTreeProof The proof of the earner's EarnerTreeMerkleLeaf against the merkle root
     * @param earnerLeaf The earner's EarnerTreeMerkleLeaf struct, providing the earner address and earnerTokenRoot
     * @param tokenIndices The indices of the token leaves in the earner's subtree
     * @param tokenTreeProofs The proofs of the token leaves against the earner's earnerTokenRoot
     * @param tokenLeaves The token leaves to be claimed
     * @dev The merkle tree is structured with the merkle root at the top and EarnerTreeMerkleLeaf as internal leaves
     * in the tree. Each earner leaf has its own subtree with TokenTreeMerkleLeaf as leaves in the subtree.
     * To prove a claim against a specified rootIndex(which specifies the distributionRoot being used),
     * the claim will first verify inclusion of the earner leaf in the tree against distributionRoots[rootIndex].root.
     * Then for each token, it will verify inclusion of the token leaf in the earner's subtree against the earner's earnerTokenRoot.
     */
    struct RewardsMerkleClaim {
        uint32 rootIndex;
        uint32 earnerIndex;
        bytes earnerTreeProof;
        EarnerTreeMerkleLeaf earnerLeaf;
        uint32[] tokenIndices;
        bytes[] tokenTreeProofs;
        TokenTreeMerkleLeaf[] tokenLeaves;
    }

    /// EVENTS ///

    /// @notice emitted when an AVS creates a valid RewardsSubmission
    event AVSRewardsSubmissionCreated(
        address indexed avs,
        uint256 indexed submissionNonce,
        bytes32 indexed rewardsSubmissionHash,
        RewardsSubmission rewardsSubmission
    );
    /// @notice emitted when a valid RewardsSubmission is created for all stakers by a valid submitter
    event RewardsSubmissionForAllCreated(
        address indexed submitter,
        uint256 indexed submissionNonce,
        bytes32 indexed rewardsSubmissionHash,
        RewardsSubmission rewardsSubmission
    );
    /// @notice rewardsUpdater is responsible for submiting DistributionRoots, only owner can set rewardsUpdater
    event RewardsUpdaterSet(address indexed oldRewardsUpdater, address indexed newRewardsUpdater);
    event RewardsForAllSubmitterSet(
        address indexed rewardsForAllSubmitter,
        bool indexed oldValue,
        bool indexed newValue
    );
    event ActivationDelaySet(uint32 oldActivationDelay, uint32 newActivationDelay);
    event GlobalCommissionBipsSet(uint16 oldGlobalCommissionBips, uint16 newGlobalCommissionBips);
    event ClaimerForSet(
        address indexed earner,
        address indexed oldClaimer,
        address indexed claimer
    );
    /// @notice rootIndex is the specific array index of the newly created root in the storage array
    event DistributionRootSubmitted(
        uint32 indexed rootIndex,
        bytes32 indexed root,
        uint32 indexed rewardsCalculationEndTimestamp,
        uint32 activatedAt
    );
    /// @notice root is one of the submitted distribution roots that was claimed against
    event RewardsClaimed(
        bytes32 root,
        address indexed earner,
        address indexed claimer,
        address indexed recipient,
        IERC20 token,
        uint256 claimedAmount
    );

    /*******************************************************************************
                            VIEW FUNCTIONS
    *******************************************************************************/

    /// @notice The address of the entity that can update the contract with new merkle roots
    function rewardsUpdater() external view returns (address);

    /**
     * @notice The interval in seconds at which the calculation for a RewardsSubmission distribution is done.
     * @dev Rewards Submission durations must be multiples of this interval.
     */
    function CALCULATION_INTERVAL_SECONDS() external view returns (uint32);

    /// @notice The maximum amount of time (seconds) that a RewardsSubmission can span over
    function MAX_REWARDS_DURATION() external view returns (uint32);

    /// @notice max amount of time (seconds) that a submission can start in the past
    function MAX_RETROACTIVE_LENGTH() external view returns (uint32);

    /// @notice max amount of time (seconds) that a submission can start in the future
    function MAX_FUTURE_LENGTH() external view returns (uint32);

    /// @notice absolute min timestamp (seconds) that a submission can start at
    function GENESIS_REWARDS_TIMESTAMP() external view returns (uint32);

    /// @notice Delay in timestamp (seconds) before a posted root can be claimed against
    function activationDelay() external view returns (uint32);

    /// @notice Mapping: earner => the address of the entity who can call `processClaim` on behalf of the earner
    function claimerFor(address earner) external view returns (address);

    /// @notice Mapping: claimer => token => total amount claimed
    function cumulativeClaimed(address claimer, IERC20 token) external view returns (uint256);

    /// @notice the commission for all operators across all avss
    function globalOperatorCommissionBips() external view returns (uint16);

    /// @notice the commission for a specific operator for a specific avs
    /// NOTE: Currently unused and simply returns the globalOperatorCommissionBips value but will be used in future release
    function operatorCommissionBips(address operator, address avs) external view returns (uint16);

    /// @notice return the hash of the earner's leaf
    function calculateEarnerLeafHash(
        EarnerTreeMerkleLeaf calldata leaf
    ) external pure returns (bytes32);

    /// @notice returns the hash of the earner's token leaf
    function calculateTokenLeafHash(
        TokenTreeMerkleLeaf calldata leaf
    ) external pure returns (bytes32);

    /// @notice returns 'true' if the claim would currently pass the check in `processClaims`
    /// but will revert if not valid
    function checkClaim(RewardsMerkleClaim calldata claim) external view returns (bool);

    /// @notice The timestamp until which RewardsSubmissions have been calculated
    function currRewardsCalculationEndTimestamp() external view returns (uint32);

    /// @notice loop through distribution roots from reverse and return hash
    function getRootIndexFromHash(bytes32 rootHash) external view returns (uint32);

    /// @notice returns the number of distribution roots posted
    function getDistributionRootsLength() external view returns (uint256);

    /*******************************************************************************
                            EXTERNAL FUNCTIONS 
    *******************************************************************************/

    /**
     * @notice Creates a new rewards submission on behalf of an AVS, to be split amongst the
     * set of stakers delegated to operators who are registered to the `avs`
     * @param rewardsSubmissions The rewards submissions being created
     * @dev Expected to be called by the ServiceManager of the AVS on behalf of which the submission is being made
     * @dev The duration of the `rewardsSubmission` cannot exceed `MAX_REWARDS_DURATION`
     * @dev The tokens are sent to the `RewardsCoordinator` contract
     * @dev Strategies must be in ascending order of addresses to check for duplicates
     * @dev This function will revert if the `rewardsSubmission` is malformed,
     * e.g. if the `strategies` and `weights` arrays are of non-equal lengths
     */
    function createAVSRewardsSubmission(RewardsSubmission[] calldata rewardsSubmissions) external;

    /**
     * @notice similar to `createAVSRewardsSubmission` except the rewards are split amongst *all* stakers
     * rather than just those delegated to operators who are registered to a single avs and is
     * a permissioned call based on isRewardsForAllSubmitter mapping.
     */
    function createRewardsForAllSubmission(RewardsSubmission[] calldata rewardsSubmission) external;

    /**
     * @notice Claim rewards against a given root (read from distributionRoots[claim.rootIndex]).
     * Earnings are cumulative so earners don't have to claim against all distribution roots they have earnings for,
     * they can simply claim against the latest root and the contract will calculate the difference between
     * their cumulativeEarnings and cumulativeClaimed. This difference is then transferred to recipient address.
     * @param claim The RewardsMerkleClaim to be processed.
     * Contains the root index, earner, token leaves, and required proofs
     * @param recipient The address recipient that receives the ERC20 rewards
     * @dev only callable by the valid claimer, that is
     * if claimerFor[claim.earner] is address(0) then only the earner can claim, otherwise only
     * claimerFor[claim.earner] can claim the rewards.
     */
    function processClaim(RewardsMerkleClaim calldata claim, address recipient) external;

    /**
     * @notice Creates a new distribution root. activatedAt is set to block.timestamp + activationDelay
     * @param root The merkle root of the distribution
     * @param rewardsCalculationEndTimestamp The timestamp (seconds) until which rewards have been calculated
     * @dev Only callable by the rewardsUpdater
     */
    function submitRoot(bytes32 root, uint32 rewardsCalculationEndTimestamp) external;

    /**
     * @notice Sets the address of the entity that can call `processClaim` on behalf of the earner (msg.sender)
     * @param claimer The address of the entity that can claim rewards on behalf of the earner
     * @dev Only callable by the `earner`
     */
    function setClaimerFor(address claimer) external;

    /**
     * @notice Sets the delay in timestamp before a posted root can be claimed against
     * @param _activationDelay Delay in timestamp (seconds) before a posted root can be claimed against
     * @dev Only callable by the contract owner
     */
    function setActivationDelay(uint32 _activationDelay) external;

    /**
     * @notice Sets the global commission for all operators across all avss
     * @param _globalCommissionBips The commission for all operators across all avss
     * @dev Only callable by the contract owner
     */
    function setGlobalOperatorCommission(uint16 _globalCommissionBips) external;

    /**
     * @notice Sets the permissioned `rewardsUpdater` address which can post new roots
     * @dev Only callable by the contract owner
     */
    function setRewardsUpdater(address _rewardsUpdater) external;

    /**
     * @notice Sets the permissioned `rewardsForAllSubmitter` address which can submit createRewardsForAllSubmission
     * @dev Only callable by the contract owner
     * @param _submitter The address of the rewardsForAllSubmitter
     * @param _newValue The new value for isRewardsForAllSubmitter
     */
    function setRewardsForAllSubmitter(address _submitter, bool _newValue) external;
}

File 27 of 35 : ISignatureUtils.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

/**
 * @title The interface for common signature utilities.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 */
interface ISignatureUtils {
    // @notice Struct that bundles together a signature and an expiration time for the signature. Used primarily for stack management.
    struct SignatureWithExpiry {
        // the signature itself, formatted as a single bytes object
        bytes signature;
        // the expiration timestamp (UTC) of the signature
        uint256 expiry;
    }

    // @notice Struct that bundles together a signature, a salt for uniqueness, and an expiration time for the signature. Used primarily for stack management.
    struct SignatureWithSaltAndExpiry {
        // the signature itself, formatted as a single bytes object
        bytes signature;
        // the salt used to generate the signature
        bytes32 salt;
        // the expiration timestamp (UTC) of the signature
        uint256 expiry;
    }
}

File 28 of 35 : ISlasher.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

import "./IStrategyManager.sol";
import "./IDelegationManager.sol";

/**
 * @title Interface for the primary 'slashing' contract for EigenLayer.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 * @notice See the `Slasher` contract itself for implementation details.
 */
interface ISlasher {
    // struct used to store information about the current state of an operator's obligations to middlewares they are serving
    struct MiddlewareTimes {
        // The update block for the middleware whose most recent update was earliest, i.e. the 'stalest' update out of all middlewares the operator is serving
        uint32 stalestUpdateBlock;
        // The latest 'serveUntilBlock' from all of the middleware that the operator is serving
        uint32 latestServeUntilBlock;
    }

    // struct used to store details relevant to a single middleware that an operator has opted-in to serving
    struct MiddlewareDetails {
        // the block at which the contract begins being able to finalize the operator's registration with the service via calling `recordFirstStakeUpdate`
        uint32 registrationMayBeginAtBlock;
        // the block before which the contract is allowed to slash the user
        uint32 contractCanSlashOperatorUntilBlock;
        // the block at which the middleware's view of the operator's stake was most recently updated
        uint32 latestUpdateBlock;
    }

    /// @notice Emitted when a middleware times is added to `operator`'s array.
    event MiddlewareTimesAdded(
        address operator,
        uint256 index,
        uint32 stalestUpdateBlock,
        uint32 latestServeUntilBlock
    );

    /// @notice Emitted when `operator` begins to allow `contractAddress` to slash them.
    event OptedIntoSlashing(address indexed operator, address indexed contractAddress);

    /// @notice Emitted when `contractAddress` signals that it will no longer be able to slash `operator` after the `contractCanSlashOperatorUntilBlock`.
    event SlashingAbilityRevoked(
        address indexed operator,
        address indexed contractAddress,
        uint32 contractCanSlashOperatorUntilBlock
    );

    /**
     * @notice Emitted when `slashingContract` 'freezes' the `slashedOperator`.
     * @dev The `slashingContract` must have permission to slash the `slashedOperator`, i.e. `canSlash(slasherOperator, slashingContract)` must return 'true'.
     */
    event OperatorFrozen(address indexed slashedOperator, address indexed slashingContract);

    /// @notice Emitted when `previouslySlashedAddress` is 'unfrozen', allowing them to again move deposited funds within EigenLayer.
    event FrozenStatusReset(address indexed previouslySlashedAddress);

    /**
     * @notice Gives the `contractAddress` permission to slash the funds of the caller.
     * @dev Typically, this function must be called prior to registering for a middleware.
     */
    function optIntoSlashing(address contractAddress) external;

    /**
     * @notice Used for 'slashing' a certain operator.
     * @param toBeFrozen The operator to be frozen.
     * @dev Technically the operator is 'frozen' (hence the name of this function), and then subject to slashing pending a decision by a human-in-the-loop.
     * @dev The operator must have previously given the caller (which should be a contract) the ability to slash them, through a call to `optIntoSlashing`.
     */
    function freezeOperator(address toBeFrozen) external;

    /**
     * @notice Removes the 'frozen' status from each of the `frozenAddresses`
     * @dev Callable only by the contract owner (i.e. governance).
     */
    function resetFrozenStatus(address[] calldata frozenAddresses) external;

    /**
     * @notice this function is a called by middlewares during an operator's registration to make sure the operator's stake at registration
     *         is slashable until serveUntil
     * @param operator the operator whose stake update is being recorded
     * @param serveUntilBlock the block until which the operator's stake at the current block is slashable
     * @dev adds the middleware's slashing contract to the operator's linked list
     */
    function recordFirstStakeUpdate(address operator, uint32 serveUntilBlock) external;

    /**
     * @notice this function is a called by middlewares during a stake update for an operator (perhaps to free pending withdrawals)
     *         to make sure the operator's stake at updateBlock is slashable until serveUntil
     * @param operator the operator whose stake update is being recorded
     * @param updateBlock the block for which the stake update is being recorded
     * @param serveUntilBlock the block until which the operator's stake at updateBlock is slashable
     * @param insertAfter the element of the operators linked list that the currently updating middleware should be inserted after
     * @dev insertAfter should be calculated offchain before making the transaction that calls this. this is subject to race conditions,
     *      but it is anticipated to be rare and not detrimental.
     */
    function recordStakeUpdate(
        address operator,
        uint32 updateBlock,
        uint32 serveUntilBlock,
        uint256 insertAfter
    ) external;

    /**
     * @notice this function is a called by middlewares during an operator's deregistration to make sure the operator's stake at deregistration
     *         is slashable until serveUntil
     * @param operator the operator whose stake update is being recorded
     * @param serveUntilBlock the block until which the operator's stake at the current block is slashable
     * @dev removes the middleware's slashing contract to the operator's linked list and revokes the middleware's (i.e. caller's) ability to
     * slash `operator` once `serveUntil` is reached
     */
    function recordLastStakeUpdateAndRevokeSlashingAbility(
        address operator,
        uint32 serveUntilBlock
    ) external;

    /// @notice The StrategyManager contract of EigenLayer
    function strategyManager() external view returns (IStrategyManager);

    /// @notice The DelegationManager contract of EigenLayer
    function delegation() external view returns (IDelegationManager);

    /**
     * @notice Used to determine whether `staker` is actively 'frozen'. If a staker is frozen, then they are potentially subject to
     * slashing of their funds, and cannot cannot deposit or withdraw from the strategyManager until the slashing process is completed
     * and the staker's status is reset (to 'unfrozen').
     * @param staker The staker of interest.
     * @return Returns 'true' if `staker` themselves has their status set to frozen, OR if the staker is delegated
     * to an operator who has their status set to frozen. Otherwise returns 'false'.
     */
    function isFrozen(address staker) external view returns (bool);

    /// @notice Returns true if `slashingContract` is currently allowed to slash `toBeSlashed`.
    function canSlash(address toBeSlashed, address slashingContract) external view returns (bool);

    /// @notice Returns the block until which `serviceContract` is allowed to slash the `operator`.
    function contractCanSlashOperatorUntilBlock(
        address operator,
        address serviceContract
    ) external view returns (uint32);

    /// @notice Returns the block at which the `serviceContract` last updated its view of the `operator`'s stake
    function latestUpdateBlock(
        address operator,
        address serviceContract
    ) external view returns (uint32);

    /// @notice A search routine for finding the correct input value of `insertAfter` to `recordStakeUpdate` / `_updateMiddlewareList`.
    function getCorrectValueForInsertAfter(
        address operator,
        uint32 updateBlock
    ) external view returns (uint256);

    /**
     * @notice Returns 'true' if `operator` can currently complete a withdrawal started at the `withdrawalStartBlock`, with `middlewareTimesIndex` used
     * to specify the index of a `MiddlewareTimes` struct in the operator's list (i.e. an index in `operatorToMiddlewareTimes[operator]`). The specified
     * struct is consulted as proof of the `operator`'s ability (or lack thereof) to complete the withdrawal.
     * This function will return 'false' if the operator cannot currently complete a withdrawal started at the `withdrawalStartBlock`, *or* in the event
     * that an incorrect `middlewareTimesIndex` is supplied, even if one or more correct inputs exist.
     * @param operator Either the operator who queued the withdrawal themselves, or if the withdrawing party is a staker who delegated to an operator,
     * this address is the operator *who the staker was delegated to* at the time of the `withdrawalStartBlock`.
     * @param withdrawalStartBlock The block number at which the withdrawal was initiated.
     * @param middlewareTimesIndex Indicates an index in `operatorToMiddlewareTimes[operator]` to consult as proof of the `operator`'s ability to withdraw
     * @dev The correct `middlewareTimesIndex` input should be computable off-chain.
     */
    function canWithdraw(
        address operator,
        uint32 withdrawalStartBlock,
        uint256 middlewareTimesIndex
    ) external returns (bool);

    /**
     * operator =>
     *  [
     *      (
     *          the least recent update block of all of the middlewares it's serving/served,
     *          latest time that the stake bonded at that update needed to serve until
     *      )
     *  ]
     */
    function operatorToMiddlewareTimes(
        address operator,
        uint256 arrayIndex
    ) external view returns (MiddlewareTimes memory);

    /// @notice Getter function for fetching `operatorToMiddlewareTimes[operator].length`
    function middlewareTimesLength(address operator) external view returns (uint256);

    /// @notice Getter function for fetching `operatorToMiddlewareTimes[operator][index].stalestUpdateBlock`.
    function getMiddlewareTimesIndexStalestUpdateBlock(
        address operator,
        uint32 index
    ) external view returns (uint32);

    /// @notice Getter function for fetching `operatorToMiddlewareTimes[operator][index].latestServeUntil`.
    function getMiddlewareTimesIndexServeUntilBlock(
        address operator,
        uint32 index
    ) external view returns (uint32);

    /// @notice Getter function for fetching `_operatorToWhitelistedContractsByUpdate[operator].size`.
    function operatorWhitelistedContractsLinkedListSize(
        address operator
    ) external view returns (uint256);

    /// @notice Getter function for fetching a single node in the operator's linked list (`_operatorToWhitelistedContractsByUpdate[operator]`).
    function operatorWhitelistedContractsLinkedListEntry(
        address operator,
        address node
    ) external view returns (bool, uint256, uint256);
}

File 29 of 35 : IStrategy.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

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

/**
 * @title Minimal interface for an `Strategy` contract.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 * @notice Custom `Strategy` implementations may expand extensively on this interface.
 */
interface IStrategy {
    /**
     * @notice Used to deposit tokens into this Strategy
     * @param token is the ERC20 token being deposited
     * @param amount is the amount of token being deposited
     * @dev This function is only callable by the strategyManager contract. It is invoked inside of the strategyManager's
     * `depositIntoStrategy` function, and individual share balances are recorded in the strategyManager as well.
     * @return newShares is the number of new shares issued at the current exchange ratio.
     */
    function deposit(IERC20 token, uint256 amount) external returns (uint256);

    /**
     * @notice Used to withdraw tokens from this Strategy, to the `recipient`'s address
     * @param recipient is the address to receive the withdrawn funds
     * @param token is the ERC20 token being transferred out
     * @param amountShares is the amount of shares being withdrawn
     * @dev This function is only callable by the strategyManager contract. It is invoked inside of the strategyManager's
     * other functions, and individual share balances are recorded in the strategyManager as well.
     */
    function withdraw(address recipient, IERC20 token, uint256 amountShares) external;

    /**
     * @notice Used to convert a number of shares to the equivalent amount of underlying tokens for this strategy.
     * @notice In contrast to `sharesToUnderlyingView`, this function **may** make state modifications
     * @param amountShares is the amount of shares to calculate its conversion into the underlying token
     * @return The amount of underlying tokens corresponding to the input `amountShares`
     * @dev Implementation for these functions in particular may vary significantly for different strategies
     */
    function sharesToUnderlying(uint256 amountShares) external returns (uint256);

    /**
     * @notice Used to convert an amount of underlying tokens to the equivalent amount of shares in this strategy.
     * @notice In contrast to `underlyingToSharesView`, this function **may** make state modifications
     * @param amountUnderlying is the amount of `underlyingToken` to calculate its conversion into strategy shares
     * @return The amount of underlying tokens corresponding to the input `amountShares`
     * @dev Implementation for these functions in particular may vary significantly for different strategies
     */
    function underlyingToShares(uint256 amountUnderlying) external returns (uint256);

    /**
     * @notice convenience function for fetching the current underlying value of all of the `user`'s shares in
     * this strategy. In contrast to `userUnderlyingView`, this function **may** make state modifications
     */
    function userUnderlying(address user) external returns (uint256);

    /**
     * @notice convenience function for fetching the current total shares of `user` in this strategy, by
     * querying the `strategyManager` contract
     */
    function shares(address user) external view returns (uint256);

    /**
     * @notice Used to convert a number of shares to the equivalent amount of underlying tokens for this strategy.
     * @notice In contrast to `sharesToUnderlying`, this function guarantees no state modifications
     * @param amountShares is the amount of shares to calculate its conversion into the underlying token
     * @return The amount of shares corresponding to the input `amountUnderlying`
     * @dev Implementation for these functions in particular may vary significantly for different strategies
     */
    function sharesToUnderlyingView(uint256 amountShares) external view returns (uint256);

    /**
     * @notice Used to convert an amount of underlying tokens to the equivalent amount of shares in this strategy.
     * @notice In contrast to `underlyingToShares`, this function guarantees no state modifications
     * @param amountUnderlying is the amount of `underlyingToken` to calculate its conversion into strategy shares
     * @return The amount of shares corresponding to the input `amountUnderlying`
     * @dev Implementation for these functions in particular may vary significantly for different strategies
     */
    function underlyingToSharesView(uint256 amountUnderlying) external view returns (uint256);

    /**
     * @notice convenience function for fetching the current underlying value of all of the `user`'s shares in
     * this strategy. In contrast to `userUnderlying`, this function guarantees no state modifications
     */
    function userUnderlyingView(address user) external view returns (uint256);

    /// @notice The underlying token for shares in this Strategy
    function underlyingToken() external view returns (IERC20);

    /// @notice The total number of extant shares in this Strategy
    function totalShares() external view returns (uint256);

    /// @notice Returns either a brief string explaining the strategy's goal & purpose, or a link to metadata that explains in more detail.
    function explanation() external view returns (string memory);
}

File 30 of 35 : IStrategyManager.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

import "./IStrategy.sol";
import "./ISlasher.sol";
import "./IDelegationManager.sol";
import "./IEigenPodManager.sol";

/**
 * @title Interface for the primary entrypoint for funds into EigenLayer.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 * @notice See the `StrategyManager` contract itself for implementation details.
 */
interface IStrategyManager {
    // Access to public vars - hack locally
    function stakerStrategyList(address staker, uint256 index) external view returns (IStrategy);
    function strategyIsWhitelistedForDeposit(IStrategy _strategy) external view returns (bool);

    /**
     * @notice Emitted when a new deposit occurs on behalf of `staker`.
     * @param staker Is the staker who is depositing funds into EigenLayer.
     * @param strategy Is the strategy that `staker` has deposited into.
     * @param token Is the token that `staker` deposited.
     * @param shares Is the number of new shares `staker` has been granted in `strategy`.
     */
    event Deposit(address staker, IERC20 token, IStrategy strategy, uint256 shares);

    /// @notice Emitted when `thirdPartyTransfersForbidden` is updated for a strategy and value by the owner
    event UpdatedThirdPartyTransfersForbidden(IStrategy strategy, bool value);

    /// @notice Emitted when the `strategyWhitelister` is changed
    event StrategyWhitelisterChanged(address previousAddress, address newAddress);

    /// @notice Emitted when a strategy is added to the approved list of strategies for deposit
    event StrategyAddedToDepositWhitelist(IStrategy strategy);

    /// @notice Emitted when a strategy is removed from the approved list of strategies for deposit
    event StrategyRemovedFromDepositWhitelist(IStrategy strategy);

    /**
     * @notice Deposits `amount` of `token` into the specified `strategy`, with the resultant shares credited to `msg.sender`
     * @param strategy is the specified strategy where deposit is to be made,
     * @param token is the denomination in which the deposit is to be made,
     * @param amount is the amount of token to be deposited in the strategy by the staker
     * @return shares The amount of new shares in the `strategy` created as part of the action.
     * @dev The `msg.sender` must have previously approved this contract to transfer at least `amount` of `token` on their behalf.
     * @dev Cannot be called by an address that is 'frozen' (this function will revert if the `msg.sender` is frozen).
     *
     * WARNING: Depositing tokens that allow reentrancy (eg. ERC-777) into a strategy is not recommended.  This can lead to attack vectors
     *          where the token balance and corresponding strategy shares are not in sync upon reentrancy.
     */
    function depositIntoStrategy(
        IStrategy strategy,
        IERC20 token,
        uint256 amount
    ) external returns (uint256 shares);

    /**
     * @notice Used for depositing an asset into the specified strategy with the resultant shares credited to `staker`,
     * who must sign off on the action.
     * Note that the assets are transferred out/from the `msg.sender`, not from the `staker`; this function is explicitly designed
     * purely to help one address deposit 'for' another.
     * @param strategy is the specified strategy where deposit is to be made,
     * @param token is the denomination in which the deposit is to be made,
     * @param amount is the amount of token to be deposited in the strategy by the staker
     * @param staker the staker that the deposited assets will be credited to
     * @param expiry the timestamp at which the signature expires
     * @param signature is a valid signature from the `staker`. either an ECDSA signature if the `staker` is an EOA, or data to forward
     * following EIP-1271 if the `staker` is a contract
     * @return shares The amount of new shares in the `strategy` created as part of the action.
     * @dev The `msg.sender` must have previously approved this contract to transfer at least `amount` of `token` on their behalf.
     * @dev A signature is required for this function to eliminate the possibility of griefing attacks, specifically those
     * targeting stakers who may be attempting to undelegate.
     * @dev Cannot be called if thirdPartyTransfersForbidden is set to true for this strategy
     *
     *  WARNING: Depositing tokens that allow reentrancy (eg. ERC-777) into a strategy is not recommended.  This can lead to attack vectors
     *          where the token balance and corresponding strategy shares are not in sync upon reentrancy
     */
    function depositIntoStrategyWithSignature(
        IStrategy strategy,
        IERC20 token,
        uint256 amount,
        address staker,
        uint256 expiry,
        bytes memory signature
    ) external returns (uint256 shares);

    /// @notice Used by the DelegationManager to remove a Staker's shares from a particular strategy when entering the withdrawal queue
    function removeShares(address staker, IStrategy strategy, uint256 shares) external;

    /// @notice Used by the DelegationManager to award a Staker some shares that have passed through the withdrawal queue
    function addShares(address staker, IERC20 token, IStrategy strategy, uint256 shares) external;

    /// @notice Used by the DelegationManager to convert withdrawn shares to tokens and send them to a recipient
    function withdrawSharesAsTokens(
        address recipient,
        IStrategy strategy,
        uint256 shares,
        IERC20 token
    ) external;

    /// @notice Returns the current shares of `user` in `strategy`
    function stakerStrategyShares(
        address user,
        IStrategy strategy
    ) external view returns (uint256 shares);

    /**
     * @notice Get all details on the staker's deposits and corresponding shares
     * @return (staker's strategies, shares in these strategies)
     */
    function getDeposits(
        address staker
    ) external view returns (IStrategy[] memory, uint256[] memory);

    /// @notice Simple getter function that returns `stakerStrategyList[staker].length`.
    function stakerStrategyListLength(address staker) external view returns (uint256);

    /**
     * @notice Owner-only function that adds the provided Strategies to the 'whitelist' of strategies that stakers can deposit into
     * @param strategiesToWhitelist Strategies that will be added to the `strategyIsWhitelistedForDeposit` mapping (if they aren't in it already)
     * @param thirdPartyTransfersForbiddenValues bool values to set `thirdPartyTransfersForbidden` to for each strategy
     */
    function addStrategiesToDepositWhitelist(
        IStrategy[] calldata strategiesToWhitelist,
        bool[] calldata thirdPartyTransfersForbiddenValues
    ) external;

    /**
     * @notice Owner-only function that removes the provided Strategies from the 'whitelist' of strategies that stakers can deposit into
     * @param strategiesToRemoveFromWhitelist Strategies that will be removed to the `strategyIsWhitelistedForDeposit` mapping (if they are in it)
     */
    function removeStrategiesFromDepositWhitelist(
        IStrategy[] calldata strategiesToRemoveFromWhitelist
    ) external;

    /// @notice Returns the single, central Delegation contract of EigenLayer
    function delegation() external view returns (IDelegationManager);

    /// @notice Returns the single, central Slasher contract of EigenLayer
    function slasher() external view returns (ISlasher);

    /// @notice Returns the EigenPodManager contract of EigenLayer
    function eigenPodManager() external view returns (IEigenPodManager);

    /// @notice Returns the address of the `strategyWhitelister`
    function strategyWhitelister() external view returns (address);

    /**
     * @notice Returns bool for whether or not `strategy` enables credit transfers. i.e enabling
     * depositIntoStrategyWithSignature calls or queueing withdrawals to a different address than the staker.
     */
    function thirdPartyTransfersForbidden(IStrategy strategy) external view returns (bool);

    // LIMITED BACKWARDS-COMPATIBILITY FOR DEPRECATED FUNCTIONALITY
    // packed struct for queued withdrawals; helps deal with stack-too-deep errors
    struct DeprecatedStruct_WithdrawerAndNonce {
        address withdrawer;
        uint96 nonce;
    }

    /**
     * Struct type used to specify an existing queued withdrawal. Rather than storing the entire struct, only a hash is stored.
     * In functions that operate on existing queued withdrawals -- e.g. `startQueuedWithdrawalWaitingPeriod` or `completeQueuedWithdrawal`,
     * the data is resubmitted and the hash of the submitted data is computed by `calculateWithdrawalRoot` and checked against the
     * stored hash in order to confirm the integrity of the submitted data.
     */
    struct DeprecatedStruct_QueuedWithdrawal {
        IStrategy[] strategies;
        uint256[] shares;
        address staker;
        DeprecatedStruct_WithdrawerAndNonce withdrawerAndNonce;
        uint32 withdrawalStartBlock;
        address delegatedAddress;
    }

    function migrateQueuedWithdrawal(
        DeprecatedStruct_QueuedWithdrawal memory queuedWithdrawal
    ) external returns (bool, bytes32);

    function calculateWithdrawalRoot(
        DeprecatedStruct_QueuedWithdrawal memory queuedWithdrawal
    ) external pure returns (bytes32);
}

File 31 of 35 : BeaconChainProofs.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.0;

import "./Merkle.sol";
import "../libraries/Endian.sol";

//Utility library for parsing and PHASE0 beacon chain block headers
//SSZ Spec: https://github.com/ethereum/consensus-specs/blob/dev/ssz/simple-serialize.md#merkleization
//BeaconBlockHeader Spec: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconblockheader
//BeaconState Spec: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconstate
library BeaconChainProofs {
    /// @notice Heights of various merkle trees in the beacon chain
    /// - beaconBlockRoot
    /// |                                             HEIGHT: BEACON_BLOCK_HEADER_TREE_HEIGHT
    /// -- beaconStateRoot
    /// |                                             HEIGHT: BEACON_STATE_TREE_HEIGHT
    /// validatorContainerRoot, balanceContainerRoot
    /// |                       |                     HEIGHT: BALANCE_TREE_HEIGHT
    /// |                       individual balances
    /// |                                             HEIGHT: VALIDATOR_TREE_HEIGHT
    /// individual validators
    uint256 internal constant BEACON_BLOCK_HEADER_TREE_HEIGHT = 3;
    uint256 internal constant BEACON_STATE_TREE_HEIGHT = 5;
    uint256 internal constant BALANCE_TREE_HEIGHT = 38;
    uint256 internal constant VALIDATOR_TREE_HEIGHT = 40;

    /// @notice Index of the beaconStateRoot in the `BeaconBlockHeader` container
    ///
    /// BeaconBlockHeader = [..., state_root, ...]
    ///                      0...      3
    ///
    /// (See https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconblockheader)
    uint256 internal constant STATE_ROOT_INDEX = 3;

    /// @notice Indices for fields in the `BeaconState` container
    ///
    /// BeaconState = [..., validators, balances, ...]
    ///                0...     11         12
    ///
    /// (See https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#beaconstate)
    uint256 internal constant VALIDATOR_CONTAINER_INDEX = 11;
    uint256 internal constant BALANCE_CONTAINER_INDEX = 12;

    /// @notice Number of fields in the `Validator` container
    /// (See https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator)
    uint256 internal constant VALIDATOR_FIELDS_LENGTH = 8;

    /// @notice Indices for fields in the `Validator` container
    uint256 internal constant VALIDATOR_PUBKEY_INDEX = 0;
    uint256 internal constant VALIDATOR_WITHDRAWAL_CREDENTIALS_INDEX = 1;
    uint256 internal constant VALIDATOR_BALANCE_INDEX = 2;
    uint256 internal constant VALIDATOR_SLASHED_INDEX = 3;
    uint256 internal constant VALIDATOR_EXIT_EPOCH_INDEX = 6;

    /// @notice Slot/Epoch timings
    uint64 internal constant SECONDS_PER_SLOT = 12;
    uint64 internal constant SLOTS_PER_EPOCH = 32;
    uint64 internal constant SECONDS_PER_EPOCH = SLOTS_PER_EPOCH * SECONDS_PER_SLOT;

    /// @notice `FAR_FUTURE_EPOCH` is used as the default value for certain `Validator`
    /// fields when a `Validator` is first created on the beacon chain
    uint64 internal constant FAR_FUTURE_EPOCH = type(uint64).max;
    bytes8 internal constant UINT64_MASK = 0xffffffffffffffff;

    /// @notice Contains a beacon state root and a merkle proof verifying its inclusion under a beacon block root
    struct StateRootProof {
        bytes32 beaconStateRoot;
        bytes proof;
    }

    /// @notice Contains a validator's fields and a merkle proof of their inclusion under a beacon state root
    struct ValidatorProof {
        bytes32[] validatorFields;
        bytes proof;
    }

    /// @notice Contains a beacon balance container root and a proof of this root under a beacon block root
    struct BalanceContainerProof {
        bytes32 balanceContainerRoot;
        bytes proof;
    }

    /// @notice Contains a validator balance root and a proof of its inclusion under a balance container root
    struct BalanceProof {
        bytes32 pubkeyHash;
        bytes32 balanceRoot;
        bytes proof;
    }

    /*******************************************************************************
                 VALIDATOR FIELDS -> BEACON STATE ROOT -> BEACON BLOCK ROOT
    *******************************************************************************/

    /// @notice Verify a merkle proof of the beacon state root against a beacon block root
    /// @param beaconBlockRoot merkle root of the beacon block
    /// @param proof the beacon state root and merkle proof of its inclusion under `beaconBlockRoot`
    function verifyStateRoot(bytes32 beaconBlockRoot, StateRootProof calldata proof) internal view {
        require(
            proof.proof.length == 32 * (BEACON_BLOCK_HEADER_TREE_HEIGHT),
            "BeaconChainProofs.verifyStateRoot: Proof has incorrect length"
        );

        /// This merkle proof verifies the `beaconStateRoot` under the `beaconBlockRoot`
        /// - beaconBlockRoot
        /// |                            HEIGHT: BEACON_BLOCK_HEADER_TREE_HEIGHT
        /// -- beaconStateRoot
        require(
            Merkle.verifyInclusionSha256({
                proof: proof.proof,
                root: beaconBlockRoot,
                leaf: proof.beaconStateRoot,
                index: STATE_ROOT_INDEX
            }),
            "BeaconChainProofs.verifyStateRoot: Invalid state root merkle proof"
        );
    }

    /// @notice Verify a merkle proof of a validator container against a `beaconStateRoot`
    /// @dev This proof starts at a validator's container root, proves through the validator container root,
    /// and continues proving to the root of the `BeaconState`
    /// @dev See https://eth2book.info/capella/part3/containers/dependencies/#validator for info on `Validator` containers
    /// @dev See https://eth2book.info/capella/part3/containers/state/#beaconstate for info on `BeaconState` containers
    /// @param beaconStateRoot merkle root of the `BeaconState` container
    /// @param validatorFields an individual validator's fields. These are merklized to form a `validatorRoot`,
    /// which is used as the leaf to prove against `beaconStateRoot`
    /// @param validatorFieldsProof a merkle proof of inclusion of `validatorFields` under `beaconStateRoot`
    /// @param validatorIndex the validator's unique index
    function verifyValidatorFields(
        bytes32 beaconStateRoot,
        bytes32[] calldata validatorFields,
        bytes calldata validatorFieldsProof,
        uint40 validatorIndex
    ) internal view {
        require(
            validatorFields.length == VALIDATOR_FIELDS_LENGTH,
            "BeaconChainProofs.verifyValidatorFields: Validator fields has incorrect length"
        );

        /// Note: the reason we use `VALIDATOR_TREE_HEIGHT + 1` here is because the merklization process for
        /// this container includes hashing the root of the validator tree with the length of the validator list
        require(
            validatorFieldsProof.length ==
                32 * ((VALIDATOR_TREE_HEIGHT + 1) + BEACON_STATE_TREE_HEIGHT),
            "BeaconChainProofs.verifyValidatorFields: Proof has incorrect length"
        );

        // Merkleize `validatorFields` to get the leaf to prove
        bytes32 validatorRoot = Merkle.merkleizeSha256(validatorFields);

        /// This proof combines two proofs, so its index accounts for the relative position of leaves in two trees:
        /// - beaconStateRoot
        /// |                            HEIGHT: BEACON_STATE_TREE_HEIGHT
        /// -- validatorContainerRoot
        /// |                            HEIGHT: VALIDATOR_TREE_HEIGHT + 1
        /// ---- validatorRoot
        uint256 index = (VALIDATOR_CONTAINER_INDEX << (VALIDATOR_TREE_HEIGHT + 1)) |
            uint256(validatorIndex);

        require(
            Merkle.verifyInclusionSha256({
                proof: validatorFieldsProof,
                root: beaconStateRoot,
                leaf: validatorRoot,
                index: index
            }),
            "BeaconChainProofs.verifyValidatorFields: Invalid merkle proof"
        );
    }

    /*******************************************************************************
             VALIDATOR BALANCE -> BALANCE CONTAINER ROOT -> BEACON BLOCK ROOT
    *******************************************************************************/

    /// @notice Verify a merkle proof of the beacon state's balances container against the beacon block root
    /// @dev This proof starts at the balance container root, proves through the beacon state root, and
    /// continues proving through the beacon block root. As a result, this proof will contain elements
    /// of a `StateRootProof` under the same block root, with the addition of proving the balances field
    /// within the beacon state.
    /// @dev This is used to make checkpoint proofs more efficient, as a checkpoint will verify multiple balances
    /// against the same balance container root.
    /// @param beaconBlockRoot merkle root of the beacon block
    /// @param proof a beacon balance container root and merkle proof of its inclusion under `beaconBlockRoot`
    function verifyBalanceContainer(
        bytes32 beaconBlockRoot,
        BalanceContainerProof calldata proof
    ) internal view {
        require(
            proof.proof.length == 32 * (BEACON_BLOCK_HEADER_TREE_HEIGHT + BEACON_STATE_TREE_HEIGHT),
            "BeaconChainProofs.verifyBalanceContainer: Proof has incorrect length"
        );

        /// This proof combines two proofs, so its index accounts for the relative position of leaves in two trees:
        /// - beaconBlockRoot
        /// |                            HEIGHT: BEACON_BLOCK_HEADER_TREE_HEIGHT
        /// -- beaconStateRoot
        /// |                            HEIGHT: BEACON_STATE_TREE_HEIGHT
        /// ---- balancesContainerRoot
        uint256 index = (STATE_ROOT_INDEX << (BEACON_STATE_TREE_HEIGHT)) | BALANCE_CONTAINER_INDEX;

        require(
            Merkle.verifyInclusionSha256({
                proof: proof.proof,
                root: beaconBlockRoot,
                leaf: proof.balanceContainerRoot,
                index: index
            }),
            "BeaconChainProofs.verifyBalanceContainer: invalid balance container proof"
        );
    }

    /// @notice Verify a merkle proof of a validator's balance against the beacon state's `balanceContainerRoot`
    /// @param balanceContainerRoot the merkle root of all validators' current balances
    /// @param validatorIndex the index of the validator whose balance we are proving
    /// @param proof the validator's associated balance root and a merkle proof of inclusion under `balanceContainerRoot`
    /// @return validatorBalanceGwei the validator's current balance (in gwei)
    function verifyValidatorBalance(
        bytes32 balanceContainerRoot,
        uint40 validatorIndex,
        BalanceProof calldata proof
    ) internal view returns (uint64 validatorBalanceGwei) {
        /// Note: the reason we use `BALANCE_TREE_HEIGHT + 1` here is because the merklization process for
        /// this container includes hashing the root of the balances tree with the length of the balances list
        require(
            proof.proof.length == 32 * (BALANCE_TREE_HEIGHT + 1),
            "BeaconChainProofs.verifyValidatorBalance: Proof has incorrect length"
        );

        /// When merkleized, beacon chain balances are combined into groups of 4 called a `balanceRoot`. The merkle
        /// proof here verifies that this validator's `balanceRoot` is included in the `balanceContainerRoot`
        /// - balanceContainerRoot
        /// |                            HEIGHT: BALANCE_TREE_HEIGHT
        /// -- balanceRoot
        uint256 balanceIndex = uint256(validatorIndex / 4);

        require(
            Merkle.verifyInclusionSha256({
                proof: proof.proof,
                root: balanceContainerRoot,
                leaf: proof.balanceRoot,
                index: balanceIndex
            }),
            "BeaconChainProofs.verifyValidatorBalance: Invalid merkle proof"
        );

        /// Extract the individual validator's balance from the `balanceRoot`
        return getBalanceAtIndex(proof.balanceRoot, validatorIndex);
    }

    /**
     * @notice Parses a balanceRoot to get the uint64 balance of a validator.
     * @dev During merkleization of the beacon state balance tree, four uint64 values are treated as a single
     * leaf in the merkle tree. We use validatorIndex % 4 to determine which of the four uint64 values to
     * extract from the balanceRoot.
     * @param balanceRoot is the combination of 4 validator balances being proven for
     * @param validatorIndex is the index of the validator being proven for
     * @return The validator's balance, in Gwei
     */
    function getBalanceAtIndex(
        bytes32 balanceRoot,
        uint40 validatorIndex
    ) internal pure returns (uint64) {
        uint256 bitShiftAmount = (validatorIndex % 4) * 64;
        return Endian.fromLittleEndianUint64(bytes32((uint256(balanceRoot) << bitShiftAmount)));
    }

    /// @notice Indices for fields in the `Validator` container:
    /// 0: pubkey
    /// 1: withdrawal credentials
    /// 2: effective balance
    /// 3: slashed?
    /// 4: activation elligibility epoch
    /// 5: activation epoch
    /// 6: exit epoch
    /// 7: withdrawable epoch
    ///
    /// (See https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator)

    /// @dev Retrieves a validator's pubkey hash
    function getPubkeyHash(bytes32[] memory validatorFields) internal pure returns (bytes32) {
        return validatorFields[VALIDATOR_PUBKEY_INDEX];
    }

    /// @dev Retrieves a validator's withdrawal credentials
    function getWithdrawalCredentials(
        bytes32[] memory validatorFields
    ) internal pure returns (bytes32) {
        return validatorFields[VALIDATOR_WITHDRAWAL_CREDENTIALS_INDEX];
    }

    /// @dev Retrieves a validator's effective balance (in gwei)
    function getEffectiveBalanceGwei(
        bytes32[] memory validatorFields
    ) internal pure returns (uint64) {
        return Endian.fromLittleEndianUint64(validatorFields[VALIDATOR_BALANCE_INDEX]);
    }

    /// @dev Retrieves true IFF a validator is marked slashed
    function isValidatorSlashed(bytes32[] memory validatorFields) internal pure returns (bool) {
        return validatorFields[VALIDATOR_SLASHED_INDEX] != 0;
    }

    /// @dev Retrieves a validator's exit epoch
    function getExitEpoch(bytes32[] memory validatorFields) internal pure returns (uint64) {
        return Endian.fromLittleEndianUint64(validatorFields[VALIDATOR_EXIT_EPOCH_INDEX]);
    }
}

File 32 of 35 : Endian.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

library Endian {
    /**
     * @notice Converts a little endian-formatted uint64 to a big endian-formatted uint64
     * @param lenum little endian-formatted uint64 input, provided as 'bytes32' type
     * @return n The big endian-formatted uint64
     * @dev Note that the input is formatted as a 'bytes32' type (i.e. 256 bits), but it is immediately truncated to a uint64 (i.e. 64 bits)
     * through a right-shift/shr operation.
     */
    function fromLittleEndianUint64(bytes32 lenum) internal pure returns (uint64 n) {
        // the number needs to be stored in little-endian encoding (ie in bytes 0-8)
        n = uint64(uint256(lenum >> 192));
        return
            (n >> 56) |
            ((0x00FF000000000000 & n) >> 40) |
            ((0x0000FF0000000000 & n) >> 24) |
            ((0x000000FF00000000 & n) >> 8) |
            ((0x00000000FF000000 & n) << 8) |
            ((0x0000000000FF0000 & n) << 24) |
            ((0x000000000000FF00 & n) << 40) |
            ((0x00000000000000FF & n) << 56);
    }
}

File 33 of 35 : Merkle.sol
// SPDX-License-Identifier: MIT
// Adapted from OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The tree and the proofs can be generated using our
 * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
 * You will find a quickstart guide in the readme.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 * OpenZeppelin's JavaScript library generates merkle trees that are safe
 * against this attack out of the box.
 */
library Merkle {
    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. The tree is built assuming `leaf` is
     * the 0 indexed `index`'th leaf from the bottom left of the tree.
     *
     * Note this is for a Merkle tree using the keccak/sha3 hash function
     */
    function verifyInclusionKeccak(
        bytes memory proof,
        bytes32 root,
        bytes32 leaf,
        uint256 index
    ) internal pure returns (bool) {
        return processInclusionProofKeccak(proof, leaf, index) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. The tree is built assuming `leaf` is
     * the 0 indexed `index`'th leaf from the bottom left of the tree.
     *
     * _Available since v4.4._
     *
     * Note this is for a Merkle tree using the keccak/sha3 hash function
     */
    function processInclusionProofKeccak(
        bytes memory proof,
        bytes32 leaf,
        uint256 index
    ) internal pure returns (bytes32) {
        require(
            proof.length != 0 && proof.length % 32 == 0,
            "Merkle.processInclusionProofKeccak: proof length should be a non-zero multiple of 32"
        );
        bytes32 computedHash = leaf;
        for (uint256 i = 32; i <= proof.length; i += 32) {
            if (index % 2 == 0) {
                // if ith bit of index is 0, then computedHash is a left sibling
                assembly {
                    mstore(0x00, computedHash)
                    mstore(0x20, mload(add(proof, i)))
                    computedHash := keccak256(0x00, 0x40)
                    index := div(index, 2)
                }
            } else {
                // if ith bit of index is 1, then computedHash is a right sibling
                assembly {
                    mstore(0x00, mload(add(proof, i)))
                    mstore(0x20, computedHash)
                    computedHash := keccak256(0x00, 0x40)
                    index := div(index, 2)
                }
            }
        }
        return computedHash;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. The tree is built assuming `leaf` is
     * the 0 indexed `index`'th leaf from the bottom left of the tree.
     *
     * Note this is for a Merkle tree using the sha256 hash function
     */
    function verifyInclusionSha256(
        bytes memory proof,
        bytes32 root,
        bytes32 leaf,
        uint256 index
    ) internal view returns (bool) {
        return processInclusionProofSha256(proof, leaf, index) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. The tree is built assuming `leaf` is
     * the 0 indexed `index`'th leaf from the bottom left of the tree.
     *
     * _Available since v4.4._
     *
     * Note this is for a Merkle tree using the sha256 hash function
     */
    function processInclusionProofSha256(
        bytes memory proof,
        bytes32 leaf,
        uint256 index
    ) internal view returns (bytes32) {
        require(
            proof.length != 0 && proof.length % 32 == 0,
            "Merkle.processInclusionProofSha256: proof length should be a non-zero multiple of 32"
        );
        bytes32[1] memory computedHash = [leaf];
        for (uint256 i = 32; i <= proof.length; i += 32) {
            if (index % 2 == 0) {
                // if ith bit of index is 0, then computedHash is a left sibling
                assembly {
                    mstore(0x00, mload(computedHash))
                    mstore(0x20, mload(add(proof, i)))
                    if iszero(staticcall(sub(gas(), 2000), 2, 0x00, 0x40, computedHash, 0x20)) {
                        revert(0, 0)
                    }
                    index := div(index, 2)
                }
            } else {
                // if ith bit of index is 1, then computedHash is a right sibling
                assembly {
                    mstore(0x00, mload(add(proof, i)))
                    mstore(0x20, mload(computedHash))
                    if iszero(staticcall(sub(gas(), 2000), 2, 0x00, 0x40, computedHash, 0x20)) {
                        revert(0, 0)
                    }
                    index := div(index, 2)
                }
            }
        }
        return computedHash[0];
    }

    /**
     @notice this function returns the merkle root of a tree created from a set of leaves using sha256 as its hash function
     @param leaves the leaves of the merkle tree
     @return The computed Merkle root of the tree.
     @dev A pre-condition to this function is that leaves.length is a power of two.  If not, the function will merkleize the inputs incorrectly.
     */
    function merkleizeSha256(bytes32[] memory leaves) internal pure returns (bytes32) {
        //there are half as many nodes in the layer above the leaves
        uint256 numNodesInLayer = leaves.length / 2;
        //create a layer to store the internal nodes
        bytes32[] memory layer = new bytes32[](numNodesInLayer);
        //fill the layer with the pairwise hashes of the leaves
        for (uint256 i = 0; i < numNodesInLayer; i++) {
            layer[i] = sha256(abi.encodePacked(leaves[2 * i], leaves[2 * i + 1]));
        }
        //the next layer above has half as many nodes
        numNodesInLayer /= 2;
        //while we haven't computed the root
        while (numNodesInLayer != 0) {
            //overwrite the first numNodesInLayer nodes in layer with the pairwise hashes of their children
            for (uint256 i = 0; i < numNodesInLayer; i++) {
                layer[i] = sha256(abi.encodePacked(layer[2 * i], layer[2 * i + 1]));
            }
            //the next layer above has half as many nodes
            numNodesInLayer /= 2;
        }
        //the first node in the layer is the root
        return layer[0];
    }
}

File 34 of 35 : Errors.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

/// @dev Error for 0x0 address inputs
error InvalidZeroInput();

/// @dev Error when owner tries to sweep 0 balance token
error InvalidZeroBalance();

/// @dev Error when strategy does not have specified underlying
error InvalidStrategy();

/// @dev Error when vault with same salt already created
error VaultAlreadyCreated();

/// @dev Error when vault is already delegated
error AlreadyDelegated();

/// @dev Error when strategy underlying token does not match vault underlying token
error InvalidUnderlyingToken();

/// @dev Error when invalid token amount is deposited
error InvalidTokenAmount();

/// @dev Error when withdrawer is not the claimer
error UnAuthorizedClaimer();

/// @dev Error when vault is not delegated to any Operator
error VaultNotDelegated();

/// @dev error when try to configure maxCooldownBlocksBasisPoints > 100%
error InvalidMaxCooldownBlocksBasisPoints();

/// @dev Error when vault owner tries to configure cooldown less than EigenLayer cooldown
error InvalidWithdrawalCooldown();

/// @dev Error when admin tried to update cooldown more than 50% of minCooldownBlocks
error ExceedMaxCooldownBlocks();

/// @dev Error when admin tries to update cooldown blocks before cooldownBlocksUpdateDelay
error EarlyCooldownBlocksUpdate();

/// @dev Error when user tries to claim withdrawRequest before cooldownBlocks
error EarlyClaim();

/// @dev Error when vault owner tries to track user initiated withdrawal through emergency tracking
error UserWithdrawalAlreadyTracked();

/// @dev Error when emergency tracking already tracked withdrawal
error WithdrawalAlreadyTracked();

/// @dev Error when emergency tracking already completed withdrawal
error WithdrawalAlreadyCompleted();

/// @dev Error when vault owner tries to complete invalid Withdrawal
error InvalidWithdrawal();

/// @dev Error when vault owner tries to configure more than 100% as fee
error InvalidFee();

/// @dev Error when vault owner tried to claim rewards without specifying rewards destination
error RewardsDestinationNotConfigured();

/// @dev Error when vault is paused
error VaultPaused();

/// @dev Error when non pauser tries to change pause state
error NotPauser();

/// @dev Error when vaultOwner tries to sweep LP token
error InvalidTokenSweep();

File 35 of 35 : EzRvaultStorage.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../EigenLayer/interfaces/IStrategy.sol";

abstract contract EzRVaultStorageV1 {
    struct UserWithdrawRequest {
        address withdrawer;
        uint256 lpTokenAmountLocked;
        uint256 createdAt;
    }

    /// @dev scale factor for underlying token as decimals
    uint8 public underlyingDecimals;

    /// @dev Underlying token for vault
    IERC20 public underlying;

    /// @dev EigenLayer Strategy for underlying token
    IStrategy public underlyingStrategy;

    /// @dev min vault cooldown blocks for user withdrawals
    uint256 public vaultCooldownBlocks;

    /// @dev tracks the block number at which cooldownBlocks got updated
    uint256 public cooldownBlocksUpdatedAt;

    /// @dev Track of token shares in withdraw queue of EigenLayer
    uint256 public queuedShares;

    /// @dev mapping to track withdraw request owner with withdrawalRoot key
    mapping(bytes32 => UserWithdrawRequest) public withdrawRequest;

    /// @dev mapping to track emergencyQueued withdrawals
    mapping(bytes32 => bool) public emergencyWithdrawal;

    /// @dev rewards fee on vault
    uint256 public vaultFee;

    /// @dev rewards fee destination specified by vaultOwner
    address public vaultFeeDestination;

    /// @dev destination for non underlying reward tokens
    address public vaultRewardsDestination;

    /// @dev track the pause status of vault
    bool public paused;

    /// @dev track the pauser account address
    address public pauser;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IStrategyManager","name":"_strategyManager","type":"address"},{"internalType":"contract IDelegationManager","name":"_delegationManager","type":"address"},{"internalType":"contract IRewardsCoordinator","name":"_rewardsCoordinator","type":"address"},{"internalType":"contract IERC20","name":"_eigen","type":"address"},{"internalType":"contract IERC20","name":"_bEigen","type":"address"},{"internalType":"uint256","name":"_protocolFee","type":"uint256"},{"internalType":"address","name":"_protocolTreasury","type":"address"},{"internalType":"uint256","name":"_maxCooldownBlocksBasisPoints","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyDelegated","type":"error"},{"inputs":[],"name":"EarlyClaim","type":"error"},{"inputs":[],"name":"EarlyCooldownBlocksUpdate","type":"error"},{"inputs":[],"name":"ExceedMaxCooldownBlocks","type":"error"},{"inputs":[],"name":"InvalidFee","type":"error"},{"inputs":[],"name":"InvalidMaxCooldownBlocksBasisPoints","type":"error"},{"inputs":[],"name":"InvalidStrategy","type":"error"},{"inputs":[],"name":"InvalidTokenAmount","type":"error"},{"inputs":[],"name":"InvalidTokenSweep","type":"error"},{"inputs":[],"name":"InvalidUnderlyingToken","type":"error"},{"inputs":[],"name":"InvalidWithdrawal","type":"error"},{"inputs":[],"name":"InvalidWithdrawalCooldown","type":"error"},{"inputs":[],"name":"InvalidZeroBalance","type":"error"},{"inputs":[],"name":"InvalidZeroInput","type":"error"},{"inputs":[],"name":"NotPauser","type":"error"},{"inputs":[],"name":"RewardsDestinationNotConfigured","type":"error"},{"inputs":[],"name":"UnAuthorizedClaimer","type":"error"},{"inputs":[],"name":"UserWithdrawalAlreadyTracked","type":"error"},{"inputs":[],"name":"VaultNotDelegated","type":"error"},{"inputs":[],"name":"VaultPaused","type":"error"},{"inputs":[],"name":"WithdrawalAlreadyCompleted","type":"error"},{"inputs":[],"name":"WithdrawalAlreadyTracked","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":"address","name":"delegateAddress","type":"address"}],"name":"DelegationAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"underlyingAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lpMinted","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"address","name":"delegatedTo","type":"address"},{"internalType":"address","name":"withdrawer","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint32","name":"startBlock","type":"uint32"},{"internalType":"contract IStrategy[]","name":"strategies","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"indexed":false,"internalType":"struct IDelegationManager.Withdrawal","name":"withdrawal","type":"tuple"}],"name":"EmergencyWithdrawalCompleted","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"address","name":"delegatedTo","type":"address"},{"internalType":"address","name":"withdrawer","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint32","name":"startBlock","type":"uint32"},{"internalType":"contract IStrategy[]","name":"strategies","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"indexed":false,"internalType":"struct IDelegationManager.Withdrawal","name":"withdrawal","type":"tuple"}],"name":"EmergencyWithdrawalTracked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"IncentiveDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"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":"bool","name":"paused","type":"bool"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPauser","type":"address"},{"indexed":false,"internalType":"address","name":"newPauser","type":"address"}],"name":"PauserUpdated","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":"uint256","name":"oldVaultCooldown","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newVaultCooldown","type":"uint256"}],"name":"VaultCooldownUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"withdrawalRoot","type":"bytes32"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"underlyingClaimAmount","type":"uint256"},{"components":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"address","name":"delegatedTo","type":"address"},{"internalType":"address","name":"withdrawer","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint32","name":"startBlock","type":"uint32"},{"internalType":"contract IStrategy[]","name":"strategies","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"indexed":false,"internalType":"struct IDelegationManager.Withdrawal","name":"withdrawal","type":"tuple"}],"name":"WithdrawRequestClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"withdrawRoot","type":"bytes32"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"address","name":"delegatedTo","type":"address"},{"indexed":false,"internalType":"address","name":"withdrawer","type":"address"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startBlock","type":"uint256"},{"indexed":false,"internalType":"contract IStrategy[]","name":"strategies","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"name":"WithdrawStarted","type":"event"},{"inputs":[],"name":"BALANCE_OFFSET","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BASIS_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"B_EIGEN","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EIGEN","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SEVEN_DAYS_BLOCKS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SHARE_OFFSET","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"address","name":"delegatedTo","type":"address"},{"internalType":"address","name":"withdrawer","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint32","name":"startBlock","type":"uint32"},{"internalType":"contract IStrategy[]","name":"strategies","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"internalType":"struct IDelegationManager.Withdrawal","name":"withdrawal","type":"tuple"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"address","name":"delegatedTo","type":"address"},{"internalType":"address","name":"withdrawer","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint32","name":"startBlock","type":"uint32"},{"internalType":"contract IStrategy[]","name":"strategies","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"internalType":"struct IDelegationManager.Withdrawal","name":"withdrawal","type":"tuple"}],"name":"completeEmergencyTrackedWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cooldownBlocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cooldownBlocksUpdatedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"delegationManager","outputs":[{"internalType":"contract IDelegationManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositIncentive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"address","name":"delegatedTo","type":"address"},{"internalType":"address","name":"withdrawer","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint32","name":"startBlock","type":"uint32"},{"internalType":"contract IStrategy[]","name":"strategies","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"internalType":"struct IDelegationManager.Withdrawal","name":"withdrawal","type":"tuple"}],"name":"emergencyTrackQueuedWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"emergencyWithdrawal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUnderlyingBalanceFromStrategy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"contract IERC20","name":"_underlying","type":"address"},{"internalType":"contract IStrategy","name":"_strategy","type":"address"},{"internalType":"address","name":"vaultOwner","type":"address"},{"internalType":"uint256","name":"_cooldownBlocks","type":"uint256"},{"internalType":"uint256","name":"_vaultFee","type":"uint256"},{"internalType":"address","name":"_vaultFeeDestination","type":"address"},{"internalType":"address","name":"_rewardsDestination","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxCooldownBlocksBasisPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauser","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"rootIndex","type":"uint32"},{"internalType":"uint32","name":"earnerIndex","type":"uint32"},{"internalType":"bytes","name":"earnerTreeProof","type":"bytes"},{"components":[{"internalType":"address","name":"earner","type":"address"},{"internalType":"bytes32","name":"earnerTokenRoot","type":"bytes32"}],"internalType":"struct IRewardsCoordinator.EarnerTreeMerkleLeaf","name":"earnerLeaf","type":"tuple"},{"internalType":"uint32[]","name":"tokenIndices","type":"uint32[]"},{"internalType":"bytes[]","name":"tokenTreeProofs","type":"bytes[]"},{"components":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"cumulativeEarnings","type":"uint256"}],"internalType":"struct IRewardsCoordinator.TokenTreeMerkleLeaf[]","name":"tokenLeaves","type":"tuple[]"}],"internalType":"struct IRewardsCoordinator.RewardsMerkleClaim","name":"_claim","type":"tuple"}],"name":"processRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"protocolFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolTreasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"queuedShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardsCoordinator","outputs":[{"internalType":"contract IRewardsCoordinator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"scaleFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_cooldownBlocks","type":"uint256"}],"name":"setCooldownBlocks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_delegateAddress","type":"address"},{"components":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint256","name":"expiry","type":"uint256"}],"internalType":"struct ISignatureUtils.SignatureWithExpiry","name":"approverSignatureAndExpiry","type":"tuple"},{"internalType":"bytes32","name":"approverSalt","type":"bytes32"}],"name":"setDelegateAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_pauser","type":"address"}],"name":"setPauser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategyManager","outputs":[{"internalType":"contract IStrategyManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"sweepERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlyingDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlyingStrategy","outputs":[{"internalType":"contract IStrategy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultCooldownBlocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultFeeDestination","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vaultRewardsDestination","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"withdrawRequest","outputs":[{"internalType":"address","name":"withdrawer","type":"address"},{"internalType":"uint256","name":"lpTokenAmountLocked","type":"uint256"},{"internalType":"uint256","name":"createdAt","type":"uint256"}],"stateMutability":"view","type":"function"}]

6101806040523480156200001257600080fd5b506040516200524938038062005249833981016040819052620000359162000245565b6001600160a01b03881615806200005357506001600160a01b038716155b806200006657506001600160a01b038616155b806200007957506001600160a01b038516155b806200008c57506001600160a01b038416155b8062000096575082155b80620000a957506001600160a01b038216155b80620000b3575080155b15620000d25760405163862a606760e01b815260040160405180910390fd5b612710831115620000f6576040516358d620b360e01b815260040160405180910390fd5b6127108111156200011a5760405163acd519f360e01b815260040160405180910390fd5b6001600160a01b0380891660805287811660a05286811660c0526101208490528281166101405261016082905285811660e0528416610100526200015d6200016b565b5050505050505050620002ee565b600054610100900460ff1615620001d85760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116146200022a576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6001600160a01b03811681146200024257600080fd5b50565b600080600080600080600080610100898b0312156200026357600080fd5b885162000270816200022c565b60208a015190985062000283816200022c565b60408a015190975062000296816200022c565b60608a0151909650620002a9816200022c565b60808a0151909550620002bc816200022c565b60a08a015160c08b01519195509350620002d6816200022c565b8092505060e089015190509295985092959890939650565b60805160a05160c05160e05161010051610120516101405161016051614e2a6200041f600039600081816108030152610bbe01526000818161059e01526137ad01526000818161069c01528181611c4c015261376d01526000818161067501528181611d740152611daf01526000818161083d0152611d390152600081816105e901526124c60152600081816107dc0152818161097a01528181610a1401528181610b0a01528181610d6001528181610f4a01528181610fc301528181611107015281816112ab01528181611354015281816115360152818161160d0152818161185101528181611f5301528181612174015281816127070152818161281f01528181612a070152612afc0152600081816104b001528181611caf0152818161335001526133ae0152614e2a6000f3fe608060405234801561001057600080fd5b50600436106103835760003560e01c8063843eeecd116101de578063b86687381161010f578063e00af4a7116100ad578063ea4d3c9b1161007c578063ea4d3c9b146107d7578063efea6da7146107fe578063f2fde38b14610825578063fdc371ce1461083857600080fd5b8063e00af4a714610795578063e1467e85146107a8578063e1f1c4a7146107bb578063e58837df146107c457600080fd5b8063d6324e60116100e9578063d6324e6014610753578063d83ad00c14610766578063d9a90a8e1461076f578063dd62ed3e1461078257600080fd5b8063b8668738146106e4578063ba285bd1146106ec578063c7539659146106f557600080fd5b8063a457c2d71161017c578063ad93b4b711610156578063ad93b4b7146103e4578063b0e21e8a14610697578063b6954532146106be578063b6b55f25146106d157600080fd5b8063a457c2d71461064a578063a9059cbb1461065d578063ab5a851b1461067057600080fd5b80638c01d542116101b85780638c01d5421461060b5780638da5cb5b1461061e57806395d89b411461062f5780639fd0506d1461063757600080fd5b8063843eeecd146105c95780638456cb59146105dc5780638a2fc4e3146105e457600080fd5b806339b70e38116102b8578063683dd1911161025657806370a082311161023057806370a0823114610568578063715018a614610591578063803db96d146105995780638105165b146105c057600080fd5b8063683dd191146105255780636f307dc31461052d5780636fbec0cd1461054557600080fd5b806359f6adc71161029257806359f6adc7146104ed5780635c975abb1461050057806360cd4a6014610514578063679aefce1461051d57600080fd5b806339b70e38146104ab5780633f4ba83a146104d25780635361477b146104da57600080fd5b806323b872dd116103255780632d88af4a116102ff5780632d88af4a146104675780632e1a7d4d1461047a578063313ce5671461048d578063395093511461049857600080fd5b806323b872dd1461040a57806325a760c21461041d5780632819c2d21461043c57600080fd5b80630baa9ed6116103615780630baa9ed6146103dc578063101395fa146103e457806314626dc6146103ed57806318160ddd1461040257600080fd5b806301ac145b1461038857806306fdde03146103a4578063095ea7b3146103b9575b600080fd5b61039160d05481565b6040519081526020015b60405180910390f35b6103ac61085f565b60405161039b9190613c30565b6103cc6103c7366004613c63565b6108f1565b604051901515815260200161039b565b61039161090b565b6103916103e881565b6104006103fb366004613c8f565b610a90565b005b603554610391565b6103cc610418366004613ca8565b610c78565b60c95461042a9060ff1681565b60405160ff909116815260200161039b565b60d25461044f906001600160a01b031681565b6040516001600160a01b03909116815260200161039b565b610400610475366004613ce9565b610c9e565b610391610488366004613c8f565b610d36565b60c95460ff1661042a565b6103cc6104a6366004613c63565b6111e6565b61044f7f000000000000000000000000000000000000000000000000000000000000000081565b610400611208565b6104006104e8366004613ded565b611254565b6104006104fb366004613c8f565b61140b565b60d2546103cc90600160a01b900460ff1681565b61039160cb5481565b610391611498565b6103916114e6565b60c95461044f9061010090046001600160a01b031681565b6103cc610553366004613c8f565b60cf6020526000908152604090205460ff1681565b610391610576366004613ce9565b6001600160a01b031660009081526033602052604090205490565b6104006114fa565b61044f7f000000000000000000000000000000000000000000000000000000000000000081565b61039161c4e081565b6104006105d7366004613e96565b61150e565b6104006119cf565b61044f7f000000000000000000000000000000000000000000000000000000000000000081565b60d15461044f906001600160a01b031681565b6065546001600160a01b031661044f565b6103ac611a57565b60d35461044f906001600160a01b031681565b6103cc610658366004613c63565b611a66565b6103cc61066b366004613c63565b611af1565b61044f7f000000000000000000000000000000000000000000000000000000000000000081565b6103917f000000000000000000000000000000000000000000000000000000000000000081565b6104006106cc366004613ef0565b611aff565b6103916106df366004613c8f565b61214a565b61039161231a565b61039160cc5481565b61072e610703366004613c8f565b60ce602052600090815260409020805460018201546002909201546001600160a01b03909116919083565b604080516001600160a01b03909416845260208401929092529082015260600161039b565b60ca5461044f906001600160a01b031681565b61039160cd5481565b61040061077d366004613fbe565b61247e565b610391610790366004613ff9565b6125d0565b6104006107a3366004613ce9565b6125fb565b6104006107b6366004614138565b6126e5565b61039161271081565b6104006107d2366004614138565b612991565b61044f7f000000000000000000000000000000000000000000000000000000000000000081565b6103917f000000000000000000000000000000000000000000000000000000000000000081565b610400610833366004613ce9565b612c16565b61044f7f000000000000000000000000000000000000000000000000000000000000000081565b60606036805461086e90614216565b80601f016020809104026020016040519081016040528092919081815260200182805461089a90614216565b80156108e75780601f106108bc576101008083540402835291602001916108e7565b820191906000526020600020905b8154815290600101906020018083116108ca57829003601f168201915b5050505050905090565b6000336108ff818585612c8c565b60019150505b92915050565b60408051600180825281830190925260009182919060208083019080368337505060ca5482519293506001600160a01b03169183915060009061095057610950614250565b6001600160a01b03928316602091820292909201015260cb54604051630449ca3960e01b815290917f00000000000000000000000000000000000000000000000000000000000000001690630449ca39906109af9085906004016142aa565b602060405180830381865afa1580156109cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f091906142bd565b116109fd5760cb54610a8a565b604051630449ca3960e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630449ca3990610a499084906004016142aa565b602060405180830381865afa158015610a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8a91906142bd565b91505090565b610a98612db0565b610aa0612e09565b60408051600180825281830190925260009160208083019080368337505060ca5482519293506001600160a01b031691839150600090610ae257610ae2614250565b6001600160a01b039283166020918202929092010152604051630449ca3960e01b81526000917f00000000000000000000000000000000000000000000000000000000000000001690630449ca3990610b3f9085906004016142aa565b602060405180830381865afa158015610b5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8091906142bd565b905080831080610b8e575082155b15610bac57604051630130feaf60e01b815260040160405180910390fd5b80831115610c24576000612710610be37f0000000000000000000000000000000000000000000000000000000000000000846142ec565b610bed9190614303565b610bf79083614325565b905080841115610c1a57604051636108fcdb60e11b815260040160405180910390fd5b610c22612e63565b505b60cb5460408051918252602082018590527fea142c60fe44885a5d85aaac36e42beaab40f1e0c956960d5b9d3422b5d1c535910160405180910390a1505060cb8190554360cc55610c756001609755565b50565b600033610c86858285612ea6565b610c91858585612f20565b60019150505b9392505050565b610ca6612e09565b6001600160a01b038116610ccd5760405163862a606760e01b815260040160405180910390fd5b60d354604080516001600160a01b03928316815291831660208301527f1ff153f4b082245afbf3211a8d2d207da4c5df490e965f9a9ad141b0cd001dda910160405180910390a160d380546001600160a01b0319166001600160a01b0392909216919091179055565b6000610d40612db0565b604051631976849960e21b81523060048201526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906365da126490602401602060405180830381865afa158015610da7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcb9190614338565b6001600160a01b031603610df257604051635add22c560e01b815260040160405180910390fd5b60d254600160a01b900460ff1615610e1d576040516336a7e2cd60e21b815260040160405180910390fd5b81600003610e3e5760405163862a606760e01b815260040160405180910390fd5b6040516323b872dd60e01b8152336004820152306024820181905260448201849052906323b872dd906064016020604051808303816000875af1158015610e89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ead9190614355565b506000610eb86114e6565b610ec0611498565b610eca90856142ec565b610ed49190614303565b90506000610ee1826130cb565b905080600081518110610ef657610ef6614250565b602002602001015160200151600081518110610f1457610f14614250565b602002602001015160cd6000828254610f2d9190614325565b909155505060405163285e212160e21b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a178848490602401602060405180830381865afa158015610f99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbd91906142bd565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dd8dd02846040518263ffffffff1660e01b815260040161100d91906143a7565b6000604051808303816000875af115801561102c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110549190810190614441565b60008151811061106657611066614250565b60209081029190910181015160408051606081018252338082528185018b815243838501908152600086815260ce90975295849020925183546001600160a01b0319166001600160a01b039182161784559051600184015594516002909201919091559051631976849960e21b815230600482018190529294507f0176007ec78c756143be1d2a6feec53fd9e31d37037259af455e8cfc1cb33811938593917f0000000000000000000000000000000000000000000000000000000000000000909116906365da126490602401602060405180830381865afa158015611150573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111749190614338565b3087438a60008151811061118a5761118a614250565b6020026020010151600001518b6000815181106111a9576111a9614250565b6020026020010151602001516040516111ca999897969594939291906144c6565b60405180910390a193505050506111e16001609755565b919050565b6000336108ff8185856111f983836125d0565b6112039190614325565b612c8c565b611210612e09565b60d2805460ff60a01b19169055604051600081527f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd2906020015b60405180910390a1565b61125c612db0565b611264612e09565b6001600160a01b03831661128b5760405163862a606760e01b815260040160405180910390fd5b604051631976849960e21b81523060048201526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906365da126490602401602060405180830381865afa1580156112f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113169190614338565b6001600160a01b03161461133d57604051631a30c08d60e31b815260040160405180910390fd5b60405163eea9064b60e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063eea9064b9061138d90869086908690600401614549565b600060405180830381600087803b1580156113a757600080fd5b505af11580156113bb573d6000803e3d6000fd5b50506040516001600160a01b03861681527ffe608947467beb30a90e072fd2fc7d52baecf0935f542011fcd8fa6362a5d5b39250602001905060405180910390a16114066001609755565b505050565b611413612db0565b806000036114345760405163862a606760e01b815260040160405180910390fd5b60c9546114519061010090046001600160a01b03163330846132cb565b61145a81613336565b506040518181527fb02f19427b6324e7102facbe680a13b90e2424617afe32d862c9edf6dfaa83709060200160405180910390a1610c756001609755565b60006103e86114a660355490565b6114b09190614325565b6114b86114e6565b6103e86114c361231a565b6114cd9190614325565b6114d791906142ec565b6114e19190614303565b905090565b60c9546000906114e19060ff16600a61466e565b611502612e09565b61150c600061341d565b565b611516612db0565b604051631976849960e21b81523060048201526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906365da126490602401602060405180830381865afa15801561157d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a19190614338565b6001600160a01b0316036115c857604051635add22c560e01b815260040160405180910390fd5b60d254600160a01b900460ff16156115f3576040516336a7e2cd60e21b815260040160405180910390fd5b604051632cbd9b6d60e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063597b36da906116429085906004016147f2565b602060405180830381865afa15801561165f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168391906142bd565b600081815260ce60205260409020549091506001600160a01b0316331415806116aa575033155b156116c857604051630bdbeed760e31b815260040160405180910390fd5b6116d061090b565b600082815260ce60205260409020600201546116ec9043614805565b101561170b576040516315844b9560e11b815260040160405180910390fd5b6040805160018082528183019092526000916020808301908036833701905050905060c960019054906101000a90046001600160a01b03168160008151811061175657611756614250565b6001600160a01b03909216602092830291909101820152600083815260ce909152604090206001015461178a90309061346f565b61179760c0840184614818565b60008181106117a8576117a8614250565b9050602002013560cd60008282546117c09190614805565b909155505060c9546040516370a0823160e01b815230600482015260009161010090046001600160a01b0316906370a0823190602401602060405180830381865afa158015611813573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183791906142bd565b6040516360d7faed60e01b81529091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906360d7faed9061188e9087908690600090600190600401614861565b600060405180830381600087803b1580156118a857600080fd5b505af11580156118bc573d6000803e3d6000fd5b505060c9546040516370a0823160e01b8152306004820152600093508492506101009091046001600160a01b0316906370a0823190602401602060405180830381865afa158015611911573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193591906142bd565b61193f9190614805565b60c95490915061195e9061010090046001600160a01b031633836135a3565b7f8cc13279d432798ff883698cc787fdd496411d0d094093602f07fe03f087079084338388604051611993949392919061489f565b60405180910390a1505050600090815260ce6020526040812080546001600160a01b03191681556001810182905560020155610c756001609755565b6065546001600160a01b031633148015906119f5575060d3546001600160a01b03163314155b15611a135760405163492f678160e01b815260040160405180910390fd5b60d2805460ff60a01b1916600160a01b179055604051600181527f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd29060200161124a565b60606037805461086e90614216565b60003381611a7482866125d0565b905083811015611ad95760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b611ae68286868403612c8c565b506001949350505050565b6000336108ff818585612f20565b600054610100900460ff1615808015611b1f5750600054600160ff909116105b80611b395750303b158015611b39575060005460ff166001145b611b9c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611ad0565b6000805460ff191660011790558015611bbf576000805461ff0019166101001790555b6001600160a01b0388161580611bdc57506001600160a01b038716155b80611bee57506001600160a01b038616155b80611c0057506001600160a01b038316155b80611c1257506001600160a01b038216155b80611c1c57508951155b80611c2657508851155b15611c445760405163862a606760e01b815260040160405180910390fd5b612710611c717f000000000000000000000000000000000000000000000000000000000000000086614325565b1115611c90576040516358d620b360e01b815260040160405180910390fd5b60405163198f077960e21b81526001600160a01b0388811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063663c1de490602401602060405180830381865afa158015611cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d1a9190614355565b611d3757604051632711b74d60e11b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316886001600160a01b03161480611da857507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316886001600160a01b0316145b15611e65577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316876001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e399190614338565b6001600160a01b031614611e60576040516317dc37cb60e11b815260040160405180910390fd5b611ef8565b876001600160a01b0316876001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ed19190614338565b6001600160a01b031614611ef8576040516317dc37cb60e11b815260040160405180910390fd5b604080516001808252818301909252600091602080830190803683370190505090508781600081518110611f2e57611f2e614250565b6001600160a01b039283166020918202929092010152604051630449ca3960e01b81527f000000000000000000000000000000000000000000000000000000000000000090911690630449ca3990611f8a9084906004016142aa565b602060405180830381865afa158015611fa7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fcb91906142bd565b861015611feb57604051630130feaf60e01b815260040160405180910390fd5b611ff58b8b6135d3565b611ffd613604565b6120068761341d565b60c98054610100600160a81b0319166101006001600160a01b038c81169182029290921790925560ca80546001600160a01b031916918b169190911790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa15801561207f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a391906148cc565b60c9805460ff9290921660ff199092169190911790555060cb8590554360cc5560d084905560d180546001600160a01b038086166001600160a01b03199283161790925560d2805492851692909116919091179055801561213e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b6000612154612db0565b604051631976849960e21b81523060048201526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906365da126490602401602060405180830381865afa1580156121bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121df9190614338565b6001600160a01b03160361220657604051635add22c560e01b815260040160405180910390fd5b60d254600160a01b900460ff1615612231576040516336a7e2cd60e21b815260040160405180910390fd5b816000036122525760405163862a606760e01b815260040160405180910390fd5b60c95461226f9061010090046001600160a01b03163330856132cb565b6000612279611498565b6122816114e6565b61228b90856142ec565b6122959190614303565b9050806000036122b857604051632160733960e01b815260040160405180910390fd5b6122c23382613633565b6122cb83613336565b60408051338152602081018690529081018390529092507f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159060600160405180910390a1506111e16001609755565b600060cd546000146124125760ca5460cd54604051637a8b263760e01b81526001600160a01b0390921691637a8b26379161235b9160040190815260200190565b602060405180830381865afa158015612378573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239c91906142bd565b60ca54604051630aa794bf60e31b81523060048201526001600160a01b039091169063553ca5f890602401602060405180830381865afa1580156123e4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061240891906142bd565b6114e19190614325565b60ca54604051630aa794bf60e31b81523060048201526001600160a01b039091169063553ca5f890602401602060405180830381865afa15801561245a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e191906142bd565b612486612e09565b60d2546001600160a01b03166124af57604051630cd4f69d60e01b815260040160405180910390fd5b604051633ccc861d60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690633ccc861d906124fd9084903090600401614aa4565b600060405180830381600087803b15801561251757600080fd5b505af115801561252b573d6000803e3d6000fd5b5050505060005b61253f60e0830183614b9d565b90508110156125cc57600061258561255a60e0850185614b9d565b8481811061256a5761256a614250565b6125809260206040909202019081019150613ce9565b6136f4565b90506125c361259760e0850185614b9d565b848181106125a7576125a7614250565b6125bd9260206040909202019081019150613ce9565b82613829565b50600101612532565b5050565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b612603612db0565b61260b612e09565b306001600160a01b0382160361263457604051631b533c7560e11b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561267b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269f91906142bd565b9050806000036126c257604051630e3b112360e01b815260040160405180910390fd5b60006126cd836136f4565b90506126d98382613829565b5050610c756001609755565b6126ed612e09565b604051632cbd9b6d60e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063597b36da9061273c908590600401614c5a565b602060405180830381865afa158015612759573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061277d91906142bd565b600081815260cf602052604090205490915060ff166127af5760405163c945242d60e01b815260040160405180910390fd5b6040805160018082528183019092526000916020808301908036833701905050905060c960019054906101000a90046001600160a01b0316816000815181106127fa576127fa614250565b6001600160a01b0392831660209182029290920101526040516360d7faed60e01b81527f0000000000000000000000000000000000000000000000000000000000000000909116906360d7faed9061285e9086908590600090600190600401614c6d565b600060405180830381600087803b15801561287857600080fd5b505af115801561288c573d6000803e3d6000fd5b505050508260c001516000815181106128a7576128a7614250565b602002602001015160cd60008282546128c09190614805565b9091555050600082815260cf602052604090819020805460ff1916905560c95490516370a0823160e01b81523060048201526129549161010090046001600160a01b0316906370a0823190602401602060405180830381865afa15801561292b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061294f91906142bd565b613336565b507f9de94d299df82b41c8ef1c090ea1b6fc6bb0c7ac32732410eec0b58df27c57d7836040516129849190614c5a565b60405180910390a1505050565b612999612e09565b60ca5460a082015180516001600160a01b03909216916000906129be576129be614250565b60200260200101516001600160a01b0316146129ed57604051632711b74d60e11b815260040160405180910390fd5b604051632cbd9b6d60e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063597b36da90612a3c908590600401614c5a565b602060405180830381865afa158015612a59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7d91906142bd565b600081815260ce60205260409020549091506001600160a01b031615612ab657604051634e629a9960e11b815260040160405180910390fd5b600081815260cf602052604090205460ff1615612ae65760405163eb3d1dcd60e01b815260040160405180910390fd5b604051635bf8375f60e11b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063b7f06ebe90602401602060405180830381865afa158015612b4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b6f9190614355565b612b8c576040516355780d0f60e11b815260040160405180910390fd5b8160c00151600081518110612ba357612ba3614250565b602002602001015160cd6000828254612bbc9190614325565b9091555050600081815260cf602052604090819020805460ff19166001179055517f97c48b25f8fb5648d626126d6ba4b2d81315b243f41121822689297cdafff6a290612c0a908490614c5a565b60405180910390a15050565b612c1e612e09565b6001600160a01b038116612c835760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611ad0565b610c758161341d565b6001600160a01b038316612cee5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401611ad0565b6001600160a01b038216612d4f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401611ad0565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600260975403612e025760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611ad0565b6002609755565b6065546001600160a01b0316331461150c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611ad0565b61c4e060cb54612e739190614325565b60cc54612e809043614805565b101561150c5760405163df3e0d1960e01b815260040160405180910390fd5b6001609755565b6000612eb284846125d0565b90506000198114612f1a5781811015612f0d5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401611ad0565b612f1a8484848403612c8c565b50505050565b6001600160a01b038316612f845760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401611ad0565b6001600160a01b038216612fe65760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611ad0565b6001600160a01b0383166000908152603360205260409020548181101561305e5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401611ad0565b6001600160a01b0380851660008181526033602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906130be9086815260200190565b60405180910390a3612f1a565b604080516001808252818301909252606091816020015b604080516060808201835280825260208201526000918101919091528152602001906001900390816130e257505060408051600180825281830190925291925060208083019080368337019050508160008151811061314357613143614250565b60209081029190910101515260ca5481516001600160a01b0390911690829060009061317157613171614250565b60200260200101516000015160008151811061318f5761318f614250565b6001600160a01b039290921660209283029190910182015260408051600180825281830190925291828101908036833701905050816000815181106131d6576131d6614250565b602090810291909101810151015260ca546040516338f6b94760e21b8152600481018490526001600160a01b039091169063e3dae51c90602401602060405180830381865afa15801561322d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061325191906142bd565b8160008151811061326457613264614250565b60200260200101516020015160008151811061328257613282614250565b60200260200101818152505030816000815181106132a2576132a2614250565b6020026020010151604001906001600160a01b031690816001600160a01b031681525050919050565b6040516001600160a01b0380851660248301528316604482015260648101829052612f1a9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613867565b60c9546000906133759061010090046001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000008461393c565b60ca5460c9546040516373d0285560e11b81526001600160a01b03928316600482015261010090910482166024820152604481018490527f00000000000000000000000000000000000000000000000000000000000000009091169063e7a050aa906064016020604051808303816000875af11580156133f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090591906142bd565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166134cf5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401611ad0565b6001600160a01b038216600090815260336020526040902054818110156135435760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401611ad0565b6001600160a01b03831660008181526033602090815260408083208686039055603580548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6040516001600160a01b03831660248201526044810182905261140690849063a9059cbb60e01b906064016132ff565b600054610100900460ff166135fa5760405162461bcd60e51b8152600401611ad090614c80565b6125cc82826139e9565b600054610100900460ff1661362b5760405162461bcd60e51b8152600401611ad090614c80565b61150c613a29565b6001600160a01b0382166136895760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401611ad0565b806035600082825461369b9190614325565b90915550506001600160a01b0382166000818152603360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6040516370a0823160e01b815230600482015260009081906001600160a01b038416906370a0823190602401602060405180830381865afa15801561373d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061376191906142bd565b905060006127106137927f0000000000000000000000000000000000000000000000000000000000000000846142ec565b61379c9190614303565b90506137d26001600160a01b0385167f0000000000000000000000000000000000000000000000000000000000000000836135a3565b600061271060d054846137e591906142ec565b6137ef9190614303565b60d15490915061380c906001600160a01b038781169116836135a3565b6138168183614325565b6138209084614805565b95945050505050565b60c9546001600160a01b0361010090910481169083160361384d5761140681613336565b60d2546125cc906001600160a01b038481169116836135a3565b60006138bc826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613a509092919063ffffffff16565b90508051600014806138dd5750808060200190518101906138dd9190614355565b6114065760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611ad0565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa15801561398c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139b091906142bd565b9050612f1a8463095ea7b360e01b856139c98686614325565b6040516001600160a01b03909216602483015260448201526064016132ff565b600054610100900460ff16613a105760405162461bcd60e51b8152600401611ad090614c80565b6036613a1c8382614d19565b5060376114068282614d19565b600054610100900460ff16612e9f5760405162461bcd60e51b8152600401611ad090614c80565b6060613a5f8484600085613a67565b949350505050565b606082471015613ac85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611ad0565b600080866001600160a01b03168587604051613ae49190614dd8565b60006040518083038185875af1925050503d8060008114613b21576040519150601f19603f3d011682016040523d82523d6000602084013e613b26565b606091505b5091509150613b3787838387613b42565b979650505050505050565b60608315613bb1578251600003613baa576001600160a01b0385163b613baa5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611ad0565b5081613a5f565b613a5f8383815115613bc65781518083602001fd5b8060405162461bcd60e51b8152600401611ad09190613c30565b60005b83811015613bfb578181015183820152602001613be3565b50506000910152565b60008151808452613c1c816020860160208601613be0565b601f01601f19169290920160200192915050565b602081526000610c976020830184613c04565b6001600160a01b0381168114610c7557600080fd5b80356111e181613c43565b60008060408385031215613c7657600080fd5b8235613c8181613c43565b946020939093013593505050565b600060208284031215613ca157600080fd5b5035919050565b600080600060608486031215613cbd57600080fd5b8335613cc881613c43565b92506020840135613cd881613c43565b929592945050506040919091013590565b600060208284031215613cfb57600080fd5b8135610c9781613c43565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715613d3e57613d3e613d06565b60405290565b60405160e081016001600160401b0381118282101715613d3e57613d3e613d06565b604051601f8201601f191681016001600160401b0381118282101715613d8e57613d8e613d06565b604052919050565b60006001600160401b03831115613daf57613daf613d06565b613dc2601f8401601f1916602001613d66565b9050828152838383011115613dd657600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613e0257600080fd5b8335613e0d81613c43565b925060208401356001600160401b0380821115613e2957600080fd5b9085019060408288031215613e3d57600080fd5b613e45613d1c565b823582811115613e5457600080fd5b83019150601f82018813613e6757600080fd5b613e7688833560208501613d96565b815260208301356020820152809450505050604084013590509250925092565b600060208284031215613ea857600080fd5b81356001600160401b03811115613ebe57600080fd5b820160e08185031215610c9757600080fd5b600082601f830112613ee157600080fd5b610c9783833560208501613d96565b60008060008060008060008060006101208a8c031215613f0f57600080fd5b89356001600160401b0380821115613f2657600080fd5b613f328d838e01613ed0565b9a5060208c0135915080821115613f4857600080fd5b50613f558c828d01613ed0565b98505060408a0135613f6681613c43565b965060608a0135613f7681613c43565b9550613f8460808b01613c58565b945060a08a0135935060c08a01359250613fa060e08b01613c58565b9150613faf6101008b01613c58565b90509295985092959850929598565b600060208284031215613fd057600080fd5b81356001600160401b03811115613fe657600080fd5b82016101008185031215610c9757600080fd5b6000806040838503121561400c57600080fd5b823561401781613c43565b9150602083013561402781613c43565b809150509250929050565b803563ffffffff811681146111e157600080fd5b60006001600160401b0382111561405f5761405f613d06565b5060051b60200190565b600082601f83011261407a57600080fd5b8135602061408f61408a83614046565b613d66565b82815260059290921b840181019181810190868411156140ae57600080fd5b8286015b848110156140d25780356140c581613c43565b83529183019183016140b2565b509695505050505050565b600082601f8301126140ee57600080fd5b813560206140fe61408a83614046565b82815260059290921b8401810191818101908684111561411d57600080fd5b8286015b848110156140d25780358352918301918301614121565b60006020828403121561414a57600080fd5b81356001600160401b038082111561416157600080fd5b9083019060e0828603121561417557600080fd5b61417d613d44565b61418683613c58565b815261419460208401613c58565b60208201526141a560408401613c58565b6040820152606083013560608201526141c060808401614032565b608082015260a0830135828111156141d757600080fd5b6141e387828601614069565b60a08301525060c0830135828111156141fb57600080fd5b614207878286016140dd565b60c08301525095945050505050565b600181811c9082168061422a57607f821691505b60208210810361424a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561429f5781516001600160a01b03168752958201959082019060010161427a565b509495945050505050565b602081526000610c976020830184614266565b6000602082840312156142cf57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610905576109056142d6565b60008261432057634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610905576109056142d6565b60006020828403121561434a57600080fd5b8151610c9781613c43565b60006020828403121561436757600080fd5b81518015158114610c9757600080fd5b600081518084526020808501945080840160005b8381101561429f5781518752958201959082019060010161438b565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561443357603f198984030185528151606081518186526143f482870182614266565b915050888201518582038a87015261440c8282614377565b928901516001600160a01b03169589019590955250948701949250908601906001016143ce565b509098975050505050505050565b6000602080838503121561445457600080fd5b82516001600160401b0381111561446a57600080fd5b8301601f8101851361447b57600080fd5b805161448961408a82614046565b81815260059190911b820183019083810190878311156144a857600080fd5b928401925b82841015613b37578351825292840192908401906144ad565b8981526001600160a01b03898116602083015288811660408301528781166060830152861660808201526bffffffffffffffffffffffff851660a082015260c0810184905261012060e0820181905260009061452483820186614266565b90508281036101008401526145398185614377565b9c9b505050505050505050505050565b60018060a01b038416815260606020820152600083516040606084015261457360a0840182613c04565b602095909501516080840152505060400152919050565b600181815b808511156145c55781600019048211156145ab576145ab6142d6565b808516156145b857918102915b93841c939080029061458f565b509250929050565b6000826145dc57506001610905565b816145e957506000610905565b81600181146145ff576002811461460957614625565b6001915050610905565b60ff84111561461a5761461a6142d6565b50506001821b610905565b5060208310610133831016604e8410600b8410161715614648575081810a610905565b614652838361458a565b8060001904821115614666576146666142d6565b029392505050565b6000610c9760ff8416836145cd565b6000808335601e1984360301811261469457600080fd5b83016020810192503590506001600160401b038111156146b357600080fd5b8060051b36038213156146c557600080fd5b9250929050565b8183526000602080850194508260005b8581101561429f5781356146ef81613c43565b6001600160a01b0316875295820195908201906001016146dc565b81835260006001600160fb1b0383111561472357600080fd5b8260051b80836020870137939093016020019392505050565b6000813561474981613c43565b6001600160a01b03908116845260208301359061476582613c43565b908116602085015260408301359061477c82613c43565b1660408401526060828101359084015263ffffffff61479d60808401614032565b1660808401526147b060a083018361467d565b60e060a08601526147c560e0860182846146cc565b9150506147d560c084018461467d565b85830360c08701526147e883828461470a565b9695505050505050565b602081526000610c97602083018461473c565b81810381811115610905576109056142d6565b6000808335601e1984360301811261482f57600080fd5b8301803591506001600160401b0382111561484957600080fd5b6020019150600581901b36038213156146c557600080fd5b608081526000614874608083018761473c565b82810360208401526148868187614266565b6040840195909552505090151560609091015292915050565b84815260018060a01b03841660208201528260408201526080606082015260006147e8608083018461473c565b6000602082840312156148de57600080fd5b815160ff81168114610c9757600080fd5b6000808335601e1984360301811261490657600080fd5b83016020810192503590506001600160401b0381111561492557600080fd5b8036038213156146c557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b803561496881613c43565b6001600160a01b03168252602090810135910152565b8183526000602080850194508260005b8581101561429f5763ffffffff6149a483614032565b168752958201959082019060010161498e565b81835260006020808501808196508560051b810191508460005b87811015614a075782840389526149e882886148ef565b6149f3868284614934565b9a87019a95505050908401906001016149d1565b5091979650505050505050565b6000808335601e19843603018112614a2b57600080fd5b83016020810192503590506001600160401b03811115614a4a57600080fd5b8060061b36038213156146c557600080fd5b8183526000602080850194508260005b8581101561429f578135614a7f81613c43565b6001600160a01b03168752818301358388015260409687019690910190600101614a6c565b60408152600063ffffffff80614ab986614032565b16604084015280614acc60208701614032565b16606084015250614ae060408501856148ef565b610100806080860152614af861014086018385614934565b9250614b0a60a086016060890161495d565b614b1760a088018861467d565b9250603f19808786030160e0880152614b3185858461497e565b9450614b4060c08a018a61467d565b94509150808786030183880152614b588585846149b7565b9450614b6760e08a018a614a14565b9450925080878603016101208801525050614b83838383614a5c565b9350505050610c9760208301846001600160a01b03169052565b6000808335601e19843603018112614bb457600080fd5b8301803591506001600160401b03821115614bce57600080fd5b6020019150600681901b36038213156146c557600080fd5b600060018060a01b03808351168452806020840151166020850152806040840151166040850152506060820151606084015263ffffffff608083015116608084015260a082015160e060a0850152614c4160e0850182614266565b905060c083015184820360c08601526138208282614377565b602081526000610c976020830184614be6565b6080815260006148746080830187614be6565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b601f82111561140657600081815260208120601f850160051c81016020861015614cf25750805b601f850160051c820191505b81811015614d1157828155600101614cfe565b505050505050565b81516001600160401b03811115614d3257614d32613d06565b614d4681614d408454614216565b84614ccb565b602080601f831160018114614d7b5760008415614d635750858301515b600019600386901b1c1916600185901b178555614d11565b600085815260208120601f198616915b82811015614daa57888601518255948401946001909101908401614d8b565b5085821015614dc85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008251614dea818460208701613be0565b919091019291505056fea2646970667358221220eea430ccb7c3020beb9393f0158e7f4def0f3e3b8e6354c7cab1a7407e148a8964736f6c63430008130033000000000000000000000000858646372cc42e1a627fce94aa7a7033e7cf075a00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a0000000000000000000000007750d328b314effa365a0402ccfd489b80b0adda000000000000000000000000ec53bf9167f50cdeb3ae105f56099aaab9061f8300000000000000000000000083e9115d334d248ce39a6f36144aeab5b3456e750000000000000000000000000000000000000000000000000000000000000064000000000000000000000000d22fb2d2c09c108c44b622c37f6d2f4bc9f856680000000000000000000000000000000000000000000000000000000000001388

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106103835760003560e01c8063843eeecd116101de578063b86687381161010f578063e00af4a7116100ad578063ea4d3c9b1161007c578063ea4d3c9b146107d7578063efea6da7146107fe578063f2fde38b14610825578063fdc371ce1461083857600080fd5b8063e00af4a714610795578063e1467e85146107a8578063e1f1c4a7146107bb578063e58837df146107c457600080fd5b8063d6324e60116100e9578063d6324e6014610753578063d83ad00c14610766578063d9a90a8e1461076f578063dd62ed3e1461078257600080fd5b8063b8668738146106e4578063ba285bd1146106ec578063c7539659146106f557600080fd5b8063a457c2d71161017c578063ad93b4b711610156578063ad93b4b7146103e4578063b0e21e8a14610697578063b6954532146106be578063b6b55f25146106d157600080fd5b8063a457c2d71461064a578063a9059cbb1461065d578063ab5a851b1461067057600080fd5b80638c01d542116101b85780638c01d5421461060b5780638da5cb5b1461061e57806395d89b411461062f5780639fd0506d1461063757600080fd5b8063843eeecd146105c95780638456cb59146105dc5780638a2fc4e3146105e457600080fd5b806339b70e38116102b8578063683dd1911161025657806370a082311161023057806370a0823114610568578063715018a614610591578063803db96d146105995780638105165b146105c057600080fd5b8063683dd191146105255780636f307dc31461052d5780636fbec0cd1461054557600080fd5b806359f6adc71161029257806359f6adc7146104ed5780635c975abb1461050057806360cd4a6014610514578063679aefce1461051d57600080fd5b806339b70e38146104ab5780633f4ba83a146104d25780635361477b146104da57600080fd5b806323b872dd116103255780632d88af4a116102ff5780632d88af4a146104675780632e1a7d4d1461047a578063313ce5671461048d578063395093511461049857600080fd5b806323b872dd1461040a57806325a760c21461041d5780632819c2d21461043c57600080fd5b80630baa9ed6116103615780630baa9ed6146103dc578063101395fa146103e457806314626dc6146103ed57806318160ddd1461040257600080fd5b806301ac145b1461038857806306fdde03146103a4578063095ea7b3146103b9575b600080fd5b61039160d05481565b6040519081526020015b60405180910390f35b6103ac61085f565b60405161039b9190613c30565b6103cc6103c7366004613c63565b6108f1565b604051901515815260200161039b565b61039161090b565b6103916103e881565b6104006103fb366004613c8f565b610a90565b005b603554610391565b6103cc610418366004613ca8565b610c78565b60c95461042a9060ff1681565b60405160ff909116815260200161039b565b60d25461044f906001600160a01b031681565b6040516001600160a01b03909116815260200161039b565b610400610475366004613ce9565b610c9e565b610391610488366004613c8f565b610d36565b60c95460ff1661042a565b6103cc6104a6366004613c63565b6111e6565b61044f7f000000000000000000000000858646372cc42e1a627fce94aa7a7033e7cf075a81565b610400611208565b6104006104e8366004613ded565b611254565b6104006104fb366004613c8f565b61140b565b60d2546103cc90600160a01b900460ff1681565b61039160cb5481565b610391611498565b6103916114e6565b60c95461044f9061010090046001600160a01b031681565b6103cc610553366004613c8f565b60cf6020526000908152604090205460ff1681565b610391610576366004613ce9565b6001600160a01b031660009081526033602052604090205490565b6104006114fa565b61044f7f000000000000000000000000d22fb2d2c09c108c44b622c37f6d2f4bc9f8566881565b61039161c4e081565b6104006105d7366004613e96565b61150e565b6104006119cf565b61044f7f0000000000000000000000007750d328b314effa365a0402ccfd489b80b0adda81565b60d15461044f906001600160a01b031681565b6065546001600160a01b031661044f565b6103ac611a57565b60d35461044f906001600160a01b031681565b6103cc610658366004613c63565b611a66565b6103cc61066b366004613c63565b611af1565b61044f7f00000000000000000000000083e9115d334d248ce39a6f36144aeab5b3456e7581565b6103917f000000000000000000000000000000000000000000000000000000000000006481565b6104006106cc366004613ef0565b611aff565b6103916106df366004613c8f565b61214a565b61039161231a565b61039160cc5481565b61072e610703366004613c8f565b60ce602052600090815260409020805460018201546002909201546001600160a01b03909116919083565b604080516001600160a01b03909416845260208401929092529082015260600161039b565b60ca5461044f906001600160a01b031681565b61039160cd5481565b61040061077d366004613fbe565b61247e565b610391610790366004613ff9565b6125d0565b6104006107a3366004613ce9565b6125fb565b6104006107b6366004614138565b6126e5565b61039161271081565b6104006107d2366004614138565b612991565b61044f7f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a81565b6103917f000000000000000000000000000000000000000000000000000000000000138881565b610400610833366004613ce9565b612c16565b61044f7f000000000000000000000000ec53bf9167f50cdeb3ae105f56099aaab9061f8381565b60606036805461086e90614216565b80601f016020809104026020016040519081016040528092919081815260200182805461089a90614216565b80156108e75780601f106108bc576101008083540402835291602001916108e7565b820191906000526020600020905b8154815290600101906020018083116108ca57829003601f168201915b5050505050905090565b6000336108ff818585612c8c565b60019150505b92915050565b60408051600180825281830190925260009182919060208083019080368337505060ca5482519293506001600160a01b03169183915060009061095057610950614250565b6001600160a01b03928316602091820292909201015260cb54604051630449ca3960e01b815290917f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a1690630449ca39906109af9085906004016142aa565b602060405180830381865afa1580156109cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f091906142bd565b116109fd5760cb54610a8a565b604051630449ca3960e01b81526001600160a01b037f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a1690630449ca3990610a499084906004016142aa565b602060405180830381865afa158015610a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8a91906142bd565b91505090565b610a98612db0565b610aa0612e09565b60408051600180825281830190925260009160208083019080368337505060ca5482519293506001600160a01b031691839150600090610ae257610ae2614250565b6001600160a01b039283166020918202929092010152604051630449ca3960e01b81526000917f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a1690630449ca3990610b3f9085906004016142aa565b602060405180830381865afa158015610b5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8091906142bd565b905080831080610b8e575082155b15610bac57604051630130feaf60e01b815260040160405180910390fd5b80831115610c24576000612710610be37f0000000000000000000000000000000000000000000000000000000000001388846142ec565b610bed9190614303565b610bf79083614325565b905080841115610c1a57604051636108fcdb60e11b815260040160405180910390fd5b610c22612e63565b505b60cb5460408051918252602082018590527fea142c60fe44885a5d85aaac36e42beaab40f1e0c956960d5b9d3422b5d1c535910160405180910390a1505060cb8190554360cc55610c756001609755565b50565b600033610c86858285612ea6565b610c91858585612f20565b60019150505b9392505050565b610ca6612e09565b6001600160a01b038116610ccd5760405163862a606760e01b815260040160405180910390fd5b60d354604080516001600160a01b03928316815291831660208301527f1ff153f4b082245afbf3211a8d2d207da4c5df490e965f9a9ad141b0cd001dda910160405180910390a160d380546001600160a01b0319166001600160a01b0392909216919091179055565b6000610d40612db0565b604051631976849960e21b81523060048201526000906001600160a01b037f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a16906365da126490602401602060405180830381865afa158015610da7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcb9190614338565b6001600160a01b031603610df257604051635add22c560e01b815260040160405180910390fd5b60d254600160a01b900460ff1615610e1d576040516336a7e2cd60e21b815260040160405180910390fd5b81600003610e3e5760405163862a606760e01b815260040160405180910390fd5b6040516323b872dd60e01b8152336004820152306024820181905260448201849052906323b872dd906064016020604051808303816000875af1158015610e89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ead9190614355565b506000610eb86114e6565b610ec0611498565b610eca90856142ec565b610ed49190614303565b90506000610ee1826130cb565b905080600081518110610ef657610ef6614250565b602002602001015160200151600081518110610f1457610f14614250565b602002602001015160cd6000828254610f2d9190614325565b909155505060405163285e212160e21b81523060048201526000907f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a6001600160a01b03169063a178848490602401602060405180830381865afa158015610f99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbd91906142bd565b905060007f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a6001600160a01b0316630dd8dd02846040518263ffffffff1660e01b815260040161100d91906143a7565b6000604051808303816000875af115801561102c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110549190810190614441565b60008151811061106657611066614250565b60209081029190910181015160408051606081018252338082528185018b815243838501908152600086815260ce90975295849020925183546001600160a01b0319166001600160a01b039182161784559051600184015594516002909201919091559051631976849960e21b815230600482018190529294507f0176007ec78c756143be1d2a6feec53fd9e31d37037259af455e8cfc1cb33811938593917f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a909116906365da126490602401602060405180830381865afa158015611150573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111749190614338565b3087438a60008151811061118a5761118a614250565b6020026020010151600001518b6000815181106111a9576111a9614250565b6020026020010151602001516040516111ca999897969594939291906144c6565b60405180910390a193505050506111e16001609755565b919050565b6000336108ff8185856111f983836125d0565b6112039190614325565b612c8c565b611210612e09565b60d2805460ff60a01b19169055604051600081527f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd2906020015b60405180910390a1565b61125c612db0565b611264612e09565b6001600160a01b03831661128b5760405163862a606760e01b815260040160405180910390fd5b604051631976849960e21b81523060048201526000906001600160a01b037f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a16906365da126490602401602060405180830381865afa1580156112f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113169190614338565b6001600160a01b03161461133d57604051631a30c08d60e31b815260040160405180910390fd5b60405163eea9064b60e01b81526001600160a01b037f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a169063eea9064b9061138d90869086908690600401614549565b600060405180830381600087803b1580156113a757600080fd5b505af11580156113bb573d6000803e3d6000fd5b50506040516001600160a01b03861681527ffe608947467beb30a90e072fd2fc7d52baecf0935f542011fcd8fa6362a5d5b39250602001905060405180910390a16114066001609755565b505050565b611413612db0565b806000036114345760405163862a606760e01b815260040160405180910390fd5b60c9546114519061010090046001600160a01b03163330846132cb565b61145a81613336565b506040518181527fb02f19427b6324e7102facbe680a13b90e2424617afe32d862c9edf6dfaa83709060200160405180910390a1610c756001609755565b60006103e86114a660355490565b6114b09190614325565b6114b86114e6565b6103e86114c361231a565b6114cd9190614325565b6114d791906142ec565b6114e19190614303565b905090565b60c9546000906114e19060ff16600a61466e565b611502612e09565b61150c600061341d565b565b611516612db0565b604051631976849960e21b81523060048201526000906001600160a01b037f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a16906365da126490602401602060405180830381865afa15801561157d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a19190614338565b6001600160a01b0316036115c857604051635add22c560e01b815260040160405180910390fd5b60d254600160a01b900460ff16156115f3576040516336a7e2cd60e21b815260040160405180910390fd5b604051632cbd9b6d60e11b81526000906001600160a01b037f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a169063597b36da906116429085906004016147f2565b602060405180830381865afa15801561165f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168391906142bd565b600081815260ce60205260409020549091506001600160a01b0316331415806116aa575033155b156116c857604051630bdbeed760e31b815260040160405180910390fd5b6116d061090b565b600082815260ce60205260409020600201546116ec9043614805565b101561170b576040516315844b9560e11b815260040160405180910390fd5b6040805160018082528183019092526000916020808301908036833701905050905060c960019054906101000a90046001600160a01b03168160008151811061175657611756614250565b6001600160a01b03909216602092830291909101820152600083815260ce909152604090206001015461178a90309061346f565b61179760c0840184614818565b60008181106117a8576117a8614250565b9050602002013560cd60008282546117c09190614805565b909155505060c9546040516370a0823160e01b815230600482015260009161010090046001600160a01b0316906370a0823190602401602060405180830381865afa158015611813573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183791906142bd565b6040516360d7faed60e01b81529091506001600160a01b037f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a16906360d7faed9061188e9087908690600090600190600401614861565b600060405180830381600087803b1580156118a857600080fd5b505af11580156118bc573d6000803e3d6000fd5b505060c9546040516370a0823160e01b8152306004820152600093508492506101009091046001600160a01b0316906370a0823190602401602060405180830381865afa158015611911573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061193591906142bd565b61193f9190614805565b60c95490915061195e9061010090046001600160a01b031633836135a3565b7f8cc13279d432798ff883698cc787fdd496411d0d094093602f07fe03f087079084338388604051611993949392919061489f565b60405180910390a1505050600090815260ce6020526040812080546001600160a01b03191681556001810182905560020155610c756001609755565b6065546001600160a01b031633148015906119f5575060d3546001600160a01b03163314155b15611a135760405163492f678160e01b815260040160405180910390fd5b60d2805460ff60a01b1916600160a01b179055604051600181527f0e2fb031ee032dc02d8011dc50b816eb450cf856abd8261680dac74f72165bd29060200161124a565b60606037805461086e90614216565b60003381611a7482866125d0565b905083811015611ad95760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b611ae68286868403612c8c565b506001949350505050565b6000336108ff818585612f20565b600054610100900460ff1615808015611b1f5750600054600160ff909116105b80611b395750303b158015611b39575060005460ff166001145b611b9c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611ad0565b6000805460ff191660011790558015611bbf576000805461ff0019166101001790555b6001600160a01b0388161580611bdc57506001600160a01b038716155b80611bee57506001600160a01b038616155b80611c0057506001600160a01b038316155b80611c1257506001600160a01b038216155b80611c1c57508951155b80611c2657508851155b15611c445760405163862a606760e01b815260040160405180910390fd5b612710611c717f000000000000000000000000000000000000000000000000000000000000006486614325565b1115611c90576040516358d620b360e01b815260040160405180910390fd5b60405163198f077960e21b81526001600160a01b0388811660048301527f000000000000000000000000858646372cc42e1a627fce94aa7a7033e7cf075a169063663c1de490602401602060405180830381865afa158015611cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d1a9190614355565b611d3757604051632711b74d60e11b815260040160405180910390fd5b7f000000000000000000000000ec53bf9167f50cdeb3ae105f56099aaab9061f836001600160a01b0316886001600160a01b03161480611da857507f00000000000000000000000083e9115d334d248ce39a6f36144aeab5b3456e756001600160a01b0316886001600160a01b0316145b15611e65577f00000000000000000000000083e9115d334d248ce39a6f36144aeab5b3456e756001600160a01b0316876001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e399190614338565b6001600160a01b031614611e60576040516317dc37cb60e11b815260040160405180910390fd5b611ef8565b876001600160a01b0316876001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ed19190614338565b6001600160a01b031614611ef8576040516317dc37cb60e11b815260040160405180910390fd5b604080516001808252818301909252600091602080830190803683370190505090508781600081518110611f2e57611f2e614250565b6001600160a01b039283166020918202929092010152604051630449ca3960e01b81527f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a90911690630449ca3990611f8a9084906004016142aa565b602060405180830381865afa158015611fa7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fcb91906142bd565b861015611feb57604051630130feaf60e01b815260040160405180910390fd5b611ff58b8b6135d3565b611ffd613604565b6120068761341d565b60c98054610100600160a81b0319166101006001600160a01b038c81169182029290921790925560ca80546001600160a01b031916918b169190911790556040805163313ce56760e01b8152905163313ce567916004808201926020929091908290030181865afa15801561207f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a391906148cc565b60c9805460ff9290921660ff199092169190911790555060cb8590554360cc5560d084905560d180546001600160a01b038086166001600160a01b03199283161790925560d2805492851692909116919091179055801561213e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b6000612154612db0565b604051631976849960e21b81523060048201526000906001600160a01b037f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a16906365da126490602401602060405180830381865afa1580156121bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121df9190614338565b6001600160a01b03160361220657604051635add22c560e01b815260040160405180910390fd5b60d254600160a01b900460ff1615612231576040516336a7e2cd60e21b815260040160405180910390fd5b816000036122525760405163862a606760e01b815260040160405180910390fd5b60c95461226f9061010090046001600160a01b03163330856132cb565b6000612279611498565b6122816114e6565b61228b90856142ec565b6122959190614303565b9050806000036122b857604051632160733960e01b815260040160405180910390fd5b6122c23382613633565b6122cb83613336565b60408051338152602081018690529081018390529092507f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159060600160405180910390a1506111e16001609755565b600060cd546000146124125760ca5460cd54604051637a8b263760e01b81526001600160a01b0390921691637a8b26379161235b9160040190815260200190565b602060405180830381865afa158015612378573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239c91906142bd565b60ca54604051630aa794bf60e31b81523060048201526001600160a01b039091169063553ca5f890602401602060405180830381865afa1580156123e4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061240891906142bd565b6114e19190614325565b60ca54604051630aa794bf60e31b81523060048201526001600160a01b039091169063553ca5f890602401602060405180830381865afa15801561245a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e191906142bd565b612486612e09565b60d2546001600160a01b03166124af57604051630cd4f69d60e01b815260040160405180910390fd5b604051633ccc861d60e01b81526001600160a01b037f0000000000000000000000007750d328b314effa365a0402ccfd489b80b0adda1690633ccc861d906124fd9084903090600401614aa4565b600060405180830381600087803b15801561251757600080fd5b505af115801561252b573d6000803e3d6000fd5b5050505060005b61253f60e0830183614b9d565b90508110156125cc57600061258561255a60e0850185614b9d565b8481811061256a5761256a614250565b6125809260206040909202019081019150613ce9565b6136f4565b90506125c361259760e0850185614b9d565b848181106125a7576125a7614250565b6125bd9260206040909202019081019150613ce9565b82613829565b50600101612532565b5050565b6001600160a01b03918216600090815260346020908152604080832093909416825291909152205490565b612603612db0565b61260b612e09565b306001600160a01b0382160361263457604051631b533c7560e11b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa15801561267b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269f91906142bd565b9050806000036126c257604051630e3b112360e01b815260040160405180910390fd5b60006126cd836136f4565b90506126d98382613829565b5050610c756001609755565b6126ed612e09565b604051632cbd9b6d60e11b81526000906001600160a01b037f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a169063597b36da9061273c908590600401614c5a565b602060405180830381865afa158015612759573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061277d91906142bd565b600081815260cf602052604090205490915060ff166127af5760405163c945242d60e01b815260040160405180910390fd5b6040805160018082528183019092526000916020808301908036833701905050905060c960019054906101000a90046001600160a01b0316816000815181106127fa576127fa614250565b6001600160a01b0392831660209182029290920101526040516360d7faed60e01b81527f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a909116906360d7faed9061285e9086908590600090600190600401614c6d565b600060405180830381600087803b15801561287857600080fd5b505af115801561288c573d6000803e3d6000fd5b505050508260c001516000815181106128a7576128a7614250565b602002602001015160cd60008282546128c09190614805565b9091555050600082815260cf602052604090819020805460ff1916905560c95490516370a0823160e01b81523060048201526129549161010090046001600160a01b0316906370a0823190602401602060405180830381865afa15801561292b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061294f91906142bd565b613336565b507f9de94d299df82b41c8ef1c090ea1b6fc6bb0c7ac32732410eec0b58df27c57d7836040516129849190614c5a565b60405180910390a1505050565b612999612e09565b60ca5460a082015180516001600160a01b03909216916000906129be576129be614250565b60200260200101516001600160a01b0316146129ed57604051632711b74d60e11b815260040160405180910390fd5b604051632cbd9b6d60e11b81526000906001600160a01b037f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a169063597b36da90612a3c908590600401614c5a565b602060405180830381865afa158015612a59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7d91906142bd565b600081815260ce60205260409020549091506001600160a01b031615612ab657604051634e629a9960e11b815260040160405180910390fd5b600081815260cf602052604090205460ff1615612ae65760405163eb3d1dcd60e01b815260040160405180910390fd5b604051635bf8375f60e11b8152600481018290527f00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a6001600160a01b03169063b7f06ebe90602401602060405180830381865afa158015612b4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b6f9190614355565b612b8c576040516355780d0f60e11b815260040160405180910390fd5b8160c00151600081518110612ba357612ba3614250565b602002602001015160cd6000828254612bbc9190614325565b9091555050600081815260cf602052604090819020805460ff19166001179055517f97c48b25f8fb5648d626126d6ba4b2d81315b243f41121822689297cdafff6a290612c0a908490614c5a565b60405180910390a15050565b612c1e612e09565b6001600160a01b038116612c835760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611ad0565b610c758161341d565b6001600160a01b038316612cee5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401611ad0565b6001600160a01b038216612d4f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401611ad0565b6001600160a01b0383811660008181526034602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600260975403612e025760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611ad0565b6002609755565b6065546001600160a01b0316331461150c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611ad0565b61c4e060cb54612e739190614325565b60cc54612e809043614805565b101561150c5760405163df3e0d1960e01b815260040160405180910390fd5b6001609755565b6000612eb284846125d0565b90506000198114612f1a5781811015612f0d5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401611ad0565b612f1a8484848403612c8c565b50505050565b6001600160a01b038316612f845760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401611ad0565b6001600160a01b038216612fe65760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401611ad0565b6001600160a01b0383166000908152603360205260409020548181101561305e5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401611ad0565b6001600160a01b0380851660008181526033602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906130be9086815260200190565b60405180910390a3612f1a565b604080516001808252818301909252606091816020015b604080516060808201835280825260208201526000918101919091528152602001906001900390816130e257505060408051600180825281830190925291925060208083019080368337019050508160008151811061314357613143614250565b60209081029190910101515260ca5481516001600160a01b0390911690829060009061317157613171614250565b60200260200101516000015160008151811061318f5761318f614250565b6001600160a01b039290921660209283029190910182015260408051600180825281830190925291828101908036833701905050816000815181106131d6576131d6614250565b602090810291909101810151015260ca546040516338f6b94760e21b8152600481018490526001600160a01b039091169063e3dae51c90602401602060405180830381865afa15801561322d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061325191906142bd565b8160008151811061326457613264614250565b60200260200101516020015160008151811061328257613282614250565b60200260200101818152505030816000815181106132a2576132a2614250565b6020026020010151604001906001600160a01b031690816001600160a01b031681525050919050565b6040516001600160a01b0380851660248301528316604482015260648101829052612f1a9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613867565b60c9546000906133759061010090046001600160a01b03167f000000000000000000000000858646372cc42e1a627fce94aa7a7033e7cf075a8461393c565b60ca5460c9546040516373d0285560e11b81526001600160a01b03928316600482015261010090910482166024820152604481018490527f000000000000000000000000858646372cc42e1a627fce94aa7a7033e7cf075a9091169063e7a050aa906064016020604051808303816000875af11580156133f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090591906142bd565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166134cf5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401611ad0565b6001600160a01b038216600090815260336020526040902054818110156135435760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401611ad0565b6001600160a01b03831660008181526033602090815260408083208686039055603580548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b6040516001600160a01b03831660248201526044810182905261140690849063a9059cbb60e01b906064016132ff565b600054610100900460ff166135fa5760405162461bcd60e51b8152600401611ad090614c80565b6125cc82826139e9565b600054610100900460ff1661362b5760405162461bcd60e51b8152600401611ad090614c80565b61150c613a29565b6001600160a01b0382166136895760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401611ad0565b806035600082825461369b9190614325565b90915550506001600160a01b0382166000818152603360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6040516370a0823160e01b815230600482015260009081906001600160a01b038416906370a0823190602401602060405180830381865afa15801561373d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061376191906142bd565b905060006127106137927f0000000000000000000000000000000000000000000000000000000000000064846142ec565b61379c9190614303565b90506137d26001600160a01b0385167f000000000000000000000000d22fb2d2c09c108c44b622c37f6d2f4bc9f85668836135a3565b600061271060d054846137e591906142ec565b6137ef9190614303565b60d15490915061380c906001600160a01b038781169116836135a3565b6138168183614325565b6138209084614805565b95945050505050565b60c9546001600160a01b0361010090910481169083160361384d5761140681613336565b60d2546125cc906001600160a01b038481169116836135a3565b60006138bc826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613a509092919063ffffffff16565b90508051600014806138dd5750808060200190518101906138dd9190614355565b6114065760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611ad0565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa15801561398c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139b091906142bd565b9050612f1a8463095ea7b360e01b856139c98686614325565b6040516001600160a01b03909216602483015260448201526064016132ff565b600054610100900460ff16613a105760405162461bcd60e51b8152600401611ad090614c80565b6036613a1c8382614d19565b5060376114068282614d19565b600054610100900460ff16612e9f5760405162461bcd60e51b8152600401611ad090614c80565b6060613a5f8484600085613a67565b949350505050565b606082471015613ac85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401611ad0565b600080866001600160a01b03168587604051613ae49190614dd8565b60006040518083038185875af1925050503d8060008114613b21576040519150601f19603f3d011682016040523d82523d6000602084013e613b26565b606091505b5091509150613b3787838387613b42565b979650505050505050565b60608315613bb1578251600003613baa576001600160a01b0385163b613baa5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611ad0565b5081613a5f565b613a5f8383815115613bc65781518083602001fd5b8060405162461bcd60e51b8152600401611ad09190613c30565b60005b83811015613bfb578181015183820152602001613be3565b50506000910152565b60008151808452613c1c816020860160208601613be0565b601f01601f19169290920160200192915050565b602081526000610c976020830184613c04565b6001600160a01b0381168114610c7557600080fd5b80356111e181613c43565b60008060408385031215613c7657600080fd5b8235613c8181613c43565b946020939093013593505050565b600060208284031215613ca157600080fd5b5035919050565b600080600060608486031215613cbd57600080fd5b8335613cc881613c43565b92506020840135613cd881613c43565b929592945050506040919091013590565b600060208284031215613cfb57600080fd5b8135610c9781613c43565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715613d3e57613d3e613d06565b60405290565b60405160e081016001600160401b0381118282101715613d3e57613d3e613d06565b604051601f8201601f191681016001600160401b0381118282101715613d8e57613d8e613d06565b604052919050565b60006001600160401b03831115613daf57613daf613d06565b613dc2601f8401601f1916602001613d66565b9050828152838383011115613dd657600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613e0257600080fd5b8335613e0d81613c43565b925060208401356001600160401b0380821115613e2957600080fd5b9085019060408288031215613e3d57600080fd5b613e45613d1c565b823582811115613e5457600080fd5b83019150601f82018813613e6757600080fd5b613e7688833560208501613d96565b815260208301356020820152809450505050604084013590509250925092565b600060208284031215613ea857600080fd5b81356001600160401b03811115613ebe57600080fd5b820160e08185031215610c9757600080fd5b600082601f830112613ee157600080fd5b610c9783833560208501613d96565b60008060008060008060008060006101208a8c031215613f0f57600080fd5b89356001600160401b0380821115613f2657600080fd5b613f328d838e01613ed0565b9a5060208c0135915080821115613f4857600080fd5b50613f558c828d01613ed0565b98505060408a0135613f6681613c43565b965060608a0135613f7681613c43565b9550613f8460808b01613c58565b945060a08a0135935060c08a01359250613fa060e08b01613c58565b9150613faf6101008b01613c58565b90509295985092959850929598565b600060208284031215613fd057600080fd5b81356001600160401b03811115613fe657600080fd5b82016101008185031215610c9757600080fd5b6000806040838503121561400c57600080fd5b823561401781613c43565b9150602083013561402781613c43565b809150509250929050565b803563ffffffff811681146111e157600080fd5b60006001600160401b0382111561405f5761405f613d06565b5060051b60200190565b600082601f83011261407a57600080fd5b8135602061408f61408a83614046565b613d66565b82815260059290921b840181019181810190868411156140ae57600080fd5b8286015b848110156140d25780356140c581613c43565b83529183019183016140b2565b509695505050505050565b600082601f8301126140ee57600080fd5b813560206140fe61408a83614046565b82815260059290921b8401810191818101908684111561411d57600080fd5b8286015b848110156140d25780358352918301918301614121565b60006020828403121561414a57600080fd5b81356001600160401b038082111561416157600080fd5b9083019060e0828603121561417557600080fd5b61417d613d44565b61418683613c58565b815261419460208401613c58565b60208201526141a560408401613c58565b6040820152606083013560608201526141c060808401614032565b608082015260a0830135828111156141d757600080fd5b6141e387828601614069565b60a08301525060c0830135828111156141fb57600080fd5b614207878286016140dd565b60c08301525095945050505050565b600181811c9082168061422a57607f821691505b60208210810361424a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561429f5781516001600160a01b03168752958201959082019060010161427a565b509495945050505050565b602081526000610c976020830184614266565b6000602082840312156142cf57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417610905576109056142d6565b60008261432057634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610905576109056142d6565b60006020828403121561434a57600080fd5b8151610c9781613c43565b60006020828403121561436757600080fd5b81518015158114610c9757600080fd5b600081518084526020808501945080840160005b8381101561429f5781518752958201959082019060010161438b565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561443357603f198984030185528151606081518186526143f482870182614266565b915050888201518582038a87015261440c8282614377565b928901516001600160a01b03169589019590955250948701949250908601906001016143ce565b509098975050505050505050565b6000602080838503121561445457600080fd5b82516001600160401b0381111561446a57600080fd5b8301601f8101851361447b57600080fd5b805161448961408a82614046565b81815260059190911b820183019083810190878311156144a857600080fd5b928401925b82841015613b37578351825292840192908401906144ad565b8981526001600160a01b03898116602083015288811660408301528781166060830152861660808201526bffffffffffffffffffffffff851660a082015260c0810184905261012060e0820181905260009061452483820186614266565b90508281036101008401526145398185614377565b9c9b505050505050505050505050565b60018060a01b038416815260606020820152600083516040606084015261457360a0840182613c04565b602095909501516080840152505060400152919050565b600181815b808511156145c55781600019048211156145ab576145ab6142d6565b808516156145b857918102915b93841c939080029061458f565b509250929050565b6000826145dc57506001610905565b816145e957506000610905565b81600181146145ff576002811461460957614625565b6001915050610905565b60ff84111561461a5761461a6142d6565b50506001821b610905565b5060208310610133831016604e8410600b8410161715614648575081810a610905565b614652838361458a565b8060001904821115614666576146666142d6565b029392505050565b6000610c9760ff8416836145cd565b6000808335601e1984360301811261469457600080fd5b83016020810192503590506001600160401b038111156146b357600080fd5b8060051b36038213156146c557600080fd5b9250929050565b8183526000602080850194508260005b8581101561429f5781356146ef81613c43565b6001600160a01b0316875295820195908201906001016146dc565b81835260006001600160fb1b0383111561472357600080fd5b8260051b80836020870137939093016020019392505050565b6000813561474981613c43565b6001600160a01b03908116845260208301359061476582613c43565b908116602085015260408301359061477c82613c43565b1660408401526060828101359084015263ffffffff61479d60808401614032565b1660808401526147b060a083018361467d565b60e060a08601526147c560e0860182846146cc565b9150506147d560c084018461467d565b85830360c08701526147e883828461470a565b9695505050505050565b602081526000610c97602083018461473c565b81810381811115610905576109056142d6565b6000808335601e1984360301811261482f57600080fd5b8301803591506001600160401b0382111561484957600080fd5b6020019150600581901b36038213156146c557600080fd5b608081526000614874608083018761473c565b82810360208401526148868187614266565b6040840195909552505090151560609091015292915050565b84815260018060a01b03841660208201528260408201526080606082015260006147e8608083018461473c565b6000602082840312156148de57600080fd5b815160ff81168114610c9757600080fd5b6000808335601e1984360301811261490657600080fd5b83016020810192503590506001600160401b0381111561492557600080fd5b8036038213156146c557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b803561496881613c43565b6001600160a01b03168252602090810135910152565b8183526000602080850194508260005b8581101561429f5763ffffffff6149a483614032565b168752958201959082019060010161498e565b81835260006020808501808196508560051b810191508460005b87811015614a075782840389526149e882886148ef565b6149f3868284614934565b9a87019a95505050908401906001016149d1565b5091979650505050505050565b6000808335601e19843603018112614a2b57600080fd5b83016020810192503590506001600160401b03811115614a4a57600080fd5b8060061b36038213156146c557600080fd5b8183526000602080850194508260005b8581101561429f578135614a7f81613c43565b6001600160a01b03168752818301358388015260409687019690910190600101614a6c565b60408152600063ffffffff80614ab986614032565b16604084015280614acc60208701614032565b16606084015250614ae060408501856148ef565b610100806080860152614af861014086018385614934565b9250614b0a60a086016060890161495d565b614b1760a088018861467d565b9250603f19808786030160e0880152614b3185858461497e565b9450614b4060c08a018a61467d565b94509150808786030183880152614b588585846149b7565b9450614b6760e08a018a614a14565b9450925080878603016101208801525050614b83838383614a5c565b9350505050610c9760208301846001600160a01b03169052565b6000808335601e19843603018112614bb457600080fd5b8301803591506001600160401b03821115614bce57600080fd5b6020019150600681901b36038213156146c557600080fd5b600060018060a01b03808351168452806020840151166020850152806040840151166040850152506060820151606084015263ffffffff608083015116608084015260a082015160e060a0850152614c4160e0850182614266565b905060c083015184820360c08601526138208282614377565b602081526000610c976020830184614be6565b6080815260006148746080830187614be6565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b601f82111561140657600081815260208120601f850160051c81016020861015614cf25750805b601f850160051c820191505b81811015614d1157828155600101614cfe565b505050505050565b81516001600160401b03811115614d3257614d32613d06565b614d4681614d408454614216565b84614ccb565b602080601f831160018114614d7b5760008415614d635750858301515b600019600386901b1c1916600185901b178555614d11565b600085815260208120601f198616915b82811015614daa57888601518255948401946001909101908401614d8b565b5085821015614dc85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008251614dea818460208701613be0565b919091019291505056fea2646970667358221220eea430ccb7c3020beb9393f0158e7f4def0f3e3b8e6354c7cab1a7407e148a8964736f6c63430008130033

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

000000000000000000000000858646372cc42e1a627fce94aa7a7033e7cf075a00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a0000000000000000000000007750d328b314effa365a0402ccfd489b80b0adda000000000000000000000000ec53bf9167f50cdeb3ae105f56099aaab9061f8300000000000000000000000083e9115d334d248ce39a6f36144aeab5b3456e750000000000000000000000000000000000000000000000000000000000000064000000000000000000000000d22fb2d2c09c108c44b622c37f6d2f4bc9f856680000000000000000000000000000000000000000000000000000000000001388

-----Decoded View---------------
Arg [0] : _strategyManager (address): 0x858646372CC42E1A627fcE94aa7A7033e7CF075A
Arg [1] : _delegationManager (address): 0x39053D51B77DC0d36036Fc1fCc8Cb819df8Ef37A
Arg [2] : _rewardsCoordinator (address): 0x7750d328b314EfFa365A0402CcfD489B80B0adda
Arg [3] : _eigen (address): 0xec53bF9167f50cDEB3Ae105f56099aaaB9061F83
Arg [4] : _bEigen (address): 0x83E9115d334D248Ce39a6f36144aEaB5b3456e75
Arg [5] : _protocolFee (uint256): 100
Arg [6] : _protocolTreasury (address): 0xD22FB2d2c09C108c44b622c37F6d2f4Bc9f85668
Arg [7] : _maxCooldownBlocksBasisPoints (uint256): 5000

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000858646372cc42e1a627fce94aa7a7033e7cf075a
Arg [1] : 00000000000000000000000039053d51b77dc0d36036fc1fcc8cb819df8ef37a
Arg [2] : 0000000000000000000000007750d328b314effa365a0402ccfd489b80b0adda
Arg [3] : 000000000000000000000000ec53bf9167f50cdeb3ae105f56099aaab9061f83
Arg [4] : 00000000000000000000000083e9115d334d248ce39a6f36144aeab5b3456e75
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [6] : 000000000000000000000000d22fb2d2c09c108c44b622c37f6d2f4bc9f85668
Arg [7] : 0000000000000000000000000000000000000000000000000000000000001388


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
Loading...
Loading
[ 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.