ETH Price: $3,312.55 (-3.30%)

Contract

0x6B6D4e2DFcB864c83E29641429C528e8016BaCDf
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60a06040209827612024-10-17 4:01:1140 days ago1729137671IN
 Create: Liquifier
0 ETH0.043249578.45762912

Advanced mode:
Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Liquifier

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 500 runs

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

import "@openzeppelin-upgradeable/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin-upgradeable/contracts/access/OwnableUpgradeable.sol";
import "@openzeppelin-upgradeable/contracts/security/PausableUpgradeable.sol";
import "@openzeppelin-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import "./interfaces/ILiquifier.sol";
import "./interfaces/ILiquidityPool.sol";

import "./eigenlayer-interfaces/IStrategyManager.sol";
import "./eigenlayer-interfaces/IDelegationManager.sol";


/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via PancakeSwap V3
interface IPancackeV3SwapRouter {
    function WETH9() external returns (address);

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

    /// @notice Swaps `amountIn` of one token for as much as possible of another token
    /// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance,
    /// and swap the entire amount, enabling contracts to send tokens before calling this function.
    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    function unwrapWETH9(uint256 amountMinimum, address recipient) external payable;
}

interface IERC20Burnable is IERC20 {
    function burn(uint256 amount) external;
}

/// Go wild, spread eETH/weETH to the world
contract Liquifier is Initializable, UUPSUpgradeable, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable, ILiquifier {
    using SafeERC20 for IERC20;

    uint32 public DEPRECATED_eigenLayerWithdrawalClaimGasCost;
    uint32 public timeBoundCapRefreshInterval; // seconds

    bool public quoteStEthWithCurve;

    uint128 public DEPRECATED_accumulatedFee;

    mapping(address => TokenInfo) public tokenInfos;
    mapping(bytes32 => bool) public isRegisteredQueuedWithdrawals;
    mapping(address => bool) public admins;

    address public treasury;
    ILiquidityPool public liquidityPool;
    IStrategyManager public eigenLayerStrategyManager;
    ILidoWithdrawalQueue public lidoWithdrawalQueue;

    ICurvePool public cbEth_Eth_Pool;
    ICurvePool public wbEth_Eth_Pool;
    ICurvePool public stEth_Eth_Pool;

    IcbETH public cbEth;
    IwBETH public wbEth;
    ILido public lido;

    IDelegationManager public eigenLayerDelegationManager;

    IPancackeV3SwapRouter pancakeRouter;

    mapping(string => bool) flags;
    
    // To support L2 native minting of weETH
    IERC20[] public dummies;
    address public l1SyncPool;

    mapping(address => bool) public pausers;

    event Liquified(address _user, uint256 _toEEthAmount, address _fromToken, bool _isRestaked);
    event RegisteredQueuedWithdrawal(bytes32 _withdrawalRoot, IStrategyManager.DeprecatedStruct_QueuedWithdrawal _queuedWithdrawal);
    event RegisteredQueuedWithdrawal_V2(bytes32 _withdrawalRoot, IDelegationManager.Withdrawal _queuedWithdrawal);
    event CompletedQueuedWithdrawal(bytes32 _withdrawalRoot);
    event QueuedStEthWithdrawals(uint256[] _reqIds);
    event CompletedStEthQueuedWithdrawals(uint256[] _reqIds);

    error StrategyShareNotEnough();
    error NotSupportedToken();
    error EthTransferFailed();
    error NotEnoughBalance();
    error AlreadyRegistered();
    error NotRegistered();
    error WrongOutput();
    error IncorrectCaller();
    error IncorrectAmount();

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

    /// @notice initialize to set variables on deployment
    // function initialize(address _treasury, address _liquidityPool, address _eigenLayerStrategyManager, address _lidoWithdrawalQueue, 
    //                     address _stEth, address _cbEth, address _wbEth, address _cbEth_Eth_Pool, address _wbEth_Eth_Pool, address _stEth_Eth_Pool,
    //                     uint32 _timeBoundCapRefreshInterval) initializer external {
    //     __Pausable_init();
    //     __Ownable_init();
    //     __UUPSUpgradeable_init();
    //     __ReentrancyGuard_init();

    //     treasury = _treasury;
    //     liquidityPool = ILiquidityPool(_liquidityPool);
    //     lidoWithdrawalQueue = ILidoWithdrawalQueue(_lidoWithdrawalQueue);
    //     eigenLayerStrategyManager = IEigenLayerStrategyManager(_eigenLayerStrategyManager);

    //     lido = ILido(_stEth);
    //     cbEth = IcbETH(_cbEth);
    //     wbEth = IwBETH(_wbEth);
    //     cbEth_Eth_Pool = ICurvePool(_cbEth_Eth_Pool);
    //     wbEth_Eth_Pool = ICurvePool(_wbEth_Eth_Pool);
    //     stEth_Eth_Pool = ICurvePool(_stEth_Eth_Pool);
        
    //     timeBoundCapRefreshInterval = _timeBoundCapRefreshInterval;
    //     DEPRECATED_eigenLayerWithdrawalClaimGasCost = 150_000;
    // }

    receive() external payable {}

    /// the users mint eETH given the queued withdrawal for their LRT with withdrawer == address(this)
    /// @param _queuedWithdrawal The QueuedWithdrawal to be used for the deposit. This is the proof that the user has the re-staked ETH and requested the withdrawals setting the Liquifier contract as the withdrawer.
    /// @param _referral The referral address
    /// @return mintedAmount the amount of eETH minted to the caller (= msg.sender)
    function depositWithQueuedWithdrawal(IDelegationManager.Withdrawal calldata _queuedWithdrawal, address _referral) external whenNotPaused nonReentrant returns (uint256) {
        bytes32 withdrawalRoot = verifyQueuedWithdrawal(msg.sender, _queuedWithdrawal);

        /// register it to prevent duplicate deposits with the same queued withdrawal
        isRegisteredQueuedWithdrawals[withdrawalRoot] = true;
        emit RegisteredQueuedWithdrawal_V2(withdrawalRoot, _queuedWithdrawal);

        /// queue the strategy share for withdrawal
        uint256 amount = _enqueueForWithdrawal(_queuedWithdrawal.strategies, _queuedWithdrawal.shares);
        
        /// mint eETH to the user
        uint256 eEthShare = liquidityPool.depositToRecipient(msg.sender, amount, _referral);

        return eEthShare;
    }

    /// Deposit Liquid Staking Token such as stETH and Mint eETH
    /// @param _token The address of the token to deposit
    /// @param _amount The amount of the token to deposit
    /// @param _referral The referral address
    /// @return mintedAmount the amount of eETH minted to the caller (= msg.sender)
    /// If the token is l2Eth, only the l2SyncPool can call this function
    function depositWithERC20(address _token, uint256 _amount, address _referral) public whenNotPaused nonReentrant returns (uint256) {        
        require(isTokenWhitelisted(_token) && (!tokenInfos[_token].isL2Eth || msg.sender == l1SyncPool), "NOT_ALLOWED");

        IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);

        // The L1SyncPool's `_anticipatedDeposit` should be the only place to mint the `token` and always send its entirety to the Liquifier contract
        if(tokenInfos[_token].isL2Eth) _L2SanityChecks(_token);

        uint256 dx = quoteByMarketValue(_token, _amount);

        // discount
        dx = (10000 - tokenInfos[_token].discountInBasisPoints) * dx / 10000;
        require(!isDepositCapReached(_token, dx), "CAPPED");

        uint256 eEthShare = liquidityPool.depositToRecipient(msg.sender, dx, _referral);

        emit Liquified(msg.sender, dx, _token, false);

        _afterDeposit(_token, dx);
        return eEthShare;
    }

    function depositWithERC20WithPermit(address _token, uint256 _amount, address _referral, PermitInput calldata _permit) external whenNotPaused returns (uint256) {
        try IERC20Permit(_token).permit(msg.sender, address(this), _permit.value, _permit.deadline, _permit.v, _permit.r, _permit.s) {} catch {}
        return depositWithERC20(_token, _amount, _referral);
    }

    /// @notice Used to complete the specified `queuedWithdrawals`. The function caller must match `queuedWithdrawals[...].withdrawer`
    /// @param _queuedWithdrawals The QueuedWithdrawals to complete.
    /// @param _tokens Array of tokens for each QueuedWithdrawal. See `completeQueuedWithdrawal` for the usage of a single array.
    /// @param _middlewareTimesIndexes One index to reference per QueuedWithdrawal. See `completeQueuedWithdrawal` for the usage of a single index.
    /// @dev middlewareTimesIndex should be calculated off chain before calling this function by finding the first index that satisfies `slasher.canWithdraw`
    function completeQueuedWithdrawals(IDelegationManager.Withdrawal[] calldata _queuedWithdrawals, IERC20[][] calldata _tokens, uint256[] calldata _middlewareTimesIndexes) external onlyAdmin {
        uint256 num = _queuedWithdrawals.length;
        bool[] memory receiveAsTokens = new bool[](num);
        for (uint256 i = 0; i < num; i++) {
            _completeWithdrawals(_queuedWithdrawals[i]);

            /// so that the shares withdrawn from the specified strategies are sent to the caller
            receiveAsTokens[i] = true;
        }

        /// it will update the erc20 balances of this contract
        eigenLayerDelegationManager.completeQueuedWithdrawals(_queuedWithdrawals, _tokens, _middlewareTimesIndexes, receiveAsTokens);
    }

    /// Initiate the process for redemption of stETH 
    function stEthRequestWithdrawal() external onlyAdmin returns (uint256[] memory) {
        uint256 amount = lido.balanceOf(address(this));
        return stEthRequestWithdrawal(amount);
    }

    function stEthRequestWithdrawal(uint256 _amount) public onlyAdmin returns (uint256[] memory) {
        if (_amount < lidoWithdrawalQueue.MIN_STETH_WITHDRAWAL_AMOUNT()) revert IncorrectAmount();
        if (_amount > lido.balanceOf(address(this))) revert NotEnoughBalance();

        tokenInfos[address(lido)].ethAmountPendingForWithdrawals += uint128(_amount);

        uint256 maxAmount = lidoWithdrawalQueue.MAX_STETH_WITHDRAWAL_AMOUNT();
        uint256 numReqs = (_amount + maxAmount - 1) / maxAmount;
        uint256[] memory reqAmounts = new uint256[](numReqs);
        for (uint256 i = 0; i < numReqs; i++) {
            reqAmounts[i] = (i == numReqs - 1) ? _amount - i * maxAmount : maxAmount;
        }
        lido.approve(address(lidoWithdrawalQueue), _amount);
        uint256[] memory reqIds = lidoWithdrawalQueue.requestWithdrawals(reqAmounts, address(this));

        emit QueuedStEthWithdrawals(reqIds);

        return reqIds;
    }

    /// @notice Claim a batch of withdrawal requests if they are finalized sending the ETH to the this contract back
    /// @param _requestIds array of request ids to claim
    /// @param _hints checkpoint hint for each id. Can be obtained with `findCheckpointHints()`
    function stEthClaimWithdrawals(uint256[] calldata _requestIds, uint256[] calldata _hints) external onlyAdmin {
        uint256 balance = address(this).balance;
        lidoWithdrawalQueue.claimWithdrawals(_requestIds, _hints);
        uint256 newBalance = address(this).balance;

        // to prevent the underflow error
        uint128 dx = uint128(_min(newBalance - balance, tokenInfos[address(lido)].ethAmountPendingForWithdrawals));
        tokenInfos[address(lido)].ethAmountPendingForWithdrawals -= dx;

        emit CompletedStEthQueuedWithdrawals(_requestIds);
    }

    // Send the redeemed ETH back to the liquidity pool & Send the fee to Treasury
    function withdrawEther() external onlyAdmin {
        uint256 amountToLiquidityPool = address(this).balance;
        (bool sent, ) = payable(address(liquidityPool)).call{value: amountToLiquidityPool, gas: 20000}("");
        if (!sent) revert EthTransferFailed();
    }

    function updateWhitelistedToken(address _token, bool _isWhitelisted) external onlyOwner {
        tokenInfos[_token].isWhitelisted = _isWhitelisted;
    }

    function updateDepositCap(address _token, uint32 _timeBoundCapInEther, uint32 _totalCapInEther) public onlyOwner {
        tokenInfos[_token].timeBoundCapInEther = _timeBoundCapInEther;
        tokenInfos[_token].totalCapInEther = _totalCapInEther;
    }
    
    function registerToken(address _token, address _target, bool _isWhitelisted, uint16 _discountInBasisPoints, uint32 _timeBoundCapInEther, uint32 _totalCapInEther, bool _isL2Eth) external onlyOwner {
        if (tokenInfos[_token].timeBoundCapClockStartTime != 0) revert AlreadyRegistered();
        if (_isL2Eth) {
            if (_token == address(0) || _target != address(0)) revert();
            dummies.push(IERC20(_token));
        } else {
            // _target = EigenLayer's Strategy contract
            if (_token != address(IStrategy(_target).underlyingToken())) revert NotSupportedToken();
        }
        tokenInfos[_token] = TokenInfo(0, 0, IStrategy(_target), _isWhitelisted, _discountInBasisPoints, uint32(block.timestamp), _timeBoundCapInEther, _totalCapInEther, 0, 0, _isL2Eth);
    }

    function updateTimeBoundCapRefreshInterval(uint32 _timeBoundCapRefreshInterval) external onlyOwner {
        timeBoundCapRefreshInterval = _timeBoundCapRefreshInterval;
    }

    function pauseDeposits(address _token) external onlyPauser {
        tokenInfos[_token].timeBoundCapInEther = 0;
        tokenInfos[_token].totalCapInEther = 0;
    }

    function updateAdmin(address _address, bool _isAdmin) external onlyOwner {
        admins[_address] = _isAdmin;
    }

    function updatePauser(address _address, bool _isPauser) external onlyAdmin {
        pausers[_address] = _isPauser;
    }

    function updateDiscountInBasisPoints(address _token, uint16 _discountInBasisPoints) external onlyAdmin {
        tokenInfos[_token].discountInBasisPoints = _discountInBasisPoints;
    }

    function updateQuoteStEthWithCurve(bool _quoteStEthWithCurve) external onlyAdmin {
        quoteStEthWithCurve = _quoteStEthWithCurve;
    }

    //Pauses the contract
    function pauseContract() external onlyPauser {
        _pause();
    }

    //Unpauses the contract
    function unPauseContract() external onlyOwner {
        _unpause();
    }

    // ETH comes in, L2ETH is burnt
    function unwrapL2Eth(address _l2Eth) external payable nonReentrant returns (uint256) {
        if (msg.sender != l1SyncPool) revert IncorrectCaller();
        if (!isTokenWhitelisted(_l2Eth) || !tokenInfos[_l2Eth].isL2Eth) revert NotSupportedToken();
        _L2SanityChecks(_l2Eth);

        IERC20(_l2Eth).safeTransfer(msg.sender, msg.value);
        return msg.value;
    }

    // uint256 _amount, uint24 _fee, uint256 _minOutputAmount, uint256 _maxWaitingTime
    function pancakeSwapForEth(address _token, uint256 _amount, uint24 _fee, uint256 _minOutputAmount, uint256 _maxWaitingTime) external onlyAdmin {
        if (_amount > IERC20(_token).balanceOf(address(this))) revert NotEnoughBalance();
        uint256 beforeBalance = address(this).balance;
        
        IERC20(_token).approve(address(pancakeRouter), _amount);

        IPancackeV3SwapRouter.ExactInputSingleParams memory input = IPancackeV3SwapRouter.ExactInputSingleParams({
            tokenIn: _token,
            tokenOut: pancakeRouter.WETH9(),
            fee: _fee,
            recipient: address(pancakeRouter),
            deadline: block.timestamp + _maxWaitingTime,
            amountIn: _amount,
            amountOutMinimum: _minOutputAmount,
            sqrtPriceLimitX96: 0
        });
        uint256 amountOut = pancakeRouter.exactInputSingle(input);

        pancakeRouter.unwrapWETH9(amountOut, address(this));
        
        uint256 currentBalance = address(this).balance;
        if (currentBalance < _minOutputAmount + beforeBalance) revert WrongOutput();
    }

    function swapCbEthToEth(uint256 _amount, uint256 _minOutputAmount) external onlyAdmin returns (uint256) {
        if (_amount > cbEth.balanceOf(address(this))) revert NotEnoughBalance();
        cbEth.approve(address(cbEth_Eth_Pool), _amount);
        return cbEth_Eth_Pool.exchange_underlying(1, 0, _amount, _minOutputAmount);
    }

    function swapWbEthToEth(uint256 _amount, uint256 _minOutputAmount) external onlyAdmin returns (uint256) {
        if (_amount > wbEth.balanceOf(address(this))) revert NotEnoughBalance();
        wbEth.approve(address(wbEth_Eth_Pool), _amount);
        return wbEth_Eth_Pool.exchange(1, 0, _amount, _minOutputAmount);
    }

    function swapStEthToEth(uint256 _amount, uint256 _minOutputAmount) external onlyAdmin returns (uint256) {
        if (_amount > lido.balanceOf(address(this))) revert NotEnoughBalance();
        lido.approve(address(stEth_Eth_Pool), _amount);
        return stEth_Eth_Pool.exchange(1, 0, _amount, _minOutputAmount);
    }

    /* VIEW FUNCTIONS */

    // Given the `_amount` of `_token` token, returns the equivalent amount of ETH 
    function quoteByFairValue(address _token, uint256 _amount) public view returns (uint256) {
        if (!isTokenWhitelisted(_token)) revert NotSupportedToken();

        if (_token == address(lido)) return _amount * 1; /// 1:1 from stETH to eETH
        else if (_token == address(cbEth)) return _amount * cbEth.exchangeRate() / 1e18;
        else if (_token == address(wbEth)) return _amount * wbEth.exchangeRate() / 1e18;
        else if (tokenInfos[_token].isL2Eth) return _amount * 1; /// 1:1 from l2Eth to eETH

        revert NotSupportedToken();
    }

    function quoteStrategyShareForDeposit(address _token, IStrategy _strategy, uint256 _share) public view returns (uint256) {
        uint256 tokenAmount = _strategy.sharesToUnderlyingView(_share);
        return quoteByMarketValue(_token, tokenAmount);
    }

    function quoteByMarketValue(address _token, uint256 _amount) public view returns (uint256) {
        if (!isTokenWhitelisted(_token)) revert NotSupportedToken();

        if (_token == address(lido)) {
            if (quoteStEthWithCurve) {
                return _min(_amount, ICurvePoolQuoter1(address(stEth_Eth_Pool)).get_dy(1, 0, _amount));
            } else {
                return _amount; /// 1:1 from stETH to eETH
            }
        } else if (_token == address(cbEth)) {
            return _min(_amount * cbEth.exchangeRate() / 1e18, ICurvePoolQuoter2(address(cbEth_Eth_Pool)).get_dy(1, 0, _amount));
        } else if (_token == address(wbEth)) {
            return _min(_amount * wbEth.exchangeRate() / 1e18, ICurvePoolQuoter1(address(wbEth_Eth_Pool)).get_dy(1, 0, _amount));
        } else if (tokenInfos[_token].isL2Eth) {
            // 1:1 for all dummy tokens
            return _amount;
        }

        revert NotSupportedToken();
    }

    function verifyQueuedWithdrawal(address _user, IDelegationManager.Withdrawal calldata _queuedWithdrawal) public view returns (bytes32) {
        require(_queuedWithdrawal.staker == _user && _queuedWithdrawal.withdrawer == address(this), "wrong depositor/withdrawer");
        for (uint256 i = 0; i < _queuedWithdrawal.strategies.length; i++) {
            address token = address(_queuedWithdrawal.strategies[i].underlyingToken());
            require(tokenInfos[token].isWhitelisted && tokenInfos[token].strategy == _queuedWithdrawal.strategies[i], "NotWhitelisted");
        }
        bytes32 withdrawalRoot = eigenLayerDelegationManager.calculateWithdrawalRoot(_queuedWithdrawal);
        require(eigenLayerDelegationManager.pendingWithdrawals(withdrawalRoot), "WrongQ");
        require(!isRegisteredQueuedWithdrawals[withdrawalRoot], "Deposited");

        return withdrawalRoot;
    }

    function isTokenWhitelisted(address _token) public view returns (bool) {
        return tokenInfos[_token].isWhitelisted;
    }

    function isL2Eth(address _token) public view returns (bool) {
        return tokenInfos[_token].isL2Eth;
    }

    function getTotalPooledEther() public view returns (uint256 total) {
        total = address(this).balance + getTotalPooledEther(address(lido)) + getTotalPooledEther(address(cbEth)) + getTotalPooledEther(address(wbEth));
        for (uint256 i = 0; i < dummies.length; i++) {
            total += getTotalPooledEther(address(dummies[i]));
        }
    }

    /// deposited (restaked) ETH can have 3 states:
    /// - restaked in EigenLayer & pending for withdrawals
    /// - non-restaked & held by this contract
    /// - non-restaked & not held by this contract & pending for withdrawals
    function getTotalPooledEtherSplits(address _token) public view returns (uint256 restaked, uint256 holding, uint256 pendingForWithdrawals) {
        TokenInfo memory info = tokenInfos[_token];
        if (!isTokenWhitelisted(_token)) return (0, 0, 0);

        if (info.strategy != IStrategy(address(0))) {
            restaked = quoteByFairValue(_token, info.strategy.sharesToUnderlyingView(info.strategyShare)); /// restaked & pending for withdrawals
        }
        holding = quoteByFairValue(_token, IERC20(_token).balanceOf(address(this))); /// eth value for erc20 holdings
        pendingForWithdrawals = info.ethAmountPendingForWithdrawals; /// eth pending for withdrawals
    }

    function getTotalPooledEther(address _token) public view returns (uint256) {
        (uint256 restaked, uint256 holding, uint256 pendingForWithdrawals) = getTotalPooledEtherSplits(_token);
        return restaked + holding + pendingForWithdrawals;
    }

    function getImplementation() external view returns (address) {
        return _getImplementation();
    }

    function timeBoundCap(address _token) public view returns (uint256) {
        return uint256(1 ether) * tokenInfos[_token].timeBoundCapInEther;
    }

    function totalCap(address _token) public view returns (uint256) {
        return uint256(1 ether) * tokenInfos[_token].totalCapInEther;
    }

    function totalDeposited(address _token) public view returns (uint256) {
        return tokenInfos[_token].totalDeposited;
    }

    function isDepositCapReached(address _token, uint256 _amount) public view returns (bool) {
        TokenInfo memory info = tokenInfos[_token];
        uint96 totalDepositedThisPeriod_ = info.totalDepositedThisPeriod;
        uint32 timeBoundCapClockStartTime_ = info.timeBoundCapClockStartTime;
        if (block.timestamp >= timeBoundCapClockStartTime_ + timeBoundCapRefreshInterval) {
            totalDepositedThisPeriod_ = 0;
        }
        return (totalDepositedThisPeriod_ + _amount > timeBoundCap(_token) || info.totalDeposited + _amount > totalCap(_token));
    }

    /* INTERNAL FUNCTIONS */
    function _enqueueForWithdrawal(IStrategy[] memory _strategies, uint256[] memory _shares) internal returns (uint256) {
        uint256 numStrategies = _strategies.length;
        uint256 amount = 0;
        for (uint256 i = 0; i < numStrategies; i++) {
            IStrategy strategy = _strategies[i];
            uint256 share = _shares[i];
            address token = address(strategy.underlyingToken());
            uint256 dx = quoteStrategyShareForDeposit(token, strategy, share);

            // discount
            dx = (10000 - tokenInfos[token].discountInBasisPoints) * dx / 10000;

            // Disable it because the deposit through EL queued withdrawal will be deprecated by EigenLayer anyway
            // But, we need to still support '_enqueueForWithdrawal' as the backward compatibility for the already queued ones
            // require(!isDepositCapReached(token, dx), "CAPPED");

            amount += dx;
            tokenInfos[token].strategyShare += uint128(share);

            _afterDeposit(token, amount);

            emit Liquified(msg.sender, dx, token, true);
        }
        return amount;
    }
    
    function _completeWithdrawals(IDelegationManager.Withdrawal memory _queuedWithdrawal) internal {
        bytes32 withdrawalRoot = eigenLayerDelegationManager.calculateWithdrawalRoot(_queuedWithdrawal);

        uint256 numStrategies = _queuedWithdrawal.strategies.length;
        for (uint256 i = 0; i < numStrategies; i++) {
            address token = address(_queuedWithdrawal.strategies[i].underlyingToken());
            uint128 share = uint128(_queuedWithdrawal.shares[i]);

            if (tokenInfos[token].strategyShare < share) revert StrategyShareNotEnough();
            tokenInfos[token].strategyShare -= share;
        }

        emit CompletedQueuedWithdrawal(withdrawalRoot);
    }

    function _afterDeposit(address _token, uint256 _amount) internal {
        TokenInfo storage info = tokenInfos[_token];
        if (block.timestamp >= info.timeBoundCapClockStartTime + timeBoundCapRefreshInterval) {
            info.totalDepositedThisPeriod = 0;
            info.timeBoundCapClockStartTime = uint32(block.timestamp);
        }
        info.totalDepositedThisPeriod += uint96(_amount);
        info.totalDeposited += uint96(_amount);
    }

    function _L2SanityChecks(address _token) internal view {
        if (IERC20(_token).totalSupply() != IERC20(_token).balanceOf(address(this))) revert();
    }

     function _min(uint256 _a, uint256 _b) internal pure returns (uint256) {
        return (_a > _b) ? _b : _a;
    }

    function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}

    function _requireAdmin() internal view virtual {
        if (!(admins[msg.sender] || msg.sender == owner())) revert IncorrectCaller();
    }

    function _requirePauser() internal view virtual {
        if (!(pausers[msg.sender] || admins[msg.sender] || msg.sender == owner())) revert IncorrectCaller();
    }

    /* MODIFIER */
    modifier onlyAdmin() {
        _requireAdmin();
        _;
    }

    modifier onlyPauser() {
        _requirePauser();
        _;
    }
}

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

