Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
RestakingPool
Compiler Version
v0.8.8+commit.dddeac2f
Optimization Enabled:
Yes with 200 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; import "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; import "src/interfaces/eigenLayer/IEigenPodManager.sol"; import {Errors} from "src/libraries/Errors.sol"; import "src/interfaces/IRestakingPool.sol"; import "src/interfaces/IELVault.sol"; import "src/staking/BasePool.sol"; import "src/interfaces/IRestakingPod.sol"; /** * @title Liquidity Restaking pool * @author NodeDAO * @notice Restaking pool on top of BasePool */ contract RestakingPool is Initializable, BasePool, IRestakingPool { address public elRewardsAddress; IEigenPodManager public eigenLayerEigenPodManager; address[] internal restakingPods; constructor() { _disableInitializers(); } function initialize( address _ownerAddr, uint256 _apr, address _dao, address _elRewardsAddress, address _poolToken, address _rateManager, address _validatorManager, address _depositContract, address _eigenLayerEigenPodManager, address[] memory _restakingPods ) public initializer { __BasePool_init( _ownerAddr, 0, _apr, 0, _dao, _poolToken, _rateManager, _validatorManager, _depositContract, false ); elRewardsAddress = _elRewardsAddress; eigenLayerEigenPodManager = IEigenPodManager(_eigenLayerEigenPodManager); for (uint256 i = 0; i < _restakingPods.length; ++i) { address _restakingPod = _restakingPods[i]; _checkRestakingPod(_restakingPod); restakingPods.push(_restakingPod); } } /** * @notice Register validator to beacon * @param _depositContractRoot deposit contract root * @param _pubkeys validator pubkey * @param _signatures deposit signatures * @param _depositDataRoots deposit data roots */ function registerValidator( bytes32 _depositContractRoot, address _restakingPod, bytes[] calldata _pubkeys, bytes[] calldata _signatures, bytes32[] calldata _depositDataRoots ) external onlyValidatorManager { if (!_isRestakingPod(_restakingPod)) { revert Errors.RestakingPodNotFound(); } if (_depositContractRoot != depositContract.get_deposit_root()) { revert Errors.DepositRootMismatch(); } uint256 _pubkeyLength = _pubkeys.length; uint256 _totalStakeAmount = _pubkeyLength * 32 ether; _checkFunds(_totalStakeAmount, true); if (_pubkeyLength != _signatures.length || _pubkeyLength != _depositDataRoots.length) { revert Errors.InvalidParameter(); } _registerPubkey(_pubkeys); for (uint256 i = 0; i < _pubkeyLength; ++i) { IRestakingPod(_restakingPod).stake{value: 32 ether}(_pubkeys[i], _signatures[i], _depositDataRoots[i]); } IRestakingPod(_restakingPod).setStakedButNotVerifiedEth(_totalStakeAmount); emit ValidatorRegistration(_pubkeys); } /** * @notice Override _checkFunds */ function _checkFunds(uint256 _requireEthAmount, bool) internal override { uint256 _poolBalance = address(this).balance; if (_requireEthAmount > _poolBalance) { IELVault(elRewardsAddress).reinvestment(); claimDelayedWithdrawals(); _poolBalance = address(this).balance; if (_requireEthAmount > _poolBalance) { revert Errors.InsufficientFunds(); } } } /** * @notice Dao add restakingPod */ function addRestakingPod(address _restakingPod) external onlyDao { _checkRestakingPod(_restakingPod); restakingPods.push(_restakingPod); emit RestakingPodAdded(_restakingPod); } /** * @notice Checks that the given address is a restakingpod */ function _checkRestakingPod(address _restakingPod) internal { if ( IRestakingPod(_restakingPod).eigenLayerEigenPod() != address(eigenLayerEigenPodManager.ownerToPod(_restakingPod)) ) { revert Errors.EigenPodMismatch(); } } /** * @notice Check the given address in the restakingPods list */ function _isRestakingPod(address _restakingPod) internal view returns (bool) { bool found = false; uint256 rpLength = restakingPods.length; for (uint256 i = 0; i < rpLength;) { if (address(restakingPods[i]) == _restakingPod) { found = true; break; } unchecked { ++i; } } return found; } /** * @notice claimDelayedWithdrawals * Because withdrawal permissions cannot be controlled, and EigenLayer has delays. * So withdrawalDelayBlocks should be 0 (for fairness, otherwise the funds can be withdrawn by 'unstakeETH') */ function claimDelayedWithdrawals() public { uint256 rpLength = restakingPods.length; for (uint256 i = 0; i < rpLength;) { IRestakingPod(restakingPods[i]).claimDelayedWithdrawals(); unchecked { ++i; } } } /** * @notice Override withdrawCredentials */ function withdrawCredentials() public view returns (bytes[] memory) { uint256 rpLength = restakingPods.length; bytes[] memory wcs = new bytes[](rpLength); for (uint256 i = 0; i < rpLength;) { wcs[i] = IRestakingPod(restakingPods[i]).withdrawCredentials(); unchecked { ++i; } } return wcs; } /** * @notice get restaking pods */ function getRestakingPods() external view returns (address[] memory) { return restakingPods; } /** * @notice getPoolAmount return pool balance + el rewards */ function getPoolAmount() external view returns (uint256) { return address(this).balance + IELVault(elRewardsAddress).getPoolRewards(); } /** * @notice getCLVaultAmount return cl rewards + withdrawal */ function getCLVaultAmount() external view returns (uint256) { uint256 _pendingAmount = 0; for (uint256 i = 0; i < restakingPods.length;) { _pendingAmount += IRestakingPod(restakingPods[i]).getClaimableDelayedWithdrawals(); unchecked { ++i; } } return _pendingAmount; } /** * @notice Funds from the execution layer reward address and consensus layer rewards only issue event; * Funds from other addresses are stake */ receive() external payable { address _sender = msg.sender; if (_sender == address(elRewardsAddress) || _isRestakingPod(_sender)) { emit Received(_sender, msg.value); } else { _stakeETH(); } } /** * @notice Contract type id */ function typeId() public pure override returns (bytes32) { return keccak256("RestakingPool"); } /** * @notice Contract version */ function version() public pure override returns (uint8) { return 2; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * 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 Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.8; 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; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; library Errors { error PermissionDenied(); error InvalidAddr(); error InvalidVersion(); error InvalidtypeId(); error InvalidApr(); error EigenLayerOperatorAlreadyDelegated(); error DepositRootMismatch(); error InvalidParameter(); error InvalidAmount(); error UpdateTimelocked(); error InsufficientFunds(); error ValidatorRegistered(); error InvalidLength(); error InvalidRequestId(); error ClaimTooEarly(); error DelayTooLarge(); error TransferFailed(); error ExecuteFailed(); error WithdrawalsRequestExist(); error CanUnstakeETH(); error WithrawalsRequestCannotClaimed(); error InvalidMsgVaule(); error DepositdataNotEnough(); error OperatorNotFound(); error InvalidCommissionRate(); error PubkeyRegistered(); error UnstakeNotEnabled(); error EigenPodMismatch(); error RestakingPodNotFound(); error PoolAlreadyExist(); error PoolDoesNotExist(); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; interface IRestakingPool { event ValidatorRegistration(bytes[] _pubkeys); event RestakingPodAdded(address _restakingPod); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; interface IELVault { function getDaoRewards() external view returns (uint256); function getPoolRewards() external view returns (uint256); function reinvestment() external; event PoolSet(address _pool); event PoolChanged(address _oldPool, address _pool); event DaoTreasuryChanged(address _oldDaoTreasury, address _daoTreasury); event PoolConfigChanged(address _oldOperatorRegistry, address _operatorRegistry); event Transfer(address _to, uint256 _amount); event Received(uint256 _amount); event Settle(uint256 _daoRewards, uint256 _poolRewards); event DaoRewardsClaimed(address _to, uint256 _daoRewards); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; import "src/modules/Version.sol"; import "src/modules/Dao.sol"; import "src/modules/WithdrawalRequest.sol"; import "src/modules/Rate.sol"; import "src/modules/Validator.sol"; import "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; import "src/interfaces/ILsdETH.sol"; import {Errors} from "src/libraries/Errors.sol"; import "src/interfaces/IBasePool.sol"; /** * @title Provide basic functions of liquidity staking * @author NodeDAO * @notice Provides * - stakeETH * - unstakeETH * - requestWithdrawals * - claimWithdrawals * - convertToShares * - convertToAssets * - exchangeRate * - setting: setValidatorManager & setRateManager & setWithdrawalDelayBlocks & pause & unpause */ abstract contract BasePool is Initializable, Version, Rate, Validator, WithdrawalRequest, Dao, IBasePool { /// Liquidity token, erc20 contract address ILsdETH public poolToken; bool public unstakeAllowed; // Staking strategy vault and total funds entering the strategy address public strategyVault; uint256 public strategyAmount; function __BasePool_init( address _ownerAddr, uint256 _withdrawalDelayBlocks, uint256 _apr, uint256 _totalUnderlyingAsset, address _dao, address _poolToken, address _rateManager, address _validatorManager, address _depositContract, bool _unstakeAllowed ) public onlyInitializing { __Version_init(_ownerAddr); __Dao_init(_dao); __Rate_init(_apr, _rateManager, _totalUnderlyingAsset); __Validator_init(_validatorManager, address(0), _depositContract); __WithdrawalRequest_init(_withdrawalDelayBlocks); poolToken = ILsdETH(_poolToken); if (_unstakeAllowed) { unstakeAllowed = _unstakeAllowed; } } /** * @notice Receive eth, mint lsdETH according to the exchange rate * @notice Allows the function to be rewritten to add functionality, such as adding a whitelist mechanism */ function stakeETH() external payable virtual { _stakeETH(); } function _stakeETH() internal whenNotPaused { uint256 _stakeAmount = msg.value; address _staker = msg.sender; if (_stakeAmount < 0.01 ether) { revert Errors.InvalidAmount(); } // Calculate the amount of lsdETH minted based on the exchange rate uint256 _mintAmount = _convertToShares(_stakeAmount, poolToken.totalSupply()); _increaseAssets(_stakeAmount); poolToken.whiteListMint(_mintAmount, _staker); emit EthStake(_staker, _stakeAmount, _mintAmount); } /** * @notice Burn lsdETH and redeem ETH according to the exchange rate * @notice Available redemption funds include: * current pool funds + funds that can be aggregated (including execution layer rewards and consensus layer rewards) */ function unstakeETH(uint256 _unstakeAmount) external nonReentrant whenNotPaused { if (!unstakeAllowed) { revert Errors.UnstakeNotEnabled(); } address _sender = msg.sender; uint256 _ethAmount = _convertToAssets(_unstakeAmount, poolToken.totalSupply()); _checkFunds(_ethAmount, true); _reduceAssets(_ethAmount); poolToken.whiteListBurn(_unstakeAmount, _sender); (bool success,) = _sender.call{value: _ethAmount}(""); if (!success) revert Errors.TransferFailed(); emit EthUnstake(_sender, _unstakeAmount, _ethAmount); } /** * @notice Create withdrawal request * @param _unstakeAmount unstake lsdETH amount */ function requestWithdrawals(uint256 _unstakeAmount) external whenNotPaused { if (!unstakeAllowed) { revert Errors.UnstakeNotEnabled(); } uint256 _totalSupply = poolToken.totalSupply(); uint256 _ethAmount = _convertToAssets(_unstakeAmount, _totalSupply); if (address(this).balance >= _ethAmount) { revert Errors.CanUnstakeETH(); } address _sender = msg.sender; _reduceAssets(_ethAmount); poolToken.whiteListBurn(_unstakeAmount, _sender); _requestWithdrawals(_sender, _unstakeAmount, _exchangeRate(_totalSupply), _ethAmount); } /** * @notice Claim withdrawal * @param _receiver fund recipient * @param _requestIds withdrawal request ids */ function claimWithdrawals(address _receiver, uint256[] memory _requestIds) external nonReentrant whenNotPaused { uint256 _totalEthAmount = 0; for (uint256 i = 0; i < _requestIds.length; ++i) { uint256 _requestId = _requestIds[i]; if (!canClaimWithdrawal(_receiver, _requestId)) { revert Errors.WithrawalsRequestCannotClaimed(); } WithdrawalInfo memory _withdrawal = _getWithdrawal(_receiver, _requestId); _claimWithdrawals(_receiver, _requestId); _totalEthAmount += _withdrawal.claimAmount; } _checkFunds(_totalEthAmount, false); (bool success,) = _receiver.call{value: _totalEthAmount}(""); if (!success) revert Errors.TransferFailed(); } /** * @notice ETH to lsdETH exchange rate * @param _stakeAmount stake amount */ function convertToShares(uint256 _stakeAmount) external view returns (uint256) { return _convertToShares(_stakeAmount, poolToken.totalSupply()); } /** * @notice lsdETH to ETH exchange rate * @param _unstakeAmount unstake lsdETH amount */ function convertToAssets(uint256 _unstakeAmount) external view returns (uint256) { return _convertToAssets(_unstakeAmount, poolToken.totalSupply()); } /** * @notice lsdETH to ETH exchange rate */ function exchangeRate() external view returns (uint256) { return _exchangeRate(poolToken.totalSupply()); } /** * @notice Receive Rewards * compatibility with 1.0 ConsensusVault.sol */ function receiveRewards(uint256) external payable { emit Received(msg.sender, msg.value); } /** * @notice Allows DAO to set up strategic funds to achieve flexible pledge strategies */ function setStrategyVault(address _strategyVault) public onlyDao { if (_strategyVault == address(0)) { revert Errors.InvalidAddr(); } emit StrategyVaultChanged(strategyVault, _strategyVault); strategyVault = _strategyVault; } /** * @notice DAO deposit funds to the strategy vault * @notice Excess funds cannot be used when there is a withdrawal request */ function strategyDeposit(uint256 _amount) public onlyDao nonReentrant { if (strategyVault == address(0)) { revert Errors.InvalidAddr(); } _checkFunds(_amount, true); // Record the total deposit funds strategyAmount += _amount; (bool success,) = strategyVault.call{value: _amount}(""); if (!success) revert Errors.TransferFailed(); emit StrategyDeposited(_amount, strategyAmount); } /** * @notice DAO deposit funds to the strategy vault * @notice The strategy vault returns funds * Rewards should not be returned through this method. * Rewards should be recharged to the execution layer and consensus layer vaults */ function strategyReturn() public payable { uint256 _amount = msg.value; // No overpayment allowed strategyAmount -= _amount; emit StrategyReturn(_amount); } /** * @notice set DAO address */ function setDao(address _dao) public onlyOwner { _setDao(_dao); } /** * @notice update validator manager * @param _validatorManager new validator manager */ function setValidatorManager(address _validatorManager) public onlyDao { _setValidatorManager(_validatorManager); } /** * @notice update rate manager * @param _rateManager new rate manager */ function setRateManager(address _rateManager) public onlyDao { _setRateManager(_rateManager); } /** * @notice update withdarawal delay block number * @param _withdrawalDelayBlocks new delay block number */ function setWithdrawalDelayBlocks(uint256 _withdrawalDelayBlocks) public onlyDao { _setWithdrawalDelayBlocks(_withdrawalDelayBlocks); } /** * @notice update validatorRegistry * @param _validatorRegistry new validatorRegistry */ function setValidatorRegistry(address _validatorRegistry) public onlyDao { _setValidatorRegistry(_validatorRegistry); } /** * @notice update unstakeAllowed * @param _unstakeAllowed unstake allowed */ function setUnstakeAllowed(bool _unstakeAllowed) public onlyDao { emit UnstakeAllowedUpdated(unstakeAllowed, _unstakeAllowed); unstakeAllowed = _unstakeAllowed; } /** * @notice stop protocol */ function pause() external onlyDao { _pause(); } /** * @notice start protocol */ function unpause() external onlyDao { _unpause(); } /** * @notice lsdETH to ETH exchange rate * @param _requireEthAmount require amount * @param _isCheckWithdrawalReuqest whether to check for asynchronous withdrawal requests */ function _checkFunds(uint256 _requireEthAmount, bool _isCheckWithdrawalReuqest) 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[48] private __gap; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; interface IRestakingPod { event Received(address _sender, uint256 _amount); event EigenLayerOperatorDelegated(address _delegateAddress); event EigenLayerOperatorUndelegated(address _delegateAddress); event StakedButNotVerifiedEthChanged(uint256 _oldAmount, uint256 _newAmount); event RestakingPodManagerChanged(address _oldPodManager, address _podManager); function eigenLayerEigenPod() external returns (address); function withdrawCredentials() external view returns (bytes memory); function claimDelayedWithdrawals() external; function setStakedButNotVerifiedEth(uint256 _amount) external; function stake(bytes calldata _pubkey, bytes calldata _signature, bytes32 _depositDataRoot) external payable; function getClaimableDelayedWithdrawals() external view returns (uint256); }
// 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); } } }
// 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); }
// ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━ // ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓ // ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛ // ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━ // ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓ // ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // SPDX-License-Identifier: CC0-1.0 pragma solidity 0.8.8; // 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); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.8; 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); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.8; import "src/libraries/eigenLayer/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, BeaconChainProofs.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, BeaconChainProofs.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, BeaconChainProofs.StateRootProof calldata stateRootProof, BeaconChainProofs.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; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.8; /** * @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); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.8; import "./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; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.8; 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); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.8; 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); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; import "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; import "openzeppelin-contracts-upgradeable/access/OwnableUpgradeable.sol"; import "openzeppelin-contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "openzeppelin-contracts-upgradeable/security/PausableUpgradeable.sol"; import "openzeppelin-contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import {Errors} from "src/libraries/Errors.sol"; import "src/interfaces/IVersion.sol"; /** * @title Version management contract * @author NodeDAO * @notice Encapsulates the basic functions of * UUPSUpgradeable contract, * OwnableUpgradeable contract, * PausableUpgradeable contract, * and ReentrancyGuardUpgradeable contract. */ abstract contract Version is Initializable, UUPSUpgradeable, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable { function __Version_init(address _ownerAddr) internal onlyInitializing { _transferOwnership(_ownerAddr); __UUPSUpgradeable_init(); __Pausable_init(); } /** * @notice When upgrading the contract, * it is required that the typeid of the contract must be constant and version +1. */ function _authorizeUpgrade(address newImplementation) internal view override onlyOwner { if (IVersion(newImplementation).typeId() != typeId()) { revert Errors.InvalidtypeId(); } if (IVersion(newImplementation).version() != version() + 1) { revert Errors.InvalidVersion(); } } function implementation() external view returns (address) { return _getImplementation(); } /** * @notice Contract type id */ function typeId() public pure virtual returns (bytes32); /** * @notice Contract version */ function version() public pure virtual returns (uint8); /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; import {Errors} from "src/libraries/Errors.sol"; import "src/interfaces/IDao.sol"; import "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; /** * @title dao permission contract * @author NodeDAO * @notice This is an abstract contract, although there are no unimplemented functions. * This contract is used in other contracts as a basic contract for dao's authority management. */ abstract contract Dao is Initializable, IDao { address public dao; modifier onlyDao() { if (msg.sender != dao) revert Errors.PermissionDenied(); _; } function __Dao_init(address _dao) internal onlyInitializing { dao = _dao; } function _setDao(address _dao) internal { emit DaoChanged(dao, _dao); dao = _dao; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; import "src/libraries/Errors.sol"; import "src/interfaces/IWithdrawalRequest.sol"; import "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; /** * @title Withdrawal request contract * @author NodeDAO * @notice Provides basic functions for withdrawal orders. * Used for asynchronous withdrawal requests in liquidity staking pools. */ abstract contract WithdrawalRequest is Initializable, IWithdrawalRequest { struct WithdrawalInfo { uint96 withdrawalHeight; uint96 withdrawalExchange; uint64 isClaim; uint128 withdrawalAmount; uint128 claimAmount; } uint256 public withdrawalDelayBlocks; // 10 days uint256 public constant MAX_WITHDRAWAL_DELAY_BLOCKS = 72000; mapping(address => WithdrawalInfo[]) internal withdrawalQueue; uint256 public totalWithdrawalAmount; function __WithdrawalRequest_init(uint256 _withdrawalDelayBlocks) internal onlyInitializing { withdrawalDelayBlocks = _withdrawalDelayBlocks; } /** * @notice Query all withdrawals of the recipient * @param _receiver fund recipient */ function getUserWithdrawals(address _receiver) public view returns (WithdrawalInfo[] memory) { return withdrawalQueue[_receiver]; } function _getWithdrawal(address _receiver, uint256 _requestId) internal view returns (WithdrawalInfo memory) { return withdrawalQueue[_receiver][_requestId]; } /** * @notice Check if the withdrawal can be claimed * @param _receiver fund recipient * @param _requestId withdrawal request id */ function canClaimWithdrawal(address _receiver, uint256 _requestId) public view returns (bool) { WithdrawalInfo[] memory _userWithdrawals = withdrawalQueue[_receiver]; if (_requestId >= _userWithdrawals.length) { revert Errors.InvalidLength(); } if (block.number < _userWithdrawals[_requestId].withdrawalHeight + withdrawalDelayBlocks) { return false; } return true; } /** * @notice Create withdrawal request * @param _receiver fund recipient * @param _withdrawalAmount withdrawal amount */ function _requestWithdrawals( address _receiver, uint256 _withdrawalAmount, uint256 _withdrawalExchange, uint256 _claimAmount ) internal { uint256 _blockNumber = block.number; withdrawalQueue[_receiver].push( WithdrawalInfo({ withdrawalHeight: uint96(_blockNumber), withdrawalExchange: uint96(_withdrawalExchange), withdrawalAmount: uint128(_withdrawalAmount), claimAmount: uint128(_claimAmount), isClaim: 0 }) ); totalWithdrawalAmount += _claimAmount; emit WithdrawalsRequest(_receiver, _withdrawalAmount, _blockNumber); } /** * @notice Claim withdrawal * @param _receiver fund recipient * @param _requestId withdrawal request id */ function _claimWithdrawals(address _receiver, uint256 _requestId) internal { WithdrawalInfo memory _userWithdrawal = withdrawalQueue[_receiver][_requestId]; if (_userWithdrawal.withdrawalAmount == 0 || _userWithdrawal.isClaim != 0) { revert Errors.InvalidRequestId(); } withdrawalQueue[_receiver][_requestId] = WithdrawalInfo({ withdrawalHeight: _userWithdrawal.withdrawalHeight, withdrawalExchange: _userWithdrawal.withdrawalExchange, withdrawalAmount: _userWithdrawal.withdrawalAmount, claimAmount: _userWithdrawal.claimAmount, isClaim: 1 }); totalWithdrawalAmount -= _userWithdrawal.claimAmount; emit WithdrawalsClaimed(_receiver, _requestId, _userWithdrawal.claimAmount); } /** * @notice update withdarawal delay block number * @param _withdrawalDelayBlocks new delay block number */ function _setWithdrawalDelayBlocks(uint256 _withdrawalDelayBlocks) internal { if (_withdrawalDelayBlocks > MAX_WITHDRAWAL_DELAY_BLOCKS) { revert Errors.DelayTooLarge(); } emit WithdrawalDelayChanged(withdrawalDelayBlocks, _withdrawalDelayBlocks); withdrawalDelayBlocks = _withdrawalDelayBlocks; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; import "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; import {Errors} from "src/libraries/Errors.sol"; import "src/interfaces/IRate.sol"; /** * @title This is yield management contract * @author NodeDAO * @notice This is a revenue management contract with compound interest. * It steadily increases totalUnderlyingAsset according to the set apr. * @notice The totalUnderlyingAsset will grow with the block, and every time the block is increased, * the totalUnderlyingAsset will be recalculated. * But the final state update occurs when assets join and exit or when the administrator updates the APR. */ abstract contract Rate is Initializable, IRate { address public rateManager; uint256 public totalUnderlyingAsset; uint256 public currentApr; uint256 public rewardsUpdateBlock; uint256 public constant UPDATE_BLOCK_LIMIT = 7200; uint256 public constant BLOCK_NUMBER_PER_YEAR = 7200 * 360; uint256 public constant MAX_APR = 2000; // max apr is 20% uint256 public constant APR_PERCENT = 10000; modifier onlyRateManager() { if (msg.sender != rateManager) revert Errors.PermissionDenied(); _; } function __Rate_init(uint256 _apr, address _rateManager, uint256 _totalUnderlyingAsset) internal onlyInitializing { if (_apr > MAX_APR) { revert Errors.InvalidApr(); } currentApr = _apr; rateManager = _rateManager; rewardsUpdateBlock = block.number; if (_totalUnderlyingAsset != 0) { totalUnderlyingAsset = _totalUnderlyingAsset; } } /** * @notice totalAsset = totalUnderlyingAsset + settleAsset * @notice When totalUnderlyingAsset is less than 32eth, * no revenue can be generated because it cannot be registered as a validator. */ function totalAssets() public view returns (uint256) { (uint256 _totalUnderlyingAsset, uint256 _estimatedRewards,) = _unsettleAssets(); if (_estimatedRewards != 0) { return _totalUnderlyingAsset + _estimatedRewards; } return _totalUnderlyingAsset; } /** * @notice ETH to lsdETH exchange rate * @param _assets ETH amount * @param _totalShares lsdETH totalSupply */ function _convertToShares(uint256 _assets, uint256 _totalShares) internal view returns (uint256) { uint256 _totalAssets = totalAssets(); if (_totalShares == 0 || _totalAssets == 0) { return _assets; } return _assets * _totalShares / _totalAssets; } /** * @notice lsdETH to ETH exchange rate * @param _shares lsdETH amount * @param _totalShares lsdETH totalSupply */ function _convertToAssets(uint256 _shares, uint256 _totalShares) internal view returns (uint256 _assets) { uint256 _totalAssets = totalAssets(); if (_totalShares == 0) { return _shares; } return _shares * _totalAssets / _totalShares; } /** * @notice lsdETH to ETH exchange rate * @param _totalShares lsdETH totalSupply */ function _exchangeRate(uint256 _totalShares) internal view returns (uint256) { return _convertToAssets(1 ether, _totalShares); } /** * @notice Calculate the unsettle assets from the last settlement block to the current block based on apr */ function _unsettleAssets() internal view returns (uint256 _totalUnderlyingAsset, uint256 _unsettleRewards, uint256 _blockNumber) { _totalUnderlyingAsset = totalUnderlyingAsset; _blockNumber = block.number; uint256 _rewardsUpdateBlock = rewardsUpdateBlock; if (_rewardsUpdateBlock == _blockNumber || _totalUnderlyingAsset < 32 ether) { return (_totalUnderlyingAsset, 0, _blockNumber); } // _unsettleRewards = totalUnderlyingAsset * apr / APR_PERCENT * blockNumber / BLOCK_NUMBER_PER_YEAR return ( _totalUnderlyingAsset, totalUnderlyingAsset * currentApr * (_blockNumber - _rewardsUpdateBlock) / APR_PERCENT / BLOCK_NUMBER_PER_YEAR, _blockNumber ); } /** * @notice increase assets only occurs when the user stake * @param _amount stake amount */ function _increaseAssets(uint256 _amount) internal { (uint256 _totalUnderlyingAsset, uint256 _estimatedRewards, uint256 _blockNumber) = _unsettleAssets(); rewardsUpdateBlock = _blockNumber; if (_estimatedRewards != 0) { totalUnderlyingAsset = _totalUnderlyingAsset + _estimatedRewards + _amount; } else { totalUnderlyingAsset = _totalUnderlyingAsset + _amount; } emit AssetsUpdated(_totalUnderlyingAsset, _estimatedRewards, _blockNumber); } /** * @notice reduce assets only occurs when the user unstake * @param _amount unstake amount */ function _reduceAssets(uint256 _amount) internal { (uint256 _totalUnderlyingAsset, uint256 _estimatedRewards, uint256 _blockNumber) = _unsettleAssets(); rewardsUpdateBlock = _blockNumber; if (_estimatedRewards != 0) { totalUnderlyingAsset = _totalUnderlyingAsset + _estimatedRewards - _amount; } else { totalUnderlyingAsset = _totalUnderlyingAsset - _amount; } emit AssetsUpdated(_totalUnderlyingAsset, _estimatedRewards, _blockNumber); } /** * @notice The rate administrator updates apr. Update totalUnderlyingAsset before apr update. * @param _apr new apr */ function updateApr(uint256 _apr) public onlyRateManager { if (_apr > MAX_APR) { revert Errors.InvalidApr(); } if (block.number < rewardsUpdateBlock + UPDATE_BLOCK_LIMIT) { revert Errors.UpdateTimelocked(); } (uint256 _totalUnderlyingAsset, uint256 _estimatedRewards, uint256 _blockNumber) = _unsettleAssets(); rewardsUpdateBlock = _blockNumber; if (_estimatedRewards != 0) { totalUnderlyingAsset = _totalUnderlyingAsset + _estimatedRewards; } emit AssetsUpdated(_totalUnderlyingAsset, _estimatedRewards, _blockNumber); emit AprUpdated(currentApr, _apr); currentApr = _apr; } /** * @notice update rate manager * @param _rateManager new rate manager */ function _setRateManager(address _rateManager) internal { emit RateManagerChanged(rateManager, _rateManager); rateManager = _rateManager; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; import {Errors} from "src/libraries/Errors.sol"; import "src/interfaces/IDepositContract.sol"; import "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol"; import "src/interfaces/IValidator.sol"; import "src/interfaces/IValidatorRegistry.sol"; /** * @title Validator deposit and pubKey check * @author NodeDAO * @notice Provides public key checking and deposit functions as the base contract. */ abstract contract Validator is Initializable, IValidator { address public validatorManager; IDepositContract public depositContract; IValidatorRegistry public validatorRegistry; modifier onlyValidatorManager() { if (msg.sender != validatorManager) revert Errors.PermissionDenied(); _; } function __Validator_init(address _validatorManager, address _validatorRegistry, address _depositContract) internal onlyInitializing { validatorManager = _validatorManager; depositContract = IDepositContract(_depositContract); if (_validatorRegistry != address(0)) { validatorRegistry = IValidatorRegistry(_validatorRegistry); } } /** * @notice deposit 32 eth to beacon */ function _deposit( bytes memory _pubkey, bytes memory _withdrawalCredential, bytes memory _signature, bytes32 _depositDataRoot ) internal { depositContract.deposit{value: 32 ether}(_pubkey, _withdrawalCredential, _signature, _depositDataRoot); } /** * @notice Register the pubkey with the validator registry contract. * Once the pubkey has been registered, it will be revert. */ function _registerPubkey(bytes[] memory _pubkeys) internal { if (address(validatorRegistry) != address(0)) { for (uint256 i = 0; i < _pubkeys.length; ++i) { validatorRegistry.registerPubkey(_pubkeys[i]); } } } /** * @notice udpate validator manager */ function _setValidatorManager(address _validatorManager) internal { emit ValidatorManagerChanged(validatorManager, _validatorManager); validatorManager = _validatorManager; } /** * @notice udpate validatorRegistry */ function _setValidatorRegistry(address _validatorRegistry) internal { emit ValidatorRegistryChanged(address(validatorRegistry), _validatorRegistry); validatorRegistry = IValidatorRegistry(_validatorRegistry); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; import "openzeppelin-contracts/token/ERC20/IERC20.sol"; interface ILsdETH is IERC20 { function whiteListMint(uint256 _amount, address _account) external; function whiteListBurn(uint256 _amount, address _account) external; event PoolChanged(address _oldPool, address _pool); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; interface IBasePool { function receiveRewards(uint256) external payable; event EthStake(address _staker, uint256 _stakeAmount, uint256 _mintAmount); event EthUnstake(address _sender, uint256 _unstakeAmount, uint256 _ethAmount); event Received(address _sender, uint256 _amount); event UnstakeAllowedUpdated(bool _oldUnstakeAllowed, bool _unstakeAllowed); event StrategyVaultChanged(address _oldStrategyVault, address _strategyVault); event StrategyDeposited(uint256 _amount, uint256 _strategyAmount); event StrategyReturn(uint256 _amount); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.8; 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; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.8; import "./Merkle.sol"; import "src/libraries/eigenLayer/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 { // constants are the number of fields and the heights of the different merkle trees used in merkleizing beacon chain containers uint256 internal constant BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT = 3; uint256 internal constant BEACON_BLOCK_BODY_FIELD_TREE_HEIGHT = 4; uint256 internal constant BEACON_STATE_FIELD_TREE_HEIGHT = 5; uint256 internal constant VALIDATOR_FIELD_TREE_HEIGHT = 3; //Note: changed in the deneb hard fork from 4->5 uint256 internal constant EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_DENEB = 5; uint256 internal constant EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_CAPELLA = 4; // SLOTS_PER_HISTORICAL_ROOT = 2**13, so tree height is 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; // 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 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 VALIDATOR_TREE_ROOT_INDEX = 11; 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_WITHDRAWABLE_EPOCH_INDEX = 7; // in execution payload header uint256 internal constant TIMESTAMP_INDEX = 9; //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; //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 = Merkle.merkleizeSha256(validatorFields); // verify the proof of the validatorRoot against the beaconStateRoot require( Merkle.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( Merkle.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, uint64 denebForkTimestamp ) 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" ); //Note: post deneb hard fork, the number of exection payload header fields increased from 15->17, adding an extra level to the tree height uint256 executionPayloadHeaderFieldTreeHeight = (getWithdrawalTimestamp(withdrawalProof) < denebForkTimestamp) ? EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_CAPELLA : EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_DENEB; require( withdrawalProof.withdrawalProof.length == 32 * (executionPayloadHeaderFieldTreeHeight + 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 * (executionPayloadHeaderFieldTreeHeight), "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( Merkle.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( Merkle.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( Merkle.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( Merkle.verifyInclusionSha256({ proof: withdrawalProof.timestampProof, root: withdrawalProof.executionPayloadRoot, leaf: withdrawalProof.timestampRoot, index: TIMESTAMP_INDEX }), "BeaconChainProofs.verifyWithdrawal: Invalid timestamp merkle proof" ); { /** * Next we verify the withdrawal fields against the executionPayloadRoot: * First we compute the withdrawal_index, then we merkleize the * withdrawalFields container to calculate the withdrawalRoot. * * Note: Merkleization of the withdrawals root tree uses MerkleizeWithMixin, 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 = Merkle.merkleizeSha256(withdrawalFields); require( Merkle.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]); } }
// 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); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.8; /** * @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); }
// 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; }
// 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; }
// 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; }
// 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; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; interface IVersion { function typeId() external pure returns (bytes32); function version() external pure returns (uint8); function implementation() external view returns (address); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; interface IDao { event DaoChanged(address _oldDao, address _dao); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; interface IWithdrawalRequest { event WithdrawalDelayChanged(uint256 _oldWithdrawalDelayBlocks, uint256 _withdrawalDelayBlocks); event WithdrawalsRequest(address _receiver, uint256 _withdrawalAmount, uint256 _blockNumber); event WithdrawalsClaimed(address _receiver, uint256 _requestId, uint256 _claimAmount); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; interface IRate { event AssetsUpdated(uint256 _totalUnderlyingAsset, uint256 _estimatedRewards, uint256 _blockNumber); event AprUpdated(uint256 _oldApr, uint256 _apr); event RateManagerChanged(address _oldAprManager, address _aprManager); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; interface IDepositContract { /// @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); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; interface IValidator { event ValidatorManagerChanged(address _oldValidatorManager, address _validatorManager); event ValidatorRegistryChanged(address _oldValidatorManager, address _validatorManager); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.8; interface IValidatorRegistry { function registerPubkey(bytes memory _pubkey) external; event PubkeyRegistered(bytes[] _pubkeys, address _poolAddr); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.8; /** * @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; } }
// SPDX-License-Identifier: BUSL-1.1 // Adapted from OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol) pragma solidity 0.8.8; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ library Merkle { /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. The tree is built assuming `leaf` is * the 0 indexed `index`'th leaf from the bottom left of the tree. * * Note this is for a Merkle tree using the keccak/sha3 hash function */ function verifyInclusionKeccak(bytes memory proof, bytes32 root, bytes32 leaf, uint256 index) internal pure returns (bool) { return processInclusionProofKeccak(proof, leaf, index) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. The tree is built assuming `leaf` is * the 0 indexed `index`'th leaf from the bottom left of the tree. * * _Available since v4.4._ * * Note this is for a Merkle tree using the keccak/sha3 hash function */ function processInclusionProofKeccak(bytes memory proof, bytes32 leaf, uint256 index) internal pure returns (bytes32) { require( proof.length != 0 && proof.length % 32 == 0, "Merkle.processInclusionProofKeccak: proof length should be a non-zero multiple of 32" ); bytes32 computedHash = leaf; for (uint256 i = 32; i <= proof.length; i += 32) { if (index % 2 == 0) { // if ith bit of index is 0, then computedHash is a left sibling assembly { mstore(0x00, computedHash) mstore(0x20, mload(add(proof, i))) computedHash := keccak256(0x00, 0x40) index := div(index, 2) } } else { // if ith bit of index is 1, then computedHash is a right sibling assembly { mstore(0x00, mload(add(proof, i))) mstore(0x20, computedHash) computedHash := keccak256(0x00, 0x40) index := div(index, 2) } } } return computedHash; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. The tree is built assuming `leaf` is * the 0 indexed `index`'th leaf from the bottom left of the tree. * * Note this is for a Merkle tree using the sha256 hash function */ function verifyInclusionSha256(bytes memory proof, bytes32 root, bytes32 leaf, uint256 index) internal view returns (bool) { return processInclusionProofSha256(proof, leaf, index) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. The tree is built assuming `leaf` is * the 0 indexed `index`'th leaf from the bottom left of the tree. * * _Available since v4.4._ * * Note this is for a Merkle tree using the sha256 hash function */ function processInclusionProofSha256(bytes memory proof, bytes32 leaf, uint256 index) internal view returns (bytes32) { require( proof.length != 0 && proof.length % 32 == 0, "Merkle.processInclusionProofSha256: proof length should be a non-zero multiple of 32" ); bytes32[1] memory computedHash = [leaf]; for (uint256 i = 32; i <= proof.length; i += 32) { if (index % 2 == 0) { // if ith bit of index is 0, then computedHash is a left sibling assembly { mstore(0x00, mload(computedHash)) mstore(0x20, mload(add(proof, i))) if iszero(staticcall(sub(gas(), 2000), 2, 0x00, 0x40, computedHash, 0x20)) { revert(0, 0) } index := div(index, 2) } } else { // if ith bit of index is 1, then computedHash is a right sibling assembly { mstore(0x00, mload(add(proof, i))) mstore(0x20, mload(computedHash)) if iszero(staticcall(sub(gas(), 2000), 2, 0x00, 0x40, computedHash, 0x20)) { revert(0, 0) } index := div(index, 2) } } } return computedHash[0]; } /** * @notice this function returns the merkle root of a tree created from a set of leaves using sha256 as its hash function * @param leaves the leaves of the merkle tree * @return The computed Merkle root of the tree. * @dev A pre-condition to this function is that leaves.length is a power of two. If not, the function will merkleize the inputs incorrectly. */ function merkleizeSha256(bytes32[] memory leaves) internal pure returns (bytes32) { //there are half as many nodes in the layer above the leaves uint256 numNodesInLayer = leaves.length / 2; //create a layer to store the internal nodes bytes32[] memory layer = new bytes32[](numNodesInLayer); //fill the layer with the pairwise hashes of the leaves for (uint256 i = 0; i < numNodesInLayer; i++) { layer[i] = sha256(abi.encodePacked(leaves[2 * i], leaves[2 * i + 1])); } //the next layer above has half as many nodes numNodesInLayer /= 2; //while we haven't computed the root while (numNodesInLayer != 0) { //overwrite the first numNodesInLayer nodes in layer with the pairwise hashes of their children for (uint256 i = 0; i < numNodesInLayer; i++) { layer[i] = sha256(abi.encodePacked(layer[2 * i], layer[2 * i + 1])); } //the next layer above has half as many nodes numNodesInLayer /= 2; } //the first node in the layer is the root return layer[0]; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.8; 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); } }
// 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; }
// 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); }
// 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; }
// 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); }
// 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 } } }
{ "remappings": [ "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CanUnstakeETH","type":"error"},{"inputs":[],"name":"DelayTooLarge","type":"error"},{"inputs":[],"name":"DepositRootMismatch","type":"error"},{"inputs":[],"name":"EigenPodMismatch","type":"error"},{"inputs":[],"name":"InsufficientFunds","type":"error"},{"inputs":[],"name":"InvalidAddr","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidApr","type":"error"},{"inputs":[],"name":"InvalidLength","type":"error"},{"inputs":[],"name":"InvalidParameter","type":"error"},{"inputs":[],"name":"InvalidRequestId","type":"error"},{"inputs":[],"name":"InvalidVersion","type":"error"},{"inputs":[],"name":"InvalidtypeId","type":"error"},{"inputs":[],"name":"PermissionDenied","type":"error"},{"inputs":[],"name":"RestakingPodNotFound","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"UnstakeNotEnabled","type":"error"},{"inputs":[],"name":"UpdateTimelocked","type":"error"},{"inputs":[],"name":"WithrawalsRequestCannotClaimed","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":false,"internalType":"uint256","name":"_oldApr","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_apr","type":"uint256"}],"name":"AprUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_totalUnderlyingAsset","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_estimatedRewards","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_blockNumber","type":"uint256"}],"name":"AssetsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_oldDao","type":"address"},{"indexed":false,"internalType":"address","name":"_dao","type":"address"}],"name":"DaoChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"_stakeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_mintAmount","type":"uint256"}],"name":"EthStake","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_unstakeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_ethAmount","type":"uint256"}],"name":"EthUnstake","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_oldAprManager","type":"address"},{"indexed":false,"internalType":"address","name":"_aprManager","type":"address"}],"name":"RateManagerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Received","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_restakingPod","type":"address"}],"name":"RestakingPodAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_strategyAmount","type":"uint256"}],"name":"StrategyDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"StrategyReturn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_oldStrategyVault","type":"address"},{"indexed":false,"internalType":"address","name":"_strategyVault","type":"address"}],"name":"StrategyVaultChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_oldUnstakeAllowed","type":"bool"},{"indexed":false,"internalType":"bool","name":"_unstakeAllowed","type":"bool"}],"name":"UnstakeAllowedUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_oldValidatorManager","type":"address"},{"indexed":false,"internalType":"address","name":"_validatorManager","type":"address"}],"name":"ValidatorManagerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes[]","name":"_pubkeys","type":"bytes[]"}],"name":"ValidatorRegistration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_oldValidatorManager","type":"address"},{"indexed":false,"internalType":"address","name":"_validatorManager","type":"address"}],"name":"ValidatorRegistryChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_oldWithdrawalDelayBlocks","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_withdrawalDelayBlocks","type":"uint256"}],"name":"WithdrawalDelayChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"_requestId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_claimAmount","type":"uint256"}],"name":"WithdrawalsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"_withdrawalAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_blockNumber","type":"uint256"}],"name":"WithdrawalsRequest","type":"event"},{"inputs":[],"name":"APR_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BLOCK_NUMBER_PER_YEAR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_APR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_WITHDRAWAL_DELAY_BLOCKS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPDATE_BLOCK_LIMIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ownerAddr","type":"address"},{"internalType":"uint256","name":"_withdrawalDelayBlocks","type":"uint256"},{"internalType":"uint256","name":"_apr","type":"uint256"},{"internalType":"uint256","name":"_totalUnderlyingAsset","type":"uint256"},{"internalType":"address","name":"_dao","type":"address"},{"internalType":"address","name":"_poolToken","type":"address"},{"internalType":"address","name":"_rateManager","type":"address"},{"internalType":"address","name":"_validatorManager","type":"address"},{"internalType":"address","name":"_depositContract","type":"address"},{"internalType":"bool","name":"_unstakeAllowed","type":"bool"}],"name":"__BasePool_init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_restakingPod","type":"address"}],"name":"addRestakingPod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_requestId","type":"uint256"}],"name":"canClaimWithdrawal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimDelayedWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256[]","name":"_requestIds","type":"uint256[]"}],"name":"claimWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_unstakeAmount","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakeAmount","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentApr","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dao","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositContract","outputs":[{"internalType":"contract IDepositContract","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eigenLayerEigenPodManager","outputs":[{"internalType":"contract IEigenPodManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"elRewardsAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exchangeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCLVaultAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPoolAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRestakingPods","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"getUserWithdrawals","outputs":[{"components":[{"internalType":"uint96","name":"withdrawalHeight","type":"uint96"},{"internalType":"uint96","name":"withdrawalExchange","type":"uint96"},{"internalType":"uint64","name":"isClaim","type":"uint64"},{"internalType":"uint128","name":"withdrawalAmount","type":"uint128"},{"internalType":"uint128","name":"claimAmount","type":"uint128"}],"internalType":"struct WithdrawalRequest.WithdrawalInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ownerAddr","type":"address"},{"internalType":"uint256","name":"_apr","type":"uint256"},{"internalType":"address","name":"_dao","type":"address"},{"internalType":"address","name":"_elRewardsAddress","type":"address"},{"internalType":"address","name":"_poolToken","type":"address"},{"internalType":"address","name":"_rateManager","type":"address"},{"internalType":"address","name":"_validatorManager","type":"address"},{"internalType":"address","name":"_depositContract","type":"address"},{"internalType":"address","name":"_eigenLayerEigenPodManager","type":"address"},{"internalType":"address[]","name":"_restakingPods","type":"address[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolToken","outputs":[{"internalType":"contract ILsdETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rateManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"receiveRewards","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_depositContractRoot","type":"bytes32"},{"internalType":"address","name":"_restakingPod","type":"address"},{"internalType":"bytes[]","name":"_pubkeys","type":"bytes[]"},{"internalType":"bytes[]","name":"_signatures","type":"bytes[]"},{"internalType":"bytes32[]","name":"_depositDataRoots","type":"bytes32[]"}],"name":"registerValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_unstakeAmount","type":"uint256"}],"name":"requestWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardsUpdateBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_dao","type":"address"}],"name":"setDao","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rateManager","type":"address"}],"name":"setRateManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategyVault","type":"address"}],"name":"setStrategyVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_unstakeAllowed","type":"bool"}],"name":"setUnstakeAllowed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_validatorManager","type":"address"}],"name":"setValidatorManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_validatorRegistry","type":"address"}],"name":"setValidatorRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_withdrawalDelayBlocks","type":"uint256"}],"name":"setWithdrawalDelayBlocks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"strategyAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"strategyDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategyReturn","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"strategyVault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUnderlyingAsset","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalWithdrawalAmount","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":"typeId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unstakeAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_unstakeAmount","type":"uint256"}],"name":"unstakeETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_apr","type":"uint256"}],"name":"updateApr","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":[],"name":"validatorManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"validatorRegistry","outputs":[{"internalType":"contract IValidatorRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"withdrawCredentials","outputs":[{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawalDelayBlocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a06040523060601b6080523480156200001857600080fd5b506200002362000029565b620000eb565b600054610100900460ff1615620000965760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e9576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b60805160601c6147b962000126600039600081816110150152818161105e015281816112da0152818161131a015261139201526147b96000f3fe6080604052600436106103bc5760003560e01c80638456cb59116101f2578063d77868da1161010d578063e94ad65b116100a0578063f2fde38b1161006f578063f2fde38b14610adf578063f376ebbb14610aff578063f60b6fe614610b20578063fe55bde914610b3557600080fd5b8063e94ad65b14610a65578063ebeac51514610a86578063ee018b6d14610aa6578063ef213ddc14610ac857600080fd5b8063e0b05b61116100dc578063e0b05b61146109e1578063e23e0e0814610a01578063e502eb6814610a18578063e606768a14610a4557600080fd5b8063d77868da1461098f578063dce590d5146109a2578063dceb986d146109c2578063ddfa63ae146109ca57600080fd5b806399ca63bb11610185578063c49db0cd11610154578063c49db0cd14610917578063c6e6f59214610937578063ca661c0414610957578063cbdf382c1461096e57600080fd5b806399ca63bb146108a9578063b62be945146108bf578063b7e34b0c146108e1578063bba59090146108f757600080fd5b80638da5cb5b116101c15780638da5cb5b146108215780638dd7f2931461083f5780638f940f6314610856578063983e87bc1461088957600080fd5b80638456cb59146107bf5780638552bf90146107d457806386d8f78d146107f457806388f36cdd1461080a57600080fd5b80634f1ef286116102e257806361e9ecf311610275578063715018a611610244578063715018a61461074957806371c3cd881461075e57806373c62d5d1461077f578063788658531461079f57600080fd5b806361e9ecf3146106c757806362d53403146106e95780636637b882146107095780637139053e1461072957600080fd5b806354fd4d50116102b157806354fd4d501461066a578063553ffcbe146106865780635c60da1b1461068e5780635c975abb146106a357600080fd5b80634f1ef286146106145780634f322ae81461062757806350f73e7c1461063e57806352d1902d1461065557600080fd5b80633ba0b9a91161035a57806345f34e921161032957806345f34e921461059f57806349773050146105bf5780634ab4ba42146105df5780634d50f9a4146105f457600080fd5b80633ba0b9a9146105335780633f4ba83a14610548578063400990981461055d5780634162169f1461057e57600080fd5b806328837c071161039657806328837c07146104bb5780632963a287146104d25780632ffb004f146104f25780633659cfe61461051357600080fd5b806301e1d1141461043a57806307a2d13a14610462578063215bd1b11461048257600080fd5b36610435576102655433906001600160a01b03168114806103e157506103e181610b56565b1561042a57604080516001600160a01b03831681523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874910160405180910390a150005b610432610bbc565b50005b600080fd5b34801561044657600080fd5b5061044f610d43565b6040519081526020015b60405180910390f35b34801561046e57600080fd5b5061044f61047d366004613bc3565b610d74565b34801561048e57600080fd5b50610265546104a3906001600160a01b031681565b6040516001600160a01b039091168152602001610459565b3480156104c757600080fd5b506104d0610e0c565b005b3480156104de57600080fd5b506104d06104ed366004613bc3565b610e9e565b3480156104fe57600080fd5b50610266546104a3906001600160a01b031681565b34801561051f57600080fd5b506104d061052e366004613c01565b61100a565b34801561053f57600080fd5b5061044f6110dc565b34801561055457600080fd5b506104d0611172565b34801561056957600080fd5b50610233546104a3906001600160a01b031681565b34801561058a57600080fd5b506101ff546104a3906001600160a01b031681565b3480156105ab57600080fd5b506104d06105ba366004613c01565b6111a8565b3480156105cb57600080fd5b506104d06105da366004613c01565b6111dd565b3480156105eb57600080fd5b5061044f611212565b34801561060057600080fd5b506104d061060f366004613bc3565b61129a565b6104d0610622366004613ce1565b6112cf565b34801561063357600080fd5b5061044f6101615481565b34801561064a57600080fd5b5061044f6101ca5481565b34801561066157600080fd5b5061044f611385565b34801561067657600080fd5b5060405160028152602001610459565b6104d0611438565b34801561069a57600080fd5b506104a361148c565b3480156106af57600080fd5b5060c95460ff165b6040519015158152602001610459565b3480156106d357600080fd5b506106dc611496565b6040516104599190613d30565b3480156106f557600080fd5b506104d0610704366004613bc3565b6114f9565b34801561071557600080fd5b506104d0610724366004613c01565b6116ca565b34801561073557600080fd5b506104d0610744366004613da0565b6116db565b34801561075557600080fd5b506104d061180e565b34801561076a57600080fd5b5061015f546104a3906001600160a01b031681565b34801561078b57600080fd5b506104d061079a366004613e55565b611820565b3480156107ab57600080fd5b506106b76107ba366004613f06565b6118c0565b3480156107cb57600080fd5b506104d06119f2565b3480156107e057600080fd5b506104d06107ef366004613bc3565b611a26565b34801561080057600080fd5b5061044f6107d081565b34801561081657600080fd5b5061044f6101625481565b34801561082d57600080fd5b506097546001600160a01b03166104a3565b34801561084b57600080fd5b5061044f6102345481565b34801561086257600080fd5b507f317cfd4f6bf59aad6e1d4b8247c96368ead3464397a31a65d0dd7d95f2fafca561044f565b34801561089557600080fd5b506104d06108a4366004613fa1565b611b5c565b3480156108b557600080fd5b5061044f61271081565b3480156108cb57600080fd5b506108d4611d4b565b60405161045991906140d0565b3480156108ed57600080fd5b5061044f611c2081565b34801561090357600080fd5b506104d0610912366004614132565b611e70565b34801561092357600080fd5b506104d0610932366004613c01565b611f05565b34801561094357600080fd5b5061044f610952366004613bc3565b611f3a565b34801561096357600080fd5b5061044f6201194081565b34801561097a57600080fd5b50610232546104a3906001600160a01b031681565b6104d061099d366004613bc3565b611f8f565b3480156109ae57600080fd5b506104d06109bd366004613bc3565b611fc4565b6104d0612103565b3480156109d657600080fd5b5061044f6101605481565b3480156109ed57600080fd5b506104d06109fc366004614198565b61210b565b348015610a0d57600080fd5b5061044f6101cc5481565b348015610a2457600080fd5b50610a38610a33366004613c01565b6123ed565b604051610459919061424d565b348015610a5157600080fd5b506104d0610a60366004613c01565b6124b8565b348015610a7157600080fd5b50610196546104a3906001600160a01b031681565b348015610a9257600080fd5b506104d0610aa1366004613c01565b612576565b348015610ab257600080fd5b50610232546106b790600160a01b900460ff1681565b348015610ad457600080fd5b5061044f62278d0081565b348015610aeb57600080fd5b506104d0610afa366004613c01565b61262a565b348015610b0b57600080fd5b50610197546104a3906001600160a01b031681565b348015610b2c57600080fd5b5061044f6126a0565b348015610b4157600080fd5b50610195546104a3906001600160a01b031681565b610267546000908190815b81811015610bb357846001600160a01b03166102678281548110610b8757610b876142df565b6000918252602090912001546001600160a01b03161415610bab5760019250610bb3565b600101610b61565b50909392505050565b610bc4612758565b3433662386f26fc10000821015610bee5760405163162908e360e11b815260040160405180910390fd5b6000610c808361023260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c4357600080fd5b505afa158015610c57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7b91906142f5565b61279e565b9050610c8b836127e1565b610232546040516319157fab60e21b8152600481018390526001600160a01b03848116602483015290911690636455feac90604401600060405180830381600087803b158015610cda57600080fd5b505af1158015610cee573d6000803e3d6000fd5b5050604080516001600160a01b0386168152602081018790529081018490527f838d17987e57e587c458220b9b38723c41fbc3f397550b506712960a73ef19f9925060600190505b60405180910390a1505050565b6000806000610d50612875565b509150915080600014610d6e57610d678183614324565b9250505090565b50919050565b6000610e068261023260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610dc957600080fd5b505afa158015610ddd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0191906142f5565b6128f3565b92915050565b6102675460005b81811015610e9a576102678181548110610e2f57610e2f6142df565b6000918252602082200154604080516328837c0760e01b815290516001600160a01b03909216926328837c079260048084019382900301818387803b158015610e7757600080fd5b505af1158015610e8b573d6000803e3d6000fd5b50505050806001019050610e13565b5050565b610ea6612758565b61023254600160a01b900460ff16610ed15760405163e1a54e4b60e01b815260040160405180910390fd5b61023254604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b158015610f1757600080fd5b505afa158015610f2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4f91906142f5565b90506000610f5d83836128f3565b9050804710610f7f5760405163e6225c4f60e01b815260040160405180910390fd5b33610f8982612919565b61023254604051638e433bc760e01b8152600481018690526001600160a01b03838116602483015290911690638e433bc790604401600060405180830381600087803b158015610fd857600080fd5b505af1158015610fec573d6000803e3d6000fd5b505050506110048185610ffe86612958565b8561296c565b50505050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561105c5760405162461bcd60e51b81526004016110539061433c565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661108e612aa9565b6001600160a01b0316146110b45760405162461bcd60e51b815260040161105390614388565b6110bd81612ac5565b604080516000808252602082019092526110d991839190612c1e565b50565b600061116d61023260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561113057600080fd5b505afa158015611144573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116891906142f5565b612958565b905090565b6101ff546001600160a01b0316331461119e57604051630782484160e21b815260040160405180910390fd5b6111a6612d9d565b565b6101ff546001600160a01b031633146111d457604051630782484160e21b815260040160405180910390fd5b6110d981612def565b6101ff546001600160a01b0316331461120957604051630782484160e21b815260040160405180910390fd5b6110d981612e5a565b610265546040805163479eb1ed60e11b815290516000926001600160a01b031691638f3d63da916004808301926020929190829003018186803b15801561125857600080fd5b505afa15801561126c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129091906142f5565b61116d9047614324565b6101ff546001600160a01b031633146112c657604051630782484160e21b815260040160405180910390fd5b6110d981612ec5565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156113185760405162461bcd60e51b81526004016110539061433c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661134a612aa9565b6001600160a01b0316146113705760405162461bcd60e51b815260040161105390614388565b61137982612ac5565b610e9a82826001612c1e565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146114255760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611053565b5060008051602061473d83398151915290565b600034905080610234600082825461145091906143d4565b90915550506040518181527f4fb0171001dc0ba5f8ca0996eb5a413cf67c611e3d6d1d6ae9ea1df128383410906020015b60405180910390a150565b600061116d612aa9565b60606102678054806020026020016040519081016040528092919081815260200182805480156114ef57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116114d1575b5050505050905090565b611501612f2b565b611509612758565b61023254600160a01b900460ff166115345760405163e1a54e4b60e01b815260040160405180910390fd5b61023254604080516318160ddd60e01b8152905133926000926115829286926001600160a01b0316916318160ddd916004808301926020929190829003018186803b158015610dc957600080fd5b905061158f816001612f85565b61159881612919565b61023254604051638e433bc760e01b8152600481018590526001600160a01b03848116602483015290911690638e433bc790604401600060405180830381600087803b1580156115e757600080fd5b505af11580156115fb573d6000803e3d6000fd5b505050506000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461164c576040519150601f19603f3d011682016040523d82523d6000602084013e611651565b606091505b5050905080611673576040516312171d8360e31b815260040160405180910390fd5b604080516001600160a01b0385168152602081018690529081018390527fdef4a00a06705bb4b80fd0c912337f4f4e01fb81d39a572514be68d328599abf9060600160405180910390a15050506110d9600160fb55565b6116d2613022565b6110d98161307c565b6116e3612f2b565b6116eb612758565b6000805b825181101561178257600083828151811061170c5761170c6142df565b6020026020010151905061172085826118c0565b61173d5760405163d23d1c8560e01b815260040160405180910390fd5b600061174986836130e7565b905061175586836131b5565b608081015161176d906001600160801b031685614324565b935050508061177b906143eb565b90506116ef565b5061178e816000612f85565b6000836001600160a01b03168260405160006040518083038185875af1925050503d80600081146117db576040519150601f19603f3d011682016040523d82523d6000602084013e6117e0565b606091505b5050905080611802576040516312171d8360e31b815260040160405180910390fd5b5050610e9a600160fb55565b611816613022565b6111a66000613431565b600054610100900460ff166118475760405162461bcd60e51b815260040161105390614406565b6118508a613483565b611859866134c3565b61186488858961350d565b6118708360008461358c565b6118798961360d565b61023280546001600160a01b0319166001600160a01b03871617905580156118b457610232805460ff60a01b1916600160a01b831515021790555b50505050505050505050565b6001600160a01b03821660009081526101cb6020908152604080832080548251818502810185019093528083528493849084015b8282101561197b5760008481526020908190206040805160a0810182526002860290920180546001600160601b038082168552600160601b82041684860152600160c01b90046001600160401b0316918301919091526001908101546001600160801b038082166060850152600160801b90910416608083015290835290920191016118f4565b505050509050805183106119a25760405163251f56a160e21b815260040160405180910390fd5b6101ca548184815181106119b8576119b86142df565b6020026020010151600001516001600160601b03166119d79190614324565b4310156119e8576000915050610e06565b5060019392505050565b6101ff546001600160a01b03163314611a1e57604051630782484160e21b815260040160405180910390fd5b6111a661363a565b61015f546001600160a01b03163314611a5257604051630782484160e21b815260040160405180910390fd5b6107d0811115611a7557604051633b61151160e11b815260040160405180910390fd5b611c2061016254611a869190614324565b431015611aa65760405163928cdae760e01b815260040160405180910390fd5b6000806000611ab3612875565b610162819055919450925090508115611ad557611ad08284614324565b610160555b60408051848152602081018490529081018290527f35a901c4413e585f9121eb5cf07e67760bd4ac498dd031249e5cd2cd225f74e49060600160405180910390a16101615460408051918252602082018690527f782f84f1274a11befd10700001e41dfdbf825313fb93311d474b857dfd8f1c2b910160405180910390a150505061016155565b600054610100900460ff1615808015611b7c5750600054600160ff909116105b80611b965750303b158015611b96575060005460ff166001145b611bf95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611053565b6000805460ff191660011790558015611c1c576000805461ff0019166101001790555b611c318b60008c60008d8c8c8c8c6000611820565b61026580546001600160a01b03808b166001600160a01b03199283161790925561026680549286169290911691909117905560005b8251811015611cf7576000838281518110611c8357611c836142df565b60200260200101519050611c9681613677565b61026780546001810182556000919091527fa97f1b0857e7df4c88b70fad2137419113682f4bd033bba6a5fb2773e2deab450180546001600160a01b0319166001600160a01b0392909216919091179055611cf0816143eb565b9050611c66565b508015611d3e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050505050565b610267546060906000816001600160401b03811115611d6c57611d6c613c1e565b604051908082528060200260200182016040528015611d9f57816020015b6060815260200190600190039081611d8a5790505b50905060005b82811015611e69576102678181548110611dc157611dc16142df565b60009182526020822001546040805163b62be94560e01b815290516001600160a01b039092169263b62be94592600480840193829003018186803b158015611e0857600080fd5b505afa158015611e1c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e449190810190614451565b828281518110611e5657611e566142df565b6020908102919091010152600101611da5565b5092915050565b6101ff546001600160a01b03163314611e9c57604051630782484160e21b815260040160405180910390fd5b6102325460408051600160a01b90920460ff161515825282151560208301527ff0700b7cce37d0ddc289445e07408f3709033f9785391e5e05b908cb9705748b910160405180910390a16102328054911515600160a01b0260ff60a01b19909216919091179055565b6101ff546001600160a01b03163314611f3157604051630782484160e21b815260040160405180910390fd5b6110d981613798565b6000610e068261023260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c4357600080fd5b604080513381523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f885258749101611481565b6101ff546001600160a01b03163314611ff057604051630782484160e21b815260040160405180910390fd5b611ff8612f2b565b610233546001600160a01b03166120225760405163e481c26960e01b815260040160405180910390fd5b61202d816001612f85565b8061023460008282546120409190614324565b9091555050610233546040516000916001600160a01b03169083908381818185875af1925050503d8060008114612093576040519150601f19603f3d011682016040523d82523d6000602084013e612098565b606091505b50509050806120ba576040516312171d8360e31b815260040160405180910390fd5b610234546040805184815260208101929092527ff58adcbb0e084c416406ed1246914693d1bebcc911fa80eb933774c868034361910160405180910390a1506110d9600160fb55565b6111a6610bbc565b610195546001600160a01b0316331461213757604051630782484160e21b815260040160405180910390fd5b61214087610b56565b61215d57604051634ae1ac7560e11b815260040160405180910390fd5b61019660009054906101000a90046001600160a01b03166001600160a01b031663c5f2892f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156121ac57600080fd5b505afa1580156121c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121e491906142f5565b881461220357604051631475764f60e11b815260040160405180910390fd5b846000612219826801bc16d674ec8000006144be565b9050612226816001612f85565b81851415806122355750818314155b1561225357604051630309cb8760e51b815260040160405180910390fd5b612265612260888a6144dd565b613803565b60005b8281101561234d57896001600160a01b0316639b4e46346801bc16d674ec8000008b8b8581811061229b5761229b6142df565b90506020028101906122ad9190614550565b8b8b878181106122bf576122bf6142df565b90506020028101906122d19190614550565b8b8b898181106122e3576122e36142df565b905060200201356040518763ffffffff1660e01b815260040161230a9594939291906145bf565b6000604051808303818588803b15801561232357600080fd5b505af1158015612337573d6000803e3d6000fd5b505050505080612346906143eb565b9050612268565b50604051631fa23e8560e01b8152600481018290526001600160a01b038a1690631fa23e8590602401600060405180830381600087803b15801561239057600080fd5b505af11580156123a4573d6000803e3d6000fd5b505050507fe585eadb0042252d35431ecfed1027caf5672811fdf1db08cb49e32fee17050588886040516123d99291906145f9565b60405180910390a150505050505050505050565b6001600160a01b03811660009081526101cb60209081526040808320805482518185028101850190935280835260609492939192909184015b828210156124ad5760008481526020908190206040805160a0810182526002860290920180546001600160601b038082168552600160601b82041684860152600160c01b90046001600160401b0316918301919091526001908101546001600160801b038082166060850152600160801b9091041660808301529083529092019101612426565b505050509050919050565b6101ff546001600160a01b031633146124e457604051630782484160e21b815260040160405180910390fd5b6001600160a01b03811661250b5760405163e481c26960e01b815260040160405180910390fd5b61023354604080516001600160a01b03928316815291831660208301527f4ec60652ba5660c71f5d158ba76777060e4df45955126c42ffe26c0c447a781e910160405180910390a161023380546001600160a01b0319166001600160a01b0392909216919091179055565b6101ff546001600160a01b031633146125a257604051630782484160e21b815260040160405180910390fd5b6125ab81613677565b61026780546001810182556000919091527fa97f1b0857e7df4c88b70fad2137419113682f4bd033bba6a5fb2773e2deab450180546001600160a01b0319166001600160a01b0383169081179091556040519081527f84cf405f0a1827114df681d11bd5006d56d6414d63c57e4cf6569fabd9a8e7ff90602001611481565b612632613022565b6001600160a01b0381166126975760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611053565b6110d981613431565b600080805b61026754811015610d6e5761026781815481106126c4576126c46142df565b60009182526020918290200154604080516289491360e11b815290516001600160a01b0390921692630112922692600480840193829003018186803b15801561270c57600080fd5b505afa158015612720573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061274491906142f5565b61274e9083614324565b91506001016126a5565b60c95460ff16156111a65760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401611053565b6000806127a9610d43565b90508215806127b6575080155b156127c45783915050610e06565b806127cf84866144be565b6127d99190614686565b949350505050565b60008060006127ee612875565b61016281905591945092509050811561281f578361280c8385614324565b6128169190614324565b6101605561282e565b6128298484614324565b610160555b60408051848152602081018490529081018290527f35a901c4413e585f9121eb5cf07e67760bd4ac498dd031249e5cd2cd225f74e49060600160405180910390a150505050565b610160546101625460009043908082148061289857506801bc16d674ec80000084105b156128a7575091926000929150565b8362278d006127106128b984866143d4565b61016154610160546128cb91906144be565b6128d591906144be565b6128df9190614686565b6128e99190614686565b9350935050909192565b6000806128fe610d43565b90508261290e5783915050610e06565b826127cf82866144be565b6000806000612926612875565b61016281905591945092509050811561294e57836129448385614324565b61281691906143d4565b61282984846143d4565b6000610e06670de0b6b3a7640000836128f3565b6001600160a01b03841660009081526101cb60209081526040808320815160a0810183526001600160601b034381811683528882168387019081529483018781526001600160801b03808c16606086019081528a821660808701908152875460018181018a55988c52998b2096516002909a029096018054985193516001600160401b0316600160c01b026001600160c01b03948716600160601b026001600160c01b0319909a169a909616999099179790971791909116929092178655935191518116600160801b029116179201919091556101cc805491928492612a53908490614324565b9091555050604080516001600160a01b0387168152602081018690529081018290527f74ffedfd7821cf30dd556fac01944f4d077a2099ae55773bb89444cce29755f49060600160405180910390a15050505050565b60008051602061473d833981519152546001600160a01b031690565b612acd613022565b7f317cfd4f6bf59aad6e1d4b8247c96368ead3464397a31a65d0dd7d95f2fafca5816001600160a01b0316638f940f636040518163ffffffff1660e01b815260040160206040518083038186803b158015612b2757600080fd5b505afa158015612b3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5f91906142f5565b14612b7d57604051630ce2ef5f60e11b815260040160405180910390fd5b612b89600260016146a8565b60ff16816001600160a01b03166354fd4d506040518163ffffffff1660e01b815260040160206040518083038186803b158015612bc557600080fd5b505afa158015612bd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bfd91906146cd565b60ff16146110d95760405163a9146eeb60e01b815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612c5657612c51836138b2565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015612c8f57600080fd5b505afa925050508015612cbf575060408051601f3d908101601f19168201909252612cbc918101906142f5565b60015b612d225760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611053565b60008051602061473d8339815191528114612d915760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611053565b50612c5183838361394e565b612da5613973565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61019554604080516001600160a01b03928316815291831660208301527ffcf16285f1e14b0b8a544860d3664317dd81073a42e811e33afe75a22886443e910160405180910390a161019580546001600160a01b0319166001600160a01b0392909216919091179055565b61019754604080516001600160a01b03928316815291831660208301527f5f98eb9c39a016a522ab1ca3601f349c89b557a9b6471ce04afa8770d5589062910160405180910390a161019780546001600160a01b0319166001600160a01b0392909216919091179055565b62011940811115612ee85760405162de26ef60e51b815260040160405180910390fd5b6101ca5460408051918252602082018390527fab3f1d5eaee409b7067167f77f1fa3f8a863366d6fb2b88559cd4f9b8e03e182910160405180910390a16101ca55565b600260fb541415612f7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611053565b600260fb55565b4780831115612c515761026560009054906101000a90046001600160a01b03166001600160a01b031663b5e86bea6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612fdf57600080fd5b505af1158015612ff3573d6000803e3d6000fd5b50505050612fff610e0c565b504780831115612c515760405163356680b760e01b815260040160405180910390fd5b6097546001600160a01b031633146111a65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611053565b6101ff54604080516001600160a01b03928316815291831660208301527ffcde6c827a52b0870bc44ed9b10212272e18c9ea1725b772e9b493750afd8da4910160405180910390a16101ff80546001600160a01b0319166001600160a01b0392909216919091179055565b6040805160a0810182526000808252602080830182905282840182905260608301829052608083018290526001600160a01b03861682526101cb905291909120805483908110613139576131396142df565b60009182526020918290206040805160a08101825260029390930290910180546001600160601b038082168552600160601b82041694840194909452600160c01b9093046001600160401b0316908201526001909101546001600160801b038082166060840152600160801b9091041660808201529392505050565b6001600160a01b03821660009081526101cb602052604081208054839081106131e0576131e06142df565b60009182526020918290206040805160a08101825260029390930290910180546001600160601b038082168552600160601b82041694840194909452600160c01b9093046001600160401b0316908201526001909101546001600160801b0380821660608401819052600160801b9092041660808301529091501580613272575060408101516001600160401b031615155b15613290576040516302e8145360e61b815260040160405180910390fd5b6040518060a0016040528082600001516001600160601b0316815260200182602001516001600160601b0316815260200160016001600160401b0316815260200182606001516001600160801b0316815260200182608001516001600160801b03168152506101cb6000856001600160a01b03166001600160a01b03168152602001908152602001600020838154811061332c5761332c6142df565b60009182526020808320845160029093020180549185015160408601516001600160401b0316600160c01b026001600160c01b036001600160601b03928316600160601b026001600160c01b03199095169290951691909117929092179290921617815560608301516080938401516001600160801b03908116600160801b0291811691909117600190920191909155918301516101cc8054919093169291906133d79084906143d4565b90915550506080810151604080516001600160a01b0386168152602081018590526001600160801b03909216908201527ff39bbe3e7fb2d887fe7e6e23dea5a53c1e720410dfb13e87567b873845136cf490606001610d36565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166134aa5760405162461bcd60e51b815260040161105390614406565b6134b381613431565b6134bb6139bc565b6110d96139e3565b600054610100900460ff166134ea5760405162461bcd60e51b815260040161105390614406565b6101ff80546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff166135345760405162461bcd60e51b815260040161105390614406565b6107d083111561355757604051633b61151160e11b815260040160405180910390fd5b61016183905561015f80546001600160a01b0319166001600160a01b03841617905543610162558015612c5157610160555050565b600054610100900460ff166135b35760405162461bcd60e51b815260040161105390614406565b61019580546001600160a01b038086166001600160a01b03199283161790925561019680548484169216919091179055821615612c515761019780546001600160a01b0384166001600160a01b0319909116179055505050565b600054610100900460ff166136345760405162461bcd60e51b815260040161105390614406565b6101ca55565b613642612758565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612dd23390565b61026654604051639ba0627560e01b81526001600160a01b03838116600483015290911690639ba062759060240160206040518083038186803b1580156136bd57600080fd5b505afa1580156136d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136f591906146f0565b6001600160a01b0316816001600160a01b0316636b0cbbd46040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561373957600080fd5b505af115801561374d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377191906146f0565b6001600160a01b0316146110d957604051630707f63f60e51b815260040160405180910390fd5b61015f54604080516001600160a01b03928316815291831660208301527f6b8a1f2fd09d355f8419738a3593f646cbd0e7be553ffcce23694ce968cc6425910160405180910390a161015f80546001600160a01b0319166001600160a01b0392909216919091179055565b610197546001600160a01b0316156110d95760005b8151811015610e9a576101975482516001600160a01b0390911690635fe984e79084908490811061384b5761384b6142df565b60200260200101516040518263ffffffff1660e01b815260040161386f919061470d565b600060405180830381600087803b15801561388957600080fd5b505af115801561389d573d6000803e3d6000fd5b50505050806138ab906143eb565b9050613818565b6001600160a01b0381163b61391f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611053565b60008051602061473d83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61395783613a12565b6000825111806139645750805b15612c51576110048383613a52565b60c95460ff166111a65760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611053565b600054610100900460ff166111a65760405162461bcd60e51b815260040161105390614406565b600054610100900460ff16613a0a5760405162461bcd60e51b815260040161105390614406565b6111a6613b46565b613a1b816138b2565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b613aba5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401611053565b600080846001600160a01b031684604051613ad59190614720565b600060405180830381855af49150503d8060008114613b10576040519150601f19603f3d011682016040523d82523d6000602084013e613b15565b606091505b5091509150613b3d828260405180606001604052806027815260200161475d60279139613b79565b95945050505050565b600054610100900460ff16613b6d5760405162461bcd60e51b815260040161105390614406565b60c9805460ff19169055565b60608315613b88575081613b92565b613b928383613b99565b9392505050565b815115613ba95781518083602001fd5b8060405162461bcd60e51b8152600401611053919061470d565b600060208284031215613bd557600080fd5b5035919050565b6001600160a01b03811681146110d957600080fd5b8035613bfc81613bdc565b919050565b600060208284031215613c1357600080fd5b8135613b9281613bdc565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613c5c57613c5c613c1e565b604052919050565b60006001600160401b03821115613c7d57613c7d613c1e565b50601f01601f191660200190565b600082601f830112613c9c57600080fd5b8135613caf613caa82613c64565b613c34565b818152846020838601011115613cc457600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215613cf457600080fd5b8235613cff81613bdc565b915060208301356001600160401b03811115613d1a57600080fd5b613d2685828601613c8b565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015613d715783516001600160a01b031683529284019291840191600101613d4c565b50909695505050505050565b60006001600160401b03821115613d9657613d96613c1e565b5060051b60200190565b60008060408385031215613db357600080fd5b8235613dbe81613bdc565b91506020838101356001600160401b03811115613dda57600080fd5b8401601f81018613613deb57600080fd5b8035613df9613caa82613d7d565b81815260059190911b82018301908381019088831115613e1857600080fd5b928401925b82841015613e3657833582529284019290840190613e1d565b80955050505050509250929050565b80358015158114613bfc57600080fd5b6000806000806000806000806000806101408b8d031215613e7557600080fd5b8a35613e8081613bdc565b995060208b0135985060408b0135975060608b0135965060808b0135613ea581613bdc565b955060a08b0135613eb581613bdc565b945060c08b0135613ec581613bdc565b935060e08b0135613ed581613bdc565b92506101008b0135613ee681613bdc565b9150613ef56101208c01613e45565b90509295989b9194979a5092959850565b60008060408385031215613f1957600080fd5b8235613f2481613bdc565b946020939093013593505050565b600082601f830112613f4357600080fd5b81356020613f53613caa83613d7d565b82815260059290921b84018101918181019086841115613f7257600080fd5b8286015b84811015613f96578035613f8981613bdc565b8352918301918301613f76565b509695505050505050565b6000806000806000806000806000806101408b8d031215613fc157600080fd5b8a35613fcc81613bdc565b995060208b0135985060408b0135613fe381613bdc565b975060608b0135613ff381613bdc565b965060808b013561400381613bdc565b955060a08b013561401381613bdc565b945061402160c08c01613bf1565b935061402f60e08c01613bf1565b925061403e6101008c01613bf1565b91506101208b01356001600160401b0381111561405a57600080fd5b6140668d828e01613f32565b9150509295989b9194979a5092959850565b60005b8381101561409357818101518382015260200161407b565b838111156110045750506000910152565b600081518084526140bc816020860160208601614078565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561412557603f198886030184526141138583516140a4565b945092850192908501906001016140f7565b5092979650505050505050565b60006020828403121561414457600080fd5b613b9282613e45565b60008083601f84011261415f57600080fd5b5081356001600160401b0381111561417657600080fd5b6020830191508360208260051b850101111561419157600080fd5b9250929050565b60008060008060008060008060a0898b0312156141b457600080fd5b8835975060208901356141c681613bdc565b965060408901356001600160401b03808211156141e257600080fd5b6141ee8c838d0161414d565b909850965060608b013591508082111561420757600080fd5b6142138c838d0161414d565b909650945060808b013591508082111561422c57600080fd5b506142398b828c0161414d565b999c989b5096995094979396929594505050565b602080825282518282018190526000919060409081850190868401855b828110156142d257815180516001600160601b039081168652878201511687860152858101516001600160401b0316868601526060808201516001600160801b0390811691870191909152608091820151169085015260a0909301929085019060010161426a565b5091979650505050505050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561430757600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600082198211156143375761433761430e565b500190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000828210156143e6576143e661430e565b500390565b60006000198214156143ff576143ff61430e565b5060010190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006020828403121561446357600080fd5b81516001600160401b0381111561447957600080fd5b8201601f8101841361448a57600080fd5b8051614498613caa82613c64565b8181528560208385010111156144ad57600080fd5b613b3d826020830160208601614078565b60008160001904831182151516156144d8576144d861430e565b500290565b60006144eb613caa84613d7d565b80848252602080830192508560051b85013681111561450957600080fd5b855b818110156145445780356001600160401b0381111561452a5760008081fd5b61453636828a01613c8b565b86525093820193820161450b565b50919695505050505050565b6000808335601e1984360301811261456757600080fd5b8301803591506001600160401b0382111561458157600080fd5b60200191503681900382131561419157600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6060815260006145d3606083018789614596565b82810360208401526145e6818688614596565b9150508260408301529695505050505050565b60208082528181018390526000906040600585901b8401810190840186845b878110156142d257868403603f190183528135368a9003601e1901811261463e57600080fd5b890180356001600160401b0381111561465657600080fd5b8036038b131561466557600080fd5b6146728682898501614596565b955050509184019190840190600101614618565b6000826146a357634e487b7160e01b600052601260045260246000fd5b500490565b600060ff821660ff84168060ff038211156146c5576146c561430e565b019392505050565b6000602082840312156146df57600080fd5b815160ff81168114613b9257600080fd5b60006020828403121561470257600080fd5b8151613b9281613bdc565b602081526000613b9260208301846140a4565b60008251614732818460208701614078565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220dbfb00a01247a6d8b16c7051d2c2d8795efa7f46f86350c879ac7d890c2e3c7164736f6c63430008080033
Deployed Bytecode
0x6080604052600436106103bc5760003560e01c80638456cb59116101f2578063d77868da1161010d578063e94ad65b116100a0578063f2fde38b1161006f578063f2fde38b14610adf578063f376ebbb14610aff578063f60b6fe614610b20578063fe55bde914610b3557600080fd5b8063e94ad65b14610a65578063ebeac51514610a86578063ee018b6d14610aa6578063ef213ddc14610ac857600080fd5b8063e0b05b61116100dc578063e0b05b61146109e1578063e23e0e0814610a01578063e502eb6814610a18578063e606768a14610a4557600080fd5b8063d77868da1461098f578063dce590d5146109a2578063dceb986d146109c2578063ddfa63ae146109ca57600080fd5b806399ca63bb11610185578063c49db0cd11610154578063c49db0cd14610917578063c6e6f59214610937578063ca661c0414610957578063cbdf382c1461096e57600080fd5b806399ca63bb146108a9578063b62be945146108bf578063b7e34b0c146108e1578063bba59090146108f757600080fd5b80638da5cb5b116101c15780638da5cb5b146108215780638dd7f2931461083f5780638f940f6314610856578063983e87bc1461088957600080fd5b80638456cb59146107bf5780638552bf90146107d457806386d8f78d146107f457806388f36cdd1461080a57600080fd5b80634f1ef286116102e257806361e9ecf311610275578063715018a611610244578063715018a61461074957806371c3cd881461075e57806373c62d5d1461077f578063788658531461079f57600080fd5b806361e9ecf3146106c757806362d53403146106e95780636637b882146107095780637139053e1461072957600080fd5b806354fd4d50116102b157806354fd4d501461066a578063553ffcbe146106865780635c60da1b1461068e5780635c975abb146106a357600080fd5b80634f1ef286146106145780634f322ae81461062757806350f73e7c1461063e57806352d1902d1461065557600080fd5b80633ba0b9a91161035a57806345f34e921161032957806345f34e921461059f57806349773050146105bf5780634ab4ba42146105df5780634d50f9a4146105f457600080fd5b80633ba0b9a9146105335780633f4ba83a14610548578063400990981461055d5780634162169f1461057e57600080fd5b806328837c071161039657806328837c07146104bb5780632963a287146104d25780632ffb004f146104f25780633659cfe61461051357600080fd5b806301e1d1141461043a57806307a2d13a14610462578063215bd1b11461048257600080fd5b36610435576102655433906001600160a01b03168114806103e157506103e181610b56565b1561042a57604080516001600160a01b03831681523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874910160405180910390a150005b610432610bbc565b50005b600080fd5b34801561044657600080fd5b5061044f610d43565b6040519081526020015b60405180910390f35b34801561046e57600080fd5b5061044f61047d366004613bc3565b610d74565b34801561048e57600080fd5b50610265546104a3906001600160a01b031681565b6040516001600160a01b039091168152602001610459565b3480156104c757600080fd5b506104d0610e0c565b005b3480156104de57600080fd5b506104d06104ed366004613bc3565b610e9e565b3480156104fe57600080fd5b50610266546104a3906001600160a01b031681565b34801561051f57600080fd5b506104d061052e366004613c01565b61100a565b34801561053f57600080fd5b5061044f6110dc565b34801561055457600080fd5b506104d0611172565b34801561056957600080fd5b50610233546104a3906001600160a01b031681565b34801561058a57600080fd5b506101ff546104a3906001600160a01b031681565b3480156105ab57600080fd5b506104d06105ba366004613c01565b6111a8565b3480156105cb57600080fd5b506104d06105da366004613c01565b6111dd565b3480156105eb57600080fd5b5061044f611212565b34801561060057600080fd5b506104d061060f366004613bc3565b61129a565b6104d0610622366004613ce1565b6112cf565b34801561063357600080fd5b5061044f6101615481565b34801561064a57600080fd5b5061044f6101ca5481565b34801561066157600080fd5b5061044f611385565b34801561067657600080fd5b5060405160028152602001610459565b6104d0611438565b34801561069a57600080fd5b506104a361148c565b3480156106af57600080fd5b5060c95460ff165b6040519015158152602001610459565b3480156106d357600080fd5b506106dc611496565b6040516104599190613d30565b3480156106f557600080fd5b506104d0610704366004613bc3565b6114f9565b34801561071557600080fd5b506104d0610724366004613c01565b6116ca565b34801561073557600080fd5b506104d0610744366004613da0565b6116db565b34801561075557600080fd5b506104d061180e565b34801561076a57600080fd5b5061015f546104a3906001600160a01b031681565b34801561078b57600080fd5b506104d061079a366004613e55565b611820565b3480156107ab57600080fd5b506106b76107ba366004613f06565b6118c0565b3480156107cb57600080fd5b506104d06119f2565b3480156107e057600080fd5b506104d06107ef366004613bc3565b611a26565b34801561080057600080fd5b5061044f6107d081565b34801561081657600080fd5b5061044f6101625481565b34801561082d57600080fd5b506097546001600160a01b03166104a3565b34801561084b57600080fd5b5061044f6102345481565b34801561086257600080fd5b507f317cfd4f6bf59aad6e1d4b8247c96368ead3464397a31a65d0dd7d95f2fafca561044f565b34801561089557600080fd5b506104d06108a4366004613fa1565b611b5c565b3480156108b557600080fd5b5061044f61271081565b3480156108cb57600080fd5b506108d4611d4b565b60405161045991906140d0565b3480156108ed57600080fd5b5061044f611c2081565b34801561090357600080fd5b506104d0610912366004614132565b611e70565b34801561092357600080fd5b506104d0610932366004613c01565b611f05565b34801561094357600080fd5b5061044f610952366004613bc3565b611f3a565b34801561096357600080fd5b5061044f6201194081565b34801561097a57600080fd5b50610232546104a3906001600160a01b031681565b6104d061099d366004613bc3565b611f8f565b3480156109ae57600080fd5b506104d06109bd366004613bc3565b611fc4565b6104d0612103565b3480156109d657600080fd5b5061044f6101605481565b3480156109ed57600080fd5b506104d06109fc366004614198565b61210b565b348015610a0d57600080fd5b5061044f6101cc5481565b348015610a2457600080fd5b50610a38610a33366004613c01565b6123ed565b604051610459919061424d565b348015610a5157600080fd5b506104d0610a60366004613c01565b6124b8565b348015610a7157600080fd5b50610196546104a3906001600160a01b031681565b348015610a9257600080fd5b506104d0610aa1366004613c01565b612576565b348015610ab257600080fd5b50610232546106b790600160a01b900460ff1681565b348015610ad457600080fd5b5061044f62278d0081565b348015610aeb57600080fd5b506104d0610afa366004613c01565b61262a565b348015610b0b57600080fd5b50610197546104a3906001600160a01b031681565b348015610b2c57600080fd5b5061044f6126a0565b348015610b4157600080fd5b50610195546104a3906001600160a01b031681565b610267546000908190815b81811015610bb357846001600160a01b03166102678281548110610b8757610b876142df565b6000918252602090912001546001600160a01b03161415610bab5760019250610bb3565b600101610b61565b50909392505050565b610bc4612758565b3433662386f26fc10000821015610bee5760405163162908e360e11b815260040160405180910390fd5b6000610c808361023260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c4357600080fd5b505afa158015610c57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7b91906142f5565b61279e565b9050610c8b836127e1565b610232546040516319157fab60e21b8152600481018390526001600160a01b03848116602483015290911690636455feac90604401600060405180830381600087803b158015610cda57600080fd5b505af1158015610cee573d6000803e3d6000fd5b5050604080516001600160a01b0386168152602081018790529081018490527f838d17987e57e587c458220b9b38723c41fbc3f397550b506712960a73ef19f9925060600190505b60405180910390a1505050565b6000806000610d50612875565b509150915080600014610d6e57610d678183614324565b9250505090565b50919050565b6000610e068261023260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610dc957600080fd5b505afa158015610ddd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0191906142f5565b6128f3565b92915050565b6102675460005b81811015610e9a576102678181548110610e2f57610e2f6142df565b6000918252602082200154604080516328837c0760e01b815290516001600160a01b03909216926328837c079260048084019382900301818387803b158015610e7757600080fd5b505af1158015610e8b573d6000803e3d6000fd5b50505050806001019050610e13565b5050565b610ea6612758565b61023254600160a01b900460ff16610ed15760405163e1a54e4b60e01b815260040160405180910390fd5b61023254604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b158015610f1757600080fd5b505afa158015610f2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4f91906142f5565b90506000610f5d83836128f3565b9050804710610f7f5760405163e6225c4f60e01b815260040160405180910390fd5b33610f8982612919565b61023254604051638e433bc760e01b8152600481018690526001600160a01b03838116602483015290911690638e433bc790604401600060405180830381600087803b158015610fd857600080fd5b505af1158015610fec573d6000803e3d6000fd5b505050506110048185610ffe86612958565b8561296c565b50505050565b306001600160a01b037f00000000000000000000000080c1ef2e1bc5c2adfe1d245e1c1c4969156bd0fc16141561105c5760405162461bcd60e51b81526004016110539061433c565b60405180910390fd5b7f00000000000000000000000080c1ef2e1bc5c2adfe1d245e1c1c4969156bd0fc6001600160a01b031661108e612aa9565b6001600160a01b0316146110b45760405162461bcd60e51b815260040161105390614388565b6110bd81612ac5565b604080516000808252602082019092526110d991839190612c1e565b50565b600061116d61023260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561113057600080fd5b505afa158015611144573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116891906142f5565b612958565b905090565b6101ff546001600160a01b0316331461119e57604051630782484160e21b815260040160405180910390fd5b6111a6612d9d565b565b6101ff546001600160a01b031633146111d457604051630782484160e21b815260040160405180910390fd5b6110d981612def565b6101ff546001600160a01b0316331461120957604051630782484160e21b815260040160405180910390fd5b6110d981612e5a565b610265546040805163479eb1ed60e11b815290516000926001600160a01b031691638f3d63da916004808301926020929190829003018186803b15801561125857600080fd5b505afa15801561126c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129091906142f5565b61116d9047614324565b6101ff546001600160a01b031633146112c657604051630782484160e21b815260040160405180910390fd5b6110d981612ec5565b306001600160a01b037f00000000000000000000000080c1ef2e1bc5c2adfe1d245e1c1c4969156bd0fc1614156113185760405162461bcd60e51b81526004016110539061433c565b7f00000000000000000000000080c1ef2e1bc5c2adfe1d245e1c1c4969156bd0fc6001600160a01b031661134a612aa9565b6001600160a01b0316146113705760405162461bcd60e51b815260040161105390614388565b61137982612ac5565b610e9a82826001612c1e565b6000306001600160a01b037f00000000000000000000000080c1ef2e1bc5c2adfe1d245e1c1c4969156bd0fc16146114255760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401611053565b5060008051602061473d83398151915290565b600034905080610234600082825461145091906143d4565b90915550506040518181527f4fb0171001dc0ba5f8ca0996eb5a413cf67c611e3d6d1d6ae9ea1df128383410906020015b60405180910390a150565b600061116d612aa9565b60606102678054806020026020016040519081016040528092919081815260200182805480156114ef57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116114d1575b5050505050905090565b611501612f2b565b611509612758565b61023254600160a01b900460ff166115345760405163e1a54e4b60e01b815260040160405180910390fd5b61023254604080516318160ddd60e01b8152905133926000926115829286926001600160a01b0316916318160ddd916004808301926020929190829003018186803b158015610dc957600080fd5b905061158f816001612f85565b61159881612919565b61023254604051638e433bc760e01b8152600481018590526001600160a01b03848116602483015290911690638e433bc790604401600060405180830381600087803b1580156115e757600080fd5b505af11580156115fb573d6000803e3d6000fd5b505050506000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461164c576040519150601f19603f3d011682016040523d82523d6000602084013e611651565b606091505b5050905080611673576040516312171d8360e31b815260040160405180910390fd5b604080516001600160a01b0385168152602081018690529081018390527fdef4a00a06705bb4b80fd0c912337f4f4e01fb81d39a572514be68d328599abf9060600160405180910390a15050506110d9600160fb55565b6116d2613022565b6110d98161307c565b6116e3612f2b565b6116eb612758565b6000805b825181101561178257600083828151811061170c5761170c6142df565b6020026020010151905061172085826118c0565b61173d5760405163d23d1c8560e01b815260040160405180910390fd5b600061174986836130e7565b905061175586836131b5565b608081015161176d906001600160801b031685614324565b935050508061177b906143eb565b90506116ef565b5061178e816000612f85565b6000836001600160a01b03168260405160006040518083038185875af1925050503d80600081146117db576040519150601f19603f3d011682016040523d82523d6000602084013e6117e0565b606091505b5050905080611802576040516312171d8360e31b815260040160405180910390fd5b5050610e9a600160fb55565b611816613022565b6111a66000613431565b600054610100900460ff166118475760405162461bcd60e51b815260040161105390614406565b6118508a613483565b611859866134c3565b61186488858961350d565b6118708360008461358c565b6118798961360d565b61023280546001600160a01b0319166001600160a01b03871617905580156118b457610232805460ff60a01b1916600160a01b831515021790555b50505050505050505050565b6001600160a01b03821660009081526101cb6020908152604080832080548251818502810185019093528083528493849084015b8282101561197b5760008481526020908190206040805160a0810182526002860290920180546001600160601b038082168552600160601b82041684860152600160c01b90046001600160401b0316918301919091526001908101546001600160801b038082166060850152600160801b90910416608083015290835290920191016118f4565b505050509050805183106119a25760405163251f56a160e21b815260040160405180910390fd5b6101ca548184815181106119b8576119b86142df565b6020026020010151600001516001600160601b03166119d79190614324565b4310156119e8576000915050610e06565b5060019392505050565b6101ff546001600160a01b03163314611a1e57604051630782484160e21b815260040160405180910390fd5b6111a661363a565b61015f546001600160a01b03163314611a5257604051630782484160e21b815260040160405180910390fd5b6107d0811115611a7557604051633b61151160e11b815260040160405180910390fd5b611c2061016254611a869190614324565b431015611aa65760405163928cdae760e01b815260040160405180910390fd5b6000806000611ab3612875565b610162819055919450925090508115611ad557611ad08284614324565b610160555b60408051848152602081018490529081018290527f35a901c4413e585f9121eb5cf07e67760bd4ac498dd031249e5cd2cd225f74e49060600160405180910390a16101615460408051918252602082018690527f782f84f1274a11befd10700001e41dfdbf825313fb93311d474b857dfd8f1c2b910160405180910390a150505061016155565b600054610100900460ff1615808015611b7c5750600054600160ff909116105b80611b965750303b158015611b96575060005460ff166001145b611bf95760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401611053565b6000805460ff191660011790558015611c1c576000805461ff0019166101001790555b611c318b60008c60008d8c8c8c8c6000611820565b61026580546001600160a01b03808b166001600160a01b03199283161790925561026680549286169290911691909117905560005b8251811015611cf7576000838281518110611c8357611c836142df565b60200260200101519050611c9681613677565b61026780546001810182556000919091527fa97f1b0857e7df4c88b70fad2137419113682f4bd033bba6a5fb2773e2deab450180546001600160a01b0319166001600160a01b0392909216919091179055611cf0816143eb565b9050611c66565b508015611d3e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050505050565b610267546060906000816001600160401b03811115611d6c57611d6c613c1e565b604051908082528060200260200182016040528015611d9f57816020015b6060815260200190600190039081611d8a5790505b50905060005b82811015611e69576102678181548110611dc157611dc16142df565b60009182526020822001546040805163b62be94560e01b815290516001600160a01b039092169263b62be94592600480840193829003018186803b158015611e0857600080fd5b505afa158015611e1c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e449190810190614451565b828281518110611e5657611e566142df565b6020908102919091010152600101611da5565b5092915050565b6101ff546001600160a01b03163314611e9c57604051630782484160e21b815260040160405180910390fd5b6102325460408051600160a01b90920460ff161515825282151560208301527ff0700b7cce37d0ddc289445e07408f3709033f9785391e5e05b908cb9705748b910160405180910390a16102328054911515600160a01b0260ff60a01b19909216919091179055565b6101ff546001600160a01b03163314611f3157604051630782484160e21b815260040160405180910390fd5b6110d981613798565b6000610e068261023260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c4357600080fd5b604080513381523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f885258749101611481565b6101ff546001600160a01b03163314611ff057604051630782484160e21b815260040160405180910390fd5b611ff8612f2b565b610233546001600160a01b03166120225760405163e481c26960e01b815260040160405180910390fd5b61202d816001612f85565b8061023460008282546120409190614324565b9091555050610233546040516000916001600160a01b03169083908381818185875af1925050503d8060008114612093576040519150601f19603f3d011682016040523d82523d6000602084013e612098565b606091505b50509050806120ba576040516312171d8360e31b815260040160405180910390fd5b610234546040805184815260208101929092527ff58adcbb0e084c416406ed1246914693d1bebcc911fa80eb933774c868034361910160405180910390a1506110d9600160fb55565b6111a6610bbc565b610195546001600160a01b0316331461213757604051630782484160e21b815260040160405180910390fd5b61214087610b56565b61215d57604051634ae1ac7560e11b815260040160405180910390fd5b61019660009054906101000a90046001600160a01b03166001600160a01b031663c5f2892f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156121ac57600080fd5b505afa1580156121c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121e491906142f5565b881461220357604051631475764f60e11b815260040160405180910390fd5b846000612219826801bc16d674ec8000006144be565b9050612226816001612f85565b81851415806122355750818314155b1561225357604051630309cb8760e51b815260040160405180910390fd5b612265612260888a6144dd565b613803565b60005b8281101561234d57896001600160a01b0316639b4e46346801bc16d674ec8000008b8b8581811061229b5761229b6142df565b90506020028101906122ad9190614550565b8b8b878181106122bf576122bf6142df565b90506020028101906122d19190614550565b8b8b898181106122e3576122e36142df565b905060200201356040518763ffffffff1660e01b815260040161230a9594939291906145bf565b6000604051808303818588803b15801561232357600080fd5b505af1158015612337573d6000803e3d6000fd5b505050505080612346906143eb565b9050612268565b50604051631fa23e8560e01b8152600481018290526001600160a01b038a1690631fa23e8590602401600060405180830381600087803b15801561239057600080fd5b505af11580156123a4573d6000803e3d6000fd5b505050507fe585eadb0042252d35431ecfed1027caf5672811fdf1db08cb49e32fee17050588886040516123d99291906145f9565b60405180910390a150505050505050505050565b6001600160a01b03811660009081526101cb60209081526040808320805482518185028101850190935280835260609492939192909184015b828210156124ad5760008481526020908190206040805160a0810182526002860290920180546001600160601b038082168552600160601b82041684860152600160c01b90046001600160401b0316918301919091526001908101546001600160801b038082166060850152600160801b9091041660808301529083529092019101612426565b505050509050919050565b6101ff546001600160a01b031633146124e457604051630782484160e21b815260040160405180910390fd5b6001600160a01b03811661250b5760405163e481c26960e01b815260040160405180910390fd5b61023354604080516001600160a01b03928316815291831660208301527f4ec60652ba5660c71f5d158ba76777060e4df45955126c42ffe26c0c447a781e910160405180910390a161023380546001600160a01b0319166001600160a01b0392909216919091179055565b6101ff546001600160a01b031633146125a257604051630782484160e21b815260040160405180910390fd5b6125ab81613677565b61026780546001810182556000919091527fa97f1b0857e7df4c88b70fad2137419113682f4bd033bba6a5fb2773e2deab450180546001600160a01b0319166001600160a01b0383169081179091556040519081527f84cf405f0a1827114df681d11bd5006d56d6414d63c57e4cf6569fabd9a8e7ff90602001611481565b612632613022565b6001600160a01b0381166126975760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401611053565b6110d981613431565b600080805b61026754811015610d6e5761026781815481106126c4576126c46142df565b60009182526020918290200154604080516289491360e11b815290516001600160a01b0390921692630112922692600480840193829003018186803b15801561270c57600080fd5b505afa158015612720573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061274491906142f5565b61274e9083614324565b91506001016126a5565b60c95460ff16156111a65760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401611053565b6000806127a9610d43565b90508215806127b6575080155b156127c45783915050610e06565b806127cf84866144be565b6127d99190614686565b949350505050565b60008060006127ee612875565b61016281905591945092509050811561281f578361280c8385614324565b6128169190614324565b6101605561282e565b6128298484614324565b610160555b60408051848152602081018490529081018290527f35a901c4413e585f9121eb5cf07e67760bd4ac498dd031249e5cd2cd225f74e49060600160405180910390a150505050565b610160546101625460009043908082148061289857506801bc16d674ec80000084105b156128a7575091926000929150565b8362278d006127106128b984866143d4565b61016154610160546128cb91906144be565b6128d591906144be565b6128df9190614686565b6128e99190614686565b9350935050909192565b6000806128fe610d43565b90508261290e5783915050610e06565b826127cf82866144be565b6000806000612926612875565b61016281905591945092509050811561294e57836129448385614324565b61281691906143d4565b61282984846143d4565b6000610e06670de0b6b3a7640000836128f3565b6001600160a01b03841660009081526101cb60209081526040808320815160a0810183526001600160601b034381811683528882168387019081529483018781526001600160801b03808c16606086019081528a821660808701908152875460018181018a55988c52998b2096516002909a029096018054985193516001600160401b0316600160c01b026001600160c01b03948716600160601b026001600160c01b0319909a169a909616999099179790971791909116929092178655935191518116600160801b029116179201919091556101cc805491928492612a53908490614324565b9091555050604080516001600160a01b0387168152602081018690529081018290527f74ffedfd7821cf30dd556fac01944f4d077a2099ae55773bb89444cce29755f49060600160405180910390a15050505050565b60008051602061473d833981519152546001600160a01b031690565b612acd613022565b7f317cfd4f6bf59aad6e1d4b8247c96368ead3464397a31a65d0dd7d95f2fafca5816001600160a01b0316638f940f636040518163ffffffff1660e01b815260040160206040518083038186803b158015612b2757600080fd5b505afa158015612b3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5f91906142f5565b14612b7d57604051630ce2ef5f60e11b815260040160405180910390fd5b612b89600260016146a8565b60ff16816001600160a01b03166354fd4d506040518163ffffffff1660e01b815260040160206040518083038186803b158015612bc557600080fd5b505afa158015612bd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bfd91906146cd565b60ff16146110d95760405163a9146eeb60e01b815260040160405180910390fd5b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612c5657612c51836138b2565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b158015612c8f57600080fd5b505afa925050508015612cbf575060408051601f3d908101601f19168201909252612cbc918101906142f5565b60015b612d225760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401611053565b60008051602061473d8339815191528114612d915760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401611053565b50612c5183838361394e565b612da5613973565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61019554604080516001600160a01b03928316815291831660208301527ffcf16285f1e14b0b8a544860d3664317dd81073a42e811e33afe75a22886443e910160405180910390a161019580546001600160a01b0319166001600160a01b0392909216919091179055565b61019754604080516001600160a01b03928316815291831660208301527f5f98eb9c39a016a522ab1ca3601f349c89b557a9b6471ce04afa8770d5589062910160405180910390a161019780546001600160a01b0319166001600160a01b0392909216919091179055565b62011940811115612ee85760405162de26ef60e51b815260040160405180910390fd5b6101ca5460408051918252602082018390527fab3f1d5eaee409b7067167f77f1fa3f8a863366d6fb2b88559cd4f9b8e03e182910160405180910390a16101ca55565b600260fb541415612f7e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611053565b600260fb55565b4780831115612c515761026560009054906101000a90046001600160a01b03166001600160a01b031663b5e86bea6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612fdf57600080fd5b505af1158015612ff3573d6000803e3d6000fd5b50505050612fff610e0c565b504780831115612c515760405163356680b760e01b815260040160405180910390fd5b6097546001600160a01b031633146111a65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611053565b6101ff54604080516001600160a01b03928316815291831660208301527ffcde6c827a52b0870bc44ed9b10212272e18c9ea1725b772e9b493750afd8da4910160405180910390a16101ff80546001600160a01b0319166001600160a01b0392909216919091179055565b6040805160a0810182526000808252602080830182905282840182905260608301829052608083018290526001600160a01b03861682526101cb905291909120805483908110613139576131396142df565b60009182526020918290206040805160a08101825260029390930290910180546001600160601b038082168552600160601b82041694840194909452600160c01b9093046001600160401b0316908201526001909101546001600160801b038082166060840152600160801b9091041660808201529392505050565b6001600160a01b03821660009081526101cb602052604081208054839081106131e0576131e06142df565b60009182526020918290206040805160a08101825260029390930290910180546001600160601b038082168552600160601b82041694840194909452600160c01b9093046001600160401b0316908201526001909101546001600160801b0380821660608401819052600160801b9092041660808301529091501580613272575060408101516001600160401b031615155b15613290576040516302e8145360e61b815260040160405180910390fd5b6040518060a0016040528082600001516001600160601b0316815260200182602001516001600160601b0316815260200160016001600160401b0316815260200182606001516001600160801b0316815260200182608001516001600160801b03168152506101cb6000856001600160a01b03166001600160a01b03168152602001908152602001600020838154811061332c5761332c6142df565b60009182526020808320845160029093020180549185015160408601516001600160401b0316600160c01b026001600160c01b036001600160601b03928316600160601b026001600160c01b03199095169290951691909117929092179290921617815560608301516080938401516001600160801b03908116600160801b0291811691909117600190920191909155918301516101cc8054919093169291906133d79084906143d4565b90915550506080810151604080516001600160a01b0386168152602081018590526001600160801b03909216908201527ff39bbe3e7fb2d887fe7e6e23dea5a53c1e720410dfb13e87567b873845136cf490606001610d36565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166134aa5760405162461bcd60e51b815260040161105390614406565b6134b381613431565b6134bb6139bc565b6110d96139e3565b600054610100900460ff166134ea5760405162461bcd60e51b815260040161105390614406565b6101ff80546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff166135345760405162461bcd60e51b815260040161105390614406565b6107d083111561355757604051633b61151160e11b815260040160405180910390fd5b61016183905561015f80546001600160a01b0319166001600160a01b03841617905543610162558015612c5157610160555050565b600054610100900460ff166135b35760405162461bcd60e51b815260040161105390614406565b61019580546001600160a01b038086166001600160a01b03199283161790925561019680548484169216919091179055821615612c515761019780546001600160a01b0384166001600160a01b0319909116179055505050565b600054610100900460ff166136345760405162461bcd60e51b815260040161105390614406565b6101ca55565b613642612758565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612dd23390565b61026654604051639ba0627560e01b81526001600160a01b03838116600483015290911690639ba062759060240160206040518083038186803b1580156136bd57600080fd5b505afa1580156136d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136f591906146f0565b6001600160a01b0316816001600160a01b0316636b0cbbd46040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561373957600080fd5b505af115801561374d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377191906146f0565b6001600160a01b0316146110d957604051630707f63f60e51b815260040160405180910390fd5b61015f54604080516001600160a01b03928316815291831660208301527f6b8a1f2fd09d355f8419738a3593f646cbd0e7be553ffcce23694ce968cc6425910160405180910390a161015f80546001600160a01b0319166001600160a01b0392909216919091179055565b610197546001600160a01b0316156110d95760005b8151811015610e9a576101975482516001600160a01b0390911690635fe984e79084908490811061384b5761384b6142df565b60200260200101516040518263ffffffff1660e01b815260040161386f919061470d565b600060405180830381600087803b15801561388957600080fd5b505af115801561389d573d6000803e3d6000fd5b50505050806138ab906143eb565b9050613818565b6001600160a01b0381163b61391f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401611053565b60008051602061473d83398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61395783613a12565b6000825111806139645750805b15612c51576110048383613a52565b60c95460ff166111a65760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401611053565b600054610100900460ff166111a65760405162461bcd60e51b815260040161105390614406565b600054610100900460ff16613a0a5760405162461bcd60e51b815260040161105390614406565b6111a6613b46565b613a1b816138b2565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b613aba5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401611053565b600080846001600160a01b031684604051613ad59190614720565b600060405180830381855af49150503d8060008114613b10576040519150601f19603f3d011682016040523d82523d6000602084013e613b15565b606091505b5091509150613b3d828260405180606001604052806027815260200161475d60279139613b79565b95945050505050565b600054610100900460ff16613b6d5760405162461bcd60e51b815260040161105390614406565b60c9805460ff19169055565b60608315613b88575081613b92565b613b928383613b99565b9392505050565b815115613ba95781518083602001fd5b8060405162461bcd60e51b8152600401611053919061470d565b600060208284031215613bd557600080fd5b5035919050565b6001600160a01b03811681146110d957600080fd5b8035613bfc81613bdc565b919050565b600060208284031215613c1357600080fd5b8135613b9281613bdc565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613c5c57613c5c613c1e565b604052919050565b60006001600160401b03821115613c7d57613c7d613c1e565b50601f01601f191660200190565b600082601f830112613c9c57600080fd5b8135613caf613caa82613c64565b613c34565b818152846020838601011115613cc457600080fd5b816020850160208301376000918101602001919091529392505050565b60008060408385031215613cf457600080fd5b8235613cff81613bdc565b915060208301356001600160401b03811115613d1a57600080fd5b613d2685828601613c8b565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015613d715783516001600160a01b031683529284019291840191600101613d4c565b50909695505050505050565b60006001600160401b03821115613d9657613d96613c1e565b5060051b60200190565b60008060408385031215613db357600080fd5b8235613dbe81613bdc565b91506020838101356001600160401b03811115613dda57600080fd5b8401601f81018613613deb57600080fd5b8035613df9613caa82613d7d565b81815260059190911b82018301908381019088831115613e1857600080fd5b928401925b82841015613e3657833582529284019290840190613e1d565b80955050505050509250929050565b80358015158114613bfc57600080fd5b6000806000806000806000806000806101408b8d031215613e7557600080fd5b8a35613e8081613bdc565b995060208b0135985060408b0135975060608b0135965060808b0135613ea581613bdc565b955060a08b0135613eb581613bdc565b945060c08b0135613ec581613bdc565b935060e08b0135613ed581613bdc565b92506101008b0135613ee681613bdc565b9150613ef56101208c01613e45565b90509295989b9194979a5092959850565b60008060408385031215613f1957600080fd5b8235613f2481613bdc565b946020939093013593505050565b600082601f830112613f4357600080fd5b81356020613f53613caa83613d7d565b82815260059290921b84018101918181019086841115613f7257600080fd5b8286015b84811015613f96578035613f8981613bdc565b8352918301918301613f76565b509695505050505050565b6000806000806000806000806000806101408b8d031215613fc157600080fd5b8a35613fcc81613bdc565b995060208b0135985060408b0135613fe381613bdc565b975060608b0135613ff381613bdc565b965060808b013561400381613bdc565b955060a08b013561401381613bdc565b945061402160c08c01613bf1565b935061402f60e08c01613bf1565b925061403e6101008c01613bf1565b91506101208b01356001600160401b0381111561405a57600080fd5b6140668d828e01613f32565b9150509295989b9194979a5092959850565b60005b8381101561409357818101518382015260200161407b565b838111156110045750506000910152565b600081518084526140bc816020860160208601614078565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561412557603f198886030184526141138583516140a4565b945092850192908501906001016140f7565b5092979650505050505050565b60006020828403121561414457600080fd5b613b9282613e45565b60008083601f84011261415f57600080fd5b5081356001600160401b0381111561417657600080fd5b6020830191508360208260051b850101111561419157600080fd5b9250929050565b60008060008060008060008060a0898b0312156141b457600080fd5b8835975060208901356141c681613bdc565b965060408901356001600160401b03808211156141e257600080fd5b6141ee8c838d0161414d565b909850965060608b013591508082111561420757600080fd5b6142138c838d0161414d565b909650945060808b013591508082111561422c57600080fd5b506142398b828c0161414d565b999c989b5096995094979396929594505050565b602080825282518282018190526000919060409081850190868401855b828110156142d257815180516001600160601b039081168652878201511687860152858101516001600160401b0316868601526060808201516001600160801b0390811691870191909152608091820151169085015260a0909301929085019060010161426a565b5091979650505050505050565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561430757600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600082198211156143375761433761430e565b500190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6000828210156143e6576143e661430e565b500390565b60006000198214156143ff576143ff61430e565b5060010190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006020828403121561446357600080fd5b81516001600160401b0381111561447957600080fd5b8201601f8101841361448a57600080fd5b8051614498613caa82613c64565b8181528560208385010111156144ad57600080fd5b613b3d826020830160208601614078565b60008160001904831182151516156144d8576144d861430e565b500290565b60006144eb613caa84613d7d565b80848252602080830192508560051b85013681111561450957600080fd5b855b818110156145445780356001600160401b0381111561452a5760008081fd5b61453636828a01613c8b565b86525093820193820161450b565b50919695505050505050565b6000808335601e1984360301811261456757600080fd5b8301803591506001600160401b0382111561458157600080fd5b60200191503681900382131561419157600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6060815260006145d3606083018789614596565b82810360208401526145e6818688614596565b9150508260408301529695505050505050565b60208082528181018390526000906040600585901b8401810190840186845b878110156142d257868403603f190183528135368a9003601e1901811261463e57600080fd5b890180356001600160401b0381111561465657600080fd5b8036038b131561466557600080fd5b6146728682898501614596565b955050509184019190840190600101614618565b6000826146a357634e487b7160e01b600052601260045260246000fd5b500490565b600060ff821660ff84168060ff038211156146c5576146c561430e565b019392505050565b6000602082840312156146df57600080fd5b815160ff81168114613b9257600080fd5b60006020828403121561470257600080fd5b8151613b9281613bdc565b602081526000613b9260208301846140a4565b60008251614732818460208701614078565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220dbfb00a01247a6d8b16c7051d2c2d8795efa7f46f86350c879ac7d890c2e3c7164736f6c63430008080033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.