pragma solidity ^0.8.2;

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

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

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

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

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * 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 3 of 35 : UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.0;

import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

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

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
        _;
    }

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

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeTo(address newImplementation) external virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data, true);
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeTo} and {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal override onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) 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[50] private __gap;
}

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

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../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 anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing 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 5 of 35 : PausableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

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

    bool private _paused;

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

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

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

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

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

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

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

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

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

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

pragma solidity ^0.8.0;
import "../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 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 7 of 35 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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.
 */
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].
     */
    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 8 of 35 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-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;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

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

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    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");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    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");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 9 of 35 : ILiquifier.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "../eigenlayer-interfaces/IStrategyManager.sol";
import "../eigenlayer-interfaces/IStrategy.sol";
import "../eigenlayer-interfaces/IPauserRegistry.sol";

// cbETH-ETH mainnet: 0x5FAE7E604FC3e24fd43A72867ceBaC94c65b404A
// wBETH-ETH mainnet: 0xBfAb6FA95E0091ed66058ad493189D2cB29385E6
// stETH-ETH mainnet: 0xDC24316b9AE028F1497c275EB9192a3Ea0f67022
interface ICurvePool {
    function exchange_underlying(uint256 i, uint256 j, uint256 dx, uint256 min_dy) external returns (uint256);
    function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external returns (uint256);
    function get_virtual_price() external view returns (uint256);
}

interface ICurvePoolQuoter1 {
    function get_dy(int128 i, int128 j, uint256 dx) external view returns (uint256); // wBETH-ETH, stETH-ETH
}

interface ICurvePoolQuoter2 {
    function get_dy(uint256 i, uint256 j, uint256 dx) external view returns (uint256); // cbETH-ETH
}

// mint forwarder: 0xfae23c30d383DF59D3E031C325a73d454e8721a6
// mainnet: 0xBe9895146f7AF43049ca1c1AE358B0541Ea49704
interface IcbETH is IERC20 {
    function mint(address _to, uint256 _amount) external;
    function exchangeRate() external view returns (uint256 _exchangeRate);
}

// mainnet: 0xa2E3356610840701BDf5611a53974510Ae27E2e1
interface IwBETH is IERC20 {
    function deposit(address referral) payable external;
    function mint(address _to, uint256 _amount) external;
    function exchangeRate() external view returns (uint256 _exchangeRate);
}

// mainnet: 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84
interface ILido is IERC20 {
    function getTotalPooledEther() external view returns (uint256);
    function getTotalShares() external view returns (uint256);

    function submit(address _referral) external payable returns (uint256);
    function nonces(address _user) external view returns (uint256);
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// mainnet: 0x858646372CC42E1A627fcE94aa7A7033e7CF075A
interface IEigenLayerStrategyManager is IStrategyManager {
    function withdrawalRootPending(bytes32 _withdrawalRoot) external view returns (bool);
    function numWithdrawalsQueued(address _user) external view returns (uint96);
    function pauserRegistry() external returns (IPauserRegistry);
    function paused(uint8 index) external view returns (bool);
    function unpause(uint256 newPausedStatus) external;

    // For testing
    function queueWithdrawal( uint256[] calldata strategyIndexes, IStrategy[] calldata strategies, uint256[] calldata shares, address withdrawer, bool undelegateIfPossible ) external returns(bytes32);
}

interface IEigenLayerStrategyTVLLimits is IStrategy {
    function getTVLLimits() external view returns (uint256, uint256);
    function setTVLLimits(uint256 newMaxPerDeposit, uint256 newMaxTotalDeposits) external;
    function pauserRegistry() external returns (IPauserRegistry);
    function paused(uint8 index) external view returns (bool);
    function unpause(uint256 newPausedStatus) external;
}

// mainnet: 0x889edC2eDab5f40e902b864aD4d7AdE8E412F9B1
interface ILidoWithdrawalQueue {
    function FINALIZE_ROLE() external view returns (bytes32);
    function MAX_STETH_WITHDRAWAL_AMOUNT() external view returns (uint256);
    function MIN_STETH_WITHDRAWAL_AMOUNT() external view returns (uint256);
    function requestWithdrawals(uint256[] calldata _amount, address _depositor) external returns (uint256[] memory);
    function claimWithdrawals(uint256[] calldata _requestIds, uint256[] calldata _hints) external;

    function finalize(uint256 _lastRequestIdToBeFinalized, uint256 _maxShareRate) external payable;
    function prefinalize(uint256[] calldata _batches, uint256 _maxShareRate) external view returns (uint256 ethToLock, uint256 sharesToBurn);

    function findCheckpointHints(uint256[] calldata _requestIds, uint256 _firstIndex, uint256 _lastIndex) external view returns (uint256[] memory hintIds);
    function getRoleMember(bytes32 _role, uint256 _index) external view returns (address);
    function getLastRequestId() external view returns (uint256);
    function getLastCheckpointIndex() external view returns (uint256);
}

interface ILiquifier {
    
    struct PermitInput {
        uint256 value;
        uint256 deadline;
        uint8 v;
        bytes32 r;
        bytes32 s;
    } 

    struct TokenInfo {
        uint128 strategyShare;
        uint128 ethAmountPendingForWithdrawals;
        IStrategy strategy;
        bool isWhitelisted;
        uint16 discountInBasisPoints;
        uint32 timeBoundCapClockStartTime;
        uint32 timeBoundCapInEther;
        uint32 totalCapInEther;
        uint96 totalDepositedThisPeriod;
        uint96 totalDeposited;
        bool isL2Eth;
    }

    function depositWithERC20(address _token, uint256 _amount, address _referral) external returns (uint256);
}

File 10 of 35 : ILiquidityPool.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "./IStakingManager.sol";

interface ILiquidityPool {

    struct PermitInput {
        uint256 value;
        uint256 deadline;
        uint8 v;
        bytes32 r;
        bytes32 s;
    } 

    enum SourceOfFunds {
        UNDEFINED,
        EETH,
        ETHER_FAN,
        DELEGATED_STAKING
    }

    struct FundStatistics {
        uint32 numberOfValidators;
        uint32 targetWeight;
    }

    // Necessary to preserve "statelessness" of dutyForWeek().
    // Handles case where new users join/leave holder list during an active slot
    struct HoldersUpdate {
        uint32 timestamp;
        uint32 startOfSlotNumOwners;
    }

    struct BnftHolder {
        address holder;
        uint32 timestamp;
    }

    struct BnftHoldersIndex {
        bool registered;
        uint32 index;
    }

    function numPendingDeposits() external view returns (uint32);
    function totalValueOutOfLp() external view returns (uint128);
    function totalValueInLp() external view returns (uint128);
    function getTotalEtherClaimOf(address _user) external view returns (uint256);
    function getTotalPooledEther() external view returns (uint256);
    function sharesForAmount(uint256 _amount) external view returns (uint256);
    function sharesForWithdrawalAmount(uint256 _amount) external view returns (uint256);
    function amountForShare(uint256 _share) external view returns (uint256);

    function deposit() external payable returns (uint256);
    function deposit(address _referral) external payable returns (uint256);
    function deposit(address _user, address _referral) external payable returns (uint256);
    function depositToRecipient(address _recipient, uint256 _amount, address _referral) external returns (uint256);
    function withdraw(address _recipient, uint256 _amount) external returns (uint256);
    function requestWithdraw(address recipient, uint256 amount) external returns (uint256);
    function requestWithdrawWithPermit(address _owner, uint256 _amount, PermitInput calldata _permit) external returns (uint256);
    function requestMembershipNFTWithdraw(address recipient, uint256 amount, uint256 fee) external returns (uint256);

    function batchDepositAsBnftHolder(uint256[] calldata _candidateBidIds, uint256 _numberOfValidators) external payable returns (uint256[] memory);
    function batchDepositAsBnftHolder(uint256[] calldata _candidateBidIds, uint256 _numberOfValidators, uint256 _validatorIdToCoUseWithdrawalSafe) external payable returns (uint256[] memory);
    function batchRegisterAsBnftHolder(bytes32 _depositRoot, uint256[] calldata _validatorIds, IStakingManager.DepositData[] calldata _registerValidatorDepositData, bytes32[] calldata _depositDataRootApproval, bytes[] calldata _signaturesForApprovalDeposit) external;
    function batchApproveRegistration(uint256[] memory _validatorIds, bytes[] calldata _pubKey, bytes[] calldata _signature) external;
    function batchCancelDeposit(uint256[] calldata _validatorIds) external;
    function sendExitRequests(uint256[] calldata _validatorIds) external;

    function rebase(int128 _accruedRewards) external;
    function payProtocolFees(uint128 _protocolFees) external;
    function addEthAmountLockedForWithdrawal(uint128 _amount) external;
    function reduceEthAmountLockedForWithdrawal(uint128 _amount) external;
    
    function setStakingTargetWeights(uint32 _eEthWeight, uint32 _etherFanWeight) external;
    function updateAdmin(address _newAdmin, bool _isAdmin) external;
    function pauseContract() external;
    function unPauseContract() external;
}

File 11 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 {
    /**
     * @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);

    function withdrawalRootPending(bytes32 _withdrawalRoot) external view returns (bool);
}

File 12 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 {
    // @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;

    function pendingWithdrawals(bytes32 withdrawalRoot) external view returns (bool);

    function beaconChainETHStrategy() external view returns (IStrategy);
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return 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 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 14 of 35 : draft-IERC1822Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.0;

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

File 15 of 35 : ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 *
 * @custom:oz-upgrades-unsafe-allow delegatecall
 */
abstract contract ERC1967UpgradeUpgradeable is Initializable {
    function __ERC1967Upgrade_init() internal onlyInitializing {
    }

    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
    }
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallUUPS(
        address newImplementation,
        bytes memory data,
        bool forceCall
    ) internal {
        // Upgrades from old implementations will perform a rollback test. This test requires the new
        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
        // this special case will break upgrade paths from old UUPS implementation to new ones.
        if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
            _setImplementation(newImplementation);
        } else {
            try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {
                require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
            } catch {
                revert("ERC1967Upgrade: new implementation is not UUPS");
            }
            _upgradeToAndCall(newImplementation, data, forceCall);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

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

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

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

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

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

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(
        address newBeacon,
        bytes memory data,
        bool forceCall
    ) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
        }
    }

    /**
     * @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) private returns (bytes memory) {
        require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed");
    }

    /**
     * @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 16 of 35 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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

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

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

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

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

File 17 of 35 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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 18 of 35 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return 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 : 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 20 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 21 of 35 : IStakingManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

import "./ILiquidityPool.sol";

interface IStakingManager {
    struct DepositData {
        bytes publicKey;
        bytes signature;
        bytes32 depositDataRoot;
        string ipfsHashForEncryptedValidatorKey;
    }

    struct StakerInfo {
        address staker;
        ILiquidityPool.SourceOfFunds sourceOfFund;
    }

    function bidIdToStaker(uint256 id) external view returns (address);

    function getEtherFiNodeBeacon() external view returns (address);

    function initialize(address _auctionAddress, address _depositContractAddress) external;
    function setEtherFiNodesManagerAddress(address _managerAddress) external;
    function setLiquidityPoolAddress(address _liquidityPoolAddress) external;
    
    function batchDepositWithBidIds(uint256[] calldata _candidateBidIds, uint256 _numberOfValidators, address _staker, address _tnftHolder, address _bnftHolder, ILiquidityPool.SourceOfFunds source, bool _enableRestaking, uint256 _validatorIdToCoUseWithdrawalSafe) external returns (uint256[] memory);
    function batchDepositWithBidIds(uint256[] calldata _candidateBidIds, bool _enableRestaking) external payable returns (uint256[] memory);

    function batchRegisterValidators(bytes32 _depositRoot, uint256[] calldata _validatorId, DepositData[] calldata _depositData) external;
    function batchRegisterValidators(bytes32 _depositRoot, uint256[] calldata _validatorId, address _bNftRecipient, address _tNftRecipient, DepositData[] calldata _depositData, address _user) external payable;

    function batchApproveRegistration(uint256[] memory _validatorId, bytes[] calldata _pubKey, bytes[] calldata _signature, bytes32[] calldata _depositDataRootApproval) external payable;

    function batchCancelDeposit(uint256[] calldata _validatorIds) external;

    function batchCancelDepositAsBnftHolder(uint256[] calldata _validatorIds, address _caller) external;

    function instantiateEtherFiNode(bool _createEigenPod) external returns (address);

    function updateAdmin(address _address, bool _isAdmin) external;
    function pauseContract() external;
    function unPauseContract() external;
}

File 22 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 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 "./IBeaconChainOracle.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 update of the beaconChainOracle address
    event BeaconOracleUpdated(address indexed newOracleAddress);

    /// @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
    );

    event DenebForkTimestampUpdated(uint64 newValue);

    /**
     * @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 Updates the oracle contract that provides the beacon chain state root
     * @param newBeaconChainOracle is the new oracle contract being pointed to
     * @dev Callable only by the owner of this contract (i.e. governance)
     */
    function updateBeaconChainOracle(IBeaconChainOracle newBeaconChainOracle) 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 Oracle contract that provides updates to the beacon chain's state
    function beaconChainOracle() external view returns (IBeaconChainOracle);

    /// @notice Returns the beacon block root at `timestamp`. Reverts if the Beacon block root at `timestamp` has not yet been finalized.
    function getBlockRootAtTimestamp(uint64 timestamp) external view returns (bytes32);

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

    /**
     * @notice the deneb hard fork timestamp used to determine which proof path to use for proving a withdrawal
     */
    function denebForkTimestamp() external view returns (uint64);

     /**
     * setting the deneb hard fork timestamp by the eigenPodManager owner
     * @dev this function is designed to be called twice.  Once, it is set to type(uint64).max 
     * prior to the actual deneb fork timestamp being set, and then the second time it is set 
     * to the actual deneb fork timestamp.
     */
    function setDenebForkTimestamp(uint64 newDenebForkTimestamp) external;

    function owner() external returns (address);

}

File 24 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 25 of 35 : IBeaconUpgradeable.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 IBeaconUpgradeable {
    /**
     * @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 26 of 35 : StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)

pragma solidity ^0.8.0;

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

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

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

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

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

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

File 27 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 28 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 29 of 35 : IEigenPod.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity >=0.5.0;

import "src/eigenlayer-libraries/LegacyBeaconChainProofs.sol";
import "src/eigenlayer-libraries/BeaconChainProofs.sol";
import "./IEigenPodManager.sol";
import "./IBeaconChainOracle.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
 * @notice The main functionalities are:
 * - creating new ETH validators with their withdrawal credentials pointed to this contract
 * - proving from beacon chain state roots that withdrawal credentials are pointed to this contract
 * - proving from beacon chain state roots the balances of ETH validators with their withdrawal credentials
 *   pointed to this contract
 * - updating aggregate balances in the EigenPodManager
 * - withdrawing eth when withdrawals are initiated
 * @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 {
    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 mostRecentBalanceUpdateTimestamp;
        // status of the validator
        VALIDATOR_STATUS status;
    }

    /**
     * @notice struct used to store amounts related to proven withdrawals in memory. Used to help
     * manage stack depth and optimize the number of external calls, when batching withdrawal operations.
     */
    struct VerifiedWithdrawal {
        // amount to send to a podOwner from a proven withdrawal
        uint256 amountToSendGwei;
        // difference in shares to be recorded in the eigenPodManager, as a result of the withdrawal
        int256 sharesDeltaGwei;
    }


    enum PARTIAL_WITHDRAWAL_CLAIM_STATUS {
        REDEEMED,
        PENDING,
        FAILED
    }

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

    /// @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 an ETH validator is prove to have withdrawn from the beacon chain
    event FullWithdrawalRedeemed(
        uint40 validatorIndex,
        uint64 withdrawalTimestamp,
        address indexed recipient,
        uint64 withdrawalAmountGwei
    );

    /// @notice Emitted when a partial withdrawal claim is successfully redeemed
    event PartialWithdrawalRedeemed(
        uint40 validatorIndex,
        uint64 withdrawalTimestamp,
        address indexed recipient,
        uint64 partialWithdrawalAmountGwei
    );

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

    /// @notice Emitted when podOwner enables restaking
    event RestakingActivated(address indexed podOwner);

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

    /// @notice Emitted when ETH that was previously received via the `receive` fallback is withdrawn
    event NonBeaconChainETHWithdrawn(address indexed recipient, uint256 amountWithdrawn);


    /// @notice The max amount of eth, in gwei, that can be restaked per validator
    function MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR() external view returns (uint64);

    /// @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 any ETH deposited into the EigenPod contract via the `receive` fallback function
    function nonBeaconChainETHBalanceWei() external view returns (uint256);

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

    /// @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 an indicator of whether or not the podOwner has ever "fully restaked" by successfully calling `verifyCorrectWithdrawalCredentials`.
    function hasRestaked() external view returns (bool);

    /**
     * @notice The latest timestamp at which the pod owner withdrew the balance of the pod, via calling `withdrawBeforeRestaking`.
     * @dev This variable is only updated when the `withdrawBeforeRestaking` function is called, which can only occur before `hasRestaked` is set to true for this pod.
     * Proofs for this pod are only valid against Beacon Chain state roots corresponding to timestamps after the stored `mostRecentWithdrawalTimestamp`.
     */
    function mostRecentWithdrawalTimestamp() external view returns (uint64);

    /// @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 mapping that tracks proven withdrawals
    function provenWithdrawal(bytes32 validatorPubkeyHash, uint64 slot) external view returns (bool);

    /// @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 This function verifies that the withdrawal credentials of validator(s) owned by the podOwner are pointed to
     * this contract. It also verifies the effective balance  of the validator.  It verifies the provided proof of the ETH validator against the beacon chain state
     * root, marks the validator as 'active' in EigenLayer, and credits the restaked ETH in Eigenlayer.
     * @param oracleTimestamp is the Beacon Chain timestamp whose state root the `proof` will be proven against.
     * @param validatorIndices is the list of indices of the validators being proven, refer to consensus specs
     * @param withdrawalCredentialProofs is an array of proofs, where each proof proves each ETH validator's balance and withdrawal credentials
     * against a beacon chain state root
     * @param validatorFields are the fields of the "Validator Container", refer to consensus specs
     * for details: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator
     */
    function verifyWithdrawalCredentials(
        uint64 oracleTimestamp,
        LegacyBeaconChainProofs.StateRootProof calldata stateRootProof,
        uint40[] calldata validatorIndices,
        bytes[] calldata withdrawalCredentialProofs,
        bytes32[][] calldata validatorFields
    )
        external;

    /**
     * @notice This function records an update (either increase or decrease) in the pod's balance in the StrategyManager.  
               It also verifies a merkle proof of the validator's current beacon chain balance.  
     * @param oracleTimestamp The oracleTimestamp whose state root the `proof` will be proven against.
     *        Must be within `VERIFY_BALANCE_UPDATE_WINDOW_SECONDS` of the current block.
     * @param validatorIndices is the list of indices of the validators being proven, refer to consensus specs 
     * @param validatorFieldsProofs proofs against the `beaconStateRoot` for each validator in `validatorFields`
     * @param validatorFields are the fields of the "Validator Container", refer to consensus specs
     * @dev For more details on the Beacon Chain spec, see: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator
     */
    function verifyBalanceUpdates(
        uint64 oracleTimestamp,
        uint40[] calldata validatorIndices,
        LegacyBeaconChainProofs.StateRootProof calldata stateRootProof,
        bytes[] calldata validatorFieldsProofs,
        bytes32[][] calldata validatorFields
    ) external;

    /**
     * @notice This function records full and partial withdrawals on behalf of one of the Ethereum validators for this EigenPod
     * @param oracleTimestamp is the timestamp of the oracle slot that the withdrawal is being proven against
     * @param withdrawalProofs is the information needed to check the veracity of the block numbers and withdrawals being proven
     * @param validatorFieldsProofs is the proof of the validator's fields' in the validator tree
     * @param withdrawalFields are the fields of the withdrawals being proven
     * @param validatorFields are the fields of the validators being proven
     */
    function verifyAndProcessWithdrawals(
        uint64 oracleTimestamp,
        LegacyBeaconChainProofs.StateRootProof calldata stateRootProof,
        LegacyBeaconChainProofs.WithdrawalProof[] calldata withdrawalProofs,
        bytes[] calldata validatorFieldsProofs,
        bytes32[][] calldata validatorFields,
        bytes32[][] calldata withdrawalFields
    ) external;

    /**
     * @notice Called by the pod owner to activate restaking by withdrawing
     * all existing ETH from the pod and preventing further withdrawals via
     * "withdrawBeforeRestaking()"
     */
    function activateRestaking() external;

    /// @notice Called by the pod owner to withdraw the balance of the pod when `hasRestaked` is set to false
    function withdrawBeforeRestaking() external;

    /// @notice Called by the pod owner to withdraw the nonBeaconChainETHBalanceWei
    function withdrawNonBeaconChainETHBalanceWei(address recipient, uint256 amountToWithdraw) 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;

    //--------------------------------------------------------------------------------------
    //---------------------------------  PEPE UPDATES   ------------------------------------
    //--------------------------------------------------------------------------------------

    // TODO(Dave): Once we are no longer in between the 2 updates, we can fully replace this file with
    // the new version

    /// State-changing methods

    function startCheckpoint(bool revertIfNoBalance) external;
    function verifyCheckpointProofs(
        BeaconChainProofs.BalanceContainerProof calldata balanceContainerProof,
        BeaconChainProofs.BalanceProof[] calldata proofs
    ) external;
    function setProofSubmitter(address newProofSubmitter) external;

    /// Events

    /// @notice Emitted when a checkpoint is created
    event CheckpointCreated(uint64 indexed checkpointTimestamp, bytes32 indexed beaconBlockRoot);
    /// @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);

    /// Structs

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

    /// View methods

    function activeValidatorCount() external view returns (uint256); // note - this variable already exists in M2; this change just makes it public!
    function lastCheckpointTimestamp() external view returns (uint64);
    function currentCheckpointTimestamp() external view returns (uint64);
    function currentCheckpoint() external view returns (Checkpoint memory);
}

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

/**
 * @title Interface for the BeaconStateOracle contract.
 * @author Layr Labs, Inc.
 * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
 */
interface IBeaconChainOracle {
    /// @notice The block number to state root mapping.
    function timestampToBlockRoot(uint256 timestamp) external view returns (bytes32);
}

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

import "src/eigenlayer-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 32 of 35 : LegacyBeaconChainProofs.sol
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.0;

import "./EigenlayerMerkle.sol";
import "./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 LegacyBeaconChainProofs {
    // constants are the number of fields and the heights of the different merkle trees used in merkleizing beacon chain containers
    uint256 internal constant NUM_BEACON_BLOCK_HEADER_FIELDS = 5;
    uint256 internal constant BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT = 3;

    uint256 internal constant NUM_BEACON_BLOCK_BODY_FIELDS = 11;
    uint256 internal constant BEACON_BLOCK_BODY_FIELD_TREE_HEIGHT = 4;

    uint256 internal constant NUM_BEACON_STATE_FIELDS = 21;
    uint256 internal constant BEACON_STATE_FIELD_TREE_HEIGHT = 5;

    uint256 internal constant NUM_ETH1_DATA_FIELDS = 3;
    uint256 internal constant ETH1_DATA_FIELD_TREE_HEIGHT = 2;

    uint256 internal constant NUM_VALIDATOR_FIELDS = 8;
    uint256 internal constant VALIDATOR_FIELD_TREE_HEIGHT = 3;

    uint256 internal constant NUM_EXECUTION_PAYLOAD_HEADER_FIELDS = 15;
    uint256 internal constant EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT = 4;

    uint256 internal constant NUM_EXECUTION_PAYLOAD_FIELDS = 15;
    uint256 internal constant EXECUTION_PAYLOAD_FIELD_TREE_HEIGHT = 4;

    // HISTORICAL_ROOTS_LIMIT	 = 2**24, so tree height is 24
    uint256 internal constant HISTORICAL_ROOTS_TREE_HEIGHT = 24;

    // HISTORICAL_BATCH is root of state_roots and block_root, so number of leaves =  2^1
    uint256 internal constant HISTORICAL_BATCH_TREE_HEIGHT = 1;

    // SLOTS_PER_HISTORICAL_ROOT = 2**13, so tree height is 13
    uint256 internal constant STATE_ROOTS_TREE_HEIGHT = 13;
    uint256 internal constant BLOCK_ROOTS_TREE_HEIGHT = 13;

    //HISTORICAL_ROOTS_LIMIT = 2**24, so tree height is 24
    uint256 internal constant HISTORICAL_SUMMARIES_TREE_HEIGHT = 24;

    //Index of block_summary_root in historical_summary container
    uint256 internal constant BLOCK_SUMMARY_ROOT_INDEX = 0;

    uint256 internal constant NUM_WITHDRAWAL_FIELDS = 4;
    // tree height for hash tree of an individual withdrawal container
    uint256 internal constant WITHDRAWAL_FIELD_TREE_HEIGHT = 2;

    uint256 internal constant VALIDATOR_TREE_HEIGHT = 40;

    // MAX_WITHDRAWALS_PER_PAYLOAD = 2**4, making tree height = 4
    uint256 internal constant WITHDRAWALS_TREE_HEIGHT = 4;

    //in beacon block body https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#beaconblockbody
    uint256 internal constant EXECUTION_PAYLOAD_INDEX = 9;

    // in beacon block header https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconblockheader
    uint256 internal constant SLOT_INDEX = 0;
    uint256 internal constant PROPOSER_INDEX_INDEX = 1;
    uint256 internal constant STATE_ROOT_INDEX = 3;
    uint256 internal constant BODY_ROOT_INDEX = 4;
    // in beacon state https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#beaconstate
    uint256 internal constant HISTORICAL_BATCH_STATE_ROOT_INDEX = 1;
    uint256 internal constant BEACON_STATE_SLOT_INDEX = 2;
    uint256 internal constant LATEST_BLOCK_HEADER_ROOT_INDEX = 4;
    uint256 internal constant BLOCK_ROOTS_INDEX = 5;
    uint256 internal constant STATE_ROOTS_INDEX = 6;
    uint256 internal constant HISTORICAL_ROOTS_INDEX = 7;
    uint256 internal constant ETH_1_ROOT_INDEX = 8;
    uint256 internal constant VALIDATOR_TREE_ROOT_INDEX = 11;
    uint256 internal constant EXECUTION_PAYLOAD_HEADER_INDEX = 24;
    uint256 internal constant HISTORICAL_SUMMARIES_INDEX = 27;

    // in validator https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator
    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_WITHDRAWABLE_EPOCH_INDEX = 7;

    // in execution payload header
    uint256 internal constant TIMESTAMP_INDEX = 9;
    uint256 internal constant WITHDRAWALS_ROOT_INDEX = 14;

    //in execution payload
    uint256 internal constant WITHDRAWALS_INDEX = 14;

    // in withdrawal
    uint256 internal constant WITHDRAWAL_VALIDATOR_INDEX_INDEX = 1;
    uint256 internal constant WITHDRAWAL_VALIDATOR_AMOUNT_INDEX = 3;

    //In historicalBatch
    uint256 internal constant HISTORICALBATCH_STATEROOTS_INDEX = 1;

    //Misc Constants

    /// @notice The number of slots each epoch in the beacon chain
    uint64 internal constant SLOTS_PER_EPOCH = 32;

    /// @notice The number of seconds in a slot in the beacon chain
    uint64 internal constant SECONDS_PER_SLOT = 12;

    /// @notice Number of seconds per epoch: 384 == 32 slots/epoch * 12 seconds/slot 
    uint64 internal constant SECONDS_PER_EPOCH = SLOTS_PER_EPOCH * SECONDS_PER_SLOT;

    bytes8 internal constant UINT64_MASK = 0xffffffffffffffff;

    /// @notice This struct contains the merkle proofs and leaves needed to verify a partial/full withdrawal
    struct WithdrawalProof {
        bytes withdrawalProof;
        bytes slotProof;
        bytes executionPayloadProof;
        bytes timestampProof;
        bytes historicalSummaryBlockRootProof;
        uint64 blockRootIndex;
        uint64 historicalSummaryIndex;
        uint64 withdrawalIndex;
        bytes32 blockRoot;
        bytes32 slotRoot;
        bytes32 timestampRoot;
        bytes32 executionPayloadRoot;
    }

    /// @notice This struct contains the root and proof for verifying the state root against the oracle block root
    struct StateRootProof {
        bytes32 beaconStateRoot;
        bytes proof;
    }

    /**
     * @notice This function verifies merkle proofs of the fields of a certain validator against a beacon chain state root
     * @param validatorIndex the index of the proven validator
     * @param beaconStateRoot is the beacon chain state root to be proven against.
     * @param validatorFieldsProof is the data used in proving the validator's fields
     * @param validatorFields the claimed fields of the validator
     */
    function verifyValidatorFields(
        bytes32 beaconStateRoot,
        bytes32[] calldata validatorFields,
        bytes calldata validatorFieldsProof,
        uint40 validatorIndex
    ) internal view {
        require(
            validatorFields.length == 2 ** VALIDATOR_FIELD_TREE_HEIGHT,
            "BeaconChainProofs.verifyValidatorFields: Validator fields has incorrect length"
        );

        /**
         * Note: the length of the validator merkle proof is BeaconChainProofs.VALIDATOR_TREE_HEIGHT + 1.
         * There is an additional layer added by hashing the root with the length of the validator list
         */
        require(
            validatorFieldsProof.length == 32 * ((VALIDATOR_TREE_HEIGHT + 1) + BEACON_STATE_FIELD_TREE_HEIGHT),
            "BeaconChainProofs.verifyValidatorFields: Proof has incorrect length"
        );
        uint256 index = (VALIDATOR_TREE_ROOT_INDEX << (VALIDATOR_TREE_HEIGHT + 1)) | uint256(validatorIndex);
        // merkleize the validatorFields to get the leaf to prove
        bytes32 validatorRoot = EigenlayerMerkle.merkleizeSha256(validatorFields);

        // verify the proof of the validatorRoot against the beaconStateRoot
        require(
            EigenlayerMerkle.verifyInclusionSha256({
                proof: validatorFieldsProof,
                root: beaconStateRoot,
                leaf: validatorRoot,
                index: index
            }),
            "BeaconChainProofs.verifyValidatorFields: Invalid merkle proof"
        );
    }

    /**
     * @notice This function verifies the latestBlockHeader against the state root. the latestBlockHeader is
     * a tracked in the beacon state.
     * @param beaconStateRoot is the beacon chain state root to be proven against.
     * @param stateRootProof is the provided merkle proof
     * @param latestBlockRoot is hashtree root of the latest block header in the beacon state
     */
    function verifyStateRootAgainstLatestBlockRoot(
        bytes32 latestBlockRoot,
        bytes32 beaconStateRoot,
        bytes calldata stateRootProof
    ) internal view {
        require(
            stateRootProof.length == 32 * (BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT),
            "BeaconChainProofs.verifyStateRootAgainstLatestBlockRoot: Proof has incorrect length"
        );
        //Next we verify the slot against the blockRoot
        require(
            EigenlayerMerkle.verifyInclusionSha256({
                proof: stateRootProof,
                root: latestBlockRoot,
                leaf: beaconStateRoot,
                index: STATE_ROOT_INDEX
            }),
            "BeaconChainProofs.verifyStateRootAgainstLatestBlockRoot: Invalid latest block header root merkle proof"
        );
    }

    /**
     * @notice This function verifies the slot and the withdrawal fields for a given withdrawal
     * @param withdrawalProof is the provided set of merkle proofs
     * @param withdrawalFields is the serialized withdrawal container to be proven
     */
    function verifyWithdrawal(
        bytes32 beaconStateRoot,
        bytes32[] calldata withdrawalFields,
        WithdrawalProof calldata withdrawalProof
    ) internal view {
        require(
            withdrawalFields.length == 2 ** WITHDRAWAL_FIELD_TREE_HEIGHT,
            "BeaconChainProofs.verifyWithdrawal: withdrawalFields has incorrect length"
        );

        require(
            withdrawalProof.blockRootIndex < 2 ** BLOCK_ROOTS_TREE_HEIGHT,
            "BeaconChainProofs.verifyWithdrawal: blockRootIndex is too large"
        );
        require(
            withdrawalProof.withdrawalIndex < 2 ** WITHDRAWALS_TREE_HEIGHT,
            "BeaconChainProofs.verifyWithdrawal: withdrawalIndex is too large"
        );

        require(
            withdrawalProof.historicalSummaryIndex < 2 ** HISTORICAL_SUMMARIES_TREE_HEIGHT,
            "BeaconChainProofs.verifyWithdrawal: historicalSummaryIndex is too large"
        );

        require(
            withdrawalProof.withdrawalProof.length ==
                32 * (EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT + WITHDRAWALS_TREE_HEIGHT + 1),
            "BeaconChainProofs.verifyWithdrawal: withdrawalProof has incorrect length"
        );
        require(
            withdrawalProof.executionPayloadProof.length ==
                32 * (BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT + BEACON_BLOCK_BODY_FIELD_TREE_HEIGHT),
            "BeaconChainProofs.verifyWithdrawal: executionPayloadProof has incorrect length"
        );
        require(
            withdrawalProof.slotProof.length == 32 * (BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT),
            "BeaconChainProofs.verifyWithdrawal: slotProof has incorrect length"
        );
        require(
            withdrawalProof.timestampProof.length == 32 * (EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT),
            "BeaconChainProofs.verifyWithdrawal: timestampProof has incorrect length"
        );

        require(
            withdrawalProof.historicalSummaryBlockRootProof.length ==
                32 *
                    (BEACON_STATE_FIELD_TREE_HEIGHT +
                        (HISTORICAL_SUMMARIES_TREE_HEIGHT + 1) +
                        1 +
                        (BLOCK_ROOTS_TREE_HEIGHT)),
            "BeaconChainProofs.verifyWithdrawal: historicalSummaryBlockRootProof has incorrect length"
        );
        /**
         * Note: Here, the "1" in "1 + (BLOCK_ROOTS_TREE_HEIGHT)" signifies that extra step of choosing the "block_root_summary" within the individual
         * "historical_summary". Everywhere else it signifies merkelize_with_mixin, where the length of an array is hashed with the root of the array,
         * but not here.
         */
        uint256 historicalBlockHeaderIndex = (HISTORICAL_SUMMARIES_INDEX <<
            ((HISTORICAL_SUMMARIES_TREE_HEIGHT + 1) + 1 + (BLOCK_ROOTS_TREE_HEIGHT))) |
            (uint256(withdrawalProof.historicalSummaryIndex) << (1 + (BLOCK_ROOTS_TREE_HEIGHT))) |
            (BLOCK_SUMMARY_ROOT_INDEX << (BLOCK_ROOTS_TREE_HEIGHT)) |
            uint256(withdrawalProof.blockRootIndex);

        require(
            EigenlayerMerkle.verifyInclusionSha256({
                proof: withdrawalProof.historicalSummaryBlockRootProof,
                root: beaconStateRoot,
                leaf: withdrawalProof.blockRoot,
                index: historicalBlockHeaderIndex
            }),
            "BeaconChainProofs.verifyWithdrawal: Invalid historicalsummary merkle proof"
        );

        //Next we verify the slot against the blockRoot
        require(
            EigenlayerMerkle.verifyInclusionSha256({
                proof: withdrawalProof.slotProof,
                root: withdrawalProof.blockRoot,
                leaf: withdrawalProof.slotRoot,
                index: SLOT_INDEX
            }),
            "BeaconChainProofs.verifyWithdrawal: Invalid slot merkle proof"
        );

        {
            // Next we verify the executionPayloadRoot against the blockRoot
            uint256 executionPayloadIndex = (BODY_ROOT_INDEX << (BEACON_BLOCK_BODY_FIELD_TREE_HEIGHT)) |
                EXECUTION_PAYLOAD_INDEX;
            require(
                EigenlayerMerkle.verifyInclusionSha256({
                    proof: withdrawalProof.executionPayloadProof,
                    root: withdrawalProof.blockRoot,
                    leaf: withdrawalProof.executionPayloadRoot,
                    index: executionPayloadIndex
                }),
                "BeaconChainProofs.verifyWithdrawal: Invalid executionPayload merkle proof"
            );
        }

        // Next we verify the timestampRoot against the executionPayload root
        require(
            EigenlayerMerkle.verifyInclusionSha256({
                proof: withdrawalProof.timestampProof,
                root: withdrawalProof.executionPayloadRoot,
                leaf: withdrawalProof.timestampRoot,
                index: TIMESTAMP_INDEX
            }),
            "BeaconChainProofs.verifyWithdrawal: Invalid blockNumber merkle proof"
        );

        {
            /**
             * Next we verify the withdrawal fields against the blockRoot:
             * First we compute the withdrawal_index relative to the blockRoot by concatenating the indexes of all the
             * intermediate root indexes from the bottom of the sub trees (the withdrawal container) to the top, the blockRoot.
             * Then we calculate merkleize the withdrawalFields container to calculate the the withdrawalRoot.
             * Finally we verify the withdrawalRoot against the executionPayloadRoot.
             *
             *
             * Note: EigenlayerMerkleization of the withdrawals root tree uses EigenlayerMerkleizeWithMixin, i.e., the length of the array is hashed with the root of
             * the array.  Thus we shift the WITHDRAWALS_INDEX over by WITHDRAWALS_TREE_HEIGHT + 1 and not just WITHDRAWALS_TREE_HEIGHT.
             */
            uint256 withdrawalIndex = (WITHDRAWALS_INDEX << (WITHDRAWALS_TREE_HEIGHT + 1)) |
                uint256(withdrawalProof.withdrawalIndex);
            bytes32 withdrawalRoot = EigenlayerMerkle.merkleizeSha256(withdrawalFields);
            require(
                EigenlayerMerkle.verifyInclusionSha256({
                    proof: withdrawalProof.withdrawalProof,
                    root: withdrawalProof.executionPayloadRoot,
                    leaf: withdrawalRoot,
                    index: withdrawalIndex
                }),
                "BeaconChainProofs.verifyWithdrawal: Invalid withdrawal merkle proof"
            );
        }
    }

    /**
     * @notice This function replicates the ssz hashing of a validator's pubkey, outlined below:
     *  hh := ssz.NewHasher()
     *  hh.PutBytes(validatorPubkey[:])
     *  validatorPubkeyHash := hh.Hash()
     *  hh.Reset()
     */
    function hashValidatorBLSPubkey(bytes memory validatorPubkey) internal pure returns (bytes32 pubkeyHash) {
        require(validatorPubkey.length == 48, "Input should be 48 bytes in length");
        return sha256(abi.encodePacked(validatorPubkey, bytes16(0)));
    }

    /**
     * @dev Retrieve the withdrawal timestamp
     */
    function getWithdrawalTimestamp(WithdrawalProof memory withdrawalProof) internal pure returns (uint64) {
        return
            Endian.fromLittleEndianUint64(withdrawalProof.timestampRoot);
    }

    /**
     * @dev Converts the withdrawal's slot to an epoch
     */
    function getWithdrawalEpoch(WithdrawalProof memory withdrawalProof) internal pure returns (uint64) {
        return
            Endian.fromLittleEndianUint64(withdrawalProof.slotRoot) / SLOTS_PER_EPOCH;
    }

    /**
     * Indices for validator fields (refer to consensus specs):
     * 0: pubkey
     * 1: withdrawal credentials
     * 2: effective balance
     * 3: slashed?
     * 4: activation elligibility epoch
     * 5: activation epoch
     * 6: exit epoch
     * 7: withdrawable epoch
     */

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

    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 a validator's withdrawable epoch
     */
    function getWithdrawableEpoch(bytes32[] memory validatorFields) internal pure returns (uint64) {
        return 
            Endian.fromLittleEndianUint64(validatorFields[VALIDATOR_WITHDRAWABLE_EPOCH_INDEX]);
    }

    /**
     * Indices for withdrawal fields (refer to consensus specs):
     * 0: withdrawal index
     * 1: validator index
     * 2: execution address
     * 3: withdrawal amount
     */

    /**
     * @dev Retrieves a withdrawal's validator index
     */
    function getValidatorIndex(bytes32[] memory withdrawalFields) internal pure returns (uint40) {
        return 
            uint40(Endian.fromLittleEndianUint64(withdrawalFields[WITHDRAWAL_VALIDATOR_INDEX_INDEX]));
    }

    /**
     * @dev Retrieves a withdrawal's withdrawal amount (in gwei)
     */
    function getWithdrawalAmountGwei(bytes32[] memory withdrawalFields) internal pure returns (uint64) {
        return
            Endian.fromLittleEndianUint64(withdrawalFields[WITHDRAWAL_VALIDATOR_AMOUNT_INDEX]);
    }
}

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

pragma solidity ^0.8.0;

import "./EigenlayerMerkle.sol";
import "./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(
            EigenlayerMerkle.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 = EigenlayerMerkle.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(
            EigenlayerMerkle.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(
            EigenlayerMerkle.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(
            EigenlayerMerkle.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 34 of 35 : EigenlayerMerkle.sol
// SPDX-License-Identifier: BUSL-1.1
// 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 EigenlayerMerkle {
    /**
     * @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 35 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);
    }
}

Settings
{
  "remappings": [
    "forge-std/=lib/forge-std/src/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "@uniswap/=lib/",
    "@eigenlayer/=lib/eigenlayer-contracts/src/",
    "@layerzerolabs/lz-evm-oapp-v2/contracts/=lib/Etherfi-SyncPools/node_modules/@layerzerolabs/lz-evm-oapp-v2/contracts/",
    "@layerzerolabs/lz-evm-protocol-v2/contracts/=lib/Etherfi-SyncPools/node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/",
    "@layerzerolabs/lz-evm-messagelib-v2/contracts/=lib/Etherfi-SyncPools/node_modules/@layerzerolabs/lz-evm-messagelib-v2/contracts/",
    "@layerzerolabs/lz-evm-oapp-v2/contracts-upgradeable/=lib/Etherfi-SyncPools/node_modules/layerzero-v2/oapp/contracts/",
    "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "v3-core/=lib/v3-core/",
    "v3-periphery/=lib/v3-periphery/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 500
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyRegistered","type":"error"},{"inputs":[],"name":"EthTransferFailed","type":"error"},{"inputs":[],"name":"IncorrectAmount","type":"error"},{"inputs":[],"name":"IncorrectCaller","type":"error"},{"inputs":[],"name":"NotEnoughBalance","type":"error"},{"inputs":[],"name":"NotRegistered","type":"error"},{"inputs":[],"name":"NotSupportedToken","type":"error"},{"inputs":[],"name":"StrategyShareNotEnough","type":"error"},{"inputs":[],"name":"WrongOutput","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_withdrawalRoot","type":"bytes32"}],"name":"CompletedQueuedWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"_reqIds","type":"uint256[]"}],"name":"CompletedStEthQueuedWithdrawals","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_user","type":"address"},{"indexed":false,"internalType":"uint256","name":"_toEEthAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"_fromToken","type":"address"},{"indexed":false,"internalType":"bool","name":"_isRestaked","type":"bool"}],"name":"Liquified","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"_reqIds","type":"uint256[]"}],"name":"QueuedStEthWithdrawals","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_withdrawalRoot","type":"bytes32"},{"components":[{"internalType":"contract IStrategy[]","name":"strategies","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"},{"internalType":"address","name":"staker","type":"address"},{"components":[{"internalType":"address","name":"withdrawer","type":"address"},{"internalType":"uint96","name":"nonce","type":"uint96"}],"internalType":"struct IStrategyManager.DeprecatedStruct_WithdrawerAndNonce","name":"withdrawerAndNonce","type":"tuple"},{"internalType":"uint32","name":"withdrawalStartBlock","type":"uint32"},{"internalType":"address","name":"delegatedAddress","type":"address"}],"indexed":false,"internalType":"struct IStrategyManager.DeprecatedStruct_QueuedWithdrawal","name":"_queuedWithdrawal","type":"tuple"}],"name":"RegisteredQueuedWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_withdrawalRoot","type":"bytes32"},{"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":"_queuedWithdrawal","type":"tuple"}],"name":"RegisteredQueuedWithdrawal_V2","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DEPRECATED_accumulatedFee","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPRECATED_eigenLayerWithdrawalClaimGasCost","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"admins","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cbEth","outputs":[{"internalType":"contract IcbETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cbEth_Eth_Pool","outputs":[{"internalType":"contract ICurvePool","name":"","type":"address"}],"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":"_queuedWithdrawals","type":"tuple[]"},{"internalType":"contract IERC20[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256[]","name":"_middlewareTimesIndexes","type":"uint256[]"}],"name":"completeQueuedWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referral","type":"address"}],"name":"depositWithERC20","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_referral","type":"address"},{"components":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"internalType":"struct ILiquifier.PermitInput","name":"_permit","type":"tuple"}],"name":"depositWithERC20WithPermit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"_queuedWithdrawal","type":"tuple"},{"internalType":"address","name":"_referral","type":"address"}],"name":"depositWithQueuedWithdrawal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"dummies","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eigenLayerDelegationManager","outputs":[{"internalType":"contract IDelegationManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eigenLayerStrategyManager","outputs":[{"internalType":"contract IStrategyManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getTotalPooledEther","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalPooledEther","outputs":[{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getTotalPooledEtherSplits","outputs":[{"internalType":"uint256","name":"restaked","type":"uint256"},{"internalType":"uint256","name":"holding","type":"uint256"},{"internalType":"uint256","name":"pendingForWithdrawals","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"isDepositCapReached","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"isL2Eth","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"isRegisteredQueuedWithdrawals","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"isTokenWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"l1SyncPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lido","outputs":[{"internalType":"contract ILido","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lidoWithdrawalQueue","outputs":[{"internalType":"contract ILidoWithdrawalQueue","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityPool","outputs":[{"internalType":"contract ILiquidityPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint24","name":"_fee","type":"uint24"},{"internalType":"uint256","name":"_minOutputAmount","type":"uint256"},{"internalType":"uint256","name":"_maxWaitingTime","type":"uint256"}],"name":"pancakeSwapForEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pauseContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"pauseDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pausers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"quoteByFairValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"quoteByMarketValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"quoteStEthWithCurve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"contract IStrategy","name":"_strategy","type":"address"},{"internalType":"uint256","name":"_share","type":"uint256"}],"name":"quoteStrategyShareForDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_target","type":"address"},{"internalType":"bool","name":"_isWhitelisted","type":"bool"},{"internalType":"uint16","name":"_discountInBasisPoints","type":"uint16"},{"internalType":"uint32","name":"_timeBoundCapInEther","type":"uint32"},{"internalType":"uint32","name":"_totalCapInEther","type":"uint32"},{"internalType":"bool","name":"_isL2Eth","type":"bool"}],"name":"registerToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_requestIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_hints","type":"uint256[]"}],"name":"stEthClaimWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"stEthRequestWithdrawal","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stEthRequestWithdrawal","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stEth_Eth_Pool","outputs":[{"internalType":"contract ICurvePool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minOutputAmount","type":"uint256"}],"name":"swapCbEthToEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minOutputAmount","type":"uint256"}],"name":"swapStEthToEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minOutputAmount","type":"uint256"}],"name":"swapWbEthToEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"timeBoundCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timeBoundCapRefreshInterval","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenInfos","outputs":[{"internalType":"uint128","name":"strategyShare","type":"uint128"},{"internalType":"uint128","name":"ethAmountPendingForWithdrawals","type":"uint128"},{"internalType":"contract IStrategy","name":"strategy","type":"address"},{"internalType":"bool","name":"isWhitelisted","type":"bool"},{"internalType":"uint16","name":"discountInBasisPoints","type":"uint16"},{"internalType":"uint32","name":"timeBoundCapClockStartTime","type":"uint32"},{"internalType":"uint32","name":"timeBoundCapInEther","type":"uint32"},{"internalType":"uint32","name":"totalCapInEther","type":"uint32"},{"internalType":"uint96","name":"totalDepositedThisPeriod","type":"uint96"},{"internalType":"uint96","name":"totalDeposited","type":"uint96"},{"internalType":"bool","name":"isL2Eth","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"totalCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"totalDeposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unPauseContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_l2Eth","type":"address"}],"name":"unwrapL2Eth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bool","name":"_isAdmin","type":"bool"}],"name":"updateAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint32","name":"_timeBoundCapInEther","type":"uint32"},{"internalType":"uint32","name":"_totalCapInEther","type":"uint32"}],"name":"updateDepositCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint16","name":"_discountInBasisPoints","type":"uint16"}],"name":"updateDiscountInBasisPoints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bool","name":"_isPauser","type":"bool"}],"name":"updatePauser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_quoteStEthWithCurve","type":"bool"}],"name":"updateQuoteStEthWithCurve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_timeBoundCapRefreshInterval","type":"uint32"}],"name":"updateTimeBoundCapRefreshInterval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"bool","name":"_isWhitelisted","type":"bool"}],"name":"updateWhitelistedToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"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":"_queuedWithdrawal","type":"tuple"}],"name":"verifyQueuedWithdrawal","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wbEth","outputs":[{"internalType":"contract IwBETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wbEth_Eth_Pool","outputs":[{"internalType":"contract ICurvePool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a0604052306080523480156200001557600080fd5b506200002062000026565b620000e8565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e6576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b608051615b12620001206000396000818161188e0152818161191801528181611b3501528181611bba0152611ca40152615b126000f3fe6080604052600436106103dd5760003560e01c80637bfa1058116101fd578063b6f086f411610118578063eab933cd116100ab578063f3820f271161007a578063f3820f2714610d83578063f86782a914610da3578063fbca93a914610dc3578063fe240f7e14610de4578063ff3368a114610e0457600080fd5b8063eab933cd14610d05578063eafc53b514610d25578063eeacaabc14610d45578063f2fde38b14610d6357600080fd5b8063c0e486a4116100e7578063c0e486a414610c60578063d1145dda14610ca4578063dba0baf714610cc4578063e52f81c714610ce457600080fd5b8063b6f086f414610ab8578063ba46ae7214610ad8578063bac1520314610c10578063beb23a2414610c2557600080fd5b8063923ca94011610190578063aaf10f421161015f578063aaf10f4214610a0f578063ab79ff3f14610a24578063b3134f9e14610a39578063b5af090f14610a7457600080fd5b8063923ca9401461098e578063944079ff146109ae578063a133d3e4146109ce578063a5f98e9b146109ee57600080fd5b806384f1fe19116101cc57806384f1fe19146109105780638d9708a6146109305780638da5cb5b146109505780638e97dff11461096e57600080fd5b80637bfa10581461087e5780637f0e54b91461089e57806380128b02146108be57806380f51c12146108df57600080fd5b80634f1ef286116102f8578063665a11ca1161028b578063715018a61161025a578063715018a6146107bd57806372aa1151146107d25780637362377b14610818578063756a33d31461082d57806377d575401461085e57600080fd5b8063665a11ca1461073b578063670a6fd91461075c5780636b9e41a91461077c5780636d48c3161461079d57600080fd5b80635c975abb116102c75780635c975abb146106c257806361d027b3146106da57806364db2133146106fb578063654ae0221461071b57600080fd5b80634f1ef2861461062f57806352d1902d14610642578063530554811461065757806357212680146106a157600080fd5b80632c88a5501161037057806337cfdaca1161033f57806337cfdaca146105b45780633beb5517146105c9578063429b62e5146105e9578063439766ce1461061a57600080fd5b80632c88a550146105415780632d0bbf7c1461056157806333189c46146105745780633659cfe61461059457600080fd5b806323509a2d116103ac57806323509a2d146104a457806323e127d5146104dd57806327c71b50146104fe5780632c2c29d31461052057600080fd5b806304cb66f4146103e95780631308221b1461041f578063195afac4146104565780631b31bf571461048457600080fd5b366103e457005b600080fd5b3480156103f557600080fd5b50610409610404366004614ad2565b610e25565b6040516104169190614b27565b60405180910390f35b34801561042b57600080fd5b5061012d546104469068010000000000000000900460ff1681565b6040519015158152602001610416565b34801561046257600080fd5b50610476610471366004614b6c565b611236565b604051908152602001610416565b34801561049057600080fd5b5061047661049f366004614bbe565b6113cc565b3480156104b057600080fd5b5061013a546104c5906001600160a01b031681565b6040516001600160a01b039091168152602001610416565b3480156104e957600080fd5b5061013b546104c5906001600160a01b031681565b34801561050a57600080fd5b5061051e610519366004614bbe565b611401565b005b34801561052c57600080fd5b50610138546104c5906001600160a01b031681565b34801561054d57600080fd5b5061047661055c366004614bbe565b611443565b61047661056f366004614bbe565b611477565b34801561058057600080fd5b5061051e61058f366004614bdb565b61154b565b3480156105a057600080fd5b5061051e6105af366004614bbe565b611884565b3480156105c057600080fd5b50610476611a04565b3480156105d557600080fd5b5061051e6105e4366004614c49565b611ac0565b3480156105f557600080fd5b50610446610604366004614bbe565b6101306020526000908152604090205460ff1681565b34801561062657600080fd5b5061051e611b19565b61051e61063d366004614cfe565b611b2b565b34801561064e57600080fd5b50610476611c97565b34801561066357600080fd5b50610476610672366004614bbe565b6001600160a01b0316600090815261012e6020526040902060020154600160801b90046001600160601b031690565b3480156106ad57600080fd5b50610139546104c5906001600160a01b031681565b3480156106ce57600080fd5b5060c95460ff16610446565b3480156106e657600080fd5b50610131546104c5906001600160a01b031681565b34801561070757600080fd5b5061051e610716366004614da6565b611d5c565b34801561072757600080fd5b506104c5610736366004614ad2565b611d8d565b34801561074757600080fd5b50610132546104c5906001600160a01b031681565b34801561076857600080fd5b5061051e610777366004614dcf565b611db8565b34801561078857600080fd5b50610136546104c5906001600160a01b031681565b3480156107a957600080fd5b506104766107b8366004614dfd565b611dec565b3480156107c957600080fd5b5061051e61211f565b3480156107de57600080fd5b5061012d5461080090690100000000000000000090046001600160801b031681565b6040516001600160801b039091168152602001610416565b34801561082457600080fd5b5061051e612131565b34801561083957600080fd5b50610446610848366004614ad2565b61012f6020526000908152604090205460ff1681565b34801561086a57600080fd5b50610476610879366004614e29565b6121b7565b34801561088a57600080fd5b5061051e610899366004614dcf565b612357565b3480156108aa57600080fd5b5061051e6108b9366004614dcf565b61238b565b3480156108ca57600080fd5b5061013f546104c5906001600160a01b031681565b3480156108eb57600080fd5b506104466108fa366004614bbe565b6101406020526000908152604090205460ff1681565b34801561091c57600080fd5b5061051e61092b366004614e97565b6123cc565b34801561093c57600080fd5b5061047661094b366004614f31565b612502565b34801561095c57600080fd5b506097546001600160a01b03166104c5565b34801561097a57600080fd5b5061051e610989366004614f81565b612882565b34801561099a57600080fd5b506104466109a9366004614dfd565b6129df565b3480156109ba57600080fd5b506104766109c9366004614fed565b612b3b565b3480156109da57600080fd5b506104766109e9366004614dfd565b612bb5565b3480156109fa57600080fd5b50610137546104c5906001600160a01b031681565b348015610a1b57600080fd5b506104c5612d5c565b348015610a3057600080fd5b50610409612d94565b348015610a4557600080fd5b5061012d54610a5f90640100000000900463ffffffff1681565b60405163ffffffff9091168152602001610416565b348015610a8057600080fd5b50610446610a8f366004614bbe565b6001600160a01b0316600090815261012e6020526040902060010154600160a01b900460ff1690565b348015610ac457600080fd5b50610476610ad336600461502e565b612e1d565b348015610ae457600080fd5b50610b8c610af3366004614bbe565b61012e602052600090815260409020805460018201546002909201546001600160801b0380831693600160801b93849004909116926001600160a01b0382169260ff600160a01b840481169361ffff600160a81b8204169363ffffffff600160b81b8304811694600160d81b909304811693908316926001600160601b03640100000000820481169382041691600160e01b909104168b565b604080516001600160801b039c8d1681529b909a1660208c01526001600160a01b03909816988a0198909852941515606089015261ffff909316608088015263ffffffff91821660a0880152811660c08701521660e08501526001600160601b03908116610100850152909116610120830152151561014082015261016001610416565b348015610c1c57600080fd5b5061051e6130a9565b348015610c3157600080fd5b50610c45610c40366004614bbe565b6130b9565b60408051938452602084019290925290820152606001610416565b348015610c6c57600080fd5b50610446610c7b366004614bbe565b6001600160a01b0316600090815261012e6020526040902060020154600160e01b900460ff1690565b348015610cb057600080fd5b50610476610cbf366004614e29565b613296565b348015610cd057600080fd5b50610476610cdf366004614e29565b6133f0565b348015610cf057600080fd5b50610133546104c5906001600160a01b031681565b348015610d1157600080fd5b50610476610d20366004614bbe565b61354a565b348015610d3157600080fd5b5061051e610d40366004615082565b613586565b348015610d5157600080fd5b5061012d54610a5f9063ffffffff1681565b348015610d6f57600080fd5b5061051e610d7e366004614bbe565b6135cb565b348015610d8f57600080fd5b5061051e610d9e3660046150b7565b613641565b348015610daf57600080fd5b5061051e610dbe366004615147565b613a28565b348015610dcf57600080fd5b50610135546104c5906001600160a01b031681565b348015610df057600080fd5b50610476610dff366004615164565b613a59565b348015610e1057600080fd5b50610134546104c5906001600160a01b031681565b6060610e2f613b26565b61013460009054906101000a90046001600160a01b03166001600160a01b0316630d25a9576040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea791906151c0565b821015610ec7576040516334b2073960e11b815260040160405180910390fd5b61013a546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610f10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3491906151c0565b821115610f545760405163569d45cf60e11b815260040160405180910390fd5b61013a546001600160a01b0316600090815261012e602052604090208054839190601090610f93908490600160801b90046001600160801b03166151ef565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550600061013460009054906101000a90046001600160a01b03166001600160a01b031663db2296cd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561100d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103191906151c0565b905060008160016110428287615216565b61104c9190615229565b611056919061523c565b905060008167ffffffffffffffff81111561107357611073614c8e565b60405190808252806020026020018201604052801561109c578160200160208202803683370190505b50905060005b828110156110fa576110b5600184615229565b81146110c157836110d5565b6110cb848261525e565b6110d59087615229565b8282815181106110e7576110e7615275565b60209081029190910101526001016110a2565b5061013a546101345460405163095ea7b360e01b81526001600160a01b0391821660048201526024810188905291169063095ea7b3906044016020604051808303816000875af1158015611152573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611176919061528b565b5061013454604051636b34082160e11b81526000916001600160a01b03169063d6681042906111ab90859030906004016152a8565b6000604051808303816000875af11580156111ca573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111f291908101906152f7565b90507ff804fe4e35a7437f9f462453cbe461e3f4da691083cd8be30a342c60fc58b5bd816040516112239190614b27565b60405180910390a193505050505b919050565b6000611240613b7f565b611248613bd2565b60006112543385612502565b600081815261012f602052604090819020805460ff19166001179055519091507f8fc717042aa60485e4cb5c9cfb8789863fffdc73cc2ffda985747e44ec011f85906112a39083908790615500565b60405180910390a160006113336112bd60a0870187615519565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506112fc9250505060c0880188615519565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250613c2b92505050565b61013254604051635a35098760e11b8152336004820152602481018390526001600160a01b0387811660448301529293506000929091169063b46a130e906064016020604051808303816000875af1158015611393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b791906151c0565b93505050506113c6600160fb55565b92915050565b6001600160a01b038116600090815261012e60205260408120600201546113c69063ffffffff16670de0b6b3a764000061525e565b611409613e16565b6001600160a01b0316600090815261012e6020526040902060018101805463ffffffff60d81b19169055600201805463ffffffff19169055565b600080600080611452856130b9565b91945092509050806114648385615216565b61146e9190615216565b95945050505050565b6000611481613bd2565b61013f546001600160a01b031633146114ad576040516317fe949f60e01b815260040160405180910390fd5b6001600160a01b038216600090815261012e6020526040902060010154600160a01b900460ff16158061150457506001600160a01b038216600090815261012e6020526040902060020154600160e01b900460ff16155b156115225760405163c8a08d6f60e01b815260040160405180910390fd5b61152b82613e5c565b61153f6001600160a01b0383163334613f30565b5034611231600160fb55565b611553613b26565b6040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa158015611597573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115bb91906151c0565b8411156115db5760405163569d45cf60e11b815260040160405180910390fd5b61013c5460405163095ea7b360e01b81526001600160a01b03918216600482015260248101869052479187169063095ea7b3906044016020604051808303816000875af1158015611630573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611654919061528b565b5060408051610100810182526001600160a01b03808916825261013c5483516312a9293f60e21b815293516000946020808601949390931692634aa4a4fc92600480840193829003018189875af11580156116b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d79190615563565b6001600160a01b03908116825262ffffff8816602083015261013c541660408201526060016117068542615216565b8152602080820189905260408083018890526000606093840181905261013c54825163414bf38960e01b815286516001600160a01b03908116600483015294870151851660248201529286015162ffffff16604484015293850151831660648301526080850151608483015260a085015160a483015260c085015160c483015260e0850151831660e483015293945091169063414bf38990610104016020604051808303816000875af11580156117c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117e591906151c0565b61013c5460405163125012df60e21b8152600481018390523060248201529192506001600160a01b0316906349404b7c90604401600060405180830381600087803b15801561183357600080fd5b505af1158015611847573d6000803e3d6000fd5b50479250611859915085905087615216565b81101561187957604051637766c76760e01b815260040160405180910390fd5b505050505050505050565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036119165760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b60648201526084015b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166119717f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146119dc5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b606482015260840161190d565b6119e581613fad565b60408051600080825260208201909252611a0191839190613fb5565b50565b61013954600090611a1d906001600160a01b0316611443565b61013854611a33906001600160a01b0316611443565b61013a54611a49906001600160a01b0316611443565b611a539047615216565b611a5d9190615216565b611a679190615216565b905060005b61013e54811015611abc57611aa861013e8281548110611a8e57611a8e615275565b6000918252602090912001546001600160a01b0316611443565b611ab29083615216565b9150600101611a6c565b5090565b611ac8614141565b6001600160a01b0392909216600090815261012e6020526040902060018101805463ffffffff60d81b1916600160d81b63ffffffff94851602179055600201805463ffffffff191691909216179055565b611b21613e16565b611b2961419b565b565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163003611bb85760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b606482015260840161190d565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316611c137f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614611c7e5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b606482015260840161190d565b611c8782613fad565b611c9382826001613fb5565b5050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611d375760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161190d565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b611d64614141565b61012d805463ffffffff9092166401000000000267ffffffff0000000019909216919091179055565b61013e8181548110611d9e57600080fd5b6000918252602090912001546001600160a01b0316905081565b611dc0614141565b6001600160a01b0391909116600090815261013060205260409020805460ff1916911515919091179055565b6001600160a01b038216600090815261012e6020526040812060010154600160a01b900460ff16611e305760405163c8a08d6f60e01b815260040160405180910390fd5b61013a546001600160a01b0390811690841603611ef55761012d5468010000000000000000900460ff1615611eee5761013754604051635e0d443f60e01b8152600160048201526000602482015260448101849052611ee79184916001600160a01b0390911690635e0d443f906064015b602060405180830381865afa158015611ebe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee291906151c0565b6141f5565b90506113c6565b50806113c6565b610138546001600160a01b0390811690841603611fe457611ee7670de0b6b3a764000061013860009054906101000a90046001600160a01b03166001600160a01b0316633ba0b9a96040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f9091906151c0565b611f9a908561525e565b611fa4919061523c565b6101355460405163556d6e9f60e01b81526001600482015260006024820152604481018690526001600160a01b039091169063556d6e9f90606401611ea1565b610139546001600160a01b03908116908416036120d357611ee7670de0b6b3a764000061013960009054906101000a90046001600160a01b03166001600160a01b0316633ba0b9a96040518163ffffffff1660e01b8152600401602060405180830381865afa15801561205b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061207f91906151c0565b612089908561525e565b612093919061523c565b61013654604051635e0d443f60e01b81526001600482015260006024820152604481018690526001600160a01b0390911690635e0d443f90606401611ea1565b6001600160a01b038316600090815261012e6020526040902060020154600160e01b900460ff16156121065750806113c6565b60405163c8a08d6f60e01b815260040160405180910390fd5b612127614141565b611b29600061420a565b612139613b26565b6101325460405147916000916001600160a01b0390911690614e2090849084818181858888f193505050503d8060008114612190576040519150601f19603f3d011682016040523d82523d6000602084013e612195565b606091505b5050905080611c9357604051630db2c7f160e31b815260040160405180910390fd5b60006121c1613b26565b61013a546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561220a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061222e91906151c0565b83111561224e5760405163569d45cf60e11b815260040160405180910390fd5b61013a546101375460405163095ea7b360e01b81526001600160a01b0391821660048201526024810186905291169063095ea7b3906044016020604051808303816000875af11580156122a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c9919061528b565b5061013754604051630f7c084960e21b8152600160048201526000602482015260448101859052606481018490526001600160a01b0390911690633df02124906084015b6020604051808303816000875af115801561232c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061235091906151c0565b9392505050565b61235f613b26565b6001600160a01b0391909116600090815261014060205260409020805460ff1916911515919091179055565b612393614141565b6001600160a01b03909116600090815261012e602052604090206001018054911515600160a01b0260ff60a01b19909216919091179055565b6123d4613b26565b8460008167ffffffffffffffff8111156123f0576123f0614c8e565b604051908082528060200260200182016040528015612419578160200160208202803683370190505b50905060005b828110156124885761245c89898381811061243c5761243c615275565b905060200281019061244e9190615580565b61245790615672565b61425c565b600182828151811061247057612470615275565b9115156020928302919091019091015260010161241f565b5061013b546040516319a021cb60e11b81526001600160a01b03909116906333404396906124c6908b908b908b908b908b908b908a906004016157ee565b600060405180830381600087803b1580156124e057600080fd5b505af11580156124f4573d6000803e3d6000fd5b505050505050505050505050565b60006001600160a01b03831661251b6020840184614bbe565b6001600160a01b031614801561254857503061253d6060840160408501614bbe565b6001600160a01b0316145b6125945760405162461bcd60e51b815260206004820152601a60248201527f77726f6e67206465706f7369746f722f77697468647261776572000000000000604482015260640161190d565b60005b6125a460a0840184615519565b905081101561271e5760006125bc60a0850185615519565b838181106125cc576125cc615275565b90506020020160208101906125e19190614bbe565b6001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa15801561261e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126429190615563565b6001600160a01b038116600090815261012e6020526040902060010154909150600160a01b900460ff1680156126c9575061268060a0850185615519565b8381811061269057612690615275565b90506020020160208101906126a59190614bbe565b6001600160a01b03828116600090815261012e602052604090206001015481169116145b6127155760405162461bcd60e51b815260206004820152600e60248201527f4e6f7457686974656c6973746564000000000000000000000000000000000000604482015260640161190d565b50600101612597565b5061013b54604051632cbd9b6d60e11b81526000916001600160a01b03169063597b36da906127519086906004016158a0565b602060405180830381865afa15801561276e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279291906151c0565b61013b54604051635bf8375f60e11b8152600481018390529192506001600160a01b03169063b7f06ebe90602401602060405180830381865afa1580156127dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612801919061528b565b6128365760405162461bcd60e51b815260206004820152600660248201526557726f6e675160d01b604482015260640161190d565b600081815261012f602052604090205460ff16156123505760405162461bcd60e51b815260206004820152600960248201526811195c1bdcda5d195960ba1b604482015260640161190d565b61288a613b26565b6101345460405163e3afe0a360e01b815247916001600160a01b03169063e3afe0a3906128c19088908890889088906004016158b3565b600060405180830381600087803b1580156128db57600080fd5b505af11580156128ef573d6000803e3d6000fd5b504792506000915061293890506129068484615229565b61013a546001600160a01b0316600090815261012e6020526040902054600160801b90046001600160801b03166141f5565b61013a546001600160a01b0316600090815261012e6020526040902080549192508291601090612979908490600160801b90046001600160801b03166158da565b92506101000a8154816001600160801b0302191690836001600160801b031602179055507f1ba4549e6ae292c44478aa74f36dd74de5d8e8885ffef988473df19f29f25c1587876040516129ce9291906158fa565b60405180910390a150505050505050565b6001600160a01b03808316600090815261012e6020908152604080832081516101608101835281546001600160801b038082168352600160801b91829004169482019490945260018201549586169281019290925260ff600160a01b860481161515606084015261ffff600160a81b870416608084015263ffffffff600160b81b8704811660a08501819052600160d81b909704811660c085015260029092015480831660e08501526001600160601b0364010000000080830482166101008701819052968304909116610120860152600160e01b909104909116151561014084015261012d5494959294612ad892919004168261590e565b63ffffffff164210612ae957600091505b612af28661354a565b612b05866001600160601b038516615216565b1180612b315750612b15866113cc565b858461012001516001600160601b0316612b2f9190615216565b115b9695505050505050565b604051637a8b263760e01b81526004810182905260009081906001600160a01b03851690637a8b263790602401602060405180830381865afa158015612b85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba991906151c0565b905061146e8582611dec565b6001600160a01b038216600090815261012e6020526040812060010154600160a01b900460ff16612bf95760405163c8a08d6f60e01b815260040160405180910390fd5b61013a546001600160a01b0390811690841603612c1b57611ee782600161525e565b610138546001600160a01b0390811690841603612cbc576101385460408051633ba0b9a960e01b81529051670de0b6b3a7640000926001600160a01b031691633ba0b9a99160048083019260209291908290030181865afa158015612c84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ca891906151c0565b612cb2908461525e565b611ee7919061523c565b610139546001600160a01b0390811690841603612d25576101395460408051633ba0b9a960e01b81529051670de0b6b3a7640000926001600160a01b031691633ba0b9a99160048083019260209291908290030181865afa158015612c84573d6000803e3d6000fd5b6001600160a01b038316600090815261012e6020526040902060020154600160e01b900460ff161561210657611ee782600161525e565b6000612d8f7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b6060612d9e613b26565b61013a546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612de8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e0c91906151c0565b9050612e1781610e25565b91505090565b6000612e27613b7f565b612e2f613bd2565b6001600160a01b038416600090815261012e6020526040902060010154600160a01b900460ff168015612e9b57506001600160a01b038416600090815261012e6020526040902060020154600160e01b900460ff161580612e9b575061013f546001600160a01b031633145b612ed55760405162461bcd60e51b815260206004820152600b60248201526a1393d517d0531313d5d15160aa1b604482015260640161190d565b612eea6001600160a01b038516333086614472565b6001600160a01b038416600090815261012e6020526040902060020154600160e01b900460ff1615612f1f57612f1f84613e5c565b6000612f2b8585611dec565b6001600160a01b038616600090815261012e6020526040902060010154909150612710908290612f6690600160a81b900461ffff168361592b565b61ffff16612f74919061525e565b612f7e919061523c565b9050612f8a85826129df565b15612fc05760405162461bcd60e51b815260206004820152600660248201526510d05414115160d21b604482015260640161190d565b61013254604051635a35098760e11b8152336004820152602481018390526001600160a01b038581166044830152600092169063b46a130e906064016020604051808303816000875af115801561301b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061303f91906151c0565b60408051338152602081018590526001600160a01b038916818301526000606082015290519192507f2c19962a366d611900b92f328f12302cf959ee57063a989a1869fc342220ed50919081900360800190a161309c86836144b0565b915050612350600160fb55565b6130b1614141565b611b296145d5565b6001600160a01b03818116600081815261012e6020818152604080842081516101608101835281546001600160801b038082168352600160801b91829004168286015260018301549889169382019390935260ff600160a01b89048116801515606084015261ffff600160a81b8b0416608084015263ffffffff600160b81b8b04811660a0850152600160d81b909a048a1660c084015260029093015498891660e08301526001600160601b036401000000008a048116610100840152938904909316610120820152600160e01b9097049091161515610140870152938352529182918291906131b45760008060009350935093505061328f565b60408101516001600160a01b0316156132495760408181015182519151637a8b263760e01b81526001600160801b0390921660048301526132469187916001600160a01b031690637a8b2637906024015b602060405180830381865afa158015613222573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e991906151c0565b93505b6040516370a0823160e01b815230600482015261327b9086906001600160a01b038216906370a0823190602401613205565b925080602001516001600160801b03169150505b9193909250565b60006132a0613b26565b610139546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156132e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061330d91906151c0565b83111561332d5760405163569d45cf60e11b815260040160405180910390fd5b610139546101365460405163095ea7b360e01b81526001600160a01b0391821660048201526024810186905291169063095ea7b3906044016020604051808303816000875af1158015613384573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133a8919061528b565b5061013654604051630f7c084960e21b8152600160048201526000602482015260448101859052606481018490526001600160a01b0390911690633df021249060840161230d565b60006133fa613b26565b610138546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015613443573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061346791906151c0565b8311156134875760405163569d45cf60e11b815260040160405180910390fd5b610138546101355460405163095ea7b360e01b81526001600160a01b0391821660048201526024810186905291169063095ea7b3906044016020604051808303816000875af11580156134de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613502919061528b565b50610135546040516365b2489b60e01b8152600160048201526000602482015260448101859052606481018490526001600160a01b03909116906365b2489b9060840161230d565b6001600160a01b038116600090815261012e60205260408120600101546113c690600160d81b900463ffffffff16670de0b6b3a764000061525e565b61358e613b26565b6001600160a01b03909116600090815261012e60205260409020600101805461ffff909216600160a81b0261ffff60a81b19909216919091179055565b6135d3614141565b6001600160a01b0381166136385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161190d565b611a018161420a565b613649614141565b6001600160a01b038716600090815261012e6020526040902060010154600160b81b900463ffffffff161561369157604051630ea075bf60e21b815260040160405180910390fd5b8015613710576001600160a01b03871615806136b557506001600160a01b03861615155b156136bf57600080fd5b61013e80546001810182556000919091527f3096b0ff83c28e07db9b87f650bc5521a4928b98f2734605e31b316abbb272350180546001600160a01b0319166001600160a01b0389161790556137a3565b856001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa15801561374e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137729190615563565b6001600160a01b0316876001600160a01b0316146137a35760405163c8a08d6f60e01b815260040160405180910390fd5b60405180610160016040528060006001600160801b0316815260200160006001600160801b03168152602001876001600160a01b0316815260200186151581526020018561ffff1681526020014263ffffffff1681526020018463ffffffff1681526020018363ffffffff16815260200160006001600160601b0316815260200160006001600160601b0316815260200182151581525061012e6000896001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160801b0302191690836001600160801b0316021790555060208201518160000160106101000a8154816001600160801b0302191690836001600160801b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160010160146101000a81548160ff02191690831515021790555060808201518160010160156101000a81548161ffff021916908361ffff16021790555060a08201518160010160176101000a81548163ffffffff021916908363ffffffff16021790555060c082015181600101601b6101000a81548163ffffffff021916908363ffffffff16021790555060e08201518160020160006101000a81548163ffffffff021916908363ffffffff1602179055506101008201518160020160046101000a8154816001600160601b0302191690836001600160601b031602179055506101208201518160020160106101000a8154816001600160601b0302191690836001600160601b0316021790555061014082015181600201601c6101000a81548160ff02191690831515021790555090505050505050505050565b613a30613b26565b61012d8054911515680100000000000000000268ff000000000000000019909216919091179055565b6000613a63613b7f565b6001600160a01b03851663d505accf333085356020870135613a8b6060890160408a01615946565b6040516001600160e01b031960e088901b1681526001600160a01b0395861660048201529490931660248501526044840191909152606483015260ff166084820152606085013560a4820152608085013560c482015260e401600060405180830381600087803b158015613afe57600080fd5b505af1925050508015613b0f575060015b50613b1b858585612e1d565b90505b949350505050565b336000908152610130602052604090205460ff1680613b6257506097546001600160a01b03165b6001600160a01b0316336001600160a01b0316145b611b29576040516317fe949f60e01b815260040160405180910390fd5b60c95460ff1615611b295760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161190d565b600260fb5403613c245760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161190d565b600260fb55565b815160009081805b82811015613e0d576000868281518110613c4f57613c4f615275565b602002602001015190506000868381518110613c6d57613c6d615275565b602002602001015190506000826001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa158015613cb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cdb9190615563565b90506000613cea828585612b3b565b6001600160a01b038316600090815261012e6020526040902060010154909150612710908290613d2590600160a81b900461ffff168361592b565b61ffff16613d33919061525e565b613d3d919061523c565b9050613d498187615216565b6001600160a01b038316600090815261012e6020526040812080549298508592909190613d809084906001600160801b03166151ef565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550613dae82876144b0565b60408051338152602081018390526001600160a01b038416818301526001606082015290517f2c19962a366d611900b92f328f12302cf959ee57063a989a1869fc342220ed509181900360800190a1505060019092019150613c339050565b50949350505050565b336000908152610140602052604090205460ff1680613e455750336000908152610130602052604090205460ff165b80613b6257506097546001600160a01b0316613b4d565b6040516370a0823160e01b81523060048201526001600160a01b038216906370a0823190602401602060405180830381865afa158015613ea0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ec491906151c0565b816001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613f02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f2691906151c0565b14611a0157600080fd5b6040516001600160a01b038316602482015260448101829052613fa890849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b03199093169290921790915261460e565b505050565b611a01614141565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615613fe857613fa8836146e0565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015614042575060408051601f3d908101601f1916820190925261403f918101906151c0565b60015b6140b45760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f742055555053000000000000000000000000000000000000606482015260840161190d565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc81146141355760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161190d565b50613fa883838361478e565b6097546001600160a01b03163314611b295760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161190d565b6141a3613b7f565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586141d83390565b6040516001600160a01b03909116815260200160405180910390a1565b60008183116142045782612350565b50919050565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61013b54604051632cbd9b6d60e11b81526000916001600160a01b03169063597b36da9061428e9085906004016159a3565b602060405180830381865afa1580156142ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142cf91906151c0565b60a08301515190915060005b818110156144395760008460a0015182815181106142fb576142fb615275565b60200260200101516001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa158015614340573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143649190615563565b905060008560c00151838151811061437e5761437e615275565b6020908102919091018101516001600160a01b038416600090815261012e9092526040909120549091506001600160801b03808316911610156143d45760405163a43df45160e01b815260040160405180910390fd5b6001600160a01b038216600090815261012e6020526040812080548392906144069084906001600160801b03166158da565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550505080806001019150506142db565b506040518281527f17e1f8c6562ad4a081a5b2053cc2e79b2c8eb52b7104e2ba564d690fa2e5f1669060200160405180910390a1505050565b6040516001600160a01b03808516602483015283166044820152606481018290526144aa9085906323b872dd60e01b90608401613f5c565b50505050565b6001600160a01b038216600090815261012e6020526040902061012d5460018201546144f49163ffffffff640100000000909104811691600160b81b90041661590e565b63ffffffff16421061453c576002810180546fffffffffffffffffffffffff000000001916905560018101805463ffffffff60b81b1916600160b81b4263ffffffff16021790555b818160020160048282829054906101000a90046001600160601b03166145629190615a2c565b92506101000a8154816001600160601b0302191690836001600160601b03160217905550818160020160108282829054906101000a90046001600160601b03166145ac9190615a2c565b92506101000a8154816001600160601b0302191690836001600160601b03160217905550505050565b6145dd6147b3565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336141d8565b6000614663826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166148059092919063ffffffff16565b805190915015613fa85780806020019051810190614681919061528b565b613fa85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161190d565b6001600160a01b0381163b61474d5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161190d565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b61479783614814565b6000825111806147a45750805b15613fa8576144aa8383614854565b60c95460ff16611b295760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161190d565b6060613b1e848460008561493f565b61481d816146e0565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6148bc5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161190d565b600080846001600160a01b0316846040516148d79190615a70565b600060405180830381855af49150503d8060008114614912576040519150601f19603f3d011682016040523d82523d6000602084013e614917565b606091505b509150915061146e8282604051806060016040528060278152602001615ab660279139614a1a565b6060824710156149a05760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161190d565b600080866001600160a01b031685876040516149bc9190615a70565b60006040518083038185875af1925050503d80600081146149f9576040519150601f19603f3d011682016040523d82523d6000602084013e6149fe565b606091505b5091509150614a0f87838387614a33565b979650505050505050565b60608315614a29575081612350565b6123508383614aa8565b60608315614aa2578251600003614a9b576001600160a01b0385163b614a9b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161190d565b5081613b1e565b613b1e83835b815115614ab85781518083602001fd5b8060405162461bcd60e51b815260040161190d9190615a82565b600060208284031215614ae457600080fd5b5035919050565b60008151808452602080850194506020840160005b83811015614b1c57815187529582019590820190600101614b00565b509495945050505050565b6020815260006123506020830184614aeb565b600060e0828403121561420457600080fd5b6001600160a01b0381168114611a0157600080fd5b803561123181614b4c565b60008060408385031215614b7f57600080fd5b823567ffffffffffffffff811115614b9657600080fd5b614ba285828601614b3a565b9250506020830135614bb381614b4c565b809150509250929050565b600060208284031215614bd057600080fd5b813561235081614b4c565b600080600080600060a08688031215614bf357600080fd5b8535614bfe81614b4c565b945060208601359350604086013562ffffff81168114614c1d57600080fd5b94979396509394606081013594506080013592915050565b803563ffffffff8116811461123157600080fd5b600080600060608486031215614c5e57600080fd5b8335614c6981614b4c565b9250614c7760208501614c35565b9150614c8560408501614c35565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b60405160e0810167ffffffffffffffff81118282101715614cc757614cc7614c8e565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715614cf657614cf6614c8e565b604052919050565b60008060408385031215614d1157600080fd5b8235614d1c81614b4c565b915060208381013567ffffffffffffffff80821115614d3a57600080fd5b818601915086601f830112614d4e57600080fd5b813581811115614d6057614d60614c8e565b614d72601f8201601f19168501614ccd565b91508082528784828501011115614d8857600080fd5b80848401858401376000848284010152508093505050509250929050565b600060208284031215614db857600080fd5b61235082614c35565b8015158114611a0157600080fd5b60008060408385031215614de257600080fd5b8235614ded81614b4c565b91506020830135614bb381614dc1565b60008060408385031215614e1057600080fd5b8235614e1b81614b4c565b946020939093013593505050565b60008060408385031215614e3c57600080fd5b50508035926020909101359150565b60008083601f840112614e5d57600080fd5b50813567ffffffffffffffff811115614e7557600080fd5b6020830191508360208260051b8501011115614e9057600080fd5b9250929050565b60008060008060008060608789031215614eb057600080fd5b863567ffffffffffffffff80821115614ec857600080fd5b614ed48a838b01614e4b565b90985096506020890135915080821115614eed57600080fd5b614ef98a838b01614e4b565b90965094506040890135915080821115614f1257600080fd5b50614f1f89828a01614e4b565b979a9699509497509295939492505050565b60008060408385031215614f4457600080fd5b8235614f4f81614b4c565b9150602083013567ffffffffffffffff811115614f6b57600080fd5b614f7785828601614b3a565b9150509250929050565b60008060008060408587031215614f9757600080fd5b843567ffffffffffffffff80821115614faf57600080fd5b614fbb88838901614e4b565b90965094506020870135915080821115614fd457600080fd5b50614fe187828801614e4b565b95989497509550505050565b60008060006060848603121561500257600080fd5b833561500d81614b4c565b9250602084013561501d81614b4c565b929592945050506040919091013590565b60008060006060848603121561504357600080fd5b833561504e81614b4c565b925060208401359150604084013561506581614b4c565b809150509250925092565b803561ffff8116811461123157600080fd5b6000806040838503121561509557600080fd5b82356150a081614b4c565b91506150ae60208401615070565b90509250929050565b600080600080600080600060e0888a0312156150d257600080fd5b87356150dd81614b4c565b965060208801356150ed81614b4c565b955060408801356150fd81614dc1565b945061510b60608901615070565b935061511960808901614c35565b925061512760a08901614c35565b915060c088013561513781614dc1565b8091505092959891949750929550565b60006020828403121561515957600080fd5b813561235081614dc1565b60008060008084860361010081121561517c57600080fd5b853561518781614b4c565b945060208601359350604086013561519e81614b4c565b925060a0605f19820112156151b257600080fd5b509295919450926060019150565b6000602082840312156151d257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6001600160801b0381811683821601908082111561520f5761520f6151d9565b5092915050565b808201808211156113c6576113c66151d9565b818103818111156113c6576113c66151d9565b60008261525957634e487b7160e01b600052601260045260246000fd5b500490565b80820281158282048414176113c6576113c66151d9565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561529d57600080fd5b815161235081614dc1565b6040815260006152bb6040830185614aeb565b90506001600160a01b03831660208301529392505050565b600067ffffffffffffffff8211156152ed576152ed614c8e565b5060051b60200190565b6000602080838503121561530a57600080fd5b825167ffffffffffffffff81111561532157600080fd5b8301601f8101851361533257600080fd5b8051615345615340826152d3565b614ccd565b81815260059190911b8201830190838101908783111561536457600080fd5b928401925b82841015614a0f57835182529284019290840190615369565b6000808335601e1984360301811261539957600080fd5b830160208101925035905067ffffffffffffffff8111156153b957600080fd5b8060051b3603821315614e9057600080fd5b8183526000602080850194508260005b85811015614b1c5781356153ee81614b4c565b6001600160a01b0316875295820195908201906001016153db565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561543b57600080fd5b8260051b80836020870137939093016020019392505050565b6000813561546181614b4c565b6001600160a01b03908116845260208301359061547d82614b4c565b908116602085015260408301359061549482614b4c565b1660408401526060828101359084015263ffffffff6154b560808401614c35565b1660808401526154c860a0830183615382565b60e060a08601526154dd60e0860182846153cb565b9150506154ed60c0840184615382565b85830360c0870152612b31838284615409565b828152604060208201526000613b1e6040830184615454565b6000808335601e1984360301811261553057600080fd5b83018035915067ffffffffffffffff82111561554b57600080fd5b6020019150600581901b3603821315614e9057600080fd5b60006020828403121561557557600080fd5b815161235081614b4c565b6000823560de1983360301811261559657600080fd5b9190910192915050565b600082601f8301126155b157600080fd5b813560206155c1615340836152d3565b8083825260208201915060208460051b8701019350868411156155e357600080fd5b602086015b848110156156085780356155fb81614b4c565b83529183019183016155e8565b509695505050505050565b600082601f83011261562457600080fd5b81356020615634615340836152d3565b8083825260208201915060208460051b87010193508684111561565657600080fd5b602086015b84811015615608578035835291830191830161565b565b600060e0823603121561568457600080fd5b61568c614ca4565b61569583614b61565b81526156a360208401614b61565b60208201526156b460408401614b61565b6040820152606083013560608201526156cf60808401614c35565b608082015260a083013567ffffffffffffffff808211156156ef57600080fd5b6156fb368387016155a0565b60a084015260c085013591508082111561571457600080fd5b5061572136828601615613565b60c08301525092915050565b60008383855260208086019550808560051b830101846000805b888110156157ad57858403601f19018a526157628389615382565b808652868601845b8281101561579857833561577d81614b4c565b6001600160a01b03168252928801929088019060010161576a565b509b87019b9550505091840191600101615747565b509198975050505050505050565b60008151808452602080850194506020840160005b83811015614b1c5781511515875295820195908201906001016157d0565b60808082528101879052600060a0600589901b830181019083018a835b8b81101561585357858403609f190183528135368e900360de1901811261583157600080fd5b61583d858f8301615454565b945050602092830192919091019060010161580b565b505050828103602084015261586981888a61572d565b9050828103604084015261587e818688615409565b9050828103606084015261589281856157bb565b9a9950505050505050505050565b6020815260006123506020830184615454565b6040815260006158c7604083018688615409565b8281036020840152614a0f818587615409565b6001600160801b0382811682821603908082111561520f5761520f6151d9565b602081526000613b1e602083018486615409565b63ffffffff81811683821601908082111561520f5761520f6151d9565b61ffff82811682821603908082111561520f5761520f6151d9565b60006020828403121561595857600080fd5b813560ff8116811461235057600080fd5b60008151808452602080850194506020840160005b83811015614b1c5781516001600160a01b03168752958201959082019060010161597e565b6020815260006001600160a01b03808451166020840152806020850151166040840152806040850151166060840152506060830151608083015260808301516159f460a084018263ffffffff169052565b5060a083015160e060c0840152615a0f610100840182615969565b905060c0840151601f198483030160e085015261146e8282614aeb565b6001600160601b0381811683821601908082111561520f5761520f6151d9565b60005b83811015615a67578181015183820152602001615a4f565b50506000910152565b60008251615596818460208701615a4c565b6020815260008251806020840152615aa1816040850160208701615a4c565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220fad4ebfbbb546001aaac22ddabfad81ab496a10be805c97c51f7abd422ad443064736f6c63430008180033

Deployed Bytecode

0x6080604052600436106103dd5760003560e01c80637bfa1058116101fd578063b6f086f411610118578063eab933cd116100ab578063f3820f271161007a578063f3820f2714610d83578063f86782a914610da3578063fbca93a914610dc3578063fe240f7e14610de4578063ff3368a114610e0457600080fd5b8063eab933cd14610d05578063eafc53b514610d25578063eeacaabc14610d45578063f2fde38b14610d6357600080fd5b8063c0e486a4116100e7578063c0e486a414610c60578063d1145dda14610ca4578063dba0baf714610cc4578063e52f81c714610ce457600080fd5b8063b6f086f414610ab8578063ba46ae7214610ad8578063bac1520314610c10578063beb23a2414610c2557600080fd5b8063923ca94011610190578063aaf10f421161015f578063aaf10f4214610a0f578063ab79ff3f14610a24578063b3134f9e14610a39578063b5af090f14610a7457600080fd5b8063923ca9401461098e578063944079ff146109ae578063a133d3e4146109ce578063a5f98e9b146109ee57600080fd5b806384f1fe19116101cc57806384f1fe19146109105780638d9708a6146109305780638da5cb5b146109505780638e97dff11461096e57600080fd5b80637bfa10581461087e5780637f0e54b91461089e57806380128b02146108be57806380f51c12146108df57600080fd5b80634f1ef286116102f8578063665a11ca1161028b578063715018a61161025a578063715018a6146107bd57806372aa1151146107d25780637362377b14610818578063756a33d31461082d57806377d575401461085e57600080fd5b8063665a11ca1461073b578063670a6fd91461075c5780636b9e41a91461077c5780636d48c3161461079d57600080fd5b80635c975abb116102c75780635c975abb146106c257806361d027b3146106da57806364db2133146106fb578063654ae0221461071b57600080fd5b80634f1ef2861461062f57806352d1902d14610642578063530554811461065757806357212680146106a157600080fd5b80632c88a5501161037057806337cfdaca1161033f57806337cfdaca146105b45780633beb5517146105c9578063429b62e5146105e9578063439766ce1461061a57600080fd5b80632c88a550146105415780632d0bbf7c1461056157806333189c46146105745780633659cfe61461059457600080fd5b806323509a2d116103ac57806323509a2d146104a457806323e127d5146104dd57806327c71b50146104fe5780632c2c29d31461052057600080fd5b806304cb66f4146103e95780631308221b1461041f578063195afac4146104565780631b31bf571461048457600080fd5b366103e457005b600080fd5b3480156103f557600080fd5b50610409610404366004614ad2565b610e25565b6040516104169190614b27565b60405180910390f35b34801561042b57600080fd5b5061012d546104469068010000000000000000900460ff1681565b6040519015158152602001610416565b34801561046257600080fd5b50610476610471366004614b6c565b611236565b604051908152602001610416565b34801561049057600080fd5b5061047661049f366004614bbe565b6113cc565b3480156104b057600080fd5b5061013a546104c5906001600160a01b031681565b6040516001600160a01b039091168152602001610416565b3480156104e957600080fd5b5061013b546104c5906001600160a01b031681565b34801561050a57600080fd5b5061051e610519366004614bbe565b611401565b005b34801561052c57600080fd5b50610138546104c5906001600160a01b031681565b34801561054d57600080fd5b5061047661055c366004614bbe565b611443565b61047661056f366004614bbe565b611477565b34801561058057600080fd5b5061051e61058f366004614bdb565b61154b565b3480156105a057600080fd5b5061051e6105af366004614bbe565b611884565b3480156105c057600080fd5b50610476611a04565b3480156105d557600080fd5b5061051e6105e4366004614c49565b611ac0565b3480156105f557600080fd5b50610446610604366004614bbe565b6101306020526000908152604090205460ff1681565b34801561062657600080fd5b5061051e611b19565b61051e61063d366004614cfe565b611b2b565b34801561064e57600080fd5b50610476611c97565b34801561066357600080fd5b50610476610672366004614bbe565b6001600160a01b0316600090815261012e6020526040902060020154600160801b90046001600160601b031690565b3480156106ad57600080fd5b50610139546104c5906001600160a01b031681565b3480156106ce57600080fd5b5060c95460ff16610446565b3480156106e657600080fd5b50610131546104c5906001600160a01b031681565b34801561070757600080fd5b5061051e610716366004614da6565b611d5c565b34801561072757600080fd5b506104c5610736366004614ad2565b611d8d565b34801561074757600080fd5b50610132546104c5906001600160a01b031681565b34801561076857600080fd5b5061051e610777366004614dcf565b611db8565b34801561078857600080fd5b50610136546104c5906001600160a01b031681565b3480156107a957600080fd5b506104766107b8366004614dfd565b611dec565b3480156107c957600080fd5b5061051e61211f565b3480156107de57600080fd5b5061012d5461080090690100000000000000000090046001600160801b031681565b6040516001600160801b039091168152602001610416565b34801561082457600080fd5b5061051e612131565b34801561083957600080fd5b50610446610848366004614ad2565b61012f6020526000908152604090205460ff1681565b34801561086a57600080fd5b50610476610879366004614e29565b6121b7565b34801561088a57600080fd5b5061051e610899366004614dcf565b612357565b3480156108aa57600080fd5b5061051e6108b9366004614dcf565b61238b565b3480156108ca57600080fd5b5061013f546104c5906001600160a01b031681565b3480156108eb57600080fd5b506104466108fa366004614bbe565b6101406020526000908152604090205460ff1681565b34801561091c57600080fd5b5061051e61092b366004614e97565b6123cc565b34801561093c57600080fd5b5061047661094b366004614f31565b612502565b34801561095c57600080fd5b506097546001600160a01b03166104c5565b34801561097a57600080fd5b5061051e610989366004614f81565b612882565b34801561099a57600080fd5b506104466109a9366004614dfd565b6129df565b3480156109ba57600080fd5b506104766109c9366004614fed565b612b3b565b3480156109da57600080fd5b506104766109e9366004614dfd565b612bb5565b3480156109fa57600080fd5b50610137546104c5906001600160a01b031681565b348015610a1b57600080fd5b506104c5612d5c565b348015610a3057600080fd5b50610409612d94565b348015610a4557600080fd5b5061012d54610a5f90640100000000900463ffffffff1681565b60405163ffffffff9091168152602001610416565b348015610a8057600080fd5b50610446610a8f366004614bbe565b6001600160a01b0316600090815261012e6020526040902060010154600160a01b900460ff1690565b348015610ac457600080fd5b50610476610ad336600461502e565b612e1d565b348015610ae457600080fd5b50610b8c610af3366004614bbe565b61012e602052600090815260409020805460018201546002909201546001600160801b0380831693600160801b93849004909116926001600160a01b0382169260ff600160a01b840481169361ffff600160a81b8204169363ffffffff600160b81b8304811694600160d81b909304811693908316926001600160601b03640100000000820481169382041691600160e01b909104168b565b604080516001600160801b039c8d1681529b909a1660208c01526001600160a01b03909816988a0198909852941515606089015261ffff909316608088015263ffffffff91821660a0880152811660c08701521660e08501526001600160601b03908116610100850152909116610120830152151561014082015261016001610416565b348015610c1c57600080fd5b5061051e6130a9565b348015610c3157600080fd5b50610c45610c40366004614bbe565b6130b9565b60408051938452602084019290925290820152606001610416565b348015610c6c57600080fd5b50610446610c7b366004614bbe565b6001600160a01b0316600090815261012e6020526040902060020154600160e01b900460ff1690565b348015610cb057600080fd5b50610476610cbf366004614e29565b613296565b348015610cd057600080fd5b50610476610cdf366004614e29565b6133f0565b348015610cf057600080fd5b50610133546104c5906001600160a01b031681565b348015610d1157600080fd5b50610476610d20366004614bbe565b61354a565b348015610d3157600080fd5b5061051e610d40366004615082565b613586565b348015610d5157600080fd5b5061012d54610a5f9063ffffffff1681565b348015610d6f57600080fd5b5061051e610d7e366004614bbe565b6135cb565b348015610d8f57600080fd5b5061051e610d9e3660046150b7565b613641565b348015610daf57600080fd5b5061051e610dbe366004615147565b613a28565b348015610dcf57600080fd5b50610135546104c5906001600160a01b031681565b348015610df057600080fd5b50610476610dff366004615164565b613a59565b348015610e1057600080fd5b50610134546104c5906001600160a01b031681565b6060610e2f613b26565b61013460009054906101000a90046001600160a01b03166001600160a01b0316630d25a9576040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea791906151c0565b821015610ec7576040516334b2073960e11b815260040160405180910390fd5b61013a546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610f10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3491906151c0565b821115610f545760405163569d45cf60e11b815260040160405180910390fd5b61013a546001600160a01b0316600090815261012e602052604090208054839190601090610f93908490600160801b90046001600160801b03166151ef565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550600061013460009054906101000a90046001600160a01b03166001600160a01b031663db2296cd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561100d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103191906151c0565b905060008160016110428287615216565b61104c9190615229565b611056919061523c565b905060008167ffffffffffffffff81111561107357611073614c8e565b60405190808252806020026020018201604052801561109c578160200160208202803683370190505b50905060005b828110156110fa576110b5600184615229565b81146110c157836110d5565b6110cb848261525e565b6110d59087615229565b8282815181106110e7576110e7615275565b60209081029190910101526001016110a2565b5061013a546101345460405163095ea7b360e01b81526001600160a01b0391821660048201526024810188905291169063095ea7b3906044016020604051808303816000875af1158015611152573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611176919061528b565b5061013454604051636b34082160e11b81526000916001600160a01b03169063d6681042906111ab90859030906004016152a8565b6000604051808303816000875af11580156111ca573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111f291908101906152f7565b90507ff804fe4e35a7437f9f462453cbe461e3f4da691083cd8be30a342c60fc58b5bd816040516112239190614b27565b60405180910390a193505050505b919050565b6000611240613b7f565b611248613bd2565b60006112543385612502565b600081815261012f602052604090819020805460ff19166001179055519091507f8fc717042aa60485e4cb5c9cfb8789863fffdc73cc2ffda985747e44ec011f85906112a39083908790615500565b60405180910390a160006113336112bd60a0870187615519565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506112fc9250505060c0880188615519565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250613c2b92505050565b61013254604051635a35098760e11b8152336004820152602481018390526001600160a01b0387811660448301529293506000929091169063b46a130e906064016020604051808303816000875af1158015611393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b791906151c0565b93505050506113c6600160fb55565b92915050565b6001600160a01b038116600090815261012e60205260408120600201546113c69063ffffffff16670de0b6b3a764000061525e565b611409613e16565b6001600160a01b0316600090815261012e6020526040902060018101805463ffffffff60d81b19169055600201805463ffffffff19169055565b600080600080611452856130b9565b91945092509050806114648385615216565b61146e9190615216565b95945050505050565b6000611481613bd2565b61013f546001600160a01b031633146114ad576040516317fe949f60e01b815260040160405180910390fd5b6001600160a01b038216600090815261012e6020526040902060010154600160a01b900460ff16158061150457506001600160a01b038216600090815261012e6020526040902060020154600160e01b900460ff16155b156115225760405163c8a08d6f60e01b815260040160405180910390fd5b61152b82613e5c565b61153f6001600160a01b0383163334613f30565b5034611231600160fb55565b611553613b26565b6040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa158015611597573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115bb91906151c0565b8411156115db5760405163569d45cf60e11b815260040160405180910390fd5b61013c5460405163095ea7b360e01b81526001600160a01b03918216600482015260248101869052479187169063095ea7b3906044016020604051808303816000875af1158015611630573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611654919061528b565b5060408051610100810182526001600160a01b03808916825261013c5483516312a9293f60e21b815293516000946020808601949390931692634aa4a4fc92600480840193829003018189875af11580156116b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d79190615563565b6001600160a01b03908116825262ffffff8816602083015261013c541660408201526060016117068542615216565b8152602080820189905260408083018890526000606093840181905261013c54825163414bf38960e01b815286516001600160a01b03908116600483015294870151851660248201529286015162ffffff16604484015293850151831660648301526080850151608483015260a085015160a483015260c085015160c483015260e0850151831660e483015293945091169063414bf38990610104016020604051808303816000875af11580156117c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117e591906151c0565b61013c5460405163125012df60e21b8152600481018390523060248201529192506001600160a01b0316906349404b7c90604401600060405180830381600087803b15801561183357600080fd5b505af1158015611847573d6000803e3d6000fd5b50479250611859915085905087615216565b81101561187957604051637766c76760e01b815260040160405180910390fd5b505050505050505050565b6001600160a01b037f0000000000000000000000006b6d4e2dfcb864c83e29641429c528e8016bacdf1630036119165760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b60648201526084015b60405180910390fd5b7f0000000000000000000000006b6d4e2dfcb864c83e29641429c528e8016bacdf6001600160a01b03166119717f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146119dc5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b606482015260840161190d565b6119e581613fad565b60408051600080825260208201909252611a0191839190613fb5565b50565b61013954600090611a1d906001600160a01b0316611443565b61013854611a33906001600160a01b0316611443565b61013a54611a49906001600160a01b0316611443565b611a539047615216565b611a5d9190615216565b611a679190615216565b905060005b61013e54811015611abc57611aa861013e8281548110611a8e57611a8e615275565b6000918252602090912001546001600160a01b0316611443565b611ab29083615216565b9150600101611a6c565b5090565b611ac8614141565b6001600160a01b0392909216600090815261012e6020526040902060018101805463ffffffff60d81b1916600160d81b63ffffffff94851602179055600201805463ffffffff191691909216179055565b611b21613e16565b611b2961419b565b565b6001600160a01b037f0000000000000000000000006b6d4e2dfcb864c83e29641429c528e8016bacdf163003611bb85760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b606482015260840161190d565b7f0000000000000000000000006b6d4e2dfcb864c83e29641429c528e8016bacdf6001600160a01b0316611c137f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b031614611c7e5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b606482015260840161190d565b611c8782613fad565b611c9382826001613fb5565b5050565b6000306001600160a01b037f0000000000000000000000006b6d4e2dfcb864c83e29641429c528e8016bacdf1614611d375760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161190d565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b611d64614141565b61012d805463ffffffff9092166401000000000267ffffffff0000000019909216919091179055565b61013e8181548110611d9e57600080fd5b6000918252602090912001546001600160a01b0316905081565b611dc0614141565b6001600160a01b0391909116600090815261013060205260409020805460ff1916911515919091179055565b6001600160a01b038216600090815261012e6020526040812060010154600160a01b900460ff16611e305760405163c8a08d6f60e01b815260040160405180910390fd5b61013a546001600160a01b0390811690841603611ef55761012d5468010000000000000000900460ff1615611eee5761013754604051635e0d443f60e01b8152600160048201526000602482015260448101849052611ee79184916001600160a01b0390911690635e0d443f906064015b602060405180830381865afa158015611ebe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee291906151c0565b6141f5565b90506113c6565b50806113c6565b610138546001600160a01b0390811690841603611fe457611ee7670de0b6b3a764000061013860009054906101000a90046001600160a01b03166001600160a01b0316633ba0b9a96040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f9091906151c0565b611f9a908561525e565b611fa4919061523c565b6101355460405163556d6e9f60e01b81526001600482015260006024820152604481018690526001600160a01b039091169063556d6e9f90606401611ea1565b610139546001600160a01b03908116908416036120d357611ee7670de0b6b3a764000061013960009054906101000a90046001600160a01b03166001600160a01b0316633ba0b9a96040518163ffffffff1660e01b8152600401602060405180830381865afa15801561205b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061207f91906151c0565b612089908561525e565b612093919061523c565b61013654604051635e0d443f60e01b81526001600482015260006024820152604481018690526001600160a01b0390911690635e0d443f90606401611ea1565b6001600160a01b038316600090815261012e6020526040902060020154600160e01b900460ff16156121065750806113c6565b60405163c8a08d6f60e01b815260040160405180910390fd5b612127614141565b611b29600061420a565b612139613b26565b6101325460405147916000916001600160a01b0390911690614e2090849084818181858888f193505050503d8060008114612190576040519150601f19603f3d011682016040523d82523d6000602084013e612195565b606091505b5050905080611c9357604051630db2c7f160e31b815260040160405180910390fd5b60006121c1613b26565b61013a546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561220a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061222e91906151c0565b83111561224e5760405163569d45cf60e11b815260040160405180910390fd5b61013a546101375460405163095ea7b360e01b81526001600160a01b0391821660048201526024810186905291169063095ea7b3906044016020604051808303816000875af11580156122a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c9919061528b565b5061013754604051630f7c084960e21b8152600160048201526000602482015260448101859052606481018490526001600160a01b0390911690633df02124906084015b6020604051808303816000875af115801561232c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061235091906151c0565b9392505050565b61235f613b26565b6001600160a01b0391909116600090815261014060205260409020805460ff1916911515919091179055565b612393614141565b6001600160a01b03909116600090815261012e602052604090206001018054911515600160a01b0260ff60a01b19909216919091179055565b6123d4613b26565b8460008167ffffffffffffffff8111156123f0576123f0614c8e565b604051908082528060200260200182016040528015612419578160200160208202803683370190505b50905060005b828110156124885761245c89898381811061243c5761243c615275565b905060200281019061244e9190615580565b61245790615672565b61425c565b600182828151811061247057612470615275565b9115156020928302919091019091015260010161241f565b5061013b546040516319a021cb60e11b81526001600160a01b03909116906333404396906124c6908b908b908b908b908b908b908a906004016157ee565b600060405180830381600087803b1580156124e057600080fd5b505af11580156124f4573d6000803e3d6000fd5b505050505050505050505050565b60006001600160a01b03831661251b6020840184614bbe565b6001600160a01b031614801561254857503061253d6060840160408501614bbe565b6001600160a01b0316145b6125945760405162461bcd60e51b815260206004820152601a60248201527f77726f6e67206465706f7369746f722f77697468647261776572000000000000604482015260640161190d565b60005b6125a460a0840184615519565b905081101561271e5760006125bc60a0850185615519565b838181106125cc576125cc615275565b90506020020160208101906125e19190614bbe565b6001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa15801561261e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126429190615563565b6001600160a01b038116600090815261012e6020526040902060010154909150600160a01b900460ff1680156126c9575061268060a0850185615519565b8381811061269057612690615275565b90506020020160208101906126a59190614bbe565b6001600160a01b03828116600090815261012e602052604090206001015481169116145b6127155760405162461bcd60e51b815260206004820152600e60248201527f4e6f7457686974656c6973746564000000000000000000000000000000000000604482015260640161190d565b50600101612597565b5061013b54604051632cbd9b6d60e11b81526000916001600160a01b03169063597b36da906127519086906004016158a0565b602060405180830381865afa15801561276e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279291906151c0565b61013b54604051635bf8375f60e11b8152600481018390529192506001600160a01b03169063b7f06ebe90602401602060405180830381865afa1580156127dd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612801919061528b565b6128365760405162461bcd60e51b815260206004820152600660248201526557726f6e675160d01b604482015260640161190d565b600081815261012f602052604090205460ff16156123505760405162461bcd60e51b815260206004820152600960248201526811195c1bdcda5d195960ba1b604482015260640161190d565b61288a613b26565b6101345460405163e3afe0a360e01b815247916001600160a01b03169063e3afe0a3906128c19088908890889088906004016158b3565b600060405180830381600087803b1580156128db57600080fd5b505af11580156128ef573d6000803e3d6000fd5b504792506000915061293890506129068484615229565b61013a546001600160a01b0316600090815261012e6020526040902054600160801b90046001600160801b03166141f5565b61013a546001600160a01b0316600090815261012e6020526040902080549192508291601090612979908490600160801b90046001600160801b03166158da565b92506101000a8154816001600160801b0302191690836001600160801b031602179055507f1ba4549e6ae292c44478aa74f36dd74de5d8e8885ffef988473df19f29f25c1587876040516129ce9291906158fa565b60405180910390a150505050505050565b6001600160a01b03808316600090815261012e6020908152604080832081516101608101835281546001600160801b038082168352600160801b91829004169482019490945260018201549586169281019290925260ff600160a01b860481161515606084015261ffff600160a81b870416608084015263ffffffff600160b81b8704811660a08501819052600160d81b909704811660c085015260029092015480831660e08501526001600160601b0364010000000080830482166101008701819052968304909116610120860152600160e01b909104909116151561014084015261012d5494959294612ad892919004168261590e565b63ffffffff164210612ae957600091505b612af28661354a565b612b05866001600160601b038516615216565b1180612b315750612b15866113cc565b858461012001516001600160601b0316612b2f9190615216565b115b9695505050505050565b604051637a8b263760e01b81526004810182905260009081906001600160a01b03851690637a8b263790602401602060405180830381865afa158015612b85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ba991906151c0565b905061146e8582611dec565b6001600160a01b038216600090815261012e6020526040812060010154600160a01b900460ff16612bf95760405163c8a08d6f60e01b815260040160405180910390fd5b61013a546001600160a01b0390811690841603612c1b57611ee782600161525e565b610138546001600160a01b0390811690841603612cbc576101385460408051633ba0b9a960e01b81529051670de0b6b3a7640000926001600160a01b031691633ba0b9a99160048083019260209291908290030181865afa158015612c84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ca891906151c0565b612cb2908461525e565b611ee7919061523c565b610139546001600160a01b0390811690841603612d25576101395460408051633ba0b9a960e01b81529051670de0b6b3a7640000926001600160a01b031691633ba0b9a99160048083019260209291908290030181865afa158015612c84573d6000803e3d6000fd5b6001600160a01b038316600090815261012e6020526040902060020154600160e01b900460ff161561210657611ee782600161525e565b6000612d8f7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b6060612d9e613b26565b61013a546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612de8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e0c91906151c0565b9050612e1781610e25565b91505090565b6000612e27613b7f565b612e2f613bd2565b6001600160a01b038416600090815261012e6020526040902060010154600160a01b900460ff168015612e9b57506001600160a01b038416600090815261012e6020526040902060020154600160e01b900460ff161580612e9b575061013f546001600160a01b031633145b612ed55760405162461bcd60e51b815260206004820152600b60248201526a1393d517d0531313d5d15160aa1b604482015260640161190d565b612eea6001600160a01b038516333086614472565b6001600160a01b038416600090815261012e6020526040902060020154600160e01b900460ff1615612f1f57612f1f84613e5c565b6000612f2b8585611dec565b6001600160a01b038616600090815261012e6020526040902060010154909150612710908290612f6690600160a81b900461ffff168361592b565b61ffff16612f74919061525e565b612f7e919061523c565b9050612f8a85826129df565b15612fc05760405162461bcd60e51b815260206004820152600660248201526510d05414115160d21b604482015260640161190d565b61013254604051635a35098760e11b8152336004820152602481018390526001600160a01b038581166044830152600092169063b46a130e906064016020604051808303816000875af115801561301b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061303f91906151c0565b60408051338152602081018590526001600160a01b038916818301526000606082015290519192507f2c19962a366d611900b92f328f12302cf959ee57063a989a1869fc342220ed50919081900360800190a161309c86836144b0565b915050612350600160fb55565b6130b1614141565b611b296145d5565b6001600160a01b03818116600081815261012e6020818152604080842081516101608101835281546001600160801b038082168352600160801b91829004168286015260018301549889169382019390935260ff600160a01b89048116801515606084015261ffff600160a81b8b0416608084015263ffffffff600160b81b8b04811660a0850152600160d81b909a048a1660c084015260029093015498891660e08301526001600160601b036401000000008a048116610100840152938904909316610120820152600160e01b9097049091161515610140870152938352529182918291906131b45760008060009350935093505061328f565b60408101516001600160a01b0316156132495760408181015182519151637a8b263760e01b81526001600160801b0390921660048301526132469187916001600160a01b031690637a8b2637906024015b602060405180830381865afa158015613222573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e991906151c0565b93505b6040516370a0823160e01b815230600482015261327b9086906001600160a01b038216906370a0823190602401613205565b925080602001516001600160801b03169150505b9193909250565b60006132a0613b26565b610139546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156132e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061330d91906151c0565b83111561332d5760405163569d45cf60e11b815260040160405180910390fd5b610139546101365460405163095ea7b360e01b81526001600160a01b0391821660048201526024810186905291169063095ea7b3906044016020604051808303816000875af1158015613384573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133a8919061528b565b5061013654604051630f7c084960e21b8152600160048201526000602482015260448101859052606481018490526001600160a01b0390911690633df021249060840161230d565b60006133fa613b26565b610138546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015613443573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061346791906151c0565b8311156134875760405163569d45cf60e11b815260040160405180910390fd5b610138546101355460405163095ea7b360e01b81526001600160a01b0391821660048201526024810186905291169063095ea7b3906044016020604051808303816000875af11580156134de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613502919061528b565b50610135546040516365b2489b60e01b8152600160048201526000602482015260448101859052606481018490526001600160a01b03909116906365b2489b9060840161230d565b6001600160a01b038116600090815261012e60205260408120600101546113c690600160d81b900463ffffffff16670de0b6b3a764000061525e565b61358e613b26565b6001600160a01b03909116600090815261012e60205260409020600101805461ffff909216600160a81b0261ffff60a81b19909216919091179055565b6135d3614141565b6001600160a01b0381166136385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161190d565b611a018161420a565b613649614141565b6001600160a01b038716600090815261012e6020526040902060010154600160b81b900463ffffffff161561369157604051630ea075bf60e21b815260040160405180910390fd5b8015613710576001600160a01b03871615806136b557506001600160a01b03861615155b156136bf57600080fd5b61013e80546001810182556000919091527f3096b0ff83c28e07db9b87f650bc5521a4928b98f2734605e31b316abbb272350180546001600160a01b0319166001600160a01b0389161790556137a3565b856001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa15801561374e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137729190615563565b6001600160a01b0316876001600160a01b0316146137a35760405163c8a08d6f60e01b815260040160405180910390fd5b60405180610160016040528060006001600160801b0316815260200160006001600160801b03168152602001876001600160a01b0316815260200186151581526020018561ffff1681526020014263ffffffff1681526020018463ffffffff1681526020018363ffffffff16815260200160006001600160601b0316815260200160006001600160601b0316815260200182151581525061012e6000896001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160801b0302191690836001600160801b0316021790555060208201518160000160106101000a8154816001600160801b0302191690836001600160801b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160010160146101000a81548160ff02191690831515021790555060808201518160010160156101000a81548161ffff021916908361ffff16021790555060a08201518160010160176101000a81548163ffffffff021916908363ffffffff16021790555060c082015181600101601b6101000a81548163ffffffff021916908363ffffffff16021790555060e08201518160020160006101000a81548163ffffffff021916908363ffffffff1602179055506101008201518160020160046101000a8154816001600160601b0302191690836001600160601b031602179055506101208201518160020160106101000a8154816001600160601b0302191690836001600160601b0316021790555061014082015181600201601c6101000a81548160ff02191690831515021790555090505050505050505050565b613a30613b26565b61012d8054911515680100000000000000000268ff000000000000000019909216919091179055565b6000613a63613b7f565b6001600160a01b03851663d505accf333085356020870135613a8b6060890160408a01615946565b6040516001600160e01b031960e088901b1681526001600160a01b0395861660048201529490931660248501526044840191909152606483015260ff166084820152606085013560a4820152608085013560c482015260e401600060405180830381600087803b158015613afe57600080fd5b505af1925050508015613b0f575060015b50613b1b858585612e1d565b90505b949350505050565b336000908152610130602052604090205460ff1680613b6257506097546001600160a01b03165b6001600160a01b0316336001600160a01b0316145b611b29576040516317fe949f60e01b815260040160405180910390fd5b60c95460ff1615611b295760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161190d565b600260fb5403613c245760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161190d565b600260fb55565b815160009081805b82811015613e0d576000868281518110613c4f57613c4f615275565b602002602001015190506000868381518110613c6d57613c6d615275565b602002602001015190506000826001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa158015613cb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cdb9190615563565b90506000613cea828585612b3b565b6001600160a01b038316600090815261012e6020526040902060010154909150612710908290613d2590600160a81b900461ffff168361592b565b61ffff16613d33919061525e565b613d3d919061523c565b9050613d498187615216565b6001600160a01b038316600090815261012e6020526040812080549298508592909190613d809084906001600160801b03166151ef565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550613dae82876144b0565b60408051338152602081018390526001600160a01b038416818301526001606082015290517f2c19962a366d611900b92f328f12302cf959ee57063a989a1869fc342220ed509181900360800190a1505060019092019150613c339050565b50949350505050565b336000908152610140602052604090205460ff1680613e455750336000908152610130602052604090205460ff165b80613b6257506097546001600160a01b0316613b4d565b6040516370a0823160e01b81523060048201526001600160a01b038216906370a0823190602401602060405180830381865afa158015613ea0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ec491906151c0565b816001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613f02573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f2691906151c0565b14611a0157600080fd5b6040516001600160a01b038316602482015260448101829052613fa890849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b03199093169290921790915261460e565b505050565b611a01614141565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615613fe857613fa8836146e0565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015614042575060408051601f3d908101601f1916820190925261403f918101906151c0565b60015b6140b45760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f742055555053000000000000000000000000000000000000606482015260840161190d565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc81146141355760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161190d565b50613fa883838361478e565b6097546001600160a01b03163314611b295760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161190d565b6141a3613b7f565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586141d83390565b6040516001600160a01b03909116815260200160405180910390a1565b60008183116142045782612350565b50919050565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b61013b54604051632cbd9b6d60e11b81526000916001600160a01b03169063597b36da9061428e9085906004016159a3565b602060405180830381865afa1580156142ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142cf91906151c0565b60a08301515190915060005b818110156144395760008460a0015182815181106142fb576142fb615275565b60200260200101516001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa158015614340573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143649190615563565b905060008560c00151838151811061437e5761437e615275565b6020908102919091018101516001600160a01b038416600090815261012e9092526040909120549091506001600160801b03808316911610156143d45760405163a43df45160e01b815260040160405180910390fd5b6001600160a01b038216600090815261012e6020526040812080548392906144069084906001600160801b03166158da565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550505080806001019150506142db565b506040518281527f17e1f8c6562ad4a081a5b2053cc2e79b2c8eb52b7104e2ba564d690fa2e5f1669060200160405180910390a1505050565b6040516001600160a01b03808516602483015283166044820152606481018290526144aa9085906323b872dd60e01b90608401613f5c565b50505050565b6001600160a01b038216600090815261012e6020526040902061012d5460018201546144f49163ffffffff640100000000909104811691600160b81b90041661590e565b63ffffffff16421061453c576002810180546fffffffffffffffffffffffff000000001916905560018101805463ffffffff60b81b1916600160b81b4263ffffffff16021790555b818160020160048282829054906101000a90046001600160601b03166145629190615a2c565b92506101000a8154816001600160601b0302191690836001600160601b03160217905550818160020160108282829054906101000a90046001600160601b03166145ac9190615a2c565b92506101000a8154816001600160601b0302191690836001600160601b03160217905550505050565b6145dd6147b3565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa336141d8565b6000614663826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166148059092919063ffffffff16565b805190915015613fa85780806020019051810190614681919061528b565b613fa85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161190d565b6001600160a01b0381163b61474d5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161190d565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b61479783614814565b6000825111806147a45750805b15613fa8576144aa8383614854565b60c95460ff16611b295760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161190d565b6060613b1e848460008561493f565b61481d816146e0565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6148bc5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161190d565b600080846001600160a01b0316846040516148d79190615a70565b600060405180830381855af49150503d8060008114614912576040519150601f19603f3d011682016040523d82523d6000602084013e614917565b606091505b509150915061146e8282604051806060016040528060278152602001615ab660279139614a1a565b6060824710156149a05760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161190d565b600080866001600160a01b031685876040516149bc9190615a70565b60006040518083038185875af1925050503d80600081146149f9576040519150601f19603f3d011682016040523d82523d6000602084013e6149fe565b606091505b5091509150614a0f87838387614a33565b979650505050505050565b60608315614a29575081612350565b6123508383614aa8565b60608315614aa2578251600003614a9b576001600160a01b0385163b614a9b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161190d565b5081613b1e565b613b1e83835b815115614ab85781518083602001fd5b8060405162461bcd60e51b815260040161190d9190615a82565b600060208284031215614ae457600080fd5b5035919050565b60008151808452602080850194506020840160005b83811015614b1c57815187529582019590820190600101614b00565b509495945050505050565b6020815260006123506020830184614aeb565b600060e0828403121561420457600080fd5b6001600160a01b0381168114611a0157600080fd5b803561123181614b4c565b60008060408385031215614b7f57600080fd5b823567ffffffffffffffff811115614b9657600080fd5b614ba285828601614b3a565b9250506020830135614bb381614b4c565b809150509250929050565b600060208284031215614bd057600080fd5b813561235081614b4c565b600080600080600060a08688031215614bf357600080fd5b8535614bfe81614b4c565b945060208601359350604086013562ffffff81168114614c1d57600080fd5b94979396509394606081013594506080013592915050565b803563ffffffff8116811461123157600080fd5b600080600060608486031215614c5e57600080fd5b8335614c6981614b4c565b9250614c7760208501614c35565b9150614c8560408501614c35565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b60405160e0810167ffffffffffffffff81118282101715614cc757614cc7614c8e565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715614cf657614cf6614c8e565b604052919050565b60008060408385031215614d1157600080fd5b8235614d1c81614b4c565b915060208381013567ffffffffffffffff80821115614d3a57600080fd5b818601915086601f830112614d4e57600080fd5b813581811115614d6057614d60614c8e565b614d72601f8201601f19168501614ccd565b91508082528784828501011115614d8857600080fd5b80848401858401376000848284010152508093505050509250929050565b600060208284031215614db857600080fd5b61235082614c35565b8015158114611a0157600080fd5b60008060408385031215614de257600080fd5b8235614ded81614b4c565b91506020830135614bb381614dc1565b60008060408385031215614e1057600080fd5b8235614e1b81614b4c565b946020939093013593505050565b60008060408385031215614e3c57600080fd5b50508035926020909101359150565b60008083601f840112614e5d57600080fd5b50813567ffffffffffffffff811115614e7557600080fd5b6020830191508360208260051b8501011115614e9057600080fd5b9250929050565b60008060008060008060608789031215614eb057600080fd5b863567ffffffffffffffff80821115614ec857600080fd5b614ed48a838b01614e4b565b90985096506020890135915080821115614eed57600080fd5b614ef98a838b01614e4b565b90965094506040890135915080821115614f1257600080fd5b50614f1f89828a01614e4b565b979a9699509497509295939492505050565b60008060408385031215614f4457600080fd5b8235614f4f81614b4c565b9150602083013567ffffffffffffffff811115614f6b57600080fd5b614f7785828601614b3a565b9150509250929050565b60008060008060408587031215614f9757600080fd5b843567ffffffffffffffff80821115614faf57600080fd5b614fbb88838901614e4b565b90965094506020870135915080821115614fd457600080fd5b50614fe187828801614e4b565b95989497509550505050565b60008060006060848603121561500257600080fd5b833561500d81614b4c565b9250602084013561501d81614b4c565b929592945050506040919091013590565b60008060006060848603121561504357600080fd5b833561504e81614b4c565b925060208401359150604084013561506581614b4c565b809150509250925092565b803561ffff8116811461123157600080fd5b6000806040838503121561509557600080fd5b82356150a081614b4c565b91506150ae60208401615070565b90509250929050565b600080600080600080600060e0888a0312156150d257600080fd5b87356150dd81614b4c565b965060208801356150ed81614b4c565b955060408801356150fd81614dc1565b945061510b60608901615070565b935061511960808901614c35565b925061512760a08901614c35565b915060c088013561513781614dc1565b8091505092959891949750929550565b60006020828403121561515957600080fd5b813561235081614dc1565b60008060008084860361010081121561517c57600080fd5b853561518781614b4c565b945060208601359350604086013561519e81614b4c565b925060a0605f19820112156151b257600080fd5b509295919450926060019150565b6000602082840312156151d257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6001600160801b0381811683821601908082111561520f5761520f6151d9565b5092915050565b808201808211156113c6576113c66151d9565b818103818111156113c6576113c66151d9565b60008261525957634e487b7160e01b600052601260045260246000fd5b500490565b80820281158282048414176113c6576113c66151d9565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561529d57600080fd5b815161235081614dc1565b6040815260006152bb6040830185614aeb565b90506001600160a01b03831660208301529392505050565b600067ffffffffffffffff8211156152ed576152ed614c8e565b5060051b60200190565b6000602080838503121561530a57600080fd5b825167ffffffffffffffff81111561532157600080fd5b8301601f8101851361533257600080fd5b8051615345615340826152d3565b614ccd565b81815260059190911b8201830190838101908783111561536457600080fd5b928401925b82841015614a0f57835182529284019290840190615369565b6000808335601e1984360301811261539957600080fd5b830160208101925035905067ffffffffffffffff8111156153b957600080fd5b8060051b3603821315614e9057600080fd5b8183526000602080850194508260005b85811015614b1c5781356153ee81614b4c565b6001600160a01b0316875295820195908201906001016153db565b81835260007f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83111561543b57600080fd5b8260051b80836020870137939093016020019392505050565b6000813561546181614b4c565b6001600160a01b03908116845260208301359061547d82614b4c565b908116602085015260408301359061549482614b4c565b1660408401526060828101359084015263ffffffff6154b560808401614c35565b1660808401526154c860a0830183615382565b60e060a08601526154dd60e0860182846153cb565b9150506154ed60c0840184615382565b85830360c0870152612b31838284615409565b828152604060208201526000613b1e6040830184615454565b6000808335601e1984360301811261553057600080fd5b83018035915067ffffffffffffffff82111561554b57600080fd5b6020019150600581901b3603821315614e9057600080fd5b60006020828403121561557557600080fd5b815161235081614b4c565b6000823560de1983360301811261559657600080fd5b9190910192915050565b600082601f8301126155b157600080fd5b813560206155c1615340836152d3565b8083825260208201915060208460051b8701019350868411156155e357600080fd5b602086015b848110156156085780356155fb81614b4c565b83529183019183016155e8565b509695505050505050565b600082601f83011261562457600080fd5b81356020615634615340836152d3565b8083825260208201915060208460051b87010193508684111561565657600080fd5b602086015b84811015615608578035835291830191830161565b565b600060e0823603121561568457600080fd5b61568c614ca4565b61569583614b61565b81526156a360208401614b61565b60208201526156b460408401614b61565b6040820152606083013560608201526156cf60808401614c35565b608082015260a083013567ffffffffffffffff808211156156ef57600080fd5b6156fb368387016155a0565b60a084015260c085013591508082111561571457600080fd5b5061572136828601615613565b60c08301525092915050565b60008383855260208086019550808560051b830101846000805b888110156157ad57858403601f19018a526157628389615382565b808652868601845b8281101561579857833561577d81614b4c565b6001600160a01b03168252928801929088019060010161576a565b509b87019b9550505091840191600101615747565b509198975050505050505050565b60008151808452602080850194506020840160005b83811015614b1c5781511515875295820195908201906001016157d0565b60808082528101879052600060a0600589901b830181019083018a835b8b81101561585357858403609f190183528135368e900360de1901811261583157600080fd5b61583d858f8301615454565b945050602092830192919091019060010161580b565b505050828103602084015261586981888a61572d565b9050828103604084015261587e818688615409565b9050828103606084015261589281856157bb565b9a9950505050505050505050565b6020815260006123506020830184615454565b6040815260006158c7604083018688615409565b8281036020840152614a0f818587615409565b6001600160801b0382811682821603908082111561520f5761520f6151d9565b602081526000613b1e602083018486615409565b63ffffffff81811683821601908082111561520f5761520f6151d9565b61ffff82811682821603908082111561520f5761520f6151d9565b60006020828403121561595857600080fd5b813560ff8116811461235057600080fd5b60008151808452602080850194506020840160005b83811015614b1c5781516001600160a01b03168752958201959082019060010161597e565b6020815260006001600160a01b03808451166020840152806020850151166040840152806040850151166060840152506060830151608083015260808301516159f460a084018263ffffffff169052565b5060a083015160e060c0840152615a0f610100840182615969565b905060c0840151601f198483030160e085015261146e8282614aeb565b6001600160601b0381811683821601908082111561520f5761520f6151d9565b60005b83811015615a67578181015183820152602001615a4f565b50506000910152565b60008251615596818460208701615a4c565b6020815260008251806020840152615aa1816040850160208701615a4c565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220fad4ebfbbb546001aaac22ddabfad81ab496a10be805c97c51f7abd422ad443064736f6c63430008180033

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.