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
Contract Name:
OperatorDelegator
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "../Permissions/IRoleManager.sol"; import "./OperatorDelegatorStorage.sol"; import "../EigenLayer/interfaces/IDelegationManager.sol"; import "../EigenLayer/interfaces/ISignatureUtils.sol"; import "../EigenLayer/libraries/BeaconChainProofs.sol"; import "../EigenLayer/interfaces/IRewardsCoordinator.sol"; import "../Bridge/Connext/core/IWeth.sol"; import "../Errors/Errors.sol"; /// @dev This contract will be responsible for interacting with Eigenlayer /// Each of these contracts deployed will be delegated to one specific operator /// This contract can handle multiple ERC20 tokens, all of which will be delegated to the same operator /// Each supported ERC20 token will be pointed at a single Strategy contract in EL /// Only the RestakeManager should be interacting with this contract for EL interactions. contract OperatorDelegator is Initializable, ReentrancyGuardUpgradeable, OperatorDelegatorStorageV9 { using SafeERC20 for IERC20; using BeaconChainProofs for *; uint256 internal constant GWEI_TO_WEI = 1e9; address public constant IS_NATIVE = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address public constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; /// @dev Max stakedButNotVerifiedEth amount cap per validator uint256 public constant MAX_STAKE_BUT_NOT_VERIFIED_AMOUNT = 32 ether; /// @dev Nominal base gas spent value by admin uint256 internal constant NOMINAL_BASE_GAS_SPENT = 50_000; event TokenStrategyUpdated(IERC20 token, IStrategy strategy); event DelegationAddressUpdated(address delegateAddress); event RewardsForwarded(address rewardDestination, uint256 amount); event WithdrawStarted( bytes32 withdrawRoot, address staker, address delegatedTo, address withdrawer, uint nonce, uint startBlock, IStrategy[] strategies, uint256[] shares ); event WithdrawCompleted(bytes32 withdrawalRoot, IStrategy[] strategies, uint256[] shares); event GasSpent(address admin, uint256 gasSpent); event GasRefunded(address admin, uint256 gasRefunded); event BaseGasAmountSpentUpdated(uint256 oldBaseGasAmountSpent, uint256 newBaseGasAmountSpent); event RewardsCoordinatorUpdated(address oldRewardsCoordinator, address newRewardsCoordinator); event RewardsDestinationUpdated(address oldRewardsDestination, address newRewardsDestination); event WETHUnwrapperUpdated(address oldUnwrapper, address newUnwrapper); event Log(string message); /// @dev Allows only a whitelisted address to configure the contract modifier onlyOperatorDelegatorAdmin() { _onlyOperatorDelegatorAdmin(); _; } /// @dev Allows only the RestakeManager address to call functions modifier onlyRestakeManager() { _onlyRestakeManager(); _; } /// @dev Allows only a whitelisted address to configure the contract modifier onlyNativeEthRestakeAdmin() { _onlyNativeEthRestakeAdmin(); _; } /// @dev Allows only EmergencyWithdrawTrackingAdmin to call functions modifier onlyEmergencyWithdrawTrackingAdmin() { if (!roleManager.isEmergencyWithdrawTrackingAdmin(msg.sender)) revert NotEmergencyWithdrawTrackingAdmin(); _; } /// @dev Allows only Rewards admin to process Rewards modifier onlyEigenLayerRewardsAdmin() { if (!roleManager.isEigenLayerRewardsAdmin(msg.sender)) revert NotEigenLayerRewardsAdmin(); _; } modifier onlyEmergencyCheckpointTrackingAdmin() { if (!roleManager.isEmergencyCheckpointTrackingAdmin(msg.sender)) revert NotEmergencyCheckpointTrackingAdmin(); _; } /// @dev Prevents implementation contract from being initialized. /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /// @dev Initializes the contract with initial vars function initialize( IRoleManager _roleManager, IStrategyManager _strategyManager, IRestakeManager _restakeManager, IDelegationManager _delegationManager, IEigenPodManager _eigenPodManager ) external initializer { if (address(_roleManager) == address(0x0)) revert InvalidZeroInput(); if (address(_strategyManager) == address(0x0)) revert InvalidZeroInput(); if (address(_restakeManager) == address(0x0)) revert InvalidZeroInput(); if (address(_delegationManager) == address(0x0)) revert InvalidZeroInput(); if (address(_eigenPodManager) == address(0x0)) revert InvalidZeroInput(); __ReentrancyGuard_init(); roleManager = _roleManager; strategyManager = _strategyManager; restakeManager = _restakeManager; delegationManager = _delegationManager; eigenPodManager = _eigenPodManager; // Deploy new EigenPod eigenPod = IEigenPod(eigenPodManager.createPod()); } // /** // * @notice reinitializing the OperatorDelegator to track pre PEPE Upgrade full Withdrawals, initialize to version 2 // * @dev permissioned call (onlyOperatorDelegatorAdmin), can only reinitialize once // * @param prePEPEwithdrawalAmount prePEPEwithdrawalAmount to track in exit balance // */ // function reinitialize( // uint256 prePEPEwithdrawalAmount // ) external onlyOperatorDelegatorAdmin reinitializer(2) { // // add the amount in totalBeaconChainExitBalance // totalBeaconChainExitBalance += prePEPEwithdrawalAmount; // } // Note: Deprecated // /// @dev Migrates the M1 pods to M2 pods by calling activateRestaking on eigenPod // /// @dev Should be a permissioned call by onlyNativeEthRestakeAdmin // function activateRestaking() external nonReentrant onlyNativeEthRestakeAdmin { // eigenPod.activateRestaking(); // } /// @dev Sets the strategy for a given token - setting strategy to 0x0 removes the ability to deposit and withdraw token function setTokenStrategy( IERC20 _token, IStrategy _strategy ) external nonReentrant onlyOperatorDelegatorAdmin { if (address(_token) == address(0x0)) revert InvalidZeroInput(); // check revert if strategy underlying does not match if ( address(_strategy) != address(0x0) && ((_strategy.underlyingToken() != _token) || !strategyManager.strategyIsWhitelistedForDeposit(_strategy)) ) revert InvalidStrategy(); // check revert if strategy already set and shares greater than 0 if ( address(tokenStrategyMapping[_token]) != address(0x0) && tokenStrategyMapping[_token].userUnderlyingView(address(this)) > 0 ) revert NonZeroUnderlyingStrategyExist(); tokenStrategyMapping[_token] = _strategy; emit TokenStrategyUpdated(_token, _strategy); } /// @dev Sets the address to delegate tokens to in EigenLayer -- THIS CAN ONLY BE SET ONCE function setDelegateAddress( address _delegateAddress, ISignatureUtils.SignatureWithExpiry memory approverSignatureAndExpiry, bytes32 approverSalt ) external nonReentrant onlyOperatorDelegatorAdmin { if (address(_delegateAddress) == address(0x0)) revert InvalidZeroInput(); if (delegationManager.delegatedTo(address(this)) != address(0)) revert DelegateAddressAlreadySet(); delegateAddress = _delegateAddress; delegationManager.delegateTo(delegateAddress, approverSignatureAndExpiry, approverSalt); emit DelegationAddressUpdated(_delegateAddress); } /// @dev updates the baseGasAmountSpent function setBaseGasAmountSpent( uint256 _baseGasAmountSpent ) external nonReentrant onlyOperatorDelegatorAdmin { if (_baseGasAmountSpent == 0) revert InvalidZeroInput(); emit BaseGasAmountSpentUpdated(baseGasAmountSpent, _baseGasAmountSpent); baseGasAmountSpent = _baseGasAmountSpent; } /// @dev sets the EigenLayer RewardsCoordinator address function setRewardsCoordinator( IRewardsCoordinator _rewardsCoordinator ) external nonReentrant onlyOperatorDelegatorAdmin { if (address(_rewardsCoordinator) == address(0)) revert InvalidZeroInput(); emit RewardsCoordinatorUpdated(address(rewardsCoordinator), address(_rewardsCoordinator)); rewardsCoordinator = _rewardsCoordinator; } /// @dev sets the Rewards Destination address function setRewardsDestination( address _rewardsDestination ) external nonReentrant onlyOperatorDelegatorAdmin { if (_rewardsDestination == address(0)) revert InvalidZeroInput(); emit RewardsDestinationUpdated(rewardsDestination, _rewardsDestination); rewardsDestination = _rewardsDestination; } /// @dev Deposit tokens into the EigenLayer. This call assumes any balance of tokens in this contract will be delegated /// so do not directly send tokens here or they will be delegated and attributed to the next caller. /// @return shares The amount of new shares in the `strategy` created as part of the action. function deposit( IERC20 token, uint256 tokenAmount ) external nonReentrant onlyRestakeManager returns (uint256 shares) { if (address(tokenStrategyMapping[token]) == address(0x0) || tokenAmount == 0) revert InvalidZeroInput(); // Move the tokens into this contract token.safeTransferFrom(msg.sender, address(this), tokenAmount); return _deposit(token, tokenAmount); } /** * @notice Perform necessary checks on input data and deposits into EigenLayer * @param _token token interface to deposit * @param _tokenAmount amount of given token to deposit * @return shares shares for deposited amount */ function _deposit(IERC20 _token, uint256 _tokenAmount) internal returns (uint256 shares) { // Approve the strategy manager to spend the tokens _token.safeIncreaseAllowance(address(strategyManager), _tokenAmount); // Deposit the tokens via the strategy manager return strategyManager.depositIntoStrategy(tokenStrategyMapping[_token], _token, _tokenAmount); } /// @dev Gets the index of the specific strategy in EigenLayer in the staker's strategy list function getStrategyIndex(IStrategy _strategy) public view returns (uint256) { // Get the length of the strategy list for this contract uint256 strategyLength = strategyManager.stakerStrategyListLength(address(this)); for (uint256 i = 0; i < strategyLength; i++) { if (strategyManager.stakerStrategyList(address(this), i) == _strategy) { return i; } } // Not found revert NotFound(); } /** * @notice Tracks the pending queued withdrawal shares cause by Operator force undelegating the OperatorDelegator * @dev permissioned call (onlyEmergencyWithdrawTrackingAdmin), * each withdrawal will contain single strategy and respective shares in case of 'ForceUndelegation'. * EigenLayer link - https://github.com/Layr-Labs/eigenlayer-contracts/blob/dev/src/contracts/core/DelegationManager.sol#L242 * @param withdrawals Withdrawals struct list needs to be tracked * @param tokens list of Tokens undelegated by Operator */ function emergencyTrackQueuedWithdrawals( IDelegationManager.Withdrawal[] calldata withdrawals, IERC20[] calldata tokens ) external nonReentrant onlyEmergencyWithdrawTrackingAdmin { // verify array lengths if (tokens.length != withdrawals.length) revert MismatchedArrayLengths(); for (uint256 i = 0; i < withdrawals.length; ) { if (address(tokens[i]) == address(0)) revert InvalidZeroInput(); // calculate withdrawalRoot bytes32 withdrawalRoot = delegationManager.calculateWithdrawalRoot(withdrawals[i]); // verify withdrawal is not tracked if (queuedWithdrawal[withdrawalRoot]) revert WithdrawalAlreadyTracked(); // verify withdrawal is pending and protocol not double counting if (!delegationManager.pendingWithdrawals(withdrawalRoot)) revert WithdrawalAlreadyCompleted(); // verify LST token is not provided if beaconChainETHStrategy in Withdraw Request if ( address(tokens[i]) != IS_NATIVE && withdrawals[i].strategies[0] == delegationManager.beaconChainETHStrategy() ) revert IncorrectStrategy(); // track queued shares for the token queuedShares[address(tokens[i])] += withdrawals[i].shares[0]; // mark the withdrawal root as tracked to avoid double counting queuedWithdrawal[withdrawalRoot] = true; unchecked { ++i; } } } /** * @notice Starts a withdrawal from specified tokens strategies for given amounts * @dev permissioned call (onlyNativeEthRestakeAdmin) * @param tokens list of tokens to withdraw from. For ETH -> 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE * @param tokenAmounts list of token amounts i'th index token in tokens * @return bytes32 withdrawal root */ function queueWithdrawals( IERC20[] calldata tokens, uint256[] calldata tokenAmounts ) external nonReentrant onlyNativeEthRestakeAdmin returns (bytes32) { // record gas spent uint256 gasBefore = gasleft(); if (tokens.length != tokenAmounts.length) revert MismatchedArrayLengths(); IDelegationManager.QueuedWithdrawalParams[] memory queuedWithdrawalParams = new IDelegationManager.QueuedWithdrawalParams[](1); // set strategies legth for 0th index only queuedWithdrawalParams[0].strategies = new IStrategy[](tokens.length); queuedWithdrawalParams[0].shares = new uint256[](tokens.length); // Save the nonce before starting the withdrawal uint96 nonce = uint96(delegationManager.cumulativeWithdrawalsQueued(address(this))); for (uint256 i; i < tokens.length; ) { if (address(tokens[i]) == IS_NATIVE) { // set beaconChainEthStrategy for ETH queuedWithdrawalParams[0].strategies[i] = eigenPodManager.beaconChainETHStrategy(); // set shares for ETH queuedWithdrawalParams[0].shares[i] = tokenAmounts[i]; } else { if (address(tokenStrategyMapping[tokens[i]]) == address(0)) revert InvalidZeroInput(); // set the strategy of the token queuedWithdrawalParams[0].strategies[i] = tokenStrategyMapping[tokens[i]]; // set the equivalent shares for tokenAmount queuedWithdrawalParams[0].shares[i] = tokenStrategyMapping[tokens[i]] .underlyingToSharesView(tokenAmounts[i]); } // set withdrawer as this contract address queuedWithdrawalParams[0].withdrawer = address(this); // track shares of tokens withdraw for TVL queuedShares[address(tokens[i])] += queuedWithdrawalParams[0].shares[i]; unchecked { ++i; } } // queue withdrawal in EigenLayer bytes32 withdrawalRoot = delegationManager.queueWithdrawals(queuedWithdrawalParams)[0]; // track protocol queued withdrawals queuedWithdrawal[withdrawalRoot] = true; // Emit the withdrawal started event emit WithdrawStarted( withdrawalRoot, address(this), delegateAddress, address(this), nonce, block.number, queuedWithdrawalParams[0].strategies, queuedWithdrawalParams[0].shares ); // update the gas spent for RestakeAdmin _recordGas(gasBefore, NOMINAL_BASE_GAS_SPENT); return withdrawalRoot; } /** * @notice Complete the specified withdrawal, * @dev permissioned call (onlyNativeEthRestakeAdmin) * @param withdrawal Withdrawal struct * @param tokens list of tokens to withdraw * @param middlewareTimesIndex is the index in the operator that the staker who triggered the withdrawal was delegated to's middleware times array */ function completeQueuedWithdrawal( IDelegationManager.Withdrawal calldata withdrawal, IERC20[] calldata tokens, uint256 middlewareTimesIndex ) external nonReentrant onlyNativeEthRestakeAdmin { uint256 gasBefore = gasleft(); if (tokens.length != withdrawal.strategies.length) revert MismatchedArrayLengths(); // complete the queued withdrawal from EigenLayer with receiveAsToken set to true delegationManager.completeQueuedWithdrawal(withdrawal, tokens, middlewareTimesIndex, true); _reduceQueuedShares(withdrawal, tokens); _fillBufferAndReDeposit(); // emits the Withdraw Completed event with withdrawalRoot emit WithdrawCompleted( delegationManager.calculateWithdrawalRoot(withdrawal), withdrawal.strategies, withdrawal.shares ); // record current spent gas _recordGas(gasBefore, NOMINAL_BASE_GAS_SPENT); } function completeQueuedWithdrawals( IDelegationManager.Withdrawal[] calldata withdrawals, IERC20[][] calldata tokens, uint256[] calldata middlewareTimesIndexes, bool[] calldata receiveAsTokens ) external nonReentrant onlyNativeEthRestakeAdmin { uint256 gasBefore = gasleft(); if ( withdrawals.length != tokens.length || withdrawals.length != middlewareTimesIndexes.length || withdrawals.length != receiveAsTokens.length ) revert MismatchedArrayLengths(); // complete queued withdrawals delegationManager.completeQueuedWithdrawals( withdrawals, tokens, middlewareTimesIndexes, receiveAsTokens ); // track queued shares and fill buffer for (uint256 i = 0; i < withdrawals.length; ) { if (tokens[i].length != withdrawals[i].strategies.length) revert MismatchedArrayLengths(); // revert if receiveAsToken is false if (!receiveAsTokens[i]) revert OnlyReceiveAsTokenAllowed(); // reduce queued shares for every withdrawal _reduceQueuedShares(withdrawals[i], tokens[i]); // emits the Withdraw Completed event with withdrawalRoot emit WithdrawCompleted( delegationManager.calculateWithdrawalRoot(withdrawals[i]), withdrawals[i].strategies, withdrawals[i].shares ); unchecked { ++i; } } // fill buffer and redeposit remaining _fillBufferAndReDeposit(); // record current spent gas _recordGas(gasBefore, NOMINAL_BASE_GAS_SPENT); } /// @dev Gets the underlying token amount from the amount of shares + queued withdrawal shares function getTokenBalanceFromStrategy(IERC20 token) external view returns (uint256) { return queuedShares[address(token)] == 0 ? tokenStrategyMapping[token].userUnderlyingView(address(this)) : tokenStrategyMapping[token].userUnderlyingView(address(this)) + tokenStrategyMapping[token].sharesToUnderlyingView( queuedShares[address(token)] ); } /// @dev Gets the amount of ETH staked in the EigenLayer function getStakedETHBalance() external view returns (uint256) { // check if completed checkpoint in not synced with OperatorDelegator _checkCheckpointSync(); // amount of ETH in partial withdrawals. i.e. Rewards. // Note: rewards will be part of TVL once claimed and restaked uint256 podDelta = (uint256(eigenPod.withdrawableRestakedExecutionLayerGwei()) * GWEI_TO_WEI > totalBeaconChainExitBalance) ? uint256(eigenPod.withdrawableRestakedExecutionLayerGwei()) * GWEI_TO_WEI - totalBeaconChainExitBalance : 0; // accounts for current podOwner shares + stakedButNotVerified ETH + queued withdraw shares - podDelta int256 podOwnerShares = eigenPodManager.podOwnerShares(address(this)); return podOwnerShares < 0 ? (queuedShares[IS_NATIVE] + stakedButNotVerifiedEth - uint256(-podOwnerShares)) - podDelta : (queuedShares[IS_NATIVE] + stakedButNotVerifiedEth + uint256(podOwnerShares)) - podDelta; } /// @dev Stake ETH in the EigenLayer /// Only the Restake Manager should call this function function stakeEth( bytes calldata pubkey, bytes calldata signature, bytes32 depositDataRoot ) external payable onlyRestakeManager { // if validator withdraw credentials is verified if (eigenPod.validatorStatus(pubkey) == IEigenPod.VALIDATOR_STATUS.INACTIVE) { bytes32 validatorPubKeyHash = _calculateValidatorPubkeyHash(pubkey); uint256 validatorCurrentStakedButNotVerifiedEth = validatorStakedButNotVerifiedEth[ validatorPubKeyHash ]; uint256 _stakedButNotVerifiedEth = msg.value; uint256 _validatorStakedButNotVerifiedEth = validatorCurrentStakedButNotVerifiedEth + msg.value; // check if new value addition is greater than MAX_STAKE_BUT_NOT_VERIFIED_AMOUNT if ( validatorCurrentStakedButNotVerifiedEth + msg.value > MAX_STAKE_BUT_NOT_VERIFIED_AMOUNT ) { // stakedButNotVerifiedETH per validator max capped to MAX_STAKE_BUT_NOT_VERIFIED_AMOUNT _stakedButNotVerifiedEth = MAX_STAKE_BUT_NOT_VERIFIED_AMOUNT - validatorCurrentStakedButNotVerifiedEth; // validatorStakedButNotVerifiedEth max cap to MAX_STAKE_BUT_NOT_VERIFIED_AMOUNT per validator _validatorStakedButNotVerifiedEth = MAX_STAKE_BUT_NOT_VERIFIED_AMOUNT; } validatorStakedButNotVerifiedEth[ validatorPubKeyHash ] = _validatorStakedButNotVerifiedEth; // Increment the staked but not verified ETH stakedButNotVerifiedEth += _stakedButNotVerifiedEth; } // Call the stake function in the EigenPodManager eigenPodManager.stake{ value: msg.value }(pubkey, signature, depositDataRoot); } /// @dev Verifies the withdrawal credentials for a withdrawal /// This will allow the EigenPodManager to verify the withdrawal credentials and credit the OD with shares /// Only the native eth restake admin should call this function function verifyWithdrawalCredentials( uint64 oracleTimestamp, BeaconChainProofs.StateRootProof calldata stateRootProof, uint40[] calldata validatorIndices, bytes[] calldata withdrawalCredentialProofs, bytes32[][] calldata validatorFields ) external onlyNativeEthRestakeAdmin { uint256 gasBefore = gasleft(); eigenPod.verifyWithdrawalCredentials( oracleTimestamp, stateRootProof, validatorIndices, withdrawalCredentialProofs, validatorFields ); // Decrement the staked but not verified ETH for (uint256 i = 0; i < validatorFields.length; ) { bytes32 validatorPubkeyHash = validatorFields[i].getPubkeyHash(); // decrement total stakedButNotVerifiedEth by validatorStakedButNotVerifiedEth if (validatorStakedButNotVerifiedEth[validatorPubkeyHash] != 0) { stakedButNotVerifiedEth -= validatorStakedButNotVerifiedEth[validatorPubkeyHash]; } else { // fallback to decrement total stakedButNotVerifiedEth by MAX_STAKE_BUT_NOT_VERIFIED_AMOUNT stakedButNotVerifiedEth -= MAX_STAKE_BUT_NOT_VERIFIED_AMOUNT; } // set validatorStakedButNotVerifiedEth value to 0 validatorStakedButNotVerifiedEth[validatorPubkeyHash] = 0; unchecked { ++i; } } // update the gas spent for RestakeAdmin _recordGas(gasBefore, baseGasAmountSpent); } /** * @notice Tracks the Exit Balance for checkpoints started outside OperatorDelegator. i.e. Through verifyStaleBalance. * @dev Permissioned call by only * @param missedCheckpoints . */ function emergencyTrackMissedCheckpoint( uint64[] memory missedCheckpoints ) external onlyEmergencyCheckpointTrackingAdmin { uint64 latestCheckpoint; for (uint256 i = 0; i < missedCheckpoints.length; ) { // revert if checkpoint already recorded if (recordedCheckpoints[missedCheckpoints[i]]) revert CheckpointAlreadyRecorded(); // update totalBeaconChainExitBalance uint256 totalBeaconChainExitBalanceGwei = eigenPod.checkpointBalanceExitedGwei( missedCheckpoints[i] ); totalBeaconChainExitBalance += (totalBeaconChainExitBalanceGwei * GWEI_TO_WEI); // mark the checkpoint as recorded recordedCheckpoints[missedCheckpoints[i]] = true; // if current missedCheckpoint is greated than latestCheckpoint if (missedCheckpoints[i] > latestCheckpoint) { // update the latestCheckpoint latestCheckpoint = missedCheckpoints[i]; } unchecked { ++i; } } // record the latestCheckpoint as lastCheckpointTimestamp lastCheckpointTimestamp = latestCheckpoint; } /** * @notice Starts a checkpoint on the eigenPod * @dev permissioned call by NativeEthRestakeAdmin */ function startCheckpoint() external onlyNativeEthRestakeAdmin { // check if any active checkpoint if (currentCheckpointTimestamp != 0) revert CheckpointAlreadyActive(); // check for checkpoint sync _checkCheckpointSync(); // start checkpoint eigenPod.startCheckpoint(true); // track the current checkpoint timestamp currentCheckpointTimestamp = eigenPod.currentCheckpointTimestamp(); // record the checkpoint recordedCheckpoints[currentCheckpointTimestamp] = true; } /** * @notice Verify Checkpoint Proofs on EigenPod for currently active checkpoint and tracks exited validator balance * @dev permissioned call by NativeEthRestakeAdmin * @param balanceContainerProof proves the beacon's current balance container root against a checkpoint's `beaconBlockRoot` * @param proofs Proofs for one or more validator current balances against the `balanceContainerRoot` */ function verifyCheckpointProofs( BeaconChainProofs.BalanceContainerProof calldata balanceContainerProof, BeaconChainProofs.BalanceProof[] calldata proofs ) external onlyNativeEthRestakeAdmin { // Note: try catch is used to prevent revert condition as checkpoints can be verified externally try eigenPod.verifyCheckpointProofs(balanceContainerProof, proofs) {} catch {} // if checkpoint completed. i.e eigenPod.lastCheckpointTimestamp() == currentCheckpointTimestamp if (eigenPod.lastCheckpointTimestamp() == currentCheckpointTimestamp) { // add the last completed checkpoint Exited balance in WEI uint256 totalBeaconChainExitBalanceGwei = eigenPod.checkpointBalanceExitedGwei( currentCheckpointTimestamp ); totalBeaconChainExitBalance += (totalBeaconChainExitBalanceGwei * GWEI_TO_WEI); // track completed checkpoint as last completed checkpoint lastCheckpointTimestamp = currentCheckpointTimestamp; // reset current checkpoint delete currentCheckpointTimestamp; } } /** * @notice Claim ERC20 rewards from EigenLayer * @dev Permissioned call only by EigenLayerRewardsAdmin * @param claim RewardsMerkleClaim object to process claim */ function claimRewards( IRewardsCoordinator.RewardsMerkleClaim calldata claim ) external onlyEigenLayerRewardsAdmin { // check revert if reward destination not set if (rewardsDestination == address(0)) revert RewardsDestinationNotConfigured(); uint256 gasBefore = gasleft(); rewardsCoordinator.processClaim(claim, address(this)); // process claimed rewards. i.e. If supported collateral asset then restake otherwise forward to rewards Destination for (uint256 i = 0; i < claim.tokenLeaves.length; ) { if (address(claim.tokenLeaves[i].token) == WETH) { uint256 amount = IERC20(WETH).balanceOf(address(this)); // withdraw WETH to ETH IWeth(WETH).withdraw(amount); // process ETH _processETH(); // (bool success, ) = address(this).call{ value: amount }(""); // if (!success) revert TransferFailed(); } else if (address(tokenStrategyMapping[claim.tokenLeaves[i].token]) != address(0)) { // if token supported as collateral then restake _deposit( claim.tokenLeaves[i].token, claim.tokenLeaves[i].token.balanceOf(address(this)) ); } else { // if token not supported then send to rewardsDestination claim.tokenLeaves[i].token.safeTransfer( rewardsDestination, claim.tokenLeaves[i].token.balanceOf(address(this)) ); } unchecked { ++i; } } // update the gas spent for RewardsAdmin _recordGas(gasBefore, baseGasAmountSpent); } // /** // * @notice Verify many Withdrawals and process them in the EigenPod // * @dev For each withdrawal (partial or full), verify it in the EigenPod // * Only callable by admin. // * @param oracleTimestamp . // * @param stateRootProof . // * @param withdrawalProofs . // * @param validatorFieldsProofs . // * @param validatorFields . // * @param withdrawalFields . // */ // function verifyAndProcessWithdrawals( // uint64 oracleTimestamp, // BeaconChainProofs.StateRootProof calldata stateRootProof, // BeaconChainProofs.WithdrawalProof[] calldata withdrawalProofs, // bytes[] calldata validatorFieldsProofs, // bytes32[][] calldata validatorFields, // bytes32[][] calldata withdrawalFields // ) external onlyNativeEthRestakeAdmin { // uint256 gasBefore = gasleft(); // eigenPod.verifyAndProcessWithdrawals( // oracleTimestamp, // stateRootProof, // withdrawalProofs, // validatorFieldsProofs, // validatorFields, // withdrawalFields // ); // // update the gas spent for RestakeAdmin // _recordGas(gasBefore, baseGasAmountSpent); // } // /** // * @notice Pull out any ETH in the EigenPod that is not from the beacon chain // * @dev Only callable by admin // * @param recipient Where to send the ETH // * @param amountToWithdraw Amount to pull out // */ // function withdrawNonBeaconChainETHBalanceWei( // address recipient, // uint256 amountToWithdraw // ) external onlyNativeEthRestakeAdmin { // eigenPod.withdrawNonBeaconChainETHBalanceWei(recipient, amountToWithdraw); // } /** * @notice Recover tokens accidentally sent to EigenPod * @dev Only callable by admin * @param tokenList . * @param amountsToWithdraw . * @param recipient . */ function recoverTokens( IERC20[] memory tokenList, uint256[] memory amountsToWithdraw, address recipient ) external onlyNativeEthRestakeAdmin { eigenPod.recoverTokens(tokenList, amountsToWithdraw, recipient); } // /** // * @notice Starts a delayed withdraw of the ETH from the EigenPodManager // * @dev Before the eigenpod is verified, we can sweep out any accumulated ETH from the Consensus layer validator rewards // * We also want to track the amount in the delayed withdrawal router so we can track the TVL and reward amount accurately // */ // function startDelayedWithdrawUnstakedETH() external onlyNativeEthRestakeAdmin { // // Call the start delayed withdraw function in the EigenPodManager // // This will queue up a delayed withdrawal that will be sent back to this address after the timeout // eigenPod.withdrawBeforeRestaking(); // } /** * @notice Adds the amount of gas spent for an account * @dev Tracks for later redemption from rewards coming from the DWR * @param initialGas . */ function _recordGas(uint256 initialGas, uint256 baseGasAmount) internal { uint256 gasSpent = (initialGas - gasleft() + baseGasAmount) * block.basefee; adminGasSpentInWei[msg.sender] += gasSpent; emit GasSpent(msg.sender, gasSpent); } ///@notice Calculates the pubkey hash of a validator's pubkey as per SSZ spec /// @dev using same calculation as EigenPod _calculateValidatorPubkeyHash function _calculateValidatorPubkeyHash( bytes memory validatorPubkey ) internal pure returns (bytes32) { return sha256(abi.encodePacked(validatorPubkey, bytes16(0))); } /** * @notice Send owed refunds to the admin * @dev . * @return uint256 . */ function _refundGas() internal returns (uint256) { uint256 gasRefund = address(this).balance >= adminGasSpentInWei[tx.origin] ? adminGasSpentInWei[tx.origin] : address(this).balance; bool success = payable(tx.origin).send(gasRefund); if (!success) revert TransferFailed(); // reset gas spent by admin adminGasSpentInWei[tx.origin] -= gasRefund; emit GasRefunded(tx.origin, gasRefund); return gasRefund; } /// @dev Allows only a whitelisted address to configure the contract function _onlyOperatorDelegatorAdmin() internal view { if (!roleManager.isOperatorDelegatorAdmin(msg.sender)) revert NotOperatorDelegatorAdmin(); } /// @dev Allows only a whitelisted address to configure the contract function _onlyNativeEthRestakeAdmin() internal view { if (!roleManager.isNativeEthRestakeAdmin(msg.sender)) revert NotNativeEthRestakeAdmin(); } /// @dev Allows only the RestakeManager address to call functions function _onlyRestakeManager() internal view { if (msg.sender != address(restakeManager)) revert NotRestakeManager(); } /** * @notice revert if lastCheckpointTimestamp is not recorded * 1. To prevent deposits when checkpoint was started through verifyStaleBalance * and then completed but not recorded by OperatorDelegator through emergencytrackCheckpoint. * 2. Can also prevent deposits when checkpoint was started through OperatorDelegator * but not completed through OD i.e. not recorded in OperatorDelegator. * 3. Prevents starting new checkpoint through operatorDelegator if lastcheckpoint timestamps are not synced * * @dev Checks if the lastCheckpointTimestamp of OD is synced with EigenPod * reverts if any completed checkpoint is not synced in OD */ function _checkCheckpointSync() internal view { uint64 eigenPodLastCheckpointTimestamp = eigenPod.lastCheckpointTimestamp(); if ( eigenPodLastCheckpointTimestamp != 0 && lastCheckpointTimestamp != 0 && eigenPodLastCheckpointTimestamp > lastCheckpointTimestamp ) revert CheckpointNotRecorded(); } /** * @notice Reduces queued shares for collateral asset in withdrawal request * @dev checks for any Invalid collateral asset provided in withdrawal request * @param withdrawal Withdrawal request struct on EigenLayer * @param tokens list of tokens in withdrawal request */ function _reduceQueuedShares( IDelegationManager.Withdrawal calldata withdrawal, IERC20[] memory tokens ) internal { for (uint256 i; i < tokens.length; ) { if (address(tokens[i]) == address(0)) revert InvalidZeroInput(); if ( address(tokens[i]) != IS_NATIVE && withdrawal.strategies[i] == delegationManager.beaconChainETHStrategy() ) revert IncorrectStrategy(); // deduct queued shares for tracking TVL queuedShares[address(tokens[i])] -= withdrawal.shares[i]; unchecked { ++i; } } } /** * @notice Fill withdraw buffer for all ERC20 collateral asset and reDeposit remaining asset */ function _fillBufferAndReDeposit() internal { IWithdrawQueue withdrawQueue = restakeManager.depositQueue().withdrawQueue(); for (uint256 i = 0; i < restakeManager.getCollateralTokensLength(); ) { IERC20 token = restakeManager.collateralTokens(i); // Check the withdraw buffer and fill if below buffer target uint256 bufferToFill = withdrawQueue.getWithdrawDeficit(address(token)); // get balance of this contract uint256 balanceOfToken = token.balanceOf(address(this)); if (bufferToFill > 0) { bufferToFill = (balanceOfToken <= bufferToFill) ? balanceOfToken : bufferToFill; // update amount to send to the operator Delegator balanceOfToken -= bufferToFill; // safe Approve for depositQueue token.safeIncreaseAllowance(address(restakeManager.depositQueue()), bufferToFill); // fill Withdraw Buffer via depositQueue restakeManager.depositQueue().fillERC20withdrawBuffer(address(token), bufferToFill); } // Deposit remaining token back to eigenLayer if (balanceOfToken > 0) { _deposit(token, balanceOfToken); } unchecked { ++i; } } } /** * @notice process ETH received by contract */ function _processETH() internal { uint256 remainingAmount = address(this).balance; // check if any pending Exit Balance if (totalBeaconChainExitBalance > 0) { uint256 exitedBalanceToForward = address(this).balance > totalBeaconChainExitBalance ? totalBeaconChainExitBalance : address(this).balance; // forward exited balance as fullWithdrawal restakeManager.depositQueue().forwardFullWithdrawalETH{ value: exitedBalanceToForward }(); // reduce totalBeaconChainExitBalance totalBeaconChainExitBalance -= exitedBalanceToForward; // update remaining amount remainingAmount -= exitedBalanceToForward; // check and return if remaining amount is 0 if (remainingAmount == 0) { return; } } // considered the remaining amount as protocol rewards uint256 gasRefunded = 0; if (adminGasSpentInWei[tx.origin] > 0) { gasRefunded = _refundGas(); // update the remaining amount remainingAmount -= gasRefunded; // If no funds left, return if (remainingAmount == 0) { return; } } // Forward remaining balance to the deposit queue address destination = address(restakeManager.depositQueue()); (bool success, ) = destination.call{ value: remainingAmount }(""); if (!success) revert TransferFailed(); emit RewardsForwarded(destination, remainingAmount); } /** * @notice Users should NOT send ETH directly to this contract unless they want to donate to existing ezETH holders. * This is an internal protocol function. * @dev Handle ETH sent to this contract - will get forwarded to the deposit queue for restaking as a protocol reward * @dev If msg.sender is eigenPod then forward ETH to deposit queue without taking cut (i.e. full withdrawal from beacon chain) */ receive() external payable { // if ETH coming from WETH then return if (msg.sender == WETH) { return; } // process ETH _processETH(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// 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: MIT // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IWeth { function deposit() external payable; function withdraw(uint256 value) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../EigenLayer/interfaces/IStrategyManager.sol"; import "../EigenLayer/interfaces/IDelegationManager.sol"; import "../EigenLayer/interfaces/IEigenPod.sol"; interface IOperatorDelegator { function getTokenBalanceFromStrategy(IERC20 token) external view returns (uint256); function deposit(IERC20 _token, uint256 _tokenAmount) external returns (uint256 shares); // Note: Withdraws disabled for this release // function startWithdrawal(IERC20 _token, uint256 _tokenAmount) external returns (bytes32); // function completeWithdrawal( // IStrategyManager.DeprecatedStruct_QueuedWithdrawal calldata _withdrawal, // IERC20 _token, // uint256 _middlewareTimesIndex, // address _sendToAddress // ) external; function getStakedETHBalance() external view returns (uint256); function stakeEth( bytes calldata pubkey, bytes calldata signature, bytes32 depositDataRoot ) external payable; function eigenPod() external view returns (IEigenPod); function pendingUnstakedDelayedWithdrawalAmount() external view returns (uint256); function delegateAddress() external view returns (address); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; import "../Permissions/IRoleManager.sol"; import "../EigenLayer/interfaces/IStrategy.sol"; import "../EigenLayer/interfaces/IStrategyManager.sol"; import "../EigenLayer/interfaces/IDelegationManager.sol"; import "../EigenLayer/interfaces/IEigenPod.sol"; import "../EigenLayer/interfaces/IRewardsCoordinator.sol"; import "./IOperatorDelegator.sol"; import "../IRestakeManager.sol"; import "./utils/WETHUnwrapper.sol"; /// @title OperatorDelegatorStorage /// @dev This contract will hold all local variables for the Contract /// When upgrading the protocol, inherit from this contract on the V2 version and change the /// StorageManager to inherit from the later version. This ensures there are no storage layout /// corruptions when upgrading. abstract contract OperatorDelegatorStorageV1 is IOperatorDelegator { /// @dev reference to the RoleManager contract IRoleManager public roleManager; /// @dev The main strategy manager contract in EigenLayer IStrategyManager public strategyManager; /// @dev the restake manager contract IRestakeManager public restakeManager; /// @dev The mapping of supported token addresses to their respective strategy addresses /// This will control which tokens are supported by the protocol mapping(IERC20 => IStrategy) public tokenStrategyMapping; /// @dev The address to delegate tokens to in EigenLayer address public delegateAddress; /// @dev the delegation manager contract IDelegationManager public delegationManager; /// @dev the EigenLayer EigenPodManager contract IEigenPodManager public eigenPodManager; /// @dev The EigenPod owned by this contract IEigenPod public eigenPod; /// @dev Tracks the balance that was staked to validators but hasn't been restaked to EL yet uint256 public stakedButNotVerifiedEth; } abstract contract OperatorDelegatorStorageV2 is OperatorDelegatorStorageV1 { /// @dev - DEPRECATED - This variable is no longer used uint256 public pendingUnstakedDelayedWithdrawalAmount; } abstract contract OperatorDelegatorStorageV3 is OperatorDelegatorStorageV2 { /// @dev A base tx gas amount for a transaction to be added for redemption later - in gas units uint256 public baseGasAmountSpent; /// @dev A mapping to track how much gas was spent by an address mapping(address => uint256) public adminGasSpentInWei; } abstract contract OperatorDelegatorStorageV4 is OperatorDelegatorStorageV3 { /// @dev mapping of token shares in withdraw queue of EigenLayer mapping(address => uint256) public queuedShares; /// @dev bool mapping to track if withdrawal is already queued by withdrawalRoot mapping(bytes32 => bool) public queuedWithdrawal; /// @dev mapping of validatorStakedButNotVerifiedEth with the key as validatorPubkeyHash mapping(bytes32 => uint256) public validatorStakedButNotVerifiedEth; } abstract contract OperatorDelegatorStorageV5 is OperatorDelegatorStorageV4 { /// @dev EigenLayer Rewards Coordinator IRewardsCoordinator public rewardsCoordinator; /// @dev EigenLayer Rewards Destination address public rewardsDestination; } abstract contract OperatorDelegatorStorageV6 is OperatorDelegatorStorageV5 { /// @dev Tracks total amount of BeaconChain Eth exited uint256 public totalBeaconChainExitBalance; /// @dev Tracks currently verifying checkpoint timestamp uint64 public currentCheckpointTimestamp; } abstract contract OperatorDelegatorStorageV7 is OperatorDelegatorStorageV6 { /// @notice Deprecated, not using anymore /// @dev WETHunwrapper to unwrape WETH received by EigenLayerRewards WETHUnwrapper public wethUnwrapper; } abstract contract OperatorDelegatorStorageV8 is OperatorDelegatorStorageV7 { /// @dev Tracks all the recorded checkpoints mapping(uint64 => bool) public recordedCheckpoints; } abstract contract OperatorDelegatorStorageV9 is OperatorDelegatorStorageV8 { /// @dev Tracks the last finalized checkpoint timestamp uint64 public lastCheckpointTimestamp; } /// On the next version of the protocol, if new variables are added, put them in the below /// contract and use this as the inheritance chain. // abstract contract OperatorDelegatorStorageV8 is OperatorDelegatorStorageV7 { // }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "../../Bridge/Connext/core/IWeth.sol"; import "../../Permissions/IRoleManager.sol"; import "../../Errors/Errors.sol"; // Note: Deprecated, not using anymore after PEPE upgrade contract WETHUnwrapper is Initializable { using SafeERC20 for IERC20; IWeth constant WETH = IWeth(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); constructor() { _disableInitializers(); } function unwrapWETH(uint256 amount) external { // transfer WETH from caller to this contract IERC20(address(WETH)).safeTransferFrom(msg.sender, address(this), amount); // unwrap WETH to ETH WETH.withdraw(amount); // transfer unwrapped WETH to caller (bool success, ) = msg.sender.call{ value: amount }(""); if (!success) revert TransferFailed(); } receive() external payable { // only accept ETH from WETH if (msg.sender != address(WETH)) revert UnAuthorisedCall(); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; import "../Withdraw/IWithdrawQueue.sol"; interface IDepositQueue { function depositETHFromProtocol() external payable; function totalEarned(address tokenAddress) external view returns (uint256); function forwardFullWithdrawalETH() external payable; function withdrawQueue() external view returns (IWithdrawQueue); function fillERC20withdrawBuffer(address _asset, uint256 _amount) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "./IStrategy.sol"; import "./ISignatureUtils.sol"; import "./IStrategyManager.sol"; /** * @title DelegationManager * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice This is the contract for delegation in EigenLayer. The main functionalities of this contract are * - enabling anyone to register as an operator in EigenLayer * - allowing operators to specify parameters related to stakers who delegate to them * - enabling any staker to delegate its stake to the operator of its choice (a given staker can only delegate to a single operator at a time) * - enabling a staker to undelegate its assets from the operator it is delegated to (performed as part of the withdrawal process, initiated through the StrategyManager) */ interface IDelegationManager is ISignatureUtils { // Access to public vars - hack locally function beaconChainETHStrategy() external returns (IStrategy); function pendingWithdrawals(bytes32 withdrawalRoot) external view returns (bool); function getDelegatableShares( address staker ) external view returns (IStrategy[] memory, uint256[] memory); // @notice Struct used for storing information about a single operator who has registered with EigenLayer struct OperatorDetails { // @notice address to receive the rewards that the operator earns via serving applications built on EigenLayer. address earningsReceiver; /** * @notice Address to verify signatures when a staker wishes to delegate to the operator, as well as controlling "forced undelegations". * @dev Signature verification follows these rules: * 1) If this address is left as address(0), then any staker will be free to delegate to the operator, i.e. no signature verification will be performed. * 2) If this address is an EOA (i.e. it has no code), then we follow standard ECDSA signature verification for delegations to the operator. * 3) If this address is a contract (i.e. it has code) then we forward a call to the contract and verify that it returns the correct EIP-1271 "magic value". */ address delegationApprover; /** * @notice A minimum delay -- measured in blocks -- enforced between: * 1) the operator signalling their intent to register for a service, via calling `Slasher.optIntoSlashing` * and * 2) the operator completing registration for the service, via the service ultimately calling `Slasher.recordFirstStakeUpdate` * @dev note that for a specific operator, this value *cannot decrease*, i.e. if the operator wishes to modify their OperatorDetails, * then they are only allowed to either increase this value or keep it the same. */ uint32 stakerOptOutWindowBlocks; } /** * @notice Abstract struct used in calculating an EIP712 signature for a staker to approve that they (the staker themselves) delegate to a specific operator. * @dev Used in computing the `STAKER_DELEGATION_TYPEHASH` and as a reference in the computation of the stakerDigestHash in the `delegateToBySignature` function. */ struct StakerDelegation { // the staker who is delegating address staker; // the operator being delegated to address operator; // the staker's nonce uint256 nonce; // the expiration timestamp (UTC) of the signature uint256 expiry; } /** * @notice Abstract struct used in calculating an EIP712 signature for an operator's delegationApprover to approve that a specific staker delegate to the operator. * @dev Used in computing the `DELEGATION_APPROVAL_TYPEHASH` and as a reference in the computation of the approverDigestHash in the `_delegate` function. */ struct DelegationApproval { // the staker who is delegating address staker; // the operator being delegated to address operator; // the operator's provided salt bytes32 salt; // the expiration timestamp (UTC) of the signature uint256 expiry; } /** * Struct type used to specify an existing queued withdrawal. Rather than storing the entire struct, only a hash is stored. * In functions that operate on existing queued withdrawals -- e.g. completeQueuedWithdrawal`, the data is resubmitted and the hash of the submitted * data is computed by `calculateWithdrawalRoot` and checked against the stored hash in order to confirm the integrity of the submitted data. */ struct Withdrawal { // The address that originated the Withdrawal address staker; // The address that the staker was delegated to at the time that the Withdrawal was created address delegatedTo; // The address that can complete the Withdrawal + will receive funds when completing the withdrawal address withdrawer; // Nonce used to guarantee that otherwise identical withdrawals have unique hashes uint256 nonce; // Block number when the Withdrawal was created uint32 startBlock; // Array of strategies that the Withdrawal contains IStrategy[] strategies; // Array containing the amount of shares in each Strategy in the `strategies` array uint256[] shares; } struct QueuedWithdrawalParams { // Array of strategies that the QueuedWithdrawal contains IStrategy[] strategies; // Array containing the amount of shares in each Strategy in the `strategies` array uint256[] shares; // The address of the withdrawer address withdrawer; } // @notice Emitted when a new operator registers in EigenLayer and provides their OperatorDetails. event OperatorRegistered(address indexed operator, OperatorDetails operatorDetails); /// @notice Emitted when an operator updates their OperatorDetails to @param newOperatorDetails event OperatorDetailsModified(address indexed operator, OperatorDetails newOperatorDetails); /** * @notice Emitted when @param operator indicates that they are updating their MetadataURI string * @dev Note that these strings are *never stored in storage* and are instead purely emitted in events for off-chain indexing */ event OperatorMetadataURIUpdated(address indexed operator, string metadataURI); /// @notice Emitted whenever an operator's shares are increased for a given strategy. Note that shares is the delta in the operator's shares. event OperatorSharesIncreased( address indexed operator, address staker, IStrategy strategy, uint256 shares ); /// @notice Emitted whenever an operator's shares are decreased for a given strategy. Note that shares is the delta in the operator's shares. event OperatorSharesDecreased( address indexed operator, address staker, IStrategy strategy, uint256 shares ); /// @notice Emitted when @param staker delegates to @param operator. event StakerDelegated(address indexed staker, address indexed operator); /// @notice Emitted when @param staker undelegates from @param operator. event StakerUndelegated(address indexed staker, address indexed operator); /// @notice Emitted when @param staker is undelegated via a call not originating from the staker themself event StakerForceUndelegated(address indexed staker, address indexed operator); /** * @notice Emitted when a new withdrawal is queued. * @param withdrawalRoot Is the hash of the `withdrawal`. * @param withdrawal Is the withdrawal itself. */ event WithdrawalQueued(bytes32 withdrawalRoot, Withdrawal withdrawal); /// @notice Emitted when a queued withdrawal is completed event WithdrawalCompleted(bytes32 withdrawalRoot); /// @notice Emitted when a queued withdrawal is *migrated* from the StrategyManager to the DelegationManager event WithdrawalMigrated(bytes32 oldWithdrawalRoot, bytes32 newWithdrawalRoot); /// @notice Emitted when the `minWithdrawalDelayBlocks` variable is modified from `previousValue` to `newValue`. event MinWithdrawalDelayBlocksSet(uint256 previousValue, uint256 newValue); /// @notice Emitted when the `strategyWithdrawalDelayBlocks` variable is modified from `previousValue` to `newValue`. event StrategyWithdrawalDelayBlocksSet( IStrategy strategy, uint256 previousValue, uint256 newValue ); /** * @notice Registers the caller as an operator in EigenLayer. * @param registeringOperatorDetails is the `OperatorDetails` for the operator. * @param metadataURI is a URI for the operator's metadata, i.e. a link providing more details on the operator. * * @dev Once an operator is registered, they cannot 'deregister' as an operator, and they will forever be considered "delegated to themself". * @dev This function will revert if the caller attempts to set their `earningsReceiver` to address(0). * @dev Note that the `metadataURI` is *never stored * and is only emitted in the `OperatorMetadataURIUpdated` event */ function registerAsOperator( OperatorDetails calldata registeringOperatorDetails, string calldata metadataURI ) external; /** * @notice Updates an operator's stored `OperatorDetails`. * @param newOperatorDetails is the updated `OperatorDetails` for the operator, to replace their current OperatorDetails`. * * @dev The caller must have previously registered as an operator in EigenLayer. * @dev This function will revert if the caller attempts to set their `earningsReceiver` to address(0). */ function modifyOperatorDetails(OperatorDetails calldata newOperatorDetails) external; /** * @notice Called by an operator to emit an `OperatorMetadataURIUpdated` event indicating the information has updated. * @param metadataURI The URI for metadata associated with an operator * @dev Note that the `metadataURI` is *never stored * and is only emitted in the `OperatorMetadataURIUpdated` event */ function updateOperatorMetadataURI(string calldata metadataURI) external; /** * @notice Caller delegates their stake to an operator. * @param operator The account (`msg.sender`) is delegating its assets to for use in serving applications built on EigenLayer. * @param approverSignatureAndExpiry Verifies the operator approves of this delegation * @param approverSalt A unique single use value tied to an individual signature. * @dev The approverSignatureAndExpiry is used in the event that: * 1) the operator's `delegationApprover` address is set to a non-zero value. * AND * 2) neither the operator nor their `delegationApprover` is the `msg.sender`, since in the event that the operator * or their delegationApprover is the `msg.sender`, then approval is assumed. * @dev In the event that `approverSignatureAndExpiry` is not checked, its content is ignored entirely; it's recommended to use an empty input * in this case to save on complexity + gas costs */ function delegateTo( address operator, SignatureWithExpiry memory approverSignatureAndExpiry, bytes32 approverSalt ) external; /** * @notice Caller delegates a staker's stake to an operator with valid signatures from both parties. * @param staker The account delegating stake to an `operator` account * @param operator The account (`staker`) is delegating its assets to for use in serving applications built on EigenLayer. * @param stakerSignatureAndExpiry Signed data from the staker authorizing delegating stake to an operator * @param approverSignatureAndExpiry is a parameter that will be used for verifying that the operator approves of this delegation action in the event that: * @param approverSalt Is a salt used to help guarantee signature uniqueness. Each salt can only be used once by a given approver. * * @dev If `staker` is an EOA, then `stakerSignature` is verified to be a valid ECDSA stakerSignature from `staker`, indicating their intention for this action. * @dev If `staker` is a contract, then `stakerSignature` will be checked according to EIP-1271. * @dev the operator's `delegationApprover` address is set to a non-zero value. * @dev neither the operator nor their `delegationApprover` is the `msg.sender`, since in the event that the operator or their delegationApprover * is the `msg.sender`, then approval is assumed. * @dev This function will revert if the current `block.timestamp` is equal to or exceeds the expiry * @dev In the case that `approverSignatureAndExpiry` is not checked, its content is ignored entirely; it's recommended to use an empty input * in this case to save on complexity + gas costs */ function delegateToBySignature( address staker, address operator, SignatureWithExpiry memory stakerSignatureAndExpiry, SignatureWithExpiry memory approverSignatureAndExpiry, bytes32 approverSalt ) external; /** * @notice Undelegates the staker from the operator who they are delegated to. Puts the staker into the "undelegation limbo" mode of the EigenPodManager * and queues a withdrawal of all of the staker's shares in the StrategyManager (to the staker), if necessary. * @param staker The account to be undelegated. * @return withdrawalRoot The root of the newly queued withdrawal, if a withdrawal was queued. Otherwise just bytes32(0). * * @dev Reverts if the `staker` is also an operator, since operators are not allowed to undelegate from themselves. * @dev Reverts if the caller is not the staker, nor the operator who the staker is delegated to, nor the operator's specified "delegationApprover" * @dev Reverts if the `staker` is already undelegated. */ function undelegate(address staker) external returns (bytes32[] memory withdrawalRoot); /** * Allows a staker to withdraw some shares. Withdrawn shares/strategies are immediately removed * from the staker. If the staker is delegated, withdrawn shares/strategies are also removed from * their operator. * * All withdrawn shares/strategies are placed in a queue and can be fully withdrawn after a delay. */ function queueWithdrawals( QueuedWithdrawalParams[] calldata queuedWithdrawalParams ) external returns (bytes32[] memory); /** * @notice Used to complete the specified `withdrawal`. The caller must match `withdrawal.withdrawer` * @param withdrawal The Withdrawal to complete. * @param tokens Array in which the i-th entry specifies the `token` input to the 'withdraw' function of the i-th Strategy in the `withdrawal.strategies` array. * This input can be provided with zero length if `receiveAsTokens` is set to 'false' (since in that case, this input will be unused) * @param middlewareTimesIndex is the index in the operator that the staker who triggered the withdrawal was delegated to's middleware times array * @param receiveAsTokens If true, the shares specified in the withdrawal will be withdrawn from the specified strategies themselves * and sent to the caller, through calls to `withdrawal.strategies[i].withdraw`. If false, then the shares in the specified strategies * will simply be transferred to the caller directly. * @dev middlewareTimesIndex should be calculated off chain before calling this function by finding the first index that satisfies `slasher.canWithdraw` * @dev beaconChainETHStrategy shares are non-transferrable, so if `receiveAsTokens = false` and `withdrawal.withdrawer != withdrawal.staker`, note that * any beaconChainETHStrategy shares in the `withdrawal` will be _returned to the staker_, rather than transferred to the withdrawer, unlike shares in * any other strategies, which will be transferred to the withdrawer. */ function completeQueuedWithdrawal( Withdrawal calldata withdrawal, IERC20[] calldata tokens, uint256 middlewareTimesIndex, bool receiveAsTokens ) external; /** * @notice Array-ified version of `completeQueuedWithdrawal`. * Used to complete the specified `withdrawals`. The function caller must match `withdrawals[...].withdrawer` * @param withdrawals The Withdrawals to complete. * @param tokens Array of tokens for each Withdrawal. See `completeQueuedWithdrawal` for the usage of a single array. * @param middlewareTimesIndexes One index to reference per Withdrawal. See `completeQueuedWithdrawal` for the usage of a single index. * @param receiveAsTokens Whether or not to complete each withdrawal as tokens. See `completeQueuedWithdrawal` for the usage of a single boolean. * @dev See `completeQueuedWithdrawal` for relevant dev tags */ function completeQueuedWithdrawals( Withdrawal[] calldata withdrawals, IERC20[][] calldata tokens, uint256[] calldata middlewareTimesIndexes, bool[] calldata receiveAsTokens ) external; /** * @notice Increases a staker's delegated share balance in a strategy. * @param staker The address to increase the delegated shares for their operator. * @param strategy The strategy in which to increase the delegated shares. * @param shares The number of shares to increase. * * @dev *If the staker is actively delegated*, then increases the `staker`'s delegated shares in `strategy` by `shares`. Otherwise does nothing. * @dev Callable only by the StrategyManager or EigenPodManager. */ function increaseDelegatedShares(address staker, IStrategy strategy, uint256 shares) external; /** * @notice Decreases a staker's delegated share balance in a strategy. * @param staker The address to increase the delegated shares for their operator. * @param strategy The strategy in which to decrease the delegated shares. * @param shares The number of shares to decrease. * * @dev *If the staker is actively delegated*, then decreases the `staker`'s delegated shares in `strategy` by `shares`. Otherwise does nothing. * @dev Callable only by the StrategyManager or EigenPodManager. */ function decreaseDelegatedShares(address staker, IStrategy strategy, uint256 shares) external; /** * @notice returns the address of the operator that `staker` is delegated to. * @notice Mapping: staker => operator whom the staker is currently delegated to. * @dev Note that returning address(0) indicates that the staker is not actively delegated to any operator. */ function delegatedTo(address staker) external view returns (address); /** * @notice Returns the OperatorDetails struct associated with an `operator`. */ function operatorDetails(address operator) external view returns (OperatorDetails memory); /* * @notice Returns the earnings receiver address for an operator */ function earningsReceiver(address operator) external view returns (address); /** * @notice Returns the delegationApprover account for an operator */ function delegationApprover(address operator) external view returns (address); /** * @notice Returns the stakerOptOutWindowBlocks for an operator */ function stakerOptOutWindowBlocks(address operator) external view returns (uint256); /** * @notice Given array of strategies, returns array of shares for the operator */ function getOperatorShares( address operator, IStrategy[] memory strategies ) external view returns (uint256[] memory); /** * @notice Given a list of strategies, return the minimum number of blocks that must pass to withdraw * from all the inputted strategies. Return value is >= minWithdrawalDelayBlocks as this is the global min withdrawal delay. * @param strategies The strategies to check withdrawal delays for */ function getWithdrawalDelay(IStrategy[] calldata strategies) external view returns (uint256); /** * @notice returns the total number of shares in `strategy` that are delegated to `operator`. * @notice Mapping: operator => strategy => total number of shares in the strategy delegated to the operator. * @dev By design, the following invariant should hold for each Strategy: * (operator's shares in delegation manager) = sum (shares above zero of all stakers delegated to operator) * = sum (delegateable shares of all stakers delegated to the operator) */ function operatorShares(address operator, IStrategy strategy) external view returns (uint256); /** * @notice Returns 'true' if `staker` *is* actively delegated, and 'false' otherwise. */ function isDelegated(address staker) external view returns (bool); /** * @notice Returns true is an operator has previously registered for delegation. */ function isOperator(address operator) external view returns (bool); /// @notice Mapping: staker => number of signed delegation nonces (used in `delegateToBySignature`) from the staker that the contract has already checked function stakerNonce(address staker) external view returns (uint256); /** * @notice Mapping: delegationApprover => 32-byte salt => whether or not the salt has already been used by the delegationApprover. * @dev Salts are used in the `delegateTo` and `delegateToBySignature` functions. Note that these functions only process the delegationApprover's * signature + the provided salt if the operator being delegated to has specified a nonzero address as their `delegationApprover`. */ function delegationApproverSaltIsSpent( address _delegationApprover, bytes32 salt ) external view returns (bool); /** * @notice Minimum delay enforced by this contract for completing queued withdrawals. Measured in blocks, and adjustable by this contract's owner, * up to a maximum of `MAX_WITHDRAWAL_DELAY_BLOCKS`. Minimum value is 0 (i.e. no delay enforced). * Note that strategies each have a separate withdrawal delay, which can be greater than this value. So the minimum number of blocks that must pass * to withdraw a strategy is MAX(minWithdrawalDelayBlocks, strategyWithdrawalDelayBlocks[strategy]) */ function minWithdrawalDelayBlocks() external view returns (uint256); /** * @notice Minimum delay enforced by this contract per Strategy for completing queued withdrawals. Measured in blocks, and adjustable by this contract's owner, * up to a maximum of `MAX_WITHDRAWAL_DELAY_BLOCKS`. Minimum value is 0 (i.e. no delay enforced). */ function strategyWithdrawalDelayBlocks(IStrategy strategy) external view returns (uint256); /** * @notice Calculates the digestHash for a `staker` to sign to delegate to an `operator` * @param staker The signing staker * @param operator The operator who is being delegated to * @param expiry The desired expiry time of the staker's signature */ function calculateCurrentStakerDelegationDigestHash( address staker, address operator, uint256 expiry ) external view returns (bytes32); /** * @notice Calculates the digest hash to be signed and used in the `delegateToBySignature` function * @param staker The signing staker * @param _stakerNonce The nonce of the staker. In practice we use the staker's current nonce, stored at `stakerNonce[staker]` * @param operator The operator who is being delegated to * @param expiry The desired expiry time of the staker's signature */ function calculateStakerDelegationDigestHash( address staker, uint256 _stakerNonce, address operator, uint256 expiry ) external view returns (bytes32); /** * @notice Calculates the digest hash to be signed by the operator's delegationApprove and used in the `delegateTo` and `delegateToBySignature` functions. * @param staker The account delegating their stake * @param operator The account receiving delegated stake * @param _delegationApprover the operator's `delegationApprover` who will be signing the delegationHash (in general) * @param approverSalt A unique and single use value associated with the approver signature. * @param expiry Time after which the approver's signature becomes invalid */ function calculateDelegationApprovalDigestHash( address staker, address operator, address _delegationApprover, bytes32 approverSalt, uint256 expiry ) external view returns (bytes32); /// @notice The EIP-712 typehash for the contract's domain function DOMAIN_TYPEHASH() external view returns (bytes32); /// @notice The EIP-712 typehash for the StakerDelegation struct used by the contract function STAKER_DELEGATION_TYPEHASH() external view returns (bytes32); /// @notice The EIP-712 typehash for the DelegationApproval struct used by the contract function DELEGATION_APPROVAL_TYPEHASH() external view returns (bytes32); /** * @notice Getter function for the current EIP-712 domain separator for this contract. * * @dev The domain separator will change in the event of a fork that changes the ChainID. * @dev By introducing a domain separator the DApp developers are guaranteed that there can be no signature collision. * for more detailed information please read EIP-712. */ function domainSeparator() external view returns (bytes32); /// @notice Mapping: staker => cumulative number of queued withdrawals they have ever initiated. /// @dev This only increments (doesn't decrement), and is used to help ensure that otherwise identical withdrawals have unique hashes. function cumulativeWithdrawalsQueued(address staker) external view returns (uint256); /// @notice Returns the keccak256 hash of `withdrawal`. function calculateWithdrawalRoot(Withdrawal memory withdrawal) external pure returns (bytes32); function migrateQueuedWithdrawals( IStrategyManager.DeprecatedStruct_QueuedWithdrawal[] memory withdrawalsToQueue ) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "../libraries/BeaconChainProofs.sol"; import "./IEigenPodManager.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title The implementation contract used for restaking beacon chain ETH on EigenLayer * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @dev Note that all beacon chain balances are stored as gwei within the beacon chain datastructures. We choose * to account balances in terms of gwei in the EigenPod contract and convert to wei when making calls to other contracts */ interface IEigenPod { /******************************************************************************* STRUCTS / ENUMS *******************************************************************************/ enum VALIDATOR_STATUS { INACTIVE, // doesnt exist ACTIVE, // staked on ethpos and withdrawal credentials are pointed to the EigenPod WITHDRAWN // withdrawn from the Beacon Chain } struct ValidatorInfo { // index of the validator in the beacon chain uint64 validatorIndex; // amount of beacon chain ETH restaked on EigenLayer in gwei uint64 restakedBalanceGwei; //timestamp of the validator's most recent balance update uint64 lastCheckpointedAt; // status of the validator VALIDATOR_STATUS status; } struct Checkpoint { bytes32 beaconBlockRoot; uint24 proofsRemaining; uint64 podBalanceGwei; int128 balanceDeltasGwei; } /******************************************************************************* EVENTS *******************************************************************************/ /// @notice Emitted when an ETH validator stakes via this eigenPod event EigenPodStaked(bytes pubkey); /// @notice Emitted when a pod owner updates the proof submitter address event ProofSubmitterUpdated(address prevProofSubmitter, address newProofSubmitter); /// @notice Emitted when an ETH validator's withdrawal credentials are successfully verified to be pointed to this eigenPod event ValidatorRestaked(uint40 validatorIndex); /// @notice Emitted when an ETH validator's balance is proven to be updated. Here newValidatorBalanceGwei // is the validator's balance that is credited on EigenLayer. event ValidatorBalanceUpdated( uint40 validatorIndex, uint64 balanceTimestamp, uint64 newValidatorBalanceGwei ); /// @notice Emitted when restaked beacon chain ETH is withdrawn from the eigenPod. event RestakedBeaconChainETHWithdrawn(address indexed recipient, uint256 amount); /// @notice Emitted when ETH is received via the `receive` fallback event NonBeaconChainETHReceived(uint256 amountReceived); /// @notice Emitted when a checkpoint is created event CheckpointCreated( uint64 indexed checkpointTimestamp, bytes32 indexed beaconBlockRoot, uint256 validatorCount ); /// @notice Emitted when a checkpoint is finalized event CheckpointFinalized(uint64 indexed checkpointTimestamp, int256 totalShareDeltaWei); /// @notice Emitted when a validator is proven for a given checkpoint event ValidatorCheckpointed(uint64 indexed checkpointTimestamp, uint40 indexed validatorIndex); /// @notice Emitted when a validaor is proven to have 0 balance at a given checkpoint event ValidatorWithdrawn(uint64 indexed checkpointTimestamp, uint40 indexed validatorIndex); /******************************************************************************* EXTERNAL STATE-CHANGING METHODS *******************************************************************************/ /// @notice Used to initialize the pointers to contracts crucial to the pod's functionality, in beacon proxy construction from EigenPodManager function initialize(address owner) external; /// @notice Called by EigenPodManager when the owner wants to create another ETH validator. function stake( bytes calldata pubkey, bytes calldata signature, bytes32 depositDataRoot ) external payable; /** * @notice Transfers `amountWei` in ether from this contract to the specified `recipient` address * @notice Called by EigenPodManager to withdrawBeaconChainETH that has been added to the EigenPod's balance due to a withdrawal from the beacon chain. * @dev The podOwner must have already proved sufficient withdrawals, so that this pod's `withdrawableRestakedExecutionLayerGwei` exceeds the * `amountWei` input (when converted to GWEI). * @dev Reverts if `amountWei` is not a whole Gwei amount */ function withdrawRestakedBeaconChainETH(address recipient, uint256 amount) external; /** * @dev Create a checkpoint used to prove this pod's active validator set. Checkpoints are completed * by submitting one checkpoint proof per ACTIVE validator. During the checkpoint process, the total * change in ACTIVE validator balance is tracked, and any validators with 0 balance are marked `WITHDRAWN`. * @dev Once finalized, the pod owner is awarded shares corresponding to: * - the total change in their ACTIVE validator balances * - any ETH in the pod not already awarded shares * @dev A checkpoint cannot be created if the pod already has an outstanding checkpoint. If * this is the case, the pod owner MUST complete the existing checkpoint before starting a new one. * @param revertIfNoBalance Forces a revert if the pod ETH balance is 0. This allows the pod owner * to prevent accidentally starting a checkpoint that will not increase their shares */ function startCheckpoint(bool revertIfNoBalance) external; /** * @dev Progress the current checkpoint towards completion by submitting one or more validator * checkpoint proofs. Anyone can call this method to submit proofs towards the current checkpoint. * For each validator proven, the current checkpoint's `proofsRemaining` decreases. * @dev If the checkpoint's `proofsRemaining` reaches 0, the checkpoint is finalized. * (see `_updateCheckpoint` for more details) * @dev This method can only be called when there is a currently-active checkpoint. * @param balanceContainerProof proves the beacon's current balance container root against a checkpoint's `beaconBlockRoot` * @param proofs Proofs for one or more validator current balances against the `balanceContainerRoot` */ function verifyCheckpointProofs( BeaconChainProofs.BalanceContainerProof calldata balanceContainerProof, BeaconChainProofs.BalanceProof[] calldata proofs ) external; /** * @dev Verify one or more validators have their withdrawal credentials pointed at this EigenPod, and award * shares based on their effective balance. Proven validators are marked `ACTIVE` within the EigenPod, and * future checkpoint proofs will need to include them. * @dev Withdrawal credential proofs MUST NOT be older than `currentCheckpointTimestamp`. * @dev Validators proven via this method MUST NOT have an exit epoch set already. * @param beaconTimestamp the beacon chain timestamp sent to the 4788 oracle contract. Corresponds * to the parent beacon block root against which the proof is verified. * @param stateRootProof proves a beacon state root against a beacon block root * @param validatorIndices a list of validator indices being proven * @param validatorFieldsProofs proofs of each validator's `validatorFields` against the beacon state root * @param validatorFields the fields of the beacon chain "Validator" container. See consensus specs for * details: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator */ function verifyWithdrawalCredentials( uint64 beaconTimestamp, BeaconChainProofs.StateRootProof calldata stateRootProof, uint40[] calldata validatorIndices, bytes[] calldata validatorFieldsProofs, bytes32[][] calldata validatorFields ) external; /** * @dev Prove that one of this pod's active validators was slashed on the beacon chain. A successful * staleness proof allows the caller to start a checkpoint. * * @dev Note that in order to start a checkpoint, any existing checkpoint must already be completed! * (See `_startCheckpoint` for details) * * @dev Note that this method allows anyone to start a checkpoint as soon as a slashing occurs on the beacon * chain. This is intended to make it easier to external watchers to keep a pod's balance up to date. * * @dev Note too that beacon chain slashings are not instant. There is a delay between the initial slashing event * and the validator's final exit back to the execution layer. During this time, the validator's balance may or * may not drop further due to a correlation penalty. This method allows proof of a slashed validator * to initiate a checkpoint for as long as the validator remains on the beacon chain. Once the validator * has exited and been checkpointed at 0 balance, they are no longer "checkpoint-able" and cannot be proven * "stale" via this method. * See https://eth2book.info/capella/part3/transition/epoch/#slashings for more info. * * @param beaconTimestamp the beacon chain timestamp sent to the 4788 oracle contract. Corresponds * to the parent beacon block root against which the proof is verified. * @param stateRootProof proves a beacon state root against a beacon block root * @param proof the fields of the beacon chain "Validator" container, along with a merkle proof against * the beacon state root. See the consensus specs for more details: * https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator * * @dev Staleness conditions: * - Validator's last checkpoint is older than `beaconTimestamp` * - Validator MUST be in `ACTIVE` status in the pod * - Validator MUST be slashed on the beacon chain */ function verifyStaleBalance( uint64 beaconTimestamp, BeaconChainProofs.StateRootProof calldata stateRootProof, BeaconChainProofs.ValidatorProof calldata proof ) external; /// @notice called by owner of a pod to remove any ERC20s deposited in the pod function recoverTokens( IERC20[] memory tokenList, uint256[] memory amountsToWithdraw, address recipient ) external; /// @notice Allows the owner of a pod to update the proof submitter, a permissioned /// address that can call `startCheckpoint` and `verifyWithdrawalCredentials`. /// @dev Note that EITHER the podOwner OR proofSubmitter can access these methods, /// so it's fine to set your proofSubmitter to 0 if you want the podOwner to be the /// only address that can call these methods. /// @param newProofSubmitter The new proof submitter address. If set to 0, only the /// pod owner will be able to call `startCheckpoint` and `verifyWithdrawalCredentials` function setProofSubmitter(address newProofSubmitter) external; /******************************************************************************* VIEW METHODS *******************************************************************************/ /// @notice An address with permissions to call `startCheckpoint` and `verifyWithdrawalCredentials`, set /// by the podOwner. This role exists to allow a podOwner to designate a hot wallet that can call /// these methods, allowing the podOwner to remain a cold wallet that is only used to manage funds. /// @dev If this address is NOT set, only the podOwner can call `startCheckpoint` and `verifyWithdrawalCredentials` function proofSubmitter() external view returns (address); /// @notice the amount of execution layer ETH in this contract that is staked in EigenLayer (i.e. withdrawn from beaconchain but not EigenLayer), function withdrawableRestakedExecutionLayerGwei() external view returns (uint64); /// @notice The single EigenPodManager for EigenLayer function eigenPodManager() external view returns (IEigenPodManager); /// @notice The owner of this EigenPod function podOwner() external view returns (address); /// @notice Returns the validatorInfo struct for the provided pubkeyHash function validatorPubkeyHashToInfo( bytes32 validatorPubkeyHash ) external view returns (ValidatorInfo memory); /// @notice Returns the validatorInfo struct for the provided pubkey function validatorPubkeyToInfo( bytes calldata validatorPubkey ) external view returns (ValidatorInfo memory); /// @notice This returns the status of a given validator function validatorStatus(bytes32 pubkeyHash) external view returns (VALIDATOR_STATUS); /// @notice This returns the status of a given validator pubkey function validatorStatus( bytes calldata validatorPubkey ) external view returns (VALIDATOR_STATUS); /// @notice Number of validators with proven withdrawal credentials, who do not have proven full withdrawals function activeValidatorCount() external view returns (uint256); /// @notice The timestamp of the last checkpoint finalized function lastCheckpointTimestamp() external view returns (uint64); /// @notice The timestamp of the currently-active checkpoint. Will be 0 if there is not active checkpoint function currentCheckpointTimestamp() external view returns (uint64); /// @notice Returns the currently-active checkpoint function currentCheckpoint() external view returns (Checkpoint memory); /// @notice For each checkpoint, the total balance attributed to exited validators, in gwei /// /// NOTE that the values added to this mapping are NOT guaranteed to capture the entirety of a validator's /// exit - rather, they capture the total change in a validator's balance when a checkpoint shows their /// balance change from nonzero to zero. While a change from nonzero to zero DOES guarantee that a validator /// has been fully exited, it is possible that the magnitude of this change does not capture what is /// typically thought of as a "full exit." /// /// For example: /// 1. Consider a validator was last checkpointed at 32 ETH before exiting. Once the exit has been processed, /// it is expected that the validator's exited balance is calculated to be `32 ETH`. /// 2. However, before `startCheckpoint` is called, a deposit is made to the validator for 1 ETH. The beacon /// chain will automatically withdraw this ETH, but not until the withdrawal sweep passes over the validator /// again. Until this occurs, the validator's current balance (used for checkpointing) is 1 ETH. /// 3. If `startCheckpoint` is called at this point, the balance delta calculated for this validator will be /// `-31 ETH`, and because the validator has a nonzero balance, it is not marked WITHDRAWN. /// 4. After the exit is processed by the beacon chain, a subsequent `startCheckpoint` and checkpoint proof /// will calculate a balance delta of `-1 ETH` and attribute a 1 ETH exit to the validator. /// /// If this edge case impacts your usecase, it should be possible to mitigate this by monitoring for deposits /// to your exited validators, and waiting to call `startCheckpoint` until those deposits have been automatically /// exited. /// /// Additional edge cases this mapping does not cover: /// - If a validator is slashed, their balance exited will reflect their original balance rather than the slashed amount /// - The final partial withdrawal for an exited validator will be likely be included in this mapping. /// i.e. if a validator was last checkpointed at 32.1 ETH before exiting, the next checkpoint will calculate their /// "exited" amount to be 32.1 ETH rather than 32 ETH. function checkpointBalanceExitedGwei(uint64) external view returns (uint64); /// @notice Query the 4788 oracle to get the parent block root of the slot with the given `timestamp` /// @param timestamp of the block for which the parent block root will be returned. MUST correspond /// to an existing slot within the last 24 hours. If the slot at `timestamp` was skipped, this method /// will revert. function getParentBlockRoot(uint64 timestamp) external view returns (bytes32); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "@openzeppelin/contracts/proxy/beacon/IBeacon.sol"; import "./IETHPOSDeposit.sol"; import "./IStrategyManager.sol"; import "./IEigenPod.sol"; import "./IPausable.sol"; import "./ISlasher.sol"; import "./IStrategy.sol"; /** * @title Interface for factory that creates and manages solo staking pods that have their withdrawal credentials pointed to EigenLayer. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service */ interface IEigenPodManager is IPausable { /// @notice Emitted to notify the deployment of an EigenPod event PodDeployed(address indexed eigenPod, address indexed podOwner); /// @notice Emitted to notify a deposit of beacon chain ETH recorded in the strategy manager event BeaconChainETHDeposited(address indexed podOwner, uint256 amount); /// @notice Emitted when the balance of an EigenPod is updated event PodSharesUpdated(address indexed podOwner, int256 sharesDelta); /// @notice Emitted when a withdrawal of beacon chain ETH is completed event BeaconChainETHWithdrawalCompleted( address indexed podOwner, uint256 shares, uint96 nonce, address delegatedAddress, address withdrawer, bytes32 withdrawalRoot ); /** * @notice Creates an EigenPod for the sender. * @dev Function will revert if the `msg.sender` already has an EigenPod. * @dev Returns EigenPod address */ function createPod() external returns (address); /** * @notice Stakes for a new beacon chain validator on the sender's EigenPod. * Also creates an EigenPod for the sender if they don't have one already. * @param pubkey The 48 bytes public key of the beacon chain validator. * @param signature The validator's signature of the deposit data. * @param depositDataRoot The root/hash of the deposit data for the validator's deposit. */ function stake( bytes calldata pubkey, bytes calldata signature, bytes32 depositDataRoot ) external payable; /** * @notice Changes the `podOwner`'s shares by `sharesDelta` and performs a call to the DelegationManager * to ensure that delegated shares are also tracked correctly * @param podOwner is the pod owner whose balance is being updated. * @param sharesDelta is the change in podOwner's beaconChainETHStrategy shares * @dev Callable only by the podOwner's EigenPod contract. * @dev Reverts if `sharesDelta` is not a whole Gwei amount */ function recordBeaconChainETHBalanceUpdate(address podOwner, int256 sharesDelta) external; /// @notice Returns the address of the `podOwner`'s EigenPod if it has been deployed. function ownerToPod(address podOwner) external view returns (IEigenPod); /// @notice Returns the address of the `podOwner`'s EigenPod (whether it is deployed yet or not). function getPod(address podOwner) external view returns (IEigenPod); /// @notice The ETH2 Deposit Contract function ethPOS() external view returns (IETHPOSDeposit); /// @notice Beacon proxy to which the EigenPods point function eigenPodBeacon() external view returns (IBeacon); /// @notice EigenLayer's StrategyManager contract function strategyManager() external view returns (IStrategyManager); /// @notice EigenLayer's Slasher contract function slasher() external view returns (ISlasher); /// @notice Returns 'true' if the `podOwner` has created an EigenPod, and 'false' otherwise. function hasPod(address podOwner) external view returns (bool); /// @notice Returns the number of EigenPods that have been created function numPods() external view returns (uint256); /** * @notice Mapping from Pod owner owner to the number of shares they have in the virtual beacon chain ETH strategy. * @dev The share amount can become negative. This is necessary to accommodate the fact that a pod owner's virtual beacon chain ETH shares can * decrease between the pod owner queuing and completing a withdrawal. * When the pod owner's shares would otherwise increase, this "deficit" is decreased first _instead_. * Likewise, when a withdrawal is completed, this "deficit" is decreased and the withdrawal amount is decreased; We can think of this * as the withdrawal "paying off the deficit". */ function podOwnerShares(address podOwner) external view returns (int256); /// @notice returns canonical, virtual beaconChainETH strategy function beaconChainETHStrategy() external view returns (IStrategy); /** * @notice Used by the DelegationManager to remove a pod owner's shares while they're in the withdrawal queue. * Simply decreases the `podOwner`'s shares by `shares`, down to a minimum of zero. * @dev This function reverts if it would result in `podOwnerShares[podOwner]` being less than zero, i.e. it is forbidden for this function to * result in the `podOwner` incurring a "share deficit". This behavior prevents a Staker from queuing a withdrawal which improperly removes excessive * shares from the operator to whom the staker is delegated. * @dev Reverts if `shares` is not a whole Gwei amount */ function removeShares(address podOwner, uint256 shares) external; /** * @notice Increases the `podOwner`'s shares by `shares`, paying off deficit if possible. * Used by the DelegationManager to award a pod owner shares on exiting the withdrawal queue * @dev Returns the number of shares added to `podOwnerShares[podOwner]` above zero, which will be less than the `shares` input * in the event that the podOwner has an existing shares deficit (i.e. `podOwnerShares[podOwner]` starts below zero) * @dev Reverts if `shares` is not a whole Gwei amount */ function addShares(address podOwner, uint256 shares) external returns (uint256); /** * @notice Used by the DelegationManager to complete a withdrawal, sending tokens to some destination address * @dev Prioritizes decreasing the podOwner's share deficit, if they have one * @dev Reverts if `shares` is not a whole Gwei amount */ function withdrawSharesAsTokens(address podOwner, address destination, uint256 shares) external; }
// ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━ // ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓ // ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛ // ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━ // ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓ // ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // SPDX-License-Identifier: CC0-1.0 pragma solidity >=0.5.0; // This interface is designed to be compatible with the Vyper version. /// @notice This is the Ethereum 2.0 deposit contract interface. /// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs interface IETHPOSDeposit { /// @notice A processed deposit event. event DepositEvent( bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index ); /// @notice Submit a Phase 0 DepositData object. /// @param pubkey A BLS12-381 public key. /// @param withdrawal_credentials Commitment to a public key for withdrawals. /// @param signature A BLS12-381 signature. /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object. /// Used as a protection against malformed input. function deposit( bytes calldata pubkey, bytes calldata withdrawal_credentials, bytes calldata signature, bytes32 deposit_data_root ) external payable; /// @notice Query the current deposit root hash. /// @return The deposit root hash. function get_deposit_root() external view returns (bytes32); /// @notice Query the current deposit count. /// @return The deposit count encoded as a little endian 64-bit number. function get_deposit_count() external view returns (bytes memory); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "../interfaces/IPauserRegistry.sol"; /** * @title Adds pausability to a contract, with pausing & unpausing controlled by the `pauser` and `unpauser` of a PauserRegistry contract. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice Contracts that inherit from this contract may define their own `pause` and `unpause` (and/or related) functions. * These functions should be permissioned as "onlyPauser" which defers to a `PauserRegistry` for determining access control. * @dev Pausability is implemented using a uint256, which allows up to 256 different single bit-flags; each bit can potentially pause different functionality. * Inspiration for this was taken from the NearBridge design here https://etherscan.io/address/0x3FEFc5A4B1c02f21cBc8D3613643ba0635b9a873#code. * For the `pause` and `unpause` functions we've implemented, if you pause, you can only flip (any number of) switches to on/1 (aka "paused"), and if you unpause, * you can only flip (any number of) switches to off/0 (aka "paused"). * If you want a pauseXYZ function that just flips a single bit / "pausing flag", it will: * 1) 'bit-wise and' (aka `&`) a flag with the current paused state (as a uint256) * 2) update the paused state to this new value * @dev We note as well that we have chosen to identify flags by their *bit index* as opposed to their numerical value, so, e.g. defining `DEPOSITS_PAUSED = 3` * indicates specifically that if the *third bit* of `_paused` is flipped -- i.e. it is a '1' -- then deposits should be paused */ interface IPausable { /// @notice Emitted when the `pauserRegistry` is set to `newPauserRegistry`. event PauserRegistrySet(IPauserRegistry pauserRegistry, IPauserRegistry newPauserRegistry); /// @notice Emitted when the pause is triggered by `account`, and changed to `newPausedStatus`. event Paused(address indexed account, uint256 newPausedStatus); /// @notice Emitted when the pause is lifted by `account`, and changed to `newPausedStatus`. event Unpaused(address indexed account, uint256 newPausedStatus); /// @notice Address of the `PauserRegistry` contract that this contract defers to for determining access control (for pausing). function pauserRegistry() external view returns (IPauserRegistry); /** * @notice This function is used to pause an EigenLayer contract's functionality. * It is permissioned to the `pauser` address, which is expected to be a low threshold multisig. * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once. * @dev This function can only pause functionality, and thus cannot 'unflip' any bit in `_paused` from 1 to 0. */ function pause(uint256 newPausedStatus) external; /** * @notice Alias for `pause(type(uint256).max)`. */ function pauseAll() external; /** * @notice This function is used to unpause an EigenLayer contract's functionality. * It is permissioned to the `unpauser` address, which is expected to be a high threshold multisig or governance contract. * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once. * @dev This function can only unpause functionality, and thus cannot 'flip' any bit in `_paused` from 0 to 1. */ function unpause(uint256 newPausedStatus) external; /// @notice Returns the current paused status as a uint256. function paused() external view returns (uint256); /// @notice Returns 'true' if the `indexed`th bit of `_paused` is 1, and 'false' otherwise function paused(uint8 index) external view returns (bool); /// @notice Allows the unpauser to set a new pauser registry function setPauserRegistry(IPauserRegistry newPauserRegistry) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; /** * @title Interface for the `PauserRegistry` contract. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service */ interface IPauserRegistry { event PauserStatusChanged(address pauser, bool canPause); event UnpauserChanged(address previousUnpauser, address newUnpauser); /// @notice Mapping of addresses to whether they hold the pauser role. function isPauser(address pauser) external view returns (bool); /// @notice Unique address that holds the unpauser role. Capable of changing *both* the pauser and unpauser addresses. function unpauser() external view returns (address); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.12; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IStrategy.sol"; import "./IPauserRegistry.sol"; /** * @title Interface for the `IRewardsCoordinator` contract. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice Allows AVSs to make "Rewards Submissions", which get distributed amongst the AVSs' confirmed * Operators and the Stakers delegated to those Operators. * Calculations are performed based on the completed RewardsSubmission, with the results posted in * a Merkle root against which Stakers & Operators can make claims. */ interface IRewardsCoordinator { /// STRUCTS /// /** * @notice A linear combination of strategies and multipliers for AVSs to weigh * EigenLayer strategies. * @param strategy The EigenLayer strategy to be used for the rewards submission * @param multiplier The weight of the strategy in the rewards submission */ struct StrategyAndMultiplier { IStrategy strategy; uint96 multiplier; } /** * Sliding Window for valid RewardsSubmission startTimestamp * * Scenario A: GENESIS_REWARDS_TIMESTAMP IS WITHIN RANGE * <-----MAX_RETROACTIVE_LENGTH-----> t (block.timestamp) <---MAX_FUTURE_LENGTH---> * <--------------------valid range for startTimestamp------------------------> * ^ * GENESIS_REWARDS_TIMESTAMP * * * Scenario B: GENESIS_REWARDS_TIMESTAMP IS OUT OF RANGE * <-----MAX_RETROACTIVE_LENGTH-----> t (block.timestamp) <---MAX_FUTURE_LENGTH---> * <------------------------valid range for startTimestamp------------------------> * ^ * GENESIS_REWARDS_TIMESTAMP * @notice RewardsSubmission struct submitted by AVSs when making rewards for their operators and stakers * RewardsSubmission can be for a time range within the valid window for startTimestamp and must be within max duration. * See `createAVSRewardsSubmission()` for more details. * @param strategiesAndMultipliers The strategies and their relative weights * cannot have duplicate strategies and need to be sorted in ascending address order * @param token The rewards token to be distributed * @param amount The total amount of tokens to be distributed * @param startTimestamp The timestamp (seconds) at which the submission range is considered for distribution * could start in the past or in the future but within a valid range. See the diagram above. * @param duration The duration of the submission range in seconds. Must be <= MAX_REWARDS_DURATION */ struct RewardsSubmission { StrategyAndMultiplier[] strategiesAndMultipliers; IERC20 token; uint256 amount; uint32 startTimestamp; uint32 duration; } /** * @notice A distribution root is a merkle root of the distribution of earnings for a given period. * The RewardsCoordinator stores all historical distribution roots so that earners can claim their earnings against older roots * if they wish but the merkle tree contains the cumulative earnings of all earners and tokens for a given period so earners (or their claimers if set) * only need to claim against the latest root to claim all available earnings. * @param root The merkle root of the distribution * @param rewardsCalculationEndTimestamp The timestamp (seconds) until which rewards have been calculated * @param activatedAt The timestamp (seconds) at which the root can be claimed against */ struct DistributionRoot { bytes32 root; uint32 rewardsCalculationEndTimestamp; uint32 activatedAt; } /** * @notice Internal leaf in the merkle tree for the earner's account leaf * @param earner The address of the earner * @param earnerTokenRoot The merkle root of the earner's token subtree * Each leaf in the earner's token subtree is a TokenTreeMerkleLeaf */ struct EarnerTreeMerkleLeaf { address earner; bytes32 earnerTokenRoot; } /** * @notice The actual leaves in the distribution merkle tree specifying the token earnings * for the respective earner's subtree. Each leaf is a claimable amount of a token for an earner. * @param token The token for which the earnings are being claimed * @param cumulativeEarnings The cumulative earnings of the earner for the token */ struct TokenTreeMerkleLeaf { IERC20 token; uint256 cumulativeEarnings; } /** * @notice A claim against a distribution root called by an * earners claimer (could be the earner themselves). Each token claim will claim the difference * between the cumulativeEarnings of the earner and the cumulativeClaimed of the claimer. * Each claim can specify which of the earner's earned tokens they want to claim. * See `processClaim()` for more details. * @param rootIndex The index of the root in the list of DistributionRoots * @param earnerIndex The index of the earner's account root in the merkle tree * @param earnerTreeProof The proof of the earner's EarnerTreeMerkleLeaf against the merkle root * @param earnerLeaf The earner's EarnerTreeMerkleLeaf struct, providing the earner address and earnerTokenRoot * @param tokenIndices The indices of the token leaves in the earner's subtree * @param tokenTreeProofs The proofs of the token leaves against the earner's earnerTokenRoot * @param tokenLeaves The token leaves to be claimed * @dev The merkle tree is structured with the merkle root at the top and EarnerTreeMerkleLeaf as internal leaves * in the tree. Each earner leaf has its own subtree with TokenTreeMerkleLeaf as leaves in the subtree. * To prove a claim against a specified rootIndex(which specifies the distributionRoot being used), * the claim will first verify inclusion of the earner leaf in the tree against distributionRoots[rootIndex].root. * Then for each token, it will verify inclusion of the token leaf in the earner's subtree against the earner's earnerTokenRoot. */ struct RewardsMerkleClaim { uint32 rootIndex; uint32 earnerIndex; bytes earnerTreeProof; EarnerTreeMerkleLeaf earnerLeaf; uint32[] tokenIndices; bytes[] tokenTreeProofs; TokenTreeMerkleLeaf[] tokenLeaves; } /// EVENTS /// /// @notice emitted when an AVS creates a valid RewardsSubmission event AVSRewardsSubmissionCreated( address indexed avs, uint256 indexed submissionNonce, bytes32 indexed rewardsSubmissionHash, RewardsSubmission rewardsSubmission ); /// @notice emitted when a valid RewardsSubmission is created for all stakers by a valid submitter event RewardsSubmissionForAllCreated( address indexed submitter, uint256 indexed submissionNonce, bytes32 indexed rewardsSubmissionHash, RewardsSubmission rewardsSubmission ); /// @notice rewardsUpdater is responsible for submiting DistributionRoots, only owner can set rewardsUpdater event RewardsUpdaterSet(address indexed oldRewardsUpdater, address indexed newRewardsUpdater); event RewardsForAllSubmitterSet( address indexed rewardsForAllSubmitter, bool indexed oldValue, bool indexed newValue ); event ActivationDelaySet(uint32 oldActivationDelay, uint32 newActivationDelay); event GlobalCommissionBipsSet(uint16 oldGlobalCommissionBips, uint16 newGlobalCommissionBips); event ClaimerForSet( address indexed earner, address indexed oldClaimer, address indexed claimer ); /// @notice rootIndex is the specific array index of the newly created root in the storage array event DistributionRootSubmitted( uint32 indexed rootIndex, bytes32 indexed root, uint32 indexed rewardsCalculationEndTimestamp, uint32 activatedAt ); /// @notice root is one of the submitted distribution roots that was claimed against event RewardsClaimed( bytes32 root, address indexed earner, address indexed claimer, address indexed recipient, IERC20 token, uint256 claimedAmount ); /******************************************************************************* VIEW FUNCTIONS *******************************************************************************/ /// @notice The address of the entity that can update the contract with new merkle roots function rewardsUpdater() external view returns (address); /** * @notice The interval in seconds at which the calculation for a RewardsSubmission distribution is done. * @dev Rewards Submission durations must be multiples of this interval. */ function CALCULATION_INTERVAL_SECONDS() external view returns (uint32); /// @notice The maximum amount of time (seconds) that a RewardsSubmission can span over function MAX_REWARDS_DURATION() external view returns (uint32); /// @notice max amount of time (seconds) that a submission can start in the past function MAX_RETROACTIVE_LENGTH() external view returns (uint32); /// @notice max amount of time (seconds) that a submission can start in the future function MAX_FUTURE_LENGTH() external view returns (uint32); /// @notice absolute min timestamp (seconds) that a submission can start at function GENESIS_REWARDS_TIMESTAMP() external view returns (uint32); /// @notice Delay in timestamp (seconds) before a posted root can be claimed against function activationDelay() external view returns (uint32); /// @notice Mapping: earner => the address of the entity who can call `processClaim` on behalf of the earner function claimerFor(address earner) external view returns (address); /// @notice Mapping: claimer => token => total amount claimed function cumulativeClaimed(address claimer, IERC20 token) external view returns (uint256); /// @notice the commission for all operators across all avss function globalOperatorCommissionBips() external view returns (uint16); /// @notice the commission for a specific operator for a specific avs /// NOTE: Currently unused and simply returns the globalOperatorCommissionBips value but will be used in future release function operatorCommissionBips(address operator, address avs) external view returns (uint16); /// @notice return the hash of the earner's leaf function calculateEarnerLeafHash( EarnerTreeMerkleLeaf calldata leaf ) external pure returns (bytes32); /// @notice returns the hash of the earner's token leaf function calculateTokenLeafHash( TokenTreeMerkleLeaf calldata leaf ) external pure returns (bytes32); /// @notice returns 'true' if the claim would currently pass the check in `processClaims` /// but will revert if not valid function checkClaim(RewardsMerkleClaim calldata claim) external view returns (bool); /// @notice The timestamp until which RewardsSubmissions have been calculated function currRewardsCalculationEndTimestamp() external view returns (uint32); /// @notice loop through distribution roots from reverse and return hash function getRootIndexFromHash(bytes32 rootHash) external view returns (uint32); /// @notice returns the number of distribution roots posted function getDistributionRootsLength() external view returns (uint256); /******************************************************************************* EXTERNAL FUNCTIONS *******************************************************************************/ /** * @notice Creates a new rewards submission on behalf of an AVS, to be split amongst the * set of stakers delegated to operators who are registered to the `avs` * @param rewardsSubmissions The rewards submissions being created * @dev Expected to be called by the ServiceManager of the AVS on behalf of which the submission is being made * @dev The duration of the `rewardsSubmission` cannot exceed `MAX_REWARDS_DURATION` * @dev The tokens are sent to the `RewardsCoordinator` contract * @dev Strategies must be in ascending order of addresses to check for duplicates * @dev This function will revert if the `rewardsSubmission` is malformed, * e.g. if the `strategies` and `weights` arrays are of non-equal lengths */ function createAVSRewardsSubmission(RewardsSubmission[] calldata rewardsSubmissions) external; /** * @notice similar to `createAVSRewardsSubmission` except the rewards are split amongst *all* stakers * rather than just those delegated to operators who are registered to a single avs and is * a permissioned call based on isRewardsForAllSubmitter mapping. */ function createRewardsForAllSubmission(RewardsSubmission[] calldata rewardsSubmission) external; /** * @notice Claim rewards against a given root (read from distributionRoots[claim.rootIndex]). * Earnings are cumulative so earners don't have to claim against all distribution roots they have earnings for, * they can simply claim against the latest root and the contract will calculate the difference between * their cumulativeEarnings and cumulativeClaimed. This difference is then transferred to recipient address. * @param claim The RewardsMerkleClaim to be processed. * Contains the root index, earner, token leaves, and required proofs * @param recipient The address recipient that receives the ERC20 rewards * @dev only callable by the valid claimer, that is * if claimerFor[claim.earner] is address(0) then only the earner can claim, otherwise only * claimerFor[claim.earner] can claim the rewards. */ function processClaim(RewardsMerkleClaim calldata claim, address recipient) external; /** * @notice Creates a new distribution root. activatedAt is set to block.timestamp + activationDelay * @param root The merkle root of the distribution * @param rewardsCalculationEndTimestamp The timestamp (seconds) until which rewards have been calculated * @dev Only callable by the rewardsUpdater */ function submitRoot(bytes32 root, uint32 rewardsCalculationEndTimestamp) external; /** * @notice Sets the address of the entity that can call `processClaim` on behalf of the earner (msg.sender) * @param claimer The address of the entity that can claim rewards on behalf of the earner * @dev Only callable by the `earner` */ function setClaimerFor(address claimer) external; /** * @notice Sets the delay in timestamp before a posted root can be claimed against * @param _activationDelay Delay in timestamp (seconds) before a posted root can be claimed against * @dev Only callable by the contract owner */ function setActivationDelay(uint32 _activationDelay) external; /** * @notice Sets the global commission for all operators across all avss * @param _globalCommissionBips The commission for all operators across all avss * @dev Only callable by the contract owner */ function setGlobalOperatorCommission(uint16 _globalCommissionBips) external; /** * @notice Sets the permissioned `rewardsUpdater` address which can post new roots * @dev Only callable by the contract owner */ function setRewardsUpdater(address _rewardsUpdater) external; /** * @notice Sets the permissioned `rewardsForAllSubmitter` address which can submit createRewardsForAllSubmission * @dev Only callable by the contract owner * @param _submitter The address of the rewardsForAllSubmitter * @param _newValue The new value for isRewardsForAllSubmitter */ function setRewardsForAllSubmitter(address _submitter, bool _newValue) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; /** * @title The interface for common signature utilities. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service */ interface ISignatureUtils { // @notice Struct that bundles together a signature and an expiration time for the signature. Used primarily for stack management. struct SignatureWithExpiry { // the signature itself, formatted as a single bytes object bytes signature; // the expiration timestamp (UTC) of the signature uint256 expiry; } // @notice Struct that bundles together a signature, a salt for uniqueness, and an expiration time for the signature. Used primarily for stack management. struct SignatureWithSaltAndExpiry { // the signature itself, formatted as a single bytes object bytes signature; // the salt used to generate the signature bytes32 salt; // the expiration timestamp (UTC) of the signature uint256 expiry; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "./IStrategyManager.sol"; import "./IDelegationManager.sol"; /** * @title Interface for the primary 'slashing' contract for EigenLayer. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice See the `Slasher` contract itself for implementation details. */ interface ISlasher { // struct used to store information about the current state of an operator's obligations to middlewares they are serving struct MiddlewareTimes { // The update block for the middleware whose most recent update was earliest, i.e. the 'stalest' update out of all middlewares the operator is serving uint32 stalestUpdateBlock; // The latest 'serveUntilBlock' from all of the middleware that the operator is serving uint32 latestServeUntilBlock; } // struct used to store details relevant to a single middleware that an operator has opted-in to serving struct MiddlewareDetails { // the block at which the contract begins being able to finalize the operator's registration with the service via calling `recordFirstStakeUpdate` uint32 registrationMayBeginAtBlock; // the block before which the contract is allowed to slash the user uint32 contractCanSlashOperatorUntilBlock; // the block at which the middleware's view of the operator's stake was most recently updated uint32 latestUpdateBlock; } /// @notice Emitted when a middleware times is added to `operator`'s array. event MiddlewareTimesAdded( address operator, uint256 index, uint32 stalestUpdateBlock, uint32 latestServeUntilBlock ); /// @notice Emitted when `operator` begins to allow `contractAddress` to slash them. event OptedIntoSlashing(address indexed operator, address indexed contractAddress); /// @notice Emitted when `contractAddress` signals that it will no longer be able to slash `operator` after the `contractCanSlashOperatorUntilBlock`. event SlashingAbilityRevoked( address indexed operator, address indexed contractAddress, uint32 contractCanSlashOperatorUntilBlock ); /** * @notice Emitted when `slashingContract` 'freezes' the `slashedOperator`. * @dev The `slashingContract` must have permission to slash the `slashedOperator`, i.e. `canSlash(slasherOperator, slashingContract)` must return 'true'. */ event OperatorFrozen(address indexed slashedOperator, address indexed slashingContract); /// @notice Emitted when `previouslySlashedAddress` is 'unfrozen', allowing them to again move deposited funds within EigenLayer. event FrozenStatusReset(address indexed previouslySlashedAddress); /** * @notice Gives the `contractAddress` permission to slash the funds of the caller. * @dev Typically, this function must be called prior to registering for a middleware. */ function optIntoSlashing(address contractAddress) external; /** * @notice Used for 'slashing' a certain operator. * @param toBeFrozen The operator to be frozen. * @dev Technically the operator is 'frozen' (hence the name of this function), and then subject to slashing pending a decision by a human-in-the-loop. * @dev The operator must have previously given the caller (which should be a contract) the ability to slash them, through a call to `optIntoSlashing`. */ function freezeOperator(address toBeFrozen) external; /** * @notice Removes the 'frozen' status from each of the `frozenAddresses` * @dev Callable only by the contract owner (i.e. governance). */ function resetFrozenStatus(address[] calldata frozenAddresses) external; /** * @notice this function is a called by middlewares during an operator's registration to make sure the operator's stake at registration * is slashable until serveUntil * @param operator the operator whose stake update is being recorded * @param serveUntilBlock the block until which the operator's stake at the current block is slashable * @dev adds the middleware's slashing contract to the operator's linked list */ function recordFirstStakeUpdate(address operator, uint32 serveUntilBlock) external; /** * @notice this function is a called by middlewares during a stake update for an operator (perhaps to free pending withdrawals) * to make sure the operator's stake at updateBlock is slashable until serveUntil * @param operator the operator whose stake update is being recorded * @param updateBlock the block for which the stake update is being recorded * @param serveUntilBlock the block until which the operator's stake at updateBlock is slashable * @param insertAfter the element of the operators linked list that the currently updating middleware should be inserted after * @dev insertAfter should be calculated offchain before making the transaction that calls this. this is subject to race conditions, * but it is anticipated to be rare and not detrimental. */ function recordStakeUpdate( address operator, uint32 updateBlock, uint32 serveUntilBlock, uint256 insertAfter ) external; /** * @notice this function is a called by middlewares during an operator's deregistration to make sure the operator's stake at deregistration * is slashable until serveUntil * @param operator the operator whose stake update is being recorded * @param serveUntilBlock the block until which the operator's stake at the current block is slashable * @dev removes the middleware's slashing contract to the operator's linked list and revokes the middleware's (i.e. caller's) ability to * slash `operator` once `serveUntil` is reached */ function recordLastStakeUpdateAndRevokeSlashingAbility( address operator, uint32 serveUntilBlock ) external; /// @notice The StrategyManager contract of EigenLayer function strategyManager() external view returns (IStrategyManager); /// @notice The DelegationManager contract of EigenLayer function delegation() external view returns (IDelegationManager); /** * @notice Used to determine whether `staker` is actively 'frozen'. If a staker is frozen, then they are potentially subject to * slashing of their funds, and cannot cannot deposit or withdraw from the strategyManager until the slashing process is completed * and the staker's status is reset (to 'unfrozen'). * @param staker The staker of interest. * @return Returns 'true' if `staker` themselves has their status set to frozen, OR if the staker is delegated * to an operator who has their status set to frozen. Otherwise returns 'false'. */ function isFrozen(address staker) external view returns (bool); /// @notice Returns true if `slashingContract` is currently allowed to slash `toBeSlashed`. function canSlash(address toBeSlashed, address slashingContract) external view returns (bool); /// @notice Returns the block until which `serviceContract` is allowed to slash the `operator`. function contractCanSlashOperatorUntilBlock( address operator, address serviceContract ) external view returns (uint32); /// @notice Returns the block at which the `serviceContract` last updated its view of the `operator`'s stake function latestUpdateBlock( address operator, address serviceContract ) external view returns (uint32); /// @notice A search routine for finding the correct input value of `insertAfter` to `recordStakeUpdate` / `_updateMiddlewareList`. function getCorrectValueForInsertAfter( address operator, uint32 updateBlock ) external view returns (uint256); /** * @notice Returns 'true' if `operator` can currently complete a withdrawal started at the `withdrawalStartBlock`, with `middlewareTimesIndex` used * to specify the index of a `MiddlewareTimes` struct in the operator's list (i.e. an index in `operatorToMiddlewareTimes[operator]`). The specified * struct is consulted as proof of the `operator`'s ability (or lack thereof) to complete the withdrawal. * This function will return 'false' if the operator cannot currently complete a withdrawal started at the `withdrawalStartBlock`, *or* in the event * that an incorrect `middlewareTimesIndex` is supplied, even if one or more correct inputs exist. * @param operator Either the operator who queued the withdrawal themselves, or if the withdrawing party is a staker who delegated to an operator, * this address is the operator *who the staker was delegated to* at the time of the `withdrawalStartBlock`. * @param withdrawalStartBlock The block number at which the withdrawal was initiated. * @param middlewareTimesIndex Indicates an index in `operatorToMiddlewareTimes[operator]` to consult as proof of the `operator`'s ability to withdraw * @dev The correct `middlewareTimesIndex` input should be computable off-chain. */ function canWithdraw( address operator, uint32 withdrawalStartBlock, uint256 middlewareTimesIndex ) external returns (bool); /** * operator => * [ * ( * the least recent update block of all of the middlewares it's serving/served, * latest time that the stake bonded at that update needed to serve until * ) * ] */ function operatorToMiddlewareTimes( address operator, uint256 arrayIndex ) external view returns (MiddlewareTimes memory); /// @notice Getter function for fetching `operatorToMiddlewareTimes[operator].length` function middlewareTimesLength(address operator) external view returns (uint256); /// @notice Getter function for fetching `operatorToMiddlewareTimes[operator][index].stalestUpdateBlock`. function getMiddlewareTimesIndexStalestUpdateBlock( address operator, uint32 index ) external view returns (uint32); /// @notice Getter function for fetching `operatorToMiddlewareTimes[operator][index].latestServeUntil`. function getMiddlewareTimesIndexServeUntilBlock( address operator, uint32 index ) external view returns (uint32); /// @notice Getter function for fetching `_operatorToWhitelistedContractsByUpdate[operator].size`. function operatorWhitelistedContractsLinkedListSize( address operator ) external view returns (uint256); /// @notice Getter function for fetching a single node in the operator's linked list (`_operatorToWhitelistedContractsByUpdate[operator]`). function operatorWhitelistedContractsLinkedListEntry( address operator, address node ) external view returns (bool, uint256, uint256); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @title Minimal interface for an `Strategy` contract. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice Custom `Strategy` implementations may expand extensively on this interface. */ interface IStrategy { /** * @notice Used to deposit tokens into this Strategy * @param token is the ERC20 token being deposited * @param amount is the amount of token being deposited * @dev This function is only callable by the strategyManager contract. It is invoked inside of the strategyManager's * `depositIntoStrategy` function, and individual share balances are recorded in the strategyManager as well. * @return newShares is the number of new shares issued at the current exchange ratio. */ function deposit(IERC20 token, uint256 amount) external returns (uint256); /** * @notice Used to withdraw tokens from this Strategy, to the `recipient`'s address * @param recipient is the address to receive the withdrawn funds * @param token is the ERC20 token being transferred out * @param amountShares is the amount of shares being withdrawn * @dev This function is only callable by the strategyManager contract. It is invoked inside of the strategyManager's * other functions, and individual share balances are recorded in the strategyManager as well. */ function withdraw(address recipient, IERC20 token, uint256 amountShares) external; /** * @notice Used to convert a number of shares to the equivalent amount of underlying tokens for this strategy. * @notice In contrast to `sharesToUnderlyingView`, this function **may** make state modifications * @param amountShares is the amount of shares to calculate its conversion into the underlying token * @return The amount of underlying tokens corresponding to the input `amountShares` * @dev Implementation for these functions in particular may vary significantly for different strategies */ function sharesToUnderlying(uint256 amountShares) external returns (uint256); /** * @notice Used to convert an amount of underlying tokens to the equivalent amount of shares in this strategy. * @notice In contrast to `underlyingToSharesView`, this function **may** make state modifications * @param amountUnderlying is the amount of `underlyingToken` to calculate its conversion into strategy shares * @return The amount of underlying tokens corresponding to the input `amountShares` * @dev Implementation for these functions in particular may vary significantly for different strategies */ function underlyingToShares(uint256 amountUnderlying) external returns (uint256); /** * @notice convenience function for fetching the current underlying value of all of the `user`'s shares in * this strategy. In contrast to `userUnderlyingView`, this function **may** make state modifications */ function userUnderlying(address user) external returns (uint256); /** * @notice convenience function for fetching the current total shares of `user` in this strategy, by * querying the `strategyManager` contract */ function shares(address user) external view returns (uint256); /** * @notice Used to convert a number of shares to the equivalent amount of underlying tokens for this strategy. * @notice In contrast to `sharesToUnderlying`, this function guarantees no state modifications * @param amountShares is the amount of shares to calculate its conversion into the underlying token * @return The amount of shares corresponding to the input `amountUnderlying` * @dev Implementation for these functions in particular may vary significantly for different strategies */ function sharesToUnderlyingView(uint256 amountShares) external view returns (uint256); /** * @notice Used to convert an amount of underlying tokens to the equivalent amount of shares in this strategy. * @notice In contrast to `underlyingToShares`, this function guarantees no state modifications * @param amountUnderlying is the amount of `underlyingToken` to calculate its conversion into strategy shares * @return The amount of shares corresponding to the input `amountUnderlying` * @dev Implementation for these functions in particular may vary significantly for different strategies */ function underlyingToSharesView(uint256 amountUnderlying) external view returns (uint256); /** * @notice convenience function for fetching the current underlying value of all of the `user`'s shares in * this strategy. In contrast to `userUnderlying`, this function guarantees no state modifications */ function userUnderlyingView(address user) external view returns (uint256); /// @notice The underlying token for shares in this Strategy function underlyingToken() external view returns (IERC20); /// @notice The total number of extant shares in this Strategy function totalShares() external view returns (uint256); /// @notice Returns either a brief string explaining the strategy's goal & purpose, or a link to metadata that explains in more detail. function explanation() external view returns (string memory); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "./IStrategy.sol"; import "./ISlasher.sol"; import "./IDelegationManager.sol"; import "./IEigenPodManager.sol"; /** * @title Interface for the primary entrypoint for funds into EigenLayer. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service * @notice See the `StrategyManager` contract itself for implementation details. */ interface IStrategyManager { // Access to public vars - hack locally function stakerStrategyList(address staker, uint256 index) external view returns (IStrategy); function strategyIsWhitelistedForDeposit(IStrategy _strategy) external view returns (bool); /** * @notice Emitted when a new deposit occurs on behalf of `staker`. * @param staker Is the staker who is depositing funds into EigenLayer. * @param strategy Is the strategy that `staker` has deposited into. * @param token Is the token that `staker` deposited. * @param shares Is the number of new shares `staker` has been granted in `strategy`. */ event Deposit(address staker, IERC20 token, IStrategy strategy, uint256 shares); /// @notice Emitted when `thirdPartyTransfersForbidden` is updated for a strategy and value by the owner event UpdatedThirdPartyTransfersForbidden(IStrategy strategy, bool value); /// @notice Emitted when the `strategyWhitelister` is changed event StrategyWhitelisterChanged(address previousAddress, address newAddress); /// @notice Emitted when a strategy is added to the approved list of strategies for deposit event StrategyAddedToDepositWhitelist(IStrategy strategy); /// @notice Emitted when a strategy is removed from the approved list of strategies for deposit event StrategyRemovedFromDepositWhitelist(IStrategy strategy); /** * @notice Deposits `amount` of `token` into the specified `strategy`, with the resultant shares credited to `msg.sender` * @param strategy is the specified strategy where deposit is to be made, * @param token is the denomination in which the deposit is to be made, * @param amount is the amount of token to be deposited in the strategy by the staker * @return shares The amount of new shares in the `strategy` created as part of the action. * @dev The `msg.sender` must have previously approved this contract to transfer at least `amount` of `token` on their behalf. * @dev Cannot be called by an address that is 'frozen' (this function will revert if the `msg.sender` is frozen). * * WARNING: Depositing tokens that allow reentrancy (eg. ERC-777) into a strategy is not recommended. This can lead to attack vectors * where the token balance and corresponding strategy shares are not in sync upon reentrancy. */ function depositIntoStrategy( IStrategy strategy, IERC20 token, uint256 amount ) external returns (uint256 shares); /** * @notice Used for depositing an asset into the specified strategy with the resultant shares credited to `staker`, * who must sign off on the action. * Note that the assets are transferred out/from the `msg.sender`, not from the `staker`; this function is explicitly designed * purely to help one address deposit 'for' another. * @param strategy is the specified strategy where deposit is to be made, * @param token is the denomination in which the deposit is to be made, * @param amount is the amount of token to be deposited in the strategy by the staker * @param staker the staker that the deposited assets will be credited to * @param expiry the timestamp at which the signature expires * @param signature is a valid signature from the `staker`. either an ECDSA signature if the `staker` is an EOA, or data to forward * following EIP-1271 if the `staker` is a contract * @return shares The amount of new shares in the `strategy` created as part of the action. * @dev The `msg.sender` must have previously approved this contract to transfer at least `amount` of `token` on their behalf. * @dev A signature is required for this function to eliminate the possibility of griefing attacks, specifically those * targeting stakers who may be attempting to undelegate. * @dev Cannot be called if thirdPartyTransfersForbidden is set to true for this strategy * * WARNING: Depositing tokens that allow reentrancy (eg. ERC-777) into a strategy is not recommended. This can lead to attack vectors * where the token balance and corresponding strategy shares are not in sync upon reentrancy */ function depositIntoStrategyWithSignature( IStrategy strategy, IERC20 token, uint256 amount, address staker, uint256 expiry, bytes memory signature ) external returns (uint256 shares); /// @notice Used by the DelegationManager to remove a Staker's shares from a particular strategy when entering the withdrawal queue function removeShares(address staker, IStrategy strategy, uint256 shares) external; /// @notice Used by the DelegationManager to award a Staker some shares that have passed through the withdrawal queue function addShares(address staker, IERC20 token, IStrategy strategy, uint256 shares) external; /// @notice Used by the DelegationManager to convert withdrawn shares to tokens and send them to a recipient function withdrawSharesAsTokens( address recipient, IStrategy strategy, uint256 shares, IERC20 token ) external; /// @notice Returns the current shares of `user` in `strategy` function stakerStrategyShares( address user, IStrategy strategy ) external view returns (uint256 shares); /** * @notice Get all details on the staker's deposits and corresponding shares * @return (staker's strategies, shares in these strategies) */ function getDeposits( address staker ) external view returns (IStrategy[] memory, uint256[] memory); /// @notice Simple getter function that returns `stakerStrategyList[staker].length`. function stakerStrategyListLength(address staker) external view returns (uint256); /** * @notice Owner-only function that adds the provided Strategies to the 'whitelist' of strategies that stakers can deposit into * @param strategiesToWhitelist Strategies that will be added to the `strategyIsWhitelistedForDeposit` mapping (if they aren't in it already) * @param thirdPartyTransfersForbiddenValues bool values to set `thirdPartyTransfersForbidden` to for each strategy */ function addStrategiesToDepositWhitelist( IStrategy[] calldata strategiesToWhitelist, bool[] calldata thirdPartyTransfersForbiddenValues ) external; /** * @notice Owner-only function that removes the provided Strategies from the 'whitelist' of strategies that stakers can deposit into * @param strategiesToRemoveFromWhitelist Strategies that will be removed to the `strategyIsWhitelistedForDeposit` mapping (if they are in it) */ function removeStrategiesFromDepositWhitelist( IStrategy[] calldata strategiesToRemoveFromWhitelist ) external; /// @notice Returns the single, central Delegation contract of EigenLayer function delegation() external view returns (IDelegationManager); /// @notice Returns the single, central Slasher contract of EigenLayer function slasher() external view returns (ISlasher); /// @notice Returns the EigenPodManager contract of EigenLayer function eigenPodManager() external view returns (IEigenPodManager); /// @notice Returns the address of the `strategyWhitelister` function strategyWhitelister() external view returns (address); /** * @notice Returns bool for whether or not `strategy` enables credit transfers. i.e enabling * depositIntoStrategyWithSignature calls or queueing withdrawals to a different address than the staker. */ function thirdPartyTransfersForbidden(IStrategy strategy) external view returns (bool); // LIMITED BACKWARDS-COMPATIBILITY FOR DEPRECATED FUNCTIONALITY // packed struct for queued withdrawals; helps deal with stack-too-deep errors struct DeprecatedStruct_WithdrawerAndNonce { address withdrawer; uint96 nonce; } /** * Struct type used to specify an existing queued withdrawal. Rather than storing the entire struct, only a hash is stored. * In functions that operate on existing queued withdrawals -- e.g. `startQueuedWithdrawalWaitingPeriod` or `completeQueuedWithdrawal`, * the data is resubmitted and the hash of the submitted data is computed by `calculateWithdrawalRoot` and checked against the * stored hash in order to confirm the integrity of the submitted data. */ struct DeprecatedStruct_QueuedWithdrawal { IStrategy[] strategies; uint256[] shares; address staker; DeprecatedStruct_WithdrawerAndNonce withdrawerAndNonce; uint32 withdrawalStartBlock; address delegatedAddress; } function migrateQueuedWithdrawal( DeprecatedStruct_QueuedWithdrawal memory queuedWithdrawal ) external returns (bool, bytes32); function calculateWithdrawalRoot( DeprecatedStruct_QueuedWithdrawal memory queuedWithdrawal ) external pure returns (bytes32); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import "./Merkle.sol"; import "../libraries/Endian.sol"; //Utility library for parsing and PHASE0 beacon chain block headers //SSZ Spec: https://github.com/ethereum/consensus-specs/blob/dev/ssz/simple-serialize.md#merkleization //BeaconBlockHeader Spec: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconblockheader //BeaconState Spec: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconstate library BeaconChainProofs { /// @notice Heights of various merkle trees in the beacon chain /// - beaconBlockRoot /// | HEIGHT: BEACON_BLOCK_HEADER_TREE_HEIGHT /// -- beaconStateRoot /// | HEIGHT: BEACON_STATE_TREE_HEIGHT /// validatorContainerRoot, balanceContainerRoot /// | | HEIGHT: BALANCE_TREE_HEIGHT /// | individual balances /// | HEIGHT: VALIDATOR_TREE_HEIGHT /// individual validators uint256 internal constant BEACON_BLOCK_HEADER_TREE_HEIGHT = 3; uint256 internal constant BEACON_STATE_TREE_HEIGHT = 5; uint256 internal constant BALANCE_TREE_HEIGHT = 38; uint256 internal constant VALIDATOR_TREE_HEIGHT = 40; /// @notice Index of the beaconStateRoot in the `BeaconBlockHeader` container /// /// BeaconBlockHeader = [..., state_root, ...] /// 0... 3 /// /// (See https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconblockheader) uint256 internal constant STATE_ROOT_INDEX = 3; /// @notice Indices for fields in the `BeaconState` container /// /// BeaconState = [..., validators, balances, ...] /// 0... 11 12 /// /// (See https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#beaconstate) uint256 internal constant VALIDATOR_CONTAINER_INDEX = 11; uint256 internal constant BALANCE_CONTAINER_INDEX = 12; /// @notice Number of fields in the `Validator` container /// (See https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator) uint256 internal constant VALIDATOR_FIELDS_LENGTH = 8; /// @notice Indices for fields in the `Validator` container uint256 internal constant VALIDATOR_PUBKEY_INDEX = 0; uint256 internal constant VALIDATOR_WITHDRAWAL_CREDENTIALS_INDEX = 1; uint256 internal constant VALIDATOR_BALANCE_INDEX = 2; uint256 internal constant VALIDATOR_SLASHED_INDEX = 3; uint256 internal constant VALIDATOR_EXIT_EPOCH_INDEX = 6; /// @notice Slot/Epoch timings uint64 internal constant SECONDS_PER_SLOT = 12; uint64 internal constant SLOTS_PER_EPOCH = 32; uint64 internal constant SECONDS_PER_EPOCH = SLOTS_PER_EPOCH * SECONDS_PER_SLOT; /// @notice `FAR_FUTURE_EPOCH` is used as the default value for certain `Validator` /// fields when a `Validator` is first created on the beacon chain uint64 internal constant FAR_FUTURE_EPOCH = type(uint64).max; bytes8 internal constant UINT64_MASK = 0xffffffffffffffff; /// @notice Contains a beacon state root and a merkle proof verifying its inclusion under a beacon block root struct StateRootProof { bytes32 beaconStateRoot; bytes proof; } /// @notice Contains a validator's fields and a merkle proof of their inclusion under a beacon state root struct ValidatorProof { bytes32[] validatorFields; bytes proof; } /// @notice Contains a beacon balance container root and a proof of this root under a beacon block root struct BalanceContainerProof { bytes32 balanceContainerRoot; bytes proof; } /// @notice Contains a validator balance root and a proof of its inclusion under a balance container root struct BalanceProof { bytes32 pubkeyHash; bytes32 balanceRoot; bytes proof; } /******************************************************************************* VALIDATOR FIELDS -> BEACON STATE ROOT -> BEACON BLOCK ROOT *******************************************************************************/ /// @notice Verify a merkle proof of the beacon state root against a beacon block root /// @param beaconBlockRoot merkle root of the beacon block /// @param proof the beacon state root and merkle proof of its inclusion under `beaconBlockRoot` function verifyStateRoot(bytes32 beaconBlockRoot, StateRootProof calldata proof) internal view { require( proof.proof.length == 32 * (BEACON_BLOCK_HEADER_TREE_HEIGHT), "BeaconChainProofs.verifyStateRoot: Proof has incorrect length" ); /// This merkle proof verifies the `beaconStateRoot` under the `beaconBlockRoot` /// - beaconBlockRoot /// | HEIGHT: BEACON_BLOCK_HEADER_TREE_HEIGHT /// -- beaconStateRoot require( Merkle.verifyInclusionSha256({ proof: proof.proof, root: beaconBlockRoot, leaf: proof.beaconStateRoot, index: STATE_ROOT_INDEX }), "BeaconChainProofs.verifyStateRoot: Invalid state root merkle proof" ); } /// @notice Verify a merkle proof of a validator container against a `beaconStateRoot` /// @dev This proof starts at a validator's container root, proves through the validator container root, /// and continues proving to the root of the `BeaconState` /// @dev See https://eth2book.info/capella/part3/containers/dependencies/#validator for info on `Validator` containers /// @dev See https://eth2book.info/capella/part3/containers/state/#beaconstate for info on `BeaconState` containers /// @param beaconStateRoot merkle root of the `BeaconState` container /// @param validatorFields an individual validator's fields. These are merklized to form a `validatorRoot`, /// which is used as the leaf to prove against `beaconStateRoot` /// @param validatorFieldsProof a merkle proof of inclusion of `validatorFields` under `beaconStateRoot` /// @param validatorIndex the validator's unique index function verifyValidatorFields( bytes32 beaconStateRoot, bytes32[] calldata validatorFields, bytes calldata validatorFieldsProof, uint40 validatorIndex ) internal view { require( validatorFields.length == VALIDATOR_FIELDS_LENGTH, "BeaconChainProofs.verifyValidatorFields: Validator fields has incorrect length" ); /// Note: the reason we use `VALIDATOR_TREE_HEIGHT + 1` here is because the merklization process for /// this container includes hashing the root of the validator tree with the length of the validator list require( validatorFieldsProof.length == 32 * ((VALIDATOR_TREE_HEIGHT + 1) + BEACON_STATE_TREE_HEIGHT), "BeaconChainProofs.verifyValidatorFields: Proof has incorrect length" ); // Merkleize `validatorFields` to get the leaf to prove bytes32 validatorRoot = Merkle.merkleizeSha256(validatorFields); /// This proof combines two proofs, so its index accounts for the relative position of leaves in two trees: /// - beaconStateRoot /// | HEIGHT: BEACON_STATE_TREE_HEIGHT /// -- validatorContainerRoot /// | HEIGHT: VALIDATOR_TREE_HEIGHT + 1 /// ---- validatorRoot uint256 index = (VALIDATOR_CONTAINER_INDEX << (VALIDATOR_TREE_HEIGHT + 1)) | uint256(validatorIndex); require( Merkle.verifyInclusionSha256({ proof: validatorFieldsProof, root: beaconStateRoot, leaf: validatorRoot, index: index }), "BeaconChainProofs.verifyValidatorFields: Invalid merkle proof" ); } /******************************************************************************* VALIDATOR BALANCE -> BALANCE CONTAINER ROOT -> BEACON BLOCK ROOT *******************************************************************************/ /// @notice Verify a merkle proof of the beacon state's balances container against the beacon block root /// @dev This proof starts at the balance container root, proves through the beacon state root, and /// continues proving through the beacon block root. As a result, this proof will contain elements /// of a `StateRootProof` under the same block root, with the addition of proving the balances field /// within the beacon state. /// @dev This is used to make checkpoint proofs more efficient, as a checkpoint will verify multiple balances /// against the same balance container root. /// @param beaconBlockRoot merkle root of the beacon block /// @param proof a beacon balance container root and merkle proof of its inclusion under `beaconBlockRoot` function verifyBalanceContainer( bytes32 beaconBlockRoot, BalanceContainerProof calldata proof ) internal view { require( proof.proof.length == 32 * (BEACON_BLOCK_HEADER_TREE_HEIGHT + BEACON_STATE_TREE_HEIGHT), "BeaconChainProofs.verifyBalanceContainer: Proof has incorrect length" ); /// This proof combines two proofs, so its index accounts for the relative position of leaves in two trees: /// - beaconBlockRoot /// | HEIGHT: BEACON_BLOCK_HEADER_TREE_HEIGHT /// -- beaconStateRoot /// | HEIGHT: BEACON_STATE_TREE_HEIGHT /// ---- balancesContainerRoot uint256 index = (STATE_ROOT_INDEX << (BEACON_STATE_TREE_HEIGHT)) | BALANCE_CONTAINER_INDEX; require( Merkle.verifyInclusionSha256({ proof: proof.proof, root: beaconBlockRoot, leaf: proof.balanceContainerRoot, index: index }), "BeaconChainProofs.verifyBalanceContainer: invalid balance container proof" ); } /// @notice Verify a merkle proof of a validator's balance against the beacon state's `balanceContainerRoot` /// @param balanceContainerRoot the merkle root of all validators' current balances /// @param validatorIndex the index of the validator whose balance we are proving /// @param proof the validator's associated balance root and a merkle proof of inclusion under `balanceContainerRoot` /// @return validatorBalanceGwei the validator's current balance (in gwei) function verifyValidatorBalance( bytes32 balanceContainerRoot, uint40 validatorIndex, BalanceProof calldata proof ) internal view returns (uint64 validatorBalanceGwei) { /// Note: the reason we use `BALANCE_TREE_HEIGHT + 1` here is because the merklization process for /// this container includes hashing the root of the balances tree with the length of the balances list require( proof.proof.length == 32 * (BALANCE_TREE_HEIGHT + 1), "BeaconChainProofs.verifyValidatorBalance: Proof has incorrect length" ); /// When merkleized, beacon chain balances are combined into groups of 4 called a `balanceRoot`. The merkle /// proof here verifies that this validator's `balanceRoot` is included in the `balanceContainerRoot` /// - balanceContainerRoot /// | HEIGHT: BALANCE_TREE_HEIGHT /// -- balanceRoot uint256 balanceIndex = uint256(validatorIndex / 4); require( Merkle.verifyInclusionSha256({ proof: proof.proof, root: balanceContainerRoot, leaf: proof.balanceRoot, index: balanceIndex }), "BeaconChainProofs.verifyValidatorBalance: Invalid merkle proof" ); /// Extract the individual validator's balance from the `balanceRoot` return getBalanceAtIndex(proof.balanceRoot, validatorIndex); } /** * @notice Parses a balanceRoot to get the uint64 balance of a validator. * @dev During merkleization of the beacon state balance tree, four uint64 values are treated as a single * leaf in the merkle tree. We use validatorIndex % 4 to determine which of the four uint64 values to * extract from the balanceRoot. * @param balanceRoot is the combination of 4 validator balances being proven for * @param validatorIndex is the index of the validator being proven for * @return The validator's balance, in Gwei */ function getBalanceAtIndex( bytes32 balanceRoot, uint40 validatorIndex ) internal pure returns (uint64) { uint256 bitShiftAmount = (validatorIndex % 4) * 64; return Endian.fromLittleEndianUint64(bytes32((uint256(balanceRoot) << bitShiftAmount))); } /// @notice Indices for fields in the `Validator` container: /// 0: pubkey /// 1: withdrawal credentials /// 2: effective balance /// 3: slashed? /// 4: activation elligibility epoch /// 5: activation epoch /// 6: exit epoch /// 7: withdrawable epoch /// /// (See https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator) /// @dev Retrieves a validator's pubkey hash function getPubkeyHash(bytes32[] memory validatorFields) internal pure returns (bytes32) { return validatorFields[VALIDATOR_PUBKEY_INDEX]; } /// @dev Retrieves a validator's withdrawal credentials function getWithdrawalCredentials( bytes32[] memory validatorFields ) internal pure returns (bytes32) { return validatorFields[VALIDATOR_WITHDRAWAL_CREDENTIALS_INDEX]; } /// @dev Retrieves a validator's effective balance (in gwei) function getEffectiveBalanceGwei( bytes32[] memory validatorFields ) internal pure returns (uint64) { return Endian.fromLittleEndianUint64(validatorFields[VALIDATOR_BALANCE_INDEX]); } /// @dev Retrieves true IFF a validator is marked slashed function isValidatorSlashed(bytes32[] memory validatorFields) internal pure returns (bool) { return validatorFields[VALIDATOR_SLASHED_INDEX] != 0; } /// @dev Retrieves a validator's exit epoch function getExitEpoch(bytes32[] memory validatorFields) internal pure returns (uint64) { return Endian.fromLittleEndianUint64(validatorFields[VALIDATOR_EXIT_EPOCH_INDEX]); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; library Endian { /** * @notice Converts a little endian-formatted uint64 to a big endian-formatted uint64 * @param lenum little endian-formatted uint64 input, provided as 'bytes32' type * @return n The big endian-formatted uint64 * @dev Note that the input is formatted as a 'bytes32' type (i.e. 256 bits), but it is immediately truncated to a uint64 (i.e. 64 bits) * through a right-shift/shr operation. */ function fromLittleEndianUint64(bytes32 lenum) internal pure returns (uint64 n) { // the number needs to be stored in little-endian encoding (ie in bytes 0-8) n = uint64(uint256(lenum >> 192)); return (n >> 56) | ((0x00FF000000000000 & n) >> 40) | ((0x0000FF0000000000 & n) >> 24) | ((0x000000FF00000000 & n) >> 8) | ((0x00000000FF000000 & n) << 8) | ((0x0000000000FF0000 & n) << 24) | ((0x000000000000FF00 & n) << 40) | ((0x00000000000000FF & n) << 56); } }
// SPDX-License-Identifier: MIT // Adapted from OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ library Merkle { /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. The tree is built assuming `leaf` is * the 0 indexed `index`'th leaf from the bottom left of the tree. * * Note this is for a Merkle tree using the keccak/sha3 hash function */ function verifyInclusionKeccak( bytes memory proof, bytes32 root, bytes32 leaf, uint256 index ) internal pure returns (bool) { return processInclusionProofKeccak(proof, leaf, index) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. The tree is built assuming `leaf` is * the 0 indexed `index`'th leaf from the bottom left of the tree. * * _Available since v4.4._ * * Note this is for a Merkle tree using the keccak/sha3 hash function */ function processInclusionProofKeccak( bytes memory proof, bytes32 leaf, uint256 index ) internal pure returns (bytes32) { require( proof.length != 0 && proof.length % 32 == 0, "Merkle.processInclusionProofKeccak: proof length should be a non-zero multiple of 32" ); bytes32 computedHash = leaf; for (uint256 i = 32; i <= proof.length; i += 32) { if (index % 2 == 0) { // if ith bit of index is 0, then computedHash is a left sibling assembly { mstore(0x00, computedHash) mstore(0x20, mload(add(proof, i))) computedHash := keccak256(0x00, 0x40) index := div(index, 2) } } else { // if ith bit of index is 1, then computedHash is a right sibling assembly { mstore(0x00, mload(add(proof, i))) mstore(0x20, computedHash) computedHash := keccak256(0x00, 0x40) index := div(index, 2) } } } return computedHash; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. The tree is built assuming `leaf` is * the 0 indexed `index`'th leaf from the bottom left of the tree. * * Note this is for a Merkle tree using the sha256 hash function */ function verifyInclusionSha256( bytes memory proof, bytes32 root, bytes32 leaf, uint256 index ) internal view returns (bool) { return processInclusionProofSha256(proof, leaf, index) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. The tree is built assuming `leaf` is * the 0 indexed `index`'th leaf from the bottom left of the tree. * * _Available since v4.4._ * * Note this is for a Merkle tree using the sha256 hash function */ function processInclusionProofSha256( bytes memory proof, bytes32 leaf, uint256 index ) internal view returns (bytes32) { require( proof.length != 0 && proof.length % 32 == 0, "Merkle.processInclusionProofSha256: proof length should be a non-zero multiple of 32" ); bytes32[1] memory computedHash = [leaf]; for (uint256 i = 32; i <= proof.length; i += 32) { if (index % 2 == 0) { // if ith bit of index is 0, then computedHash is a left sibling assembly { mstore(0x00, mload(computedHash)) mstore(0x20, mload(add(proof, i))) if iszero(staticcall(sub(gas(), 2000), 2, 0x00, 0x40, computedHash, 0x20)) { revert(0, 0) } index := div(index, 2) } } else { // if ith bit of index is 1, then computedHash is a right sibling assembly { mstore(0x00, mload(add(proof, i))) mstore(0x20, mload(computedHash)) if iszero(staticcall(sub(gas(), 2000), 2, 0x00, 0x40, computedHash, 0x20)) { revert(0, 0) } index := div(index, 2) } } } return computedHash[0]; } /** @notice this function returns the merkle root of a tree created from a set of leaves using sha256 as its hash function @param leaves the leaves of the merkle tree @return The computed Merkle root of the tree. @dev A pre-condition to this function is that leaves.length is a power of two. If not, the function will merkleize the inputs incorrectly. */ function merkleizeSha256(bytes32[] memory leaves) internal pure returns (bytes32) { //there are half as many nodes in the layer above the leaves uint256 numNodesInLayer = leaves.length / 2; //create a layer to store the internal nodes bytes32[] memory layer = new bytes32[](numNodesInLayer); //fill the layer with the pairwise hashes of the leaves for (uint256 i = 0; i < numNodesInLayer; i++) { layer[i] = sha256(abi.encodePacked(leaves[2 * i], leaves[2 * i + 1])); } //the next layer above has half as many nodes numNodesInLayer /= 2; //while we haven't computed the root while (numNodesInLayer != 0) { //overwrite the first numNodesInLayer nodes in layer with the pairwise hashes of their children for (uint256 i = 0; i < numNodesInLayer; i++) { layer[i] = sha256(abi.encodePacked(layer[2 * i], layer[2 * i + 1])); } //the next layer above has half as many nodes numNodesInLayer /= 2; } //the first node in the layer is the root return layer[0]; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; /// @dev Error for 0x0 address inputs error InvalidZeroInput(); /// @dev Error for already added items to a list error AlreadyAdded(); /// @dev Error for not found items in a list error NotFound(); /// @dev Error for hitting max TVL error MaxTVLReached(); /// @dev Error for caller not having permissions error NotRestakeManagerAdmin(); /// @dev Error for call not coming from deposit queue contract error NotDepositQueue(); /// @dev Error for contract being paused error ContractPaused(); /// @dev Error for exceeding max basis points (100%) error OverMaxBasisPoints(); /// @dev Error for invalid token decimals for collateral tokens (must be 18) error InvalidTokenDecimals(uint8 expected, uint8 actual); /// @dev Error when withdraw is already completed error WithdrawAlreadyCompleted(); /// @dev Error when a different address tries to complete withdraw error NotOriginalWithdrawCaller(address expectedCaller); /// @dev Error when caller does not have OD admin role error NotOperatorDelegatorAdmin(); /// @dev Error when caller does not have Oracle Admin role error NotOracleAdmin(); /// @dev Error when caller is not RestakeManager contract error NotRestakeManager(); /// @dev Errror when caller does not have ETH Restake Admin role error NotNativeEthRestakeAdmin(); /// @dev Error when delegation address was already set - cannot be set again error DelegateAddressAlreadySet(); /// @dev Error when caller does not have ERC20 Rewards Admin role error NotERC20RewardsAdmin(); /// @dev Error when sending ETH fails error TransferFailed(); /// @dev Error when caller does not have ETH Minter Burner Admin role error NotEzETHMinterBurner(); /// @dev Error when caller does not have Token Admin role error NotTokenAdmin(); /// @dev Error when price oracle is not configured error OracleNotFound(); /// @dev Error when price oracle data is stale error OraclePriceExpired(); /// @dev Error when array lengths do not match error MismatchedArrayLengths(); /// @dev Error when caller does not have Deposit Withdraw Pauser role error NotDepositWithdrawPauser(); /// @dev Error when an individual token TVL is over the max error MaxTokenTVLReached(); /// @dev Error when Oracle price is invalid error InvalidOraclePrice(); /// @dev Error when calling an invalid function error NotImplemented(); /// @dev Error when calculating token amounts is invalid error InvalidTokenAmount(); /// @dev Error when timestamp is invalid - likely in the past error InvalidTimestamp(uint256 timestamp); /// @dev Error when trade does not meet minimum output amount error InsufficientOutputAmount(); /// @dev Error when the token received over the bridge is not the one expected error InvalidTokenReceived(); /// @dev Error when the origin address is not whitelisted error InvalidOrigin(); /// @dev Error when the sender is not expected error InvalidSender(address expectedSender, address actualSender); /// @dev error when function returns 0 amount error InvalidZeroOutput(); /// @dev error when xRenzoBridge does not have enough balance to pay for fee error NotEnoughBalance(uint256 currentBalance, uint256 calculatedFees); /// @dev error when source chain is not expected error InvalidSourceChain(uint64 expectedCCIPChainSelector, uint64 actualCCIPChainSelector); /// @dev Error when an unauthorized address tries to call the bridge function on the L2 error UnauthorizedBridgeSweeper(); /// @dev Error when caller does not have BRIDGE_ADMIN role error NotBridgeAdmin(); /// @dev Error when caller does not have PRICE_FEED_SENDER role error NotPriceFeedSender(); /// @dev Error for connext price Feed unauthorised call error UnAuthorisedCall(); /// @dev Error for no price feed configured on L2 error PriceFeedNotAvailable(); /// @dev Error for invalid bridge fee share configuration error InvalidBridgeFeeShare(uint256 bridgeFee); /// @dev Error for invalid sweep batch size error InvalidSweepBatchSize(uint256 batchSize); /// @dev Error when caller does not have Withdraw Queue admin role error NotWithdrawQueueAdmin(); /// @dev Error when caller try to withdraw more than Buffer error NotEnoughWithdrawBuffer(); /// @dev Error when caller try to claim withdraw before cooldown period error EarlyClaim(); /// @dev Error when caller try to withdraw for unsupported asset error UnsupportedWithdrawAsset(); /// @dev Error when caller try to claim invalidWithdrawIndex error InvalidWithdrawIndex(); /// @dev Error when TVL was expected to be 0 error InvalidTVL(); /// @dev Error when incorrect BeaconChainStrategy is set for LST in completeQueuedWithdrawal error IncorrectStrategy(); /// @dev Error when adding new OperatorDelegator which is not delegated error OperatoDelegatorNotDelegated(); /// @dev Error when emergency tracking already tracked withdrawal error WithdrawalAlreadyTracked(); /// @dev Error when emergency tracking already completed withdrawal error WithdrawalAlreadyCompleted(); /// @dev Error when caller does not have Emergency Withdraw Tracking Admin role error NotEmergencyWithdrawTrackingAdmin(); /// @dev Error when strategy does not have specified underlying error InvalidStrategy(); /// @dev Error when strategy already set and hold non zero token balance error NonZeroUnderlyingStrategyExist(); /// @dev Error when caller tried to claim queued withdrawal when not filled error QueuedWithdrawalNotFilled(); /// @dev Error when caller does not have EigenLayerRewardsAdmin role error NotEigenLayerRewardsAdmin(); /// @dev Error when rewardsDestination is not configured while trying to claim error RewardsDestinationNotConfigured(); /// @dev Error when WETHUnwrapper is not configured while trying to claim WETH restaking rewards error WETHUnwrapperNotConfigured(); /// @dev Error when currentCheckpoint is not accounted by OperatorDelegator error CheckpointAlreadyActive(); /// @dev Error when specified checkpoint is already recorded error CheckpointAlreadyRecorded(); /// @dev Error when caller does not have Emergency Checkpoint Tracking admin role error NotEmergencyCheckpointTrackingAdmin(); /// @dev Error when last completed checkpoint on EigenPod is not recorded in OperatorDelegator error CheckpointNotRecorded(); /// @dev Error when non pauser tries to change pause state error NotPauser(); /// @dev Error when user tried to withdraw asset more than available in protocol collateral error NotEnoughCollateralValue(); /// @dev Error when admin tries to disable asset withdraw queue which is not enabled error WithdrawQueueNotEnabled(); /// @dev Error when admin tries to enable erc20 withdraw queue for IS_NATIVE address error IsNativeAddressNotAllowed(); /// @dev Error when admin tried to complete queued withdrawal with receiveAsShares error OnlyReceiveAsTokenAllowed();
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; import "./Delegation/IOperatorDelegator.sol"; import "./Deposits/IDepositQueue.sol"; interface IRestakeManager { function stakeEthInOperatorDelegator( IOperatorDelegator operatorDelegator, bytes calldata pubkey, bytes calldata signature, bytes32 depositDataRoot ) external payable; function depositTokenRewardsFromProtocol(IERC20 _token, uint256 _amount) external; function depositQueue() external view returns (IDepositQueue); function calculateTVLs() external view returns (uint256[][] memory, uint256[] memory, uint256); function depositETH() external payable; function getCollateralTokenIndex(IERC20 _collateralToken) external view returns (uint256); function getCollateralTokensLength() external view returns (uint256); function collateralTokens(uint256 index) external view returns (IERC20); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; interface IRoleManager { /// @dev Determines if the specified address has permissions to manage RoleManager /// @param potentialAddress Address to check function isRoleManagerAdmin(address potentialAddress) external view returns (bool); /// @dev Determines if the specified address has permission to mint or burn ezETH tokens /// @param potentialAddress Address to check function isEzETHMinterBurner(address potentialAddress) external view returns (bool); /// @dev Determines if the specified address has permission to update config on the OperatorDelgator Contracts /// @param potentialAddress Address to check function isOperatorDelegatorAdmin(address potentialAddress) external view returns (bool); /// @dev Determines if the specified address has permission to update config on the Oracle Contract config /// @param potentialAddress Address to check function isOracleAdmin(address potentialAddress) external view returns (bool); /// @dev Determines if the specified address has permission to update config on the Restake Manager /// @param potentialAddress Address to check function isRestakeManagerAdmin(address potentialAddress) external view returns (bool); /// @dev Determines if the specified address has permission to update config on the Token Contract /// @param potentialAddress Address to check function isTokenAdmin(address potentialAddress) external view returns (bool); /// @dev Determines if the specified address has permission to trigger restaking of native ETH /// @param potentialAddress Address to check function isNativeEthRestakeAdmin(address potentialAddress) external view returns (bool); /// @dev Determines if the specified address has permission to sweep and deposit ERC20 Rewards /// @param potentialAddress Address to check function isERC20RewardsAdmin(address potentialAddress) external view returns (bool); /// @dev Determines if the specified address has permission to pause deposits and withdraws /// @param potentialAddress Address to check function isDepositWithdrawPauser(address potentialAddress) external view returns (bool); /// @dev Determines if the specified address has permission to set whitelisted origin in xRenzoBridge /// @param potentialAddress Address to check function isBridgeAdmin(address potentialAddress) external view returns (bool); /// @dev Determined if the specified address has permission to send price feed of ezETH to L2 /// @param potentialAddress Address to check function isPriceFeedSender(address potentialAddress) external view returns (bool); /// @dev Determine if the specified address haas permission to update Withdraw Queue params /// @param potentialAddress Address to check function isWithdrawQueueAdmin(address potentialAddress) external view returns (bool); /// @dev Determine if the specified address has permission to track emergency pending queued withdrawals /// @param potentialAddress Address to check function isEmergencyWithdrawTrackingAdmin( address potentialAddress ) external view returns (bool); /// @dev Determine if the specified address has permission to process EigenLayer rewards /// @param potentialAddress Address to check function isEigenLayerRewardsAdmin(address potentialAddress) external view returns (bool); /// @dev Determin if the specified address has permission to track missed Checkpoints Exit Balance /// @param potentialAddress Address to check function isEmergencyCheckpointTrackingAdmin( address potentialAddress ) external view returns (bool); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; interface IWithdrawQueue { /// @dev To get available value to withdraw from buffer /// @param _asset address of token function getAvailableToWithdraw(address _asset) external view returns (uint256); /// @dev To get the withdraw buffer target of given asset /// @param _asset address of token function withdrawalBufferTarget(address _asset) external view returns (uint256); /// @dev To get the current Target Buffer Deficit /// @param _asset address of token function getWithdrawDeficit(address _asset) external view returns (uint256); /// @dev Fill ERC20 Withdraw Buffer /// @param _asset the token address to fill the respective buffer /// @param _amount amount of token to fill with function fillERC20WithdrawBuffer(address _asset, uint256 _amount) external; /// @dev to get the withdrawRequests for particular user /// @param _user address of the user function withdrawRequests(address _user) external view returns (uint256[] memory); /// @dev Fill ETH Withdraw buffer function fillEthWithdrawBuffer() external payable; }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CheckpointAlreadyActive","type":"error"},{"inputs":[],"name":"CheckpointAlreadyRecorded","type":"error"},{"inputs":[],"name":"CheckpointNotRecorded","type":"error"},{"inputs":[],"name":"DelegateAddressAlreadySet","type":"error"},{"inputs":[],"name":"IncorrectStrategy","type":"error"},{"inputs":[],"name":"InvalidStrategy","type":"error"},{"inputs":[],"name":"InvalidZeroInput","type":"error"},{"inputs":[],"name":"MismatchedArrayLengths","type":"error"},{"inputs":[],"name":"NonZeroUnderlyingStrategyExist","type":"error"},{"inputs":[],"name":"NotEigenLayerRewardsAdmin","type":"error"},{"inputs":[],"name":"NotEmergencyCheckpointTrackingAdmin","type":"error"},{"inputs":[],"name":"NotEmergencyWithdrawTrackingAdmin","type":"error"},{"inputs":[],"name":"NotFound","type":"error"},{"inputs":[],"name":"NotNativeEthRestakeAdmin","type":"error"},{"inputs":[],"name":"NotOperatorDelegatorAdmin","type":"error"},{"inputs":[],"name":"NotRestakeManager","type":"error"},{"inputs":[],"name":"OnlyReceiveAsTokenAllowed","type":"error"},{"inputs":[],"name":"RewardsDestinationNotConfigured","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"WithdrawalAlreadyCompleted","type":"error"},{"inputs":[],"name":"WithdrawalAlreadyTracked","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldBaseGasAmountSpent","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBaseGasAmountSpent","type":"uint256"}],"name":"BaseGasAmountSpentUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"delegateAddress","type":"address"}],"name":"DelegationAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"gasRefunded","type":"uint256"}],"name":"GasRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"gasSpent","type":"uint256"}],"name":"GasSpent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"message","type":"string"}],"name":"Log","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldRewardsCoordinator","type":"address"},{"indexed":false,"internalType":"address","name":"newRewardsCoordinator","type":"address"}],"name":"RewardsCoordinatorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldRewardsDestination","type":"address"},{"indexed":false,"internalType":"address","name":"newRewardsDestination","type":"address"}],"name":"RewardsDestinationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"rewardDestination","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsForwarded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"contract IStrategy","name":"strategy","type":"address"}],"name":"TokenStrategyUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldUnwrapper","type":"address"},{"indexed":false,"internalType":"address","name":"newUnwrapper","type":"address"}],"name":"WETHUnwrapperUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"withdrawalRoot","type":"bytes32"},{"indexed":false,"internalType":"contract IStrategy[]","name":"strategies","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"name":"WithdrawCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"withdrawRoot","type":"bytes32"},{"indexed":false,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"address","name":"delegatedTo","type":"address"},{"indexed":false,"internalType":"address","name":"withdrawer","type":"address"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startBlock","type":"uint256"},{"indexed":false,"internalType":"contract IStrategy[]","name":"strategies","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"name":"WithdrawStarted","type":"event"},{"inputs":[],"name":"IS_NATIVE","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_STAKE_BUT_NOT_VERIFIED_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"adminGasSpentInWei","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseGasAmountSpent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"rootIndex","type":"uint32"},{"internalType":"uint32","name":"earnerIndex","type":"uint32"},{"internalType":"bytes","name":"earnerTreeProof","type":"bytes"},{"components":[{"internalType":"address","name":"earner","type":"address"},{"internalType":"bytes32","name":"earnerTokenRoot","type":"bytes32"}],"internalType":"struct IRewardsCoordinator.EarnerTreeMerkleLeaf","name":"earnerLeaf","type":"tuple"},{"internalType":"uint32[]","name":"tokenIndices","type":"uint32[]"},{"internalType":"bytes[]","name":"tokenTreeProofs","type":"bytes[]"},{"components":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"cumulativeEarnings","type":"uint256"}],"internalType":"struct IRewardsCoordinator.TokenTreeMerkleLeaf[]","name":"tokenLeaves","type":"tuple[]"}],"internalType":"struct IRewardsCoordinator.RewardsMerkleClaim","name":"claim","type":"tuple"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"address","name":"delegatedTo","type":"address"},{"internalType":"address","name":"withdrawer","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint32","name":"startBlock","type":"uint32"},{"internalType":"contract IStrategy[]","name":"strategies","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"internalType":"struct IDelegationManager.Withdrawal","name":"withdrawal","type":"tuple"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256","name":"middlewareTimesIndex","type":"uint256"}],"name":"completeQueuedWithdrawal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"address","name":"delegatedTo","type":"address"},{"internalType":"address","name":"withdrawer","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint32","name":"startBlock","type":"uint32"},{"internalType":"contract IStrategy[]","name":"strategies","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"internalType":"struct IDelegationManager.Withdrawal[]","name":"withdrawals","type":"tuple[]"},{"internalType":"contract IERC20[][]","name":"tokens","type":"address[][]"},{"internalType":"uint256[]","name":"middlewareTimesIndexes","type":"uint256[]"},{"internalType":"bool[]","name":"receiveAsTokens","type":"bool[]"}],"name":"completeQueuedWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentCheckpointTimestamp","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"delegateAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"delegationManager","outputs":[{"internalType":"contract IDelegationManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eigenPod","outputs":[{"internalType":"contract IEigenPod","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eigenPodManager","outputs":[{"internalType":"contract IEigenPodManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64[]","name":"missedCheckpoints","type":"uint64[]"}],"name":"emergencyTrackMissedCheckpoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"address","name":"delegatedTo","type":"address"},{"internalType":"address","name":"withdrawer","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint32","name":"startBlock","type":"uint32"},{"internalType":"contract IStrategy[]","name":"strategies","type":"address[]"},{"internalType":"uint256[]","name":"shares","type":"uint256[]"}],"internalType":"struct IDelegationManager.Withdrawal[]","name":"withdrawals","type":"tuple[]"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"}],"name":"emergencyTrackQueuedWithdrawals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getStakedETHBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IStrategy","name":"_strategy","type":"address"}],"name":"getStrategyIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"getTokenBalanceFromStrategy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IRoleManager","name":"_roleManager","type":"address"},{"internalType":"contract IStrategyManager","name":"_strategyManager","type":"address"},{"internalType":"contract IRestakeManager","name":"_restakeManager","type":"address"},{"internalType":"contract IDelegationManager","name":"_delegationManager","type":"address"},{"internalType":"contract IEigenPodManager","name":"_eigenPodManager","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastCheckpointTimestamp","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingUnstakedDelayedWithdrawalAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"tokenAmounts","type":"uint256[]"}],"name":"queueWithdrawals","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"queuedShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"queuedWithdrawal","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"","type":"uint64"}],"name":"recordedCheckpoints","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"tokenList","type":"address[]"},{"internalType":"uint256[]","name":"amountsToWithdraw","type":"uint256[]"},{"internalType":"address","name":"recipient","type":"address"}],"name":"recoverTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"restakeManager","outputs":[{"internalType":"contract IRestakeManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsCoordinator","outputs":[{"internalType":"contract IRewardsCoordinator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsDestination","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"roleManager","outputs":[{"internalType":"contract IRoleManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_baseGasAmountSpent","type":"uint256"}],"name":"setBaseGasAmountSpent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_delegateAddress","type":"address"},{"components":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint256","name":"expiry","type":"uint256"}],"internalType":"struct ISignatureUtils.SignatureWithExpiry","name":"approverSignatureAndExpiry","type":"tuple"},{"internalType":"bytes32","name":"approverSalt","type":"bytes32"}],"name":"setDelegateAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IRewardsCoordinator","name":"_rewardsCoordinator","type":"address"}],"name":"setRewardsCoordinator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewardsDestination","type":"address"}],"name":"setRewardsDestination","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"contract IStrategy","name":"_strategy","type":"address"}],"name":"setTokenStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"pubkey","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"depositDataRoot","type":"bytes32"}],"name":"stakeEth","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"stakedButNotVerifiedEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startCheckpoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategyManager","outputs":[{"internalType":"contract IStrategyManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"tokenStrategyMapping","outputs":[{"internalType":"contract IStrategy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBeaconChainExitBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"validatorStakedButNotVerifiedEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"balanceContainerRoot","type":"bytes32"},{"internalType":"bytes","name":"proof","type":"bytes"}],"internalType":"struct BeaconChainProofs.BalanceContainerProof","name":"balanceContainerProof","type":"tuple"},{"components":[{"internalType":"bytes32","name":"pubkeyHash","type":"bytes32"},{"internalType":"bytes32","name":"balanceRoot","type":"bytes32"},{"internalType":"bytes","name":"proof","type":"bytes"}],"internalType":"struct BeaconChainProofs.BalanceProof[]","name":"proofs","type":"tuple[]"}],"name":"verifyCheckpointProofs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"oracleTimestamp","type":"uint64"},{"components":[{"internalType":"bytes32","name":"beaconStateRoot","type":"bytes32"},{"internalType":"bytes","name":"proof","type":"bytes"}],"internalType":"struct BeaconChainProofs.StateRootProof","name":"stateRootProof","type":"tuple"},{"internalType":"uint40[]","name":"validatorIndices","type":"uint40[]"},{"internalType":"bytes[]","name":"withdrawalCredentialProofs","type":"bytes[]"},{"internalType":"bytes32[][]","name":"validatorFields","type":"bytes32[][]"}],"name":"verifyWithdrawalCredentials","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wethUnwrapper","outputs":[{"internalType":"contract WETHUnwrapper","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b615f8380620000f36000396000f3fe60806040526004361061027f5760003560e01c80636d96a2aa1161014f578063bef4b8bd116100c1578063ea4d3c9b1161007a578063ea4d3c9b1461082f578063ec54aa7b1461084f578063ec7301771461086f578063ee94d67c1461088f578063f074ba62146108af578063ff0996b5146108cf57600080fd5b8063bef4b8bd1461076c578063c26f20561461078c578063d1464931146107ac578063d3e7c45b146107c2578063dc560c88146107e2578063dda3346c1461080f57600080fd5b8063a0d58d8a11610113578063a0d58d8a14610691578063a3aae136146106b1578063ad5c4648146106d1578063b3d42621146106f9578063b915588514610729578063bc79a3651461075657600080fd5b80636d96a2aa14610609578063772495c3146106295780638a2fc4e31461064957806390b51625146106695780639ebf4ab11461067e57600080fd5b80633e4bdc24116101f357806347e7ef24116101ac57806347e7ef24146105285780634f4247a1146105485780635299ac17146105745780635361477b14610594578063573803fb146105b457806367cbbdf1146105c957600080fd5b80633e4bdc24146104525780633f65cf191461047257806342ecff2a14610492578063454344d6146104ca5780634665bcda146104e0578063479d39761461050057600080fd5b806323e481751161024557806323e481751461039f5780632e992fc5146103bf57806333404396146103dc578063397bfbac146103fc57806339a18f0c1461041257806339b70e381461043257600080fd5b8062435da5146102b1578062cb637e146102ee5780630cca214f1461030e578063127842a4146103495780631459457a1461037f57600080fd5b366102ac5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc11933016102a257005b6102aa6108ef565b005b600080fd5b3480156102bd57600080fd5b506033546102d1906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102fa57600080fd5b506102aa61030936600461485a565b610b6f565b34801561031a57600080fd5b5061033b6103293660046148d1565b60416020526000908152604090205481565b6040519081526020016102e5565b34801561035557600080fd5b506102d16103643660046148ff565b6036602052600090815260409020546001600160a01b031681565b34801561038b57600080fd5b506102aa61039a36600461491c565b610d41565b3480156103ab57600080fd5b5061033b6103ba36600461498d565b610ff5565b3480156103cb57600080fd5b5061033b6801bc16d674ec80000081565b3480156103e857600080fd5b506102aa6103f73660046149f8565b61175d565b34801561040857600080fd5b5061033b603b5481565b34801561041e57600080fd5b506043546102d1906001600160a01b031681565b34801561043e57600080fd5b506034546102d1906001600160a01b031681565b34801561045e57600080fd5b506102aa61046d366004614b61565b611ac4565b34801561047e57600080fd5b506102aa61048d366004614c0c565b611d59565b34801561049e57600080fd5b506045546104b2906001600160401b031681565b6040516001600160401b0390911681526020016102e5565b3480156104d657600080fd5b5061033b60445481565b3480156104ec57600080fd5b506039546102d1906001600160a01b031681565b34801561050c57600080fd5b506102d173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b34801561053457600080fd5b5061033b610543366004614cbb565b611ed4565b34801561055457600080fd5b506045546102d1906801000000000000000090046001600160a01b031681565b34801561058057600080fd5b506102aa61058f366004614ce7565b611f59565b3480156105a057600080fd5b506102aa6105af366004614d30565b6121e1565b3480156105c057600080fd5b5061033b612371565b3480156105d557600080fd5b506105f96105e4366004614e13565b60466020526000908152604090205460ff1681565b60405190151581526020016102e5565b34801561061557600080fd5b506037546102d1906001600160a01b031681565b34801561063557600080fd5b506102aa6106443660046148ff565b612602565b34801561065557600080fd5b506042546102d1906001600160a01b031681565b34801561067557600080fd5b506102aa6126a5565b6102aa61068c366004614e71565b6127ee565b34801561069d57600080fd5b5061033b6106ac3660046148ff565b6129bd565b3480156106bd57600080fd5b50603a546102d1906001600160a01b031681565b3480156106dd57600080fd5b506102d173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b34801561070557600080fd5b506105f96107143660046148d1565b60406020819052600091825290205460ff1681565b34801561073557600080fd5b5061033b6107443660046148ff565b603e6020526000908152604090205481565b34801561076257600080fd5b5061033b603d5481565b34801561077857600080fd5b506102aa6107873660046148ff565b612af1565b34801561079857600080fd5b506102aa6107a736600461498d565b612b91565b3480156107b857600080fd5b5061033b603c5481565b3480156107ce57600080fd5b506102aa6107dd366004614ee4565b61300b565b3480156107ee57600080fd5b5061033b6107fd3660046148ff565b603f6020526000908152604090205481565b34801561081b57600080fd5b506102aa61082a366004614f85565b6134b7565b34801561083b57600080fd5b506038546102d1906001600160a01b031681565b34801561085b57600080fd5b506102aa61086a3660046148d1565b61352a565b34801561087b57600080fd5b5061033b61088a3660046148ff565b6135a5565b34801561089b57600080fd5b506047546104b2906001600160401b031681565b3480156108bb57600080fd5b506102aa6108ca366004615056565b613755565b3480156108db57600080fd5b506035546102d1906001600160a01b031681565b604454479015610a0c576000604454471161090a574761090e565b6044545b9050603560009054906101000a90046001600160a01b03166001600160a01b031663f617eecc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098791906150be565b6001600160a01b0316636c0d86bd826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156109c157600080fd5b505af11580156109d5573d6000803e3d6000fd5b505050505080604460008282546109ec91906150f1565b909155506109fc905081836150f1565b915081600003610a0a575050565b505b326000908152603e602052604081205415610a4357610a2961391d565b9050610a3581836150f1565b915081600003610a43575050565b60355460408051633d85fbb360e21b815290516000926001600160a01b03169163f617eecc9160048083019260209291908290030181865afa158015610a8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab191906150be565b90506000816001600160a01b03168460405160006040518083038185875af1925050503d8060008114610b00576040519150601f19603f3d011682016040523d82523d6000602084013e610b05565b606091505b5050905080610b27576040516312171d8360e31b815260040160405180910390fd5b604080516001600160a01b0384168152602081018690527f64459fab7324199920bec86f9ce814dab17621d386f548c8a7c4e638d28fb8f4910160405180910390a150505050565b610b776139f1565b610b7f613a4a565b60005a9050610b9160a0860186615104565b84149050610bb257604051632b477e7160e11b815260040160405180910390fd5b6038546040516360d7faed60e01b81526001600160a01b03909116906360d7faed90610beb908890889088908890600190600401615318565b600060405180830381600087803b158015610c0557600080fd5b505af1158015610c19573d6000803e3d6000fd5b50505050610c5a85858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250613ad592505050565b610c62613cd2565b603854604051632cbd9b6d60e11b81527e31d86140cfa7fee3aca26a490f754ce3afc3c6d2ca211a94172af88ec988e2916001600160a01b03169063597b36da90610cb1908990600401615358565b602060405180830381865afa158015610cce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf2919061536b565b610cff60a0880188615104565b610d0c60c08a018a615104565b604051610d1d959493929190615384565b60405180910390a1610d318161c35061411d565b50610d3b60018055565b50505050565b600054610100900460ff1615808015610d615750600054600160ff909116105b80610d7b5750303b158015610d7b575060005460ff166001145b610de35760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610e06576000805461ff0019166101001790555b6001600160a01b038616610e2d5760405163862a606760e01b815260040160405180910390fd5b6001600160a01b038516610e545760405163862a606760e01b815260040160405180910390fd5b6001600160a01b038416610e7b5760405163862a606760e01b815260040160405180910390fd5b6001600160a01b038316610ea25760405163862a606760e01b815260040160405180910390fd5b6001600160a01b038216610ec95760405163862a606760e01b815260040160405180910390fd5b610ed16141ad565b603380546001600160a01b038089166001600160a01b0319928316179092556034805488841690831617905560358054878416908316179055603880548684169083161790556039805492851692909116821790556040805163426c083160e11b815290516384d810629160048082019260209290919082900301816000875af1158015610f63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8791906150be565b603a80546001600160a01b0319166001600160a01b03929092169190911790558015610fed576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6000610fff6139f1565b611007613a4a565b60005a905084831461102c57604051632b477e7160e11b815260040160405180910390fd5b604080516001808252818301909252600091816020015b60408051606080820183528082526020820152600091810191909152815260200190600190039081611043579050509050856001600160401b0381111561108c5761108c614abb565b6040519080825280602002602001820160405280156110b5578160200160208202803683370190505b50816000815181106110c9576110c96153f2565b602090810291909101015152856001600160401b038111156110ed576110ed614abb565b604051908082528060200260200182016040528015611116578160200160208202803683370190505b508160008151811061112a5761112a6153f2565b602090810291909101810151015260385460405163285e212160e21b81523060048201526000916001600160a01b03169063a178848490602401602060405180830381865afa158015611181573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a5919061536b565b905060005b878110156115f75773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8989838181106111d9576111d96153f2565b90506020020160208101906111ee91906148ff565b6001600160a01b03160361131d57603960009054906101000a90046001600160a01b03166001600160a01b0316639104c3196040518163ffffffff1660e01b8152600401602060405180830381865afa15801561124f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127391906150be565b83600081518110611286576112866153f2565b60200260200101516000015182815181106112a3576112a36153f2565b60200260200101906001600160a01b031690816001600160a01b0316815250508686828181106112d5576112d56153f2565b90506020020135836000815181106112ef576112ef6153f2565b602002602001015160200151828151811061130c5761130c6153f2565b602002602001018181525050611520565b60006036818b8b85818110611334576113346153f2565b905060200201602081019061134991906148ff565b6001600160a01b03908116825260208201929092526040016000205416036113845760405163862a606760e01b815260040160405180910390fd5b603660008a8a8481811061139a5761139a6153f2565b90506020020160208101906113af91906148ff565b6001600160a01b039081168252602082019290925260400160009081205485519216918591906113e1576113e16153f2565b60200260200101516000015182815181106113fe576113fe6153f2565b60200260200101906001600160a01b031690816001600160a01b031681525050603660008a8a84818110611434576114346153f2565b905060200201602081019061144991906148ff565b6001600160a01b0390811682526020820192909252604001600020541663e3dae51c88888481811061147d5761147d6153f2565b905060200201356040518263ffffffff1660e01b81526004016114a291815260200190565b602060405180830381865afa1580156114bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e3919061536b565b836000815181106114f6576114f66153f2565b6020026020010151602001518281518110611513576115136153f2565b6020026020010181815250505b3083600081518110611534576115346153f2565b6020026020010151604001906001600160a01b031690816001600160a01b0316815250508260008151811061156b5761156b6153f2565b6020026020010151602001518181518110611588576115886153f2565b6020026020010151603f60008b8b858181106115a6576115a66153f2565b90506020020160208101906115bb91906148ff565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546115ea9190615408565b90915550506001016111aa565b506038546040516306ec6e8160e11b81526000916001600160a01b031690630dd8dd0290611629908690600401615484565b6000604051808303816000875af1158015611648573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611670919081019061551e565b600081518110611682576116826153f2565b6020908102919091018101516000818152604092839052918220805460ff1916600117905560375485519193507ff7c9db32693636e458573257dad812f58a7c5cc3067e0fad83b601b46947615a92849230926001600160a01b0316918391889143918b91906116f4576116f46153f2565b6020026020010151600001518a600081518110611713576117136153f2565b6020026020010151602001516040516117339897969594939291906155a3565b60405180910390a16117478461c35061411d565b935050505061175560018055565b949350505050565b6117656139f1565b61176d613a4a565b60005a905087861415806117815750878414155b8061178c5750878214155b156117aa57604051632b477e7160e11b815260040160405180910390fd5b6038546040516319a021cb60e11b81526001600160a01b03909116906333404396906117e8908c908c908c908c908c908c908c908c906004016156be565b600060405180830381600087803b15801561180257600080fd5b505af1158015611816573d6000803e3d6000fd5b5050505060005b88811015611a9b57898982818110611837576118376153f2565b90506020028101906118499190615762565b6118579060a0810190615104565b905088888381811061186b5761186b6153f2565b905060200281019061187d9190615104565b90501461189d57604051632b477e7160e11b815260040160405180910390fd5b8383828181106118af576118af6153f2565b90506020020160208101906118c49190615782565b6118e15760405163520b7b2760e11b815260040160405180910390fd5b6119638a8a838181106118f6576118f66153f2565b90506020028101906119089190615762565b89898481811061191a5761191a6153f2565b905060200281019061192c9190615104565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250613ad592505050565b6038547e31d86140cfa7fee3aca26a490f754ce3afc3c6d2ca211a94172af88ec988e2906001600160a01b031663597b36da8c8c858181106119a7576119a76153f2565b90506020028101906119b99190615762565b6040518263ffffffff1660e01b81526004016119d59190615358565b602060405180830381865afa1580156119f2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a16919061536b565b8b8b84818110611a2857611a286153f2565b9050602002810190611a3a9190615762565b611a489060a0810190615104565b8d8d86818110611a5a57611a5a6153f2565b9050602002810190611a6c9190615762565b611a7a9060c0810190615104565b604051611a8b959493929190615384565b60405180910390a160010161181d565b50611aa4613cd2565b611ab08161c35061411d565b50611aba60018055565b5050505050505050565b60335460405163b446908560e01b81523360048201526001600160a01b039091169063b446908590602401602060405180830381865afa158015611b0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b30919061579f565b611b4d57604051636f3d44a760e01b815260040160405180910390fd5b6000805b8251811015611d345760466000848381518110611b7057611b706153f2565b6020908102919091018101516001600160401b031682528101919091526040016000205460ff1615611bb5576040516319d5b96960e11b815260040160405180910390fd5b603a5483516000916001600160a01b0316906352396a5990869085908110611bdf57611bdf6153f2565b60200260200101516040518263ffffffff1660e01b8152600401611c1291906001600160401b0391909116815260200190565b602060405180830381865afa158015611c2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5391906157bc565b6001600160401b03169050611c6c633b9aca00826157d9565b60446000828254611c7d9190615408565b92505081905550600160466000868581518110611c9c57611c9c6153f2565b60200260200101516001600160401b03166001600160401b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550826001600160401b0316848381518110611cf757611cf76153f2565b60200260200101516001600160401b03161115611d2b57838281518110611d2057611d206153f2565b602002602001015192505b50600101611b51565b506047805467ffffffffffffffff19166001600160401b039290921691909117905550565b611d61613a4a565b60005a603a54604051633f65cf1960e01b81529192506001600160a01b031690633f65cf1990611da3908c908c908c908c908c908c908c908c9060040161592f565b600060405180830381600087803b158015611dbd57600080fd5b505af1158015611dd1573d6000803e3d6000fd5b5050505060005b82811015611ebc576000611e40858584818110611df757611df76153f2565b9050602002810190611e099190615104565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506141dc92505050565b60008181526041602052604090205490915015611e8457600081815260416020526040812054603b805491929091611e799084906150f1565b90915550611ea59050565b6801bc16d674ec800000603b6000828254611e9f91906150f1565b90915550505b600090815260416020526040812055600101611dd8565b50611ec981603d5461411d565b505050505050505050565b6000611ede6139f1565b611ee6614200565b6001600160a01b03838116600090815260366020526040902054161580611f0b575081155b15611f295760405163862a606760e01b815260040160405180910390fd5b611f3e6001600160a01b03841633308561422b565b611f488383614296565b9050611f5360018055565b92915050565b611f616139f1565b611f6961434b565b6001600160a01b038216611f905760405163862a606760e01b815260040160405180910390fd5b6001600160a01b038116158015906120905750816001600160a01b0316816001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa158015611feb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200f91906150be565b6001600160a01b0316141580612090575060345460405163198f077960e21b81526001600160a01b0383811660048301529091169063663c1de490602401602060405180830381865afa15801561206a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061208e919061579f565b155b156120ae57604051632711b74d60e11b815260040160405180910390fd5b6001600160a01b03828116600090815260366020526040902054161580159061214f57506001600160a01b03828116600090815260366020526040808220549051630aa794bf60e31b81523060048201529192169063553ca5f890602401602060405180830381865afa158015612129573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214d919061536b565b115b1561216d57604051630f1fd48960e11b815260040160405180910390fd5b6001600160a01b0382811660008181526036602090815260409182902080546001600160a01b031916948616948517905581519283528201929092527f1a654dbe468f1cff27ced5a916efd4120a4155caf290688ab42aebe90554683e910160405180910390a16121dd60018055565b5050565b6121e96139f1565b6121f161434b565b6001600160a01b0383166122185760405163862a606760e01b815260040160405180910390fd5b603854604051631976849960e21b81523060048201526000916001600160a01b0316906365da126490602401602060405180830381865afa158015612261573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061228591906150be565b6001600160a01b0316146122ac57604051631c52d05d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b0385811691821790925560385460405163eea9064b60e01b815292169163eea9064b916122f49186908690600401615a11565b600060405180830381600087803b15801561230e57600080fd5b505af1158015612322573d6000803e3d6000fd5b50506040516001600160a01b03861681527ffe608947467beb30a90e072fd2fc7d52baecf0935f542011fcd8fa6362a5d5b39250602001905060405180910390a161236c60018055565b505050565b600061237b6143d4565b6000604454633b9aca00603a60009054906101000a90046001600160a01b03166001600160a01b0316633474aa166040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123fc91906157bc565b6001600160401b031661240f91906157d9565b1161241b5760006124ac565b604454603a5460408051631a3a550b60e11b81529051633b9aca00926001600160a01b031691633474aa169160048083019260209291908290030181865afa15801561246b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248f91906157bc565b6001600160401b03166124a291906157d9565b6124ac91906150f1565b6039546040516360f4062b60e01b81523060048201529192506000916001600160a01b03909116906360f4062b90602401602060405180830381865afa1580156124fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251e919061536b565b90506000811261259157603b5473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600052603f6020527f5d7315d061885134292236184dbffd84acd8b3aaff2ca1613d734d4448806a5a54839183916125789190615408565b6125829190615408565b61258c91906150f1565b6125fb565b8161259b82615a52565b603b5473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600052603f6020527f5d7315d061885134292236184dbffd84acd8b3aaff2ca1613d734d4448806a5a546125e79190615408565b6125f191906150f1565b6125fb91906150f1565b9250505090565b61260a6139f1565b61261261434b565b6001600160a01b0381166126395760405163862a606760e01b815260040160405180910390fd5b604354604080516001600160a01b03928316815291831660208301527facb12817adc82e45b703a158b973e414ae18f26805e133cec337d73ac6a09c42910160405180910390a1604380546001600160a01b0319166001600160a01b0383161790556001805550565b50565b6126ad613a4a565b6045546001600160401b0316156126d65760405162be9bc360e81b815260040160405180910390fd5b6126de6143d4565b603a546040516388676cad60e01b8152600160048201526001600160a01b03909116906388676cad90602401600060405180830381600087803b15801561272457600080fd5b505af1158015612738573d6000803e3d6000fd5b50505050603a60009054906101000a90046001600160a01b03166001600160a01b03166342ecff2a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561278f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127b391906157bc565b6045805467ffffffffffffffff19166001600160401b039290921691821790556000908152604660205260409020805460ff19166001179055565b6127f6614200565b603a546040516358eaee7960e01b81526000916001600160a01b0316906358eaee79906128299089908990600401615a84565b602060405180830381865afa158015612846573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286a9190615a98565b600281111561287b5761287b615a6e565b0361294a5760006128c186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061449e92505050565b60008181526041602052604081205491925034906128df8284615408565b90506801bc16d674ec8000006128f53485615408565b111561291d5761290e836801bc16d674ec8000006150f1565b91506801bc16d674ec80000090505b6000848152604160205260408120829055603b8054849290612940908490615408565b9091555050505050505b6039546040516326d3918d60e21b81526001600160a01b0390911690639b4e46349034906129849089908990899089908990600401615ab9565b6000604051808303818588803b15801561299d57600080fd5b505af11580156129b1573d6000803e3d6000fd5b50505050505050505050565b6034546040516322e2ab0f60e21b815230600482015260009182916001600160a01b0390911690638b8aac3c90602401602060405180830381865afa158015612a0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a2e919061536b565b905060005b81811015612ad7576034546040516365e15eb160e11b8152306004820152602481018390526001600160a01b0386811692169063cbc2bd6290604401602060405180830381865afa158015612a8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ab091906150be565b6001600160a01b031603612ac5579392505050565b80612acf81615af3565b915050612a33565b5060405163c5723b5160e01b815260040160405180910390fd5b612af96139f1565b612b0161434b565b6001600160a01b038116612b285760405163862a606760e01b815260040160405180910390fd5b604254604080516001600160a01b03928316815291831660208301527f5534d16f3baa199c6d069e6404c6ff5b35d72713c7db2868654aa720b09293b9910160405180910390a1604280546001600160a01b0319166001600160a01b0383161790556001805550565b612b996139f1565b60335460405163bcc6ce2360e01b81523360048201526001600160a01b039091169063bcc6ce2390602401602060405180830381865afa158015612be1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c05919061579f565b612c2257604051632efffa9d60e01b815260040160405180910390fd5b808314612c4257604051632b477e7160e11b815260040160405180910390fd5b60005b83811015610d31576000838383818110612c6157612c616153f2565b9050602002016020810190612c7691906148ff565b6001600160a01b031603612c9d5760405163862a606760e01b815260040160405180910390fd5b6038546000906001600160a01b031663597b36da878785818110612cc357612cc36153f2565b9050602002810190612cd59190615762565b6040518263ffffffff1660e01b8152600401612cf19190615358565b602060405180830381865afa158015612d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d32919061536b565b60008181526040602081905290205490915060ff1615612d655760405163eb3d1dcd60e01b815260040160405180910390fd5b603854604051635bf8375f60e11b8152600481018390526001600160a01b039091169063b7f06ebe90602401602060405180830381865afa158015612dae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dd2919061579f565b612def576040516355780d0f60e11b815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee848484818110612e1657612e166153f2565b9050602002016020810190612e2b91906148ff565b6001600160a01b031614158015612f225750603860009054906101000a90046001600160a01b03166001600160a01b0316639104c3196040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eb691906150be565b6001600160a01b0316868684818110612ed157612ed16153f2565b9050602002810190612ee39190615762565b612ef19060a0810190615104565b6000818110612f0257612f026153f2565b9050602002016020810190612f1791906148ff565b6001600160a01b0316145b15612f4057604051630b049d2560e11b815260040160405180910390fd5b858583818110612f5257612f526153f2565b9050602002810190612f649190615762565b612f729060c0810190615104565b6000818110612f8357612f836153f2565b90506020020135603f6000868686818110612fa057612fa06153f2565b9050602002016020810190612fb591906148ff565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254612fe49190615408565b90915550506000908152604060208190529020805460ff1916600190811790915501612c45565b603354604051633402c11360e11b81523360048201526001600160a01b0390911690636805822690602401602060405180830381865afa158015613053573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613077919061579f565b6130945760405163029c791d60e61b815260040160405180910390fd5b6043546001600160a01b03166130bd57604051630cd4f69d60e01b815260040160405180910390fd5b60005a604254604051633ccc861d60e01b81529192506001600160a01b031690633ccc861d906130f39085903090600401615c46565b600060405180830381600087803b15801561310d57600080fd5b505af1158015613121573d6000803e3d6000fd5b5050505060005b61313560e0840184615d3f565b90508110156134aa5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc261316060e0850185615d3f565b83818110613170576131706153f2565b61318692602060409092020190810191506148ff565b6001600160a01b031603613280576040516370a0823160e01b815230600482015260009073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2906370a0823190602401602060405180830381865afa1580156131e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061320a919061536b565b604051632e1a7d4d60e01b81526004810182905290915073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d90602401600060405180830381600087803b15801561325a57600080fd5b505af115801561326e573d6000803e3d6000fd5b5050505061327a6108ef565b506134a2565b600060368161329260e0870187615d3f565b858181106132a2576132a26153f2565b6132b892602060409092020190810191506148ff565b6001600160a01b03908116825260208201929092526040016000205416146133b25761327a6132ea60e0850185615d3f565b838181106132fa576132fa6153f2565b61331092602060409092020190810191506148ff565b61331d60e0860186615d3f565b8481811061332d5761332d6153f2565b61334392602060409092020190810191506148ff565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015613389573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133ad919061536b565b614296565b6043546134a2906001600160a01b03166133cf60e0860186615d3f565b848181106133df576133df6153f2565b6133f592602060409092020190810191506148ff565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa15801561343b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061345f919061536b565b61346c60e0870187615d3f565b8581811061347c5761347c6153f2565b61349292602060409092020190810191506148ff565b6001600160a01b03169190614513565b600101613128565b506121dd81603d5461411d565b6134bf613a4a565b603a54604051633768cd1b60e21b81526001600160a01b039091169063dda3346c906134f390869086908690600401615d88565b600060405180830381600087803b15801561350d57600080fd5b505af1158015613521573d6000803e3d6000fd5b50505050505050565b6135326139f1565b61353a61434b565b8060000361355b5760405163862a606760e01b815260040160405180910390fd5b603d5460408051918252602082018390527fbfad24c5385b591e87ef890b13ebedaadf34399714ea0e2dc0f6e4ff69c731dd910160405180910390a1603d8190556126a260018055565b6001600160a01b0381166000908152603f6020526040812054156136da576001600160a01b03808316600090815260366020908152604080832054603f90925291829020549151637a8b263760e01b8152921691637a8b26379161360f9160040190815260200190565b602060405180830381865afa15801561362c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613650919061536b565b6001600160a01b0383811660009081526036602052604090819020549051630aa794bf60e31b815230600482015291169063553ca5f890602401602060405180830381865afa1580156136a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136cb919061536b565b6136d59190615408565b611f53565b6001600160a01b0382811660009081526036602052604090819020549051630aa794bf60e31b815230600482015291169063553ca5f890602401602060405180830381865afa158015613731573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f53919061536b565b61375d613a4a565b603a5460405163783a5d3160e11b81526001600160a01b039091169063f074ba629061379190869086908690600401615df8565b600060405180830381600087803b1580156137ab57600080fd5b505af19250505080156137bc575060015b50604554603a5460408051633ba5359f60e21b815290516001600160401b03909316926001600160a01b039092169163ee94d67c916004808201926020929091908290030181865afa158015613816573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061383a91906157bc565b6001600160401b03160361236c57603a546045546040516352396a5960e01b81526001600160401b0390911660048201526000916001600160a01b0316906352396a5990602401602060405180830381865afa15801561389e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138c291906157bc565b6001600160401b031690506138db633b9aca00826157d9565b604460008282546138ec9190615408565b9091555050604580546047805467ffffffffffffffff199081166001600160401b0384161790915516905550505050565b326000908152603e6020526040812054819047101561393c574761394d565b326000908152603e60205260409020545b604051909150600090329083156108fc0290849084818181858888f1935050505090508061398e576040516312171d8360e31b815260040160405180910390fd5b326000908152603e6020526040812080548492906139ad9084906150f1565b909155505060408051328152602081018490527f667ad9c7167aea9bfcff8b321015abb0d8b77cf151a377e09e12b9017f9889fd910160405180910390a150919050565b600260015403613a435760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610dda565b6002600155565b6033546040516358e3de6f60e01b81523360048201526001600160a01b03909116906358e3de6f90602401602060405180830381865afa158015613a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ab6919061579f565b613ad35760405163bcefa34f60e01b815260040160405180910390fd5b565b60005b815181101561236c5760006001600160a01b0316828281518110613afe57613afe6153f2565b60200260200101516001600160a01b031603613b2d5760405163862a606760e01b815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316828281518110613b5d57613b5d6153f2565b60200260200101516001600160a01b031614158015613c365750603860009054906101000a90046001600160a01b03166001600160a01b0316639104c3196040518163ffffffff1660e01b81526004016020604051808303816000875af1158015613bcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bf091906150be565b6001600160a01b0316613c0660a0850185615104565b83818110613c1657613c166153f2565b9050602002016020810190613c2b91906148ff565b6001600160a01b0316145b15613c5457604051630b049d2560e11b815260040160405180910390fd5b613c6160c0840184615104565b82818110613c7157613c716153f2565b90506020020135603f6000848481518110613c8e57613c8e6153f2565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254613cc591906150f1565b9091555050600101613ad8565b60355460408051633d85fbb360e21b815290516000926001600160a01b03169163f617eecc9160048083019260209291908290030181865afa158015613d1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d4091906150be565b6001600160a01b03166351a2d6d16040518163ffffffff1660e01b8152600401602060405180830381865afa158015613d7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613da191906150be565b905060005b603560009054906101000a90046001600160a01b03166001600160a01b03166375c745a66040518163ffffffff1660e01b8152600401602060405180830381865afa158015613df9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e1d919061536b565b8110156121dd5760355460405163172c48c760e01b8152600481018390526000916001600160a01b03169063172c48c790602401602060405180830381865afa158015613e6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e9291906150be565b604051633df3890b60e11b81526001600160a01b038083166004830152919250600091851690637be7121690602401602060405180830381865afa158015613ede573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f02919061536b565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038416906370a0823190602401602060405180830381865afa158015613f4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f70919061536b565b905081156140fd5781811115613f865781613f88565b805b9150613f9482826150f1565b9050614021603560009054906101000a90046001600160a01b03166001600160a01b031663f617eecc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613fec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061401091906150be565b6001600160a01b0385169084614543565b603560009054906101000a90046001600160a01b03166001600160a01b031663f617eecc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614074573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061409891906150be565b604051636ce6855560e11b81526001600160a01b03858116600483015260248201859052919091169063d9cd0aaa90604401600060405180830381600087803b1580156140e457600080fd5b505af11580156140f8573d6000803e3d6000fd5b505050505b801561410f5761410d8382614296565b505b836001019350505050613da6565b600048825a61412c90866150f1565b6141369190615408565b61414091906157d9565b336000908152603e6020526040812080549293508392909190614164908490615408565b909155505060408051338152602081018390527f4ff29a094e434f8a698185e97d3a285f4ba26c723f8ec8d2c9914213d61589ca910160405180910390a1505050565b60018055565b600054610100900460ff166141d45760405162461bcd60e51b8152600401610dda90615ea5565b613ad36145f0565b6000816000815181106141f1576141f16153f2565b60200260200101519050919050565b6035546001600160a01b03163314613ad3576040516342d16b8b60e11b815260040160405180910390fd5b6040516001600160a01b0380851660248301528316604482015260648101829052610d3b9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614617565b6034546000906142b3906001600160a01b03858116911684614543565b6034546001600160a01b03848116600081815260366020526040908190205490516373d0285560e11b8152908316600482015260248101919091526044810185905291169063e7a050aa906064016020604051808303816000875af1158015614320573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614344919061536b565b9392505050565b603354604051630d5dcbef60e31b81523360048201526001600160a01b0390911690636aee5f7890602401602060405180830381865afa158015614393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143b7919061579f565b613ad35760405163cbdd1d2760e01b815260040160405180910390fd5b603a5460408051633ba5359f60e21b815290516000926001600160a01b03169163ee94d67c9160048083019260209291908290030181865afa15801561441e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061444291906157bc565b90506001600160401b0381161580159061446657506047546001600160401b031615155b801561448057506047546001600160401b03908116908216115b156126a2576040516312792a5560e31b815260040160405180910390fd5b6000600282600060801b6040516020016144b9929190615ef0565b60408051601f19818403018152908290526144d391615f28565b602060405180830381855afa1580156144f0573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190611f53919061536b565b6040516001600160a01b03831660248201526044810182905261236c90849063a9059cbb60e01b9060640161425f565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015614593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145b7919061536b565b9050610d3b8463095ea7b360e01b856145d08686615408565b6040516001600160a01b039092166024830152604482015260640161425f565b600054610100900460ff166141a75760405162461bcd60e51b8152600401610dda90615ea5565b600061466c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166146ec9092919063ffffffff16565b905080516000148061468d57508080602001905181019061468d919061579f565b61236c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610dda565b6060611755848460008585600080866001600160a01b031685876040516147139190615f28565b60006040518083038185875af1925050503d8060008114614750576040519150601f19603f3d011682016040523d82523d6000602084013e614755565b606091505b509150915061476687838387614771565b979650505050505050565b606083156147e05782516000036147d9576001600160a01b0385163b6147d95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610dda565b5081611755565b61175583838151156147f55781518083602001fd5b8060405162461bcd60e51b8152600401610dda9190615f3a565b60008083601f84011261482157600080fd5b5081356001600160401b0381111561483857600080fd5b6020830191508360208260051b850101111561485357600080fd5b9250929050565b6000806000806060858703121561487057600080fd5b84356001600160401b038082111561488757600080fd5b9086019060e0828903121561489b57600080fd5b909450602086013590808211156148b157600080fd5b506148be8782880161480f565b9598909750949560400135949350505050565b6000602082840312156148e357600080fd5b5035919050565b6001600160a01b03811681146126a257600080fd5b60006020828403121561491157600080fd5b8135614344816148ea565b600080600080600060a0868803121561493457600080fd5b853561493f816148ea565b9450602086013561494f816148ea565b9350604086013561495f816148ea565b9250606086013561496f816148ea565b9150608086013561497f816148ea565b809150509295509295909350565b600080600080604085870312156149a357600080fd5b84356001600160401b03808211156149ba57600080fd5b6149c68883890161480f565b909650945060208701359150808211156149df57600080fd5b506149ec8782880161480f565b95989497509550505050565b6000806000806000806000806080898b031215614a1457600080fd5b88356001600160401b0380821115614a2b57600080fd5b614a378c838d0161480f565b909a50985060208b0135915080821115614a5057600080fd5b614a5c8c838d0161480f565b909850965060408b0135915080821115614a7557600080fd5b614a818c838d0161480f565b909650945060608b0135915080821115614a9a57600080fd5b50614aa78b828c0161480f565b999c989b5096995094979396929594505050565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715614af357614af3614abb565b60405290565b604051601f8201601f191681016001600160401b0381118282101715614b2157614b21614abb565b604052919050565b60006001600160401b03821115614b4257614b42614abb565b5060051b60200190565b6001600160401b03811681146126a257600080fd5b60006020808385031215614b7457600080fd5b82356001600160401b03811115614b8a57600080fd5b8301601f81018513614b9b57600080fd5b8035614bae614ba982614b29565b614af9565b81815260059190911b82018301908381019087831115614bcd57600080fd5b928401925b82841015614766578335614be581614b4c565b82529284019290840190614bd2565b600060408284031215614c0657600080fd5b50919050565b60008060008060008060008060a0898b031215614c2857600080fd5b8835614c3381614b4c565b975060208901356001600160401b0380821115614c4f57600080fd5b614c5b8c838d01614bf4565b985060408b0135915080821115614c7157600080fd5b614c7d8c838d0161480f565b909850965060608b0135915080821115614c9657600080fd5b614ca28c838d0161480f565b909650945060808b0135915080821115614a9a57600080fd5b60008060408385031215614cce57600080fd5b8235614cd9816148ea565b946020939093013593505050565b60008060408385031215614cfa57600080fd5b8235614d05816148ea565b91506020830135614d15816148ea565b809150509250929050565b8035614d2b816148ea565b919050565b600080600060608486031215614d4557600080fd5b8335614d50816148ea565b92506020848101356001600160401b0380821115614d6d57600080fd5b9086019060408289031215614d8157600080fd5b614d89614ad1565b823582811115614d9857600080fd5b8301601f81018a13614da957600080fd5b803583811115614dbb57614dbb614abb565b614dcd601f8201601f19168701614af9565b93508084528a86828401011115614de357600080fd5b80868301878601376000908401860152509081529082013591810191909152929592945050506040919091013590565b600060208284031215614e2557600080fd5b813561434481614b4c565b60008083601f840112614e4257600080fd5b5081356001600160401b03811115614e5957600080fd5b60208301915083602082850101111561485357600080fd5b600080600080600060608688031215614e8957600080fd5b85356001600160401b0380821115614ea057600080fd5b614eac89838a01614e30565b90975095506020880135915080821115614ec557600080fd5b50614ed288828901614e30565b96999598509660400135949350505050565b600060208284031215614ef657600080fd5b81356001600160401b03811115614f0c57600080fd5b8201610100818503121561434457600080fd5b600082601f830112614f3057600080fd5b81356020614f40614ba983614b29565b82815260059290921b84018101918181019086841115614f5f57600080fd5b8286015b84811015614f7a5780358352918301918301614f63565b509695505050505050565b600080600060608486031215614f9a57600080fd5b83356001600160401b0380821115614fb157600080fd5b818601915086601f830112614fc557600080fd5b81356020614fd5614ba983614b29565b82815260059290921b8401810191818101908a841115614ff457600080fd5b948201945b8386101561501b57853561500c816148ea565b82529482019490820190614ff9565b9750508701359250508082111561503157600080fd5b5061503e86828701614f1f565b92505061504d60408501614d20565b90509250925092565b60008060006040848603121561506b57600080fd5b83356001600160401b038082111561508257600080fd5b61508e87838801614bf4565b945060208601359150808211156150a457600080fd5b506150b18682870161480f565b9497909650939450505050565b6000602082840312156150d057600080fd5b8151614344816148ea565b634e487b7160e01b600052601160045260246000fd5b81810381811115611f5357611f536150db565b6000808335601e1984360301811261511b57600080fd5b8301803591506001600160401b0382111561513557600080fd5b6020019150600581901b360382131561485357600080fd5b803563ffffffff81168114614d2b57600080fd5b6000808335601e1984360301811261517857600080fd5b83016020810192503590506001600160401b0381111561519757600080fd5b8060051b360382131561485357600080fd5b8183526000602080850194508260005b858110156151e75781356151cc816148ea565b6001600160a01b0316875295820195908201906001016151b9565b509495945050505050565b81835260006001600160fb1b0383111561520b57600080fd5b8260051b80836020870137939093016020019392505050565b60008135615231816148ea565b6001600160a01b03908116845260208301359061524d826148ea565b9081166020850152604083013590615264826148ea565b1660408401526060828101359084015263ffffffff6152856080840161514d565b16608084015261529860a0830183615161565b60e060a08601526152ad60e0860182846151a9565b9150506152bd60c0840184615161565b85830360c08701526152d08382846151f2565b9695505050505050565b8183526000602080850194508260005b858110156151e75781356152fd816148ea565b6001600160a01b0316875295820195908201906001016152ea565b60808152600061532b6080830188615224565b828103602084015261533e8187896152da565b604084019590955250509015156060909101529392505050565b6020815260006143446020830184615224565b60006020828403121561537d57600080fd5b5051919050565b85815260606020808301829052908201859052600090869060808401835b888110156153d05783356153b5816148ea565b6001600160a01b0316825292820192908201906001016153a2565b5084810360408601526153e48187896151f2565b9a9950505050505050505050565b634e487b7160e01b600052603260045260246000fd5b80820180821115611f5357611f536150db565b600081518084526020808501945080840160005b838110156151e75781516001600160a01b03168752958201959082019060010161542f565b600081518084526020808501945080840160005b838110156151e757815187529582019590820190600101615468565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561551057603f198984030185528151606081518186526154d18287018261541b565b915050888201518582038a8701526154e98282615454565b928901516001600160a01b03169589019590955250948701949250908601906001016154ab565b509098975050505050505050565b6000602080838503121561553157600080fd5b82516001600160401b0381111561554757600080fd5b8301601f8101851361555857600080fd5b8051615566614ba982614b29565b81815260059190911b8201830190838101908783111561558557600080fd5b928401925b828410156147665783518252928401929084019061558a565b8881526001600160a01b0388811660208301528781166040830152861660608201526bffffffffffffffffffffffff8516608082015260a0810184905261010060c082018190526000906155f98382018661541b565b905082810360e084015261560d8185615454565b9b9a5050505050505050505050565b81835260006020808501808196508560051b810191508460005b8781101561566c57828403895261564d8288615161565b6156588682846152da565b9a87019a9550505090840190600101615636565b5091979650505050505050565b80151581146126a257600080fd5b8183526000602080850194508260005b858110156151e75781356156aa81615679565b151587529582019590820190600101615697565b60808082528101889052600060a060058a901b830181019083018b835b8c81101561572257858403609f19018352368e900360de190182351261570057600080fd5b61570d848f843501615224565b935060209283019291909101906001016156db565b505050828103602084015261573881898b61561c565b9050828103604084015261574d8187896151f2565b9050828103606084015261560d818587615687565b6000823560de1983360301811261577857600080fd5b9190910192915050565b60006020828403121561579457600080fd5b813561434481615679565b6000602082840312156157b157600080fd5b815161434481615679565b6000602082840312156157ce57600080fd5b815161434481614b4c565b8082028115828204841417611f5357611f536150db565b6000808335601e1984360301811261580757600080fd5b83016020810192503590506001600160401b0381111561582657600080fd5b80360382131561485357600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b80358252600061587160208301836157f0565b60406020860152615886604086018284615835565b95945050505050565b81835260006020808501808196508560051b810191508460005b8781101561566c5782840389526158c082886157f0565b6158cb868284615835565b9a87019a95505050908401906001016158a9565b81835260006020808501808196508560051b810191508460005b8781101561566c5782840389526159108288615161565b61591b8682846151f2565b9a87019a95505050908401906001016158f9565b6001600160401b03891681526000602060a08184015261595260a084018b61585e565b8381036040850152888152899082016000805b8b81101561599557833564ffffffffff8116808214615982578384fd5b8452509284019291840191600101615965565b505084810360608601526159aa81898b61588f565b92505050828103608084015261560d8185876158df565b60005b838110156159dc5781810151838201526020016159c4565b50506000910152565b600081518084526159fd8160208601602086016159c1565b601f01601f19169290920160200192915050565b60018060a01b0384168152606060208201526000835160406060840152615a3b60a08401826159e5565b602095909501516080840152505060400152919050565b6000600160ff1b8201615a6757615a676150db565b5060000390565b634e487b7160e01b600052602160045260246000fd5b602081526000611755602083018486615835565b600060208284031215615aaa57600080fd5b81516003811061434457600080fd5b606081526000615acd606083018789615835565b8281036020840152615ae0818688615835565b9150508260408301529695505050505050565b600060018201615b0557615b056150db565b5060010190565b8035615b17816148ea565b6001600160a01b03168252602090810135910152565b8183526000602080850194508260005b858110156151e75763ffffffff615b538361514d565b1687529582019590820190600101615b3d565b81835260006020808501808196508560051b810191508460005b8781101561566c578284038952615b9782886157f0565b615ba2868284615835565b9a87019a9550505090840190600101615b80565b6000808335601e19843603018112615bcd57600080fd5b83016020810192503590506001600160401b03811115615bec57600080fd5b8060061b360382131561485357600080fd5b8183526000602080850194508260005b858110156151e7578135615c21816148ea565b6001600160a01b03168752818301358388015260409687019690910190600101615c0e565b60408152600063ffffffff80615c5b8661514d565b16604084015280615c6e6020870161514d565b16606084015250615c8260408501856157f0565b610100806080860152615c9a61014086018385615835565b9250615cac60a0860160608901615b0c565b615cb960a0880188615161565b9250603f19808786030160e0880152615cd3858584615b2d565b9450615ce260c08a018a615161565b94509150808786030183880152615cfa858584615b66565b9450615d0960e08a018a615bb6565b9450925080878603016101208801525050615d25838383615bfe565b935050505061434460208301846001600160a01b03169052565b6000808335601e19843603018112615d5657600080fd5b8301803591506001600160401b03821115615d7057600080fd5b6020019150600681901b360382131561485357600080fd5b606080825284519082018190526000906020906080840190828801845b82811015615dca5781516001600160a01b031684529284019290840190600101615da5565b50505083810382850152615dde8187615454565b9250505060018060a01b0383166040830152949350505050565b60006040808352615e0b8184018761585e565b602084820381860152818683528183019050818760051b840101886000805b8a811015615e9457868403601f190185528235368d9003605e19018112615e4f578283fd5b8c018035855286810135878601526060615e6b8a8301836157f0565b9250818b880152615e7f8288018483615835565b97890197965050509286019250600101615e2a565b50919b9a5050505050505050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008351615f028184602088016159c1565b6fffffffffffffffffffffffffffffffff19939093169190920190815260100192915050565b600082516157788184602087016159c1565b60208152600061434460208301846159e556fea26469706673582212208001cfdbe132207efb84a9c435aa028e37d2a0470c4fe9796df7bff434a843eb64736f6c63430008130033
Deployed Bytecode
0x60806040526004361061027f5760003560e01c80636d96a2aa1161014f578063bef4b8bd116100c1578063ea4d3c9b1161007a578063ea4d3c9b1461082f578063ec54aa7b1461084f578063ec7301771461086f578063ee94d67c1461088f578063f074ba62146108af578063ff0996b5146108cf57600080fd5b8063bef4b8bd1461076c578063c26f20561461078c578063d1464931146107ac578063d3e7c45b146107c2578063dc560c88146107e2578063dda3346c1461080f57600080fd5b8063a0d58d8a11610113578063a0d58d8a14610691578063a3aae136146106b1578063ad5c4648146106d1578063b3d42621146106f9578063b915588514610729578063bc79a3651461075657600080fd5b80636d96a2aa14610609578063772495c3146106295780638a2fc4e31461064957806390b51625146106695780639ebf4ab11461067e57600080fd5b80633e4bdc24116101f357806347e7ef24116101ac57806347e7ef24146105285780634f4247a1146105485780635299ac17146105745780635361477b14610594578063573803fb146105b457806367cbbdf1146105c957600080fd5b80633e4bdc24146104525780633f65cf191461047257806342ecff2a14610492578063454344d6146104ca5780634665bcda146104e0578063479d39761461050057600080fd5b806323e481751161024557806323e481751461039f5780632e992fc5146103bf57806333404396146103dc578063397bfbac146103fc57806339a18f0c1461041257806339b70e381461043257600080fd5b8062435da5146102b1578062cb637e146102ee5780630cca214f1461030e578063127842a4146103495780631459457a1461037f57600080fd5b366102ac5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc11933016102a257005b6102aa6108ef565b005b600080fd5b3480156102bd57600080fd5b506033546102d1906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102fa57600080fd5b506102aa61030936600461485a565b610b6f565b34801561031a57600080fd5b5061033b6103293660046148d1565b60416020526000908152604090205481565b6040519081526020016102e5565b34801561035557600080fd5b506102d16103643660046148ff565b6036602052600090815260409020546001600160a01b031681565b34801561038b57600080fd5b506102aa61039a36600461491c565b610d41565b3480156103ab57600080fd5b5061033b6103ba36600461498d565b610ff5565b3480156103cb57600080fd5b5061033b6801bc16d674ec80000081565b3480156103e857600080fd5b506102aa6103f73660046149f8565b61175d565b34801561040857600080fd5b5061033b603b5481565b34801561041e57600080fd5b506043546102d1906001600160a01b031681565b34801561043e57600080fd5b506034546102d1906001600160a01b031681565b34801561045e57600080fd5b506102aa61046d366004614b61565b611ac4565b34801561047e57600080fd5b506102aa61048d366004614c0c565b611d59565b34801561049e57600080fd5b506045546104b2906001600160401b031681565b6040516001600160401b0390911681526020016102e5565b3480156104d657600080fd5b5061033b60445481565b3480156104ec57600080fd5b506039546102d1906001600160a01b031681565b34801561050c57600080fd5b506102d173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b34801561053457600080fd5b5061033b610543366004614cbb565b611ed4565b34801561055457600080fd5b506045546102d1906801000000000000000090046001600160a01b031681565b34801561058057600080fd5b506102aa61058f366004614ce7565b611f59565b3480156105a057600080fd5b506102aa6105af366004614d30565b6121e1565b3480156105c057600080fd5b5061033b612371565b3480156105d557600080fd5b506105f96105e4366004614e13565b60466020526000908152604090205460ff1681565b60405190151581526020016102e5565b34801561061557600080fd5b506037546102d1906001600160a01b031681565b34801561063557600080fd5b506102aa6106443660046148ff565b612602565b34801561065557600080fd5b506042546102d1906001600160a01b031681565b34801561067557600080fd5b506102aa6126a5565b6102aa61068c366004614e71565b6127ee565b34801561069d57600080fd5b5061033b6106ac3660046148ff565b6129bd565b3480156106bd57600080fd5b50603a546102d1906001600160a01b031681565b3480156106dd57600080fd5b506102d173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b34801561070557600080fd5b506105f96107143660046148d1565b60406020819052600091825290205460ff1681565b34801561073557600080fd5b5061033b6107443660046148ff565b603e6020526000908152604090205481565b34801561076257600080fd5b5061033b603d5481565b34801561077857600080fd5b506102aa6107873660046148ff565b612af1565b34801561079857600080fd5b506102aa6107a736600461498d565b612b91565b3480156107b857600080fd5b5061033b603c5481565b3480156107ce57600080fd5b506102aa6107dd366004614ee4565b61300b565b3480156107ee57600080fd5b5061033b6107fd3660046148ff565b603f6020526000908152604090205481565b34801561081b57600080fd5b506102aa61082a366004614f85565b6134b7565b34801561083b57600080fd5b506038546102d1906001600160a01b031681565b34801561085b57600080fd5b506102aa61086a3660046148d1565b61352a565b34801561087b57600080fd5b5061033b61088a3660046148ff565b6135a5565b34801561089b57600080fd5b506047546104b2906001600160401b031681565b3480156108bb57600080fd5b506102aa6108ca366004615056565b613755565b3480156108db57600080fd5b506035546102d1906001600160a01b031681565b604454479015610a0c576000604454471161090a574761090e565b6044545b9050603560009054906101000a90046001600160a01b03166001600160a01b031663f617eecc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610963573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098791906150be565b6001600160a01b0316636c0d86bd826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156109c157600080fd5b505af11580156109d5573d6000803e3d6000fd5b505050505080604460008282546109ec91906150f1565b909155506109fc905081836150f1565b915081600003610a0a575050565b505b326000908152603e602052604081205415610a4357610a2961391d565b9050610a3581836150f1565b915081600003610a43575050565b60355460408051633d85fbb360e21b815290516000926001600160a01b03169163f617eecc9160048083019260209291908290030181865afa158015610a8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab191906150be565b90506000816001600160a01b03168460405160006040518083038185875af1925050503d8060008114610b00576040519150601f19603f3d011682016040523d82523d6000602084013e610b05565b606091505b5050905080610b27576040516312171d8360e31b815260040160405180910390fd5b604080516001600160a01b0384168152602081018690527f64459fab7324199920bec86f9ce814dab17621d386f548c8a7c4e638d28fb8f4910160405180910390a150505050565b610b776139f1565b610b7f613a4a565b60005a9050610b9160a0860186615104565b84149050610bb257604051632b477e7160e11b815260040160405180910390fd5b6038546040516360d7faed60e01b81526001600160a01b03909116906360d7faed90610beb908890889088908890600190600401615318565b600060405180830381600087803b158015610c0557600080fd5b505af1158015610c19573d6000803e3d6000fd5b50505050610c5a85858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250613ad592505050565b610c62613cd2565b603854604051632cbd9b6d60e11b81527e31d86140cfa7fee3aca26a490f754ce3afc3c6d2ca211a94172af88ec988e2916001600160a01b03169063597b36da90610cb1908990600401615358565b602060405180830381865afa158015610cce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf2919061536b565b610cff60a0880188615104565b610d0c60c08a018a615104565b604051610d1d959493929190615384565b60405180910390a1610d318161c35061411d565b50610d3b60018055565b50505050565b600054610100900460ff1615808015610d615750600054600160ff909116105b80610d7b5750303b158015610d7b575060005460ff166001145b610de35760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff191660011790558015610e06576000805461ff0019166101001790555b6001600160a01b038616610e2d5760405163862a606760e01b815260040160405180910390fd5b6001600160a01b038516610e545760405163862a606760e01b815260040160405180910390fd5b6001600160a01b038416610e7b5760405163862a606760e01b815260040160405180910390fd5b6001600160a01b038316610ea25760405163862a606760e01b815260040160405180910390fd5b6001600160a01b038216610ec95760405163862a606760e01b815260040160405180910390fd5b610ed16141ad565b603380546001600160a01b038089166001600160a01b0319928316179092556034805488841690831617905560358054878416908316179055603880548684169083161790556039805492851692909116821790556040805163426c083160e11b815290516384d810629160048082019260209290919082900301816000875af1158015610f63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8791906150be565b603a80546001600160a01b0319166001600160a01b03929092169190911790558015610fed576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6000610fff6139f1565b611007613a4a565b60005a905084831461102c57604051632b477e7160e11b815260040160405180910390fd5b604080516001808252818301909252600091816020015b60408051606080820183528082526020820152600091810191909152815260200190600190039081611043579050509050856001600160401b0381111561108c5761108c614abb565b6040519080825280602002602001820160405280156110b5578160200160208202803683370190505b50816000815181106110c9576110c96153f2565b602090810291909101015152856001600160401b038111156110ed576110ed614abb565b604051908082528060200260200182016040528015611116578160200160208202803683370190505b508160008151811061112a5761112a6153f2565b602090810291909101810151015260385460405163285e212160e21b81523060048201526000916001600160a01b03169063a178848490602401602060405180830381865afa158015611181573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a5919061536b565b905060005b878110156115f75773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8989838181106111d9576111d96153f2565b90506020020160208101906111ee91906148ff565b6001600160a01b03160361131d57603960009054906101000a90046001600160a01b03166001600160a01b0316639104c3196040518163ffffffff1660e01b8152600401602060405180830381865afa15801561124f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127391906150be565b83600081518110611286576112866153f2565b60200260200101516000015182815181106112a3576112a36153f2565b60200260200101906001600160a01b031690816001600160a01b0316815250508686828181106112d5576112d56153f2565b90506020020135836000815181106112ef576112ef6153f2565b602002602001015160200151828151811061130c5761130c6153f2565b602002602001018181525050611520565b60006036818b8b85818110611334576113346153f2565b905060200201602081019061134991906148ff565b6001600160a01b03908116825260208201929092526040016000205416036113845760405163862a606760e01b815260040160405180910390fd5b603660008a8a8481811061139a5761139a6153f2565b90506020020160208101906113af91906148ff565b6001600160a01b039081168252602082019290925260400160009081205485519216918591906113e1576113e16153f2565b60200260200101516000015182815181106113fe576113fe6153f2565b60200260200101906001600160a01b031690816001600160a01b031681525050603660008a8a84818110611434576114346153f2565b905060200201602081019061144991906148ff565b6001600160a01b0390811682526020820192909252604001600020541663e3dae51c88888481811061147d5761147d6153f2565b905060200201356040518263ffffffff1660e01b81526004016114a291815260200190565b602060405180830381865afa1580156114bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e3919061536b565b836000815181106114f6576114f66153f2565b6020026020010151602001518281518110611513576115136153f2565b6020026020010181815250505b3083600081518110611534576115346153f2565b6020026020010151604001906001600160a01b031690816001600160a01b0316815250508260008151811061156b5761156b6153f2565b6020026020010151602001518181518110611588576115886153f2565b6020026020010151603f60008b8b858181106115a6576115a66153f2565b90506020020160208101906115bb91906148ff565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546115ea9190615408565b90915550506001016111aa565b506038546040516306ec6e8160e11b81526000916001600160a01b031690630dd8dd0290611629908690600401615484565b6000604051808303816000875af1158015611648573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611670919081019061551e565b600081518110611682576116826153f2565b6020908102919091018101516000818152604092839052918220805460ff1916600117905560375485519193507ff7c9db32693636e458573257dad812f58a7c5cc3067e0fad83b601b46947615a92849230926001600160a01b0316918391889143918b91906116f4576116f46153f2565b6020026020010151600001518a600081518110611713576117136153f2565b6020026020010151602001516040516117339897969594939291906155a3565b60405180910390a16117478461c35061411d565b935050505061175560018055565b949350505050565b6117656139f1565b61176d613a4a565b60005a905087861415806117815750878414155b8061178c5750878214155b156117aa57604051632b477e7160e11b815260040160405180910390fd5b6038546040516319a021cb60e11b81526001600160a01b03909116906333404396906117e8908c908c908c908c908c908c908c908c906004016156be565b600060405180830381600087803b15801561180257600080fd5b505af1158015611816573d6000803e3d6000fd5b5050505060005b88811015611a9b57898982818110611837576118376153f2565b90506020028101906118499190615762565b6118579060a0810190615104565b905088888381811061186b5761186b6153f2565b905060200281019061187d9190615104565b90501461189d57604051632b477e7160e11b815260040160405180910390fd5b8383828181106118af576118af6153f2565b90506020020160208101906118c49190615782565b6118e15760405163520b7b2760e11b815260040160405180910390fd5b6119638a8a838181106118f6576118f66153f2565b90506020028101906119089190615762565b89898481811061191a5761191a6153f2565b905060200281019061192c9190615104565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250613ad592505050565b6038547e31d86140cfa7fee3aca26a490f754ce3afc3c6d2ca211a94172af88ec988e2906001600160a01b031663597b36da8c8c858181106119a7576119a76153f2565b90506020028101906119b99190615762565b6040518263ffffffff1660e01b81526004016119d59190615358565b602060405180830381865afa1580156119f2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a16919061536b565b8b8b84818110611a2857611a286153f2565b9050602002810190611a3a9190615762565b611a489060a0810190615104565b8d8d86818110611a5a57611a5a6153f2565b9050602002810190611a6c9190615762565b611a7a9060c0810190615104565b604051611a8b959493929190615384565b60405180910390a160010161181d565b50611aa4613cd2565b611ab08161c35061411d565b50611aba60018055565b5050505050505050565b60335460405163b446908560e01b81523360048201526001600160a01b039091169063b446908590602401602060405180830381865afa158015611b0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b30919061579f565b611b4d57604051636f3d44a760e01b815260040160405180910390fd5b6000805b8251811015611d345760466000848381518110611b7057611b706153f2565b6020908102919091018101516001600160401b031682528101919091526040016000205460ff1615611bb5576040516319d5b96960e11b815260040160405180910390fd5b603a5483516000916001600160a01b0316906352396a5990869085908110611bdf57611bdf6153f2565b60200260200101516040518263ffffffff1660e01b8152600401611c1291906001600160401b0391909116815260200190565b602060405180830381865afa158015611c2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5391906157bc565b6001600160401b03169050611c6c633b9aca00826157d9565b60446000828254611c7d9190615408565b92505081905550600160466000868581518110611c9c57611c9c6153f2565b60200260200101516001600160401b03166001600160401b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550826001600160401b0316848381518110611cf757611cf76153f2565b60200260200101516001600160401b03161115611d2b57838281518110611d2057611d206153f2565b602002602001015192505b50600101611b51565b506047805467ffffffffffffffff19166001600160401b039290921691909117905550565b611d61613a4a565b60005a603a54604051633f65cf1960e01b81529192506001600160a01b031690633f65cf1990611da3908c908c908c908c908c908c908c908c9060040161592f565b600060405180830381600087803b158015611dbd57600080fd5b505af1158015611dd1573d6000803e3d6000fd5b5050505060005b82811015611ebc576000611e40858584818110611df757611df76153f2565b9050602002810190611e099190615104565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506141dc92505050565b60008181526041602052604090205490915015611e8457600081815260416020526040812054603b805491929091611e799084906150f1565b90915550611ea59050565b6801bc16d674ec800000603b6000828254611e9f91906150f1565b90915550505b600090815260416020526040812055600101611dd8565b50611ec981603d5461411d565b505050505050505050565b6000611ede6139f1565b611ee6614200565b6001600160a01b03838116600090815260366020526040902054161580611f0b575081155b15611f295760405163862a606760e01b815260040160405180910390fd5b611f3e6001600160a01b03841633308561422b565b611f488383614296565b9050611f5360018055565b92915050565b611f616139f1565b611f6961434b565b6001600160a01b038216611f905760405163862a606760e01b815260040160405180910390fd5b6001600160a01b038116158015906120905750816001600160a01b0316816001600160a01b0316632495a5996040518163ffffffff1660e01b8152600401602060405180830381865afa158015611feb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200f91906150be565b6001600160a01b0316141580612090575060345460405163198f077960e21b81526001600160a01b0383811660048301529091169063663c1de490602401602060405180830381865afa15801561206a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061208e919061579f565b155b156120ae57604051632711b74d60e11b815260040160405180910390fd5b6001600160a01b03828116600090815260366020526040902054161580159061214f57506001600160a01b03828116600090815260366020526040808220549051630aa794bf60e31b81523060048201529192169063553ca5f890602401602060405180830381865afa158015612129573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061214d919061536b565b115b1561216d57604051630f1fd48960e11b815260040160405180910390fd5b6001600160a01b0382811660008181526036602090815260409182902080546001600160a01b031916948616948517905581519283528201929092527f1a654dbe468f1cff27ced5a916efd4120a4155caf290688ab42aebe90554683e910160405180910390a16121dd60018055565b5050565b6121e96139f1565b6121f161434b565b6001600160a01b0383166122185760405163862a606760e01b815260040160405180910390fd5b603854604051631976849960e21b81523060048201526000916001600160a01b0316906365da126490602401602060405180830381865afa158015612261573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061228591906150be565b6001600160a01b0316146122ac57604051631c52d05d60e11b815260040160405180910390fd5b603780546001600160a01b0319166001600160a01b0385811691821790925560385460405163eea9064b60e01b815292169163eea9064b916122f49186908690600401615a11565b600060405180830381600087803b15801561230e57600080fd5b505af1158015612322573d6000803e3d6000fd5b50506040516001600160a01b03861681527ffe608947467beb30a90e072fd2fc7d52baecf0935f542011fcd8fa6362a5d5b39250602001905060405180910390a161236c60018055565b505050565b600061237b6143d4565b6000604454633b9aca00603a60009054906101000a90046001600160a01b03166001600160a01b0316633474aa166040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123fc91906157bc565b6001600160401b031661240f91906157d9565b1161241b5760006124ac565b604454603a5460408051631a3a550b60e11b81529051633b9aca00926001600160a01b031691633474aa169160048083019260209291908290030181865afa15801561246b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248f91906157bc565b6001600160401b03166124a291906157d9565b6124ac91906150f1565b6039546040516360f4062b60e01b81523060048201529192506000916001600160a01b03909116906360f4062b90602401602060405180830381865afa1580156124fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251e919061536b565b90506000811261259157603b5473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600052603f6020527f5d7315d061885134292236184dbffd84acd8b3aaff2ca1613d734d4448806a5a54839183916125789190615408565b6125829190615408565b61258c91906150f1565b6125fb565b8161259b82615a52565b603b5473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600052603f6020527f5d7315d061885134292236184dbffd84acd8b3aaff2ca1613d734d4448806a5a546125e79190615408565b6125f191906150f1565b6125fb91906150f1565b9250505090565b61260a6139f1565b61261261434b565b6001600160a01b0381166126395760405163862a606760e01b815260040160405180910390fd5b604354604080516001600160a01b03928316815291831660208301527facb12817adc82e45b703a158b973e414ae18f26805e133cec337d73ac6a09c42910160405180910390a1604380546001600160a01b0319166001600160a01b0383161790556001805550565b50565b6126ad613a4a565b6045546001600160401b0316156126d65760405162be9bc360e81b815260040160405180910390fd5b6126de6143d4565b603a546040516388676cad60e01b8152600160048201526001600160a01b03909116906388676cad90602401600060405180830381600087803b15801561272457600080fd5b505af1158015612738573d6000803e3d6000fd5b50505050603a60009054906101000a90046001600160a01b03166001600160a01b03166342ecff2a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561278f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127b391906157bc565b6045805467ffffffffffffffff19166001600160401b039290921691821790556000908152604660205260409020805460ff19166001179055565b6127f6614200565b603a546040516358eaee7960e01b81526000916001600160a01b0316906358eaee79906128299089908990600401615a84565b602060405180830381865afa158015612846573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286a9190615a98565b600281111561287b5761287b615a6e565b0361294a5760006128c186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061449e92505050565b60008181526041602052604081205491925034906128df8284615408565b90506801bc16d674ec8000006128f53485615408565b111561291d5761290e836801bc16d674ec8000006150f1565b91506801bc16d674ec80000090505b6000848152604160205260408120829055603b8054849290612940908490615408565b9091555050505050505b6039546040516326d3918d60e21b81526001600160a01b0390911690639b4e46349034906129849089908990899089908990600401615ab9565b6000604051808303818588803b15801561299d57600080fd5b505af11580156129b1573d6000803e3d6000fd5b50505050505050505050565b6034546040516322e2ab0f60e21b815230600482015260009182916001600160a01b0390911690638b8aac3c90602401602060405180830381865afa158015612a0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a2e919061536b565b905060005b81811015612ad7576034546040516365e15eb160e11b8152306004820152602481018390526001600160a01b0386811692169063cbc2bd6290604401602060405180830381865afa158015612a8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ab091906150be565b6001600160a01b031603612ac5579392505050565b80612acf81615af3565b915050612a33565b5060405163c5723b5160e01b815260040160405180910390fd5b612af96139f1565b612b0161434b565b6001600160a01b038116612b285760405163862a606760e01b815260040160405180910390fd5b604254604080516001600160a01b03928316815291831660208301527f5534d16f3baa199c6d069e6404c6ff5b35d72713c7db2868654aa720b09293b9910160405180910390a1604280546001600160a01b0319166001600160a01b0383161790556001805550565b612b996139f1565b60335460405163bcc6ce2360e01b81523360048201526001600160a01b039091169063bcc6ce2390602401602060405180830381865afa158015612be1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c05919061579f565b612c2257604051632efffa9d60e01b815260040160405180910390fd5b808314612c4257604051632b477e7160e11b815260040160405180910390fd5b60005b83811015610d31576000838383818110612c6157612c616153f2565b9050602002016020810190612c7691906148ff565b6001600160a01b031603612c9d5760405163862a606760e01b815260040160405180910390fd5b6038546000906001600160a01b031663597b36da878785818110612cc357612cc36153f2565b9050602002810190612cd59190615762565b6040518263ffffffff1660e01b8152600401612cf19190615358565b602060405180830381865afa158015612d0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d32919061536b565b60008181526040602081905290205490915060ff1615612d655760405163eb3d1dcd60e01b815260040160405180910390fd5b603854604051635bf8375f60e11b8152600481018390526001600160a01b039091169063b7f06ebe90602401602060405180830381865afa158015612dae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dd2919061579f565b612def576040516355780d0f60e11b815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee848484818110612e1657612e166153f2565b9050602002016020810190612e2b91906148ff565b6001600160a01b031614158015612f225750603860009054906101000a90046001600160a01b03166001600160a01b0316639104c3196040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612eb691906150be565b6001600160a01b0316868684818110612ed157612ed16153f2565b9050602002810190612ee39190615762565b612ef19060a0810190615104565b6000818110612f0257612f026153f2565b9050602002016020810190612f1791906148ff565b6001600160a01b0316145b15612f4057604051630b049d2560e11b815260040160405180910390fd5b858583818110612f5257612f526153f2565b9050602002810190612f649190615762565b612f729060c0810190615104565b6000818110612f8357612f836153f2565b90506020020135603f6000868686818110612fa057612fa06153f2565b9050602002016020810190612fb591906148ff565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254612fe49190615408565b90915550506000908152604060208190529020805460ff1916600190811790915501612c45565b603354604051633402c11360e11b81523360048201526001600160a01b0390911690636805822690602401602060405180830381865afa158015613053573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613077919061579f565b6130945760405163029c791d60e61b815260040160405180910390fd5b6043546001600160a01b03166130bd57604051630cd4f69d60e01b815260040160405180910390fd5b60005a604254604051633ccc861d60e01b81529192506001600160a01b031690633ccc861d906130f39085903090600401615c46565b600060405180830381600087803b15801561310d57600080fd5b505af1158015613121573d6000803e3d6000fd5b5050505060005b61313560e0840184615d3f565b90508110156134aa5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc261316060e0850185615d3f565b83818110613170576131706153f2565b61318692602060409092020190810191506148ff565b6001600160a01b031603613280576040516370a0823160e01b815230600482015260009073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2906370a0823190602401602060405180830381865afa1580156131e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061320a919061536b565b604051632e1a7d4d60e01b81526004810182905290915073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d90602401600060405180830381600087803b15801561325a57600080fd5b505af115801561326e573d6000803e3d6000fd5b5050505061327a6108ef565b506134a2565b600060368161329260e0870187615d3f565b858181106132a2576132a26153f2565b6132b892602060409092020190810191506148ff565b6001600160a01b03908116825260208201929092526040016000205416146133b25761327a6132ea60e0850185615d3f565b838181106132fa576132fa6153f2565b61331092602060409092020190810191506148ff565b61331d60e0860186615d3f565b8481811061332d5761332d6153f2565b61334392602060409092020190810191506148ff565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015613389573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133ad919061536b565b614296565b6043546134a2906001600160a01b03166133cf60e0860186615d3f565b848181106133df576133df6153f2565b6133f592602060409092020190810191506148ff565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa15801561343b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061345f919061536b565b61346c60e0870187615d3f565b8581811061347c5761347c6153f2565b61349292602060409092020190810191506148ff565b6001600160a01b03169190614513565b600101613128565b506121dd81603d5461411d565b6134bf613a4a565b603a54604051633768cd1b60e21b81526001600160a01b039091169063dda3346c906134f390869086908690600401615d88565b600060405180830381600087803b15801561350d57600080fd5b505af1158015613521573d6000803e3d6000fd5b50505050505050565b6135326139f1565b61353a61434b565b8060000361355b5760405163862a606760e01b815260040160405180910390fd5b603d5460408051918252602082018390527fbfad24c5385b591e87ef890b13ebedaadf34399714ea0e2dc0f6e4ff69c731dd910160405180910390a1603d8190556126a260018055565b6001600160a01b0381166000908152603f6020526040812054156136da576001600160a01b03808316600090815260366020908152604080832054603f90925291829020549151637a8b263760e01b8152921691637a8b26379161360f9160040190815260200190565b602060405180830381865afa15801561362c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613650919061536b565b6001600160a01b0383811660009081526036602052604090819020549051630aa794bf60e31b815230600482015291169063553ca5f890602401602060405180830381865afa1580156136a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136cb919061536b565b6136d59190615408565b611f53565b6001600160a01b0382811660009081526036602052604090819020549051630aa794bf60e31b815230600482015291169063553ca5f890602401602060405180830381865afa158015613731573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f53919061536b565b61375d613a4a565b603a5460405163783a5d3160e11b81526001600160a01b039091169063f074ba629061379190869086908690600401615df8565b600060405180830381600087803b1580156137ab57600080fd5b505af19250505080156137bc575060015b50604554603a5460408051633ba5359f60e21b815290516001600160401b03909316926001600160a01b039092169163ee94d67c916004808201926020929091908290030181865afa158015613816573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061383a91906157bc565b6001600160401b03160361236c57603a546045546040516352396a5960e01b81526001600160401b0390911660048201526000916001600160a01b0316906352396a5990602401602060405180830381865afa15801561389e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138c291906157bc565b6001600160401b031690506138db633b9aca00826157d9565b604460008282546138ec9190615408565b9091555050604580546047805467ffffffffffffffff199081166001600160401b0384161790915516905550505050565b326000908152603e6020526040812054819047101561393c574761394d565b326000908152603e60205260409020545b604051909150600090329083156108fc0290849084818181858888f1935050505090508061398e576040516312171d8360e31b815260040160405180910390fd5b326000908152603e6020526040812080548492906139ad9084906150f1565b909155505060408051328152602081018490527f667ad9c7167aea9bfcff8b321015abb0d8b77cf151a377e09e12b9017f9889fd910160405180910390a150919050565b600260015403613a435760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610dda565b6002600155565b6033546040516358e3de6f60e01b81523360048201526001600160a01b03909116906358e3de6f90602401602060405180830381865afa158015613a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ab6919061579f565b613ad35760405163bcefa34f60e01b815260040160405180910390fd5b565b60005b815181101561236c5760006001600160a01b0316828281518110613afe57613afe6153f2565b60200260200101516001600160a01b031603613b2d5760405163862a606760e01b815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316828281518110613b5d57613b5d6153f2565b60200260200101516001600160a01b031614158015613c365750603860009054906101000a90046001600160a01b03166001600160a01b0316639104c3196040518163ffffffff1660e01b81526004016020604051808303816000875af1158015613bcc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bf091906150be565b6001600160a01b0316613c0660a0850185615104565b83818110613c1657613c166153f2565b9050602002016020810190613c2b91906148ff565b6001600160a01b0316145b15613c5457604051630b049d2560e11b815260040160405180910390fd5b613c6160c0840184615104565b82818110613c7157613c716153f2565b90506020020135603f6000848481518110613c8e57613c8e6153f2565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000828254613cc591906150f1565b9091555050600101613ad8565b60355460408051633d85fbb360e21b815290516000926001600160a01b03169163f617eecc9160048083019260209291908290030181865afa158015613d1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d4091906150be565b6001600160a01b03166351a2d6d16040518163ffffffff1660e01b8152600401602060405180830381865afa158015613d7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613da191906150be565b905060005b603560009054906101000a90046001600160a01b03166001600160a01b03166375c745a66040518163ffffffff1660e01b8152600401602060405180830381865afa158015613df9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e1d919061536b565b8110156121dd5760355460405163172c48c760e01b8152600481018390526000916001600160a01b03169063172c48c790602401602060405180830381865afa158015613e6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e9291906150be565b604051633df3890b60e11b81526001600160a01b038083166004830152919250600091851690637be7121690602401602060405180830381865afa158015613ede573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f02919061536b565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038416906370a0823190602401602060405180830381865afa158015613f4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f70919061536b565b905081156140fd5781811115613f865781613f88565b805b9150613f9482826150f1565b9050614021603560009054906101000a90046001600160a01b03166001600160a01b031663f617eecc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613fec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061401091906150be565b6001600160a01b0385169084614543565b603560009054906101000a90046001600160a01b03166001600160a01b031663f617eecc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614074573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061409891906150be565b604051636ce6855560e11b81526001600160a01b03858116600483015260248201859052919091169063d9cd0aaa90604401600060405180830381600087803b1580156140e457600080fd5b505af11580156140f8573d6000803e3d6000fd5b505050505b801561410f5761410d8382614296565b505b836001019350505050613da6565b600048825a61412c90866150f1565b6141369190615408565b61414091906157d9565b336000908152603e6020526040812080549293508392909190614164908490615408565b909155505060408051338152602081018390527f4ff29a094e434f8a698185e97d3a285f4ba26c723f8ec8d2c9914213d61589ca910160405180910390a1505050565b60018055565b600054610100900460ff166141d45760405162461bcd60e51b8152600401610dda90615ea5565b613ad36145f0565b6000816000815181106141f1576141f16153f2565b60200260200101519050919050565b6035546001600160a01b03163314613ad3576040516342d16b8b60e11b815260040160405180910390fd5b6040516001600160a01b0380851660248301528316604482015260648101829052610d3b9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152614617565b6034546000906142b3906001600160a01b03858116911684614543565b6034546001600160a01b03848116600081815260366020526040908190205490516373d0285560e11b8152908316600482015260248101919091526044810185905291169063e7a050aa906064016020604051808303816000875af1158015614320573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614344919061536b565b9392505050565b603354604051630d5dcbef60e31b81523360048201526001600160a01b0390911690636aee5f7890602401602060405180830381865afa158015614393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143b7919061579f565b613ad35760405163cbdd1d2760e01b815260040160405180910390fd5b603a5460408051633ba5359f60e21b815290516000926001600160a01b03169163ee94d67c9160048083019260209291908290030181865afa15801561441e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061444291906157bc565b90506001600160401b0381161580159061446657506047546001600160401b031615155b801561448057506047546001600160401b03908116908216115b156126a2576040516312792a5560e31b815260040160405180910390fd5b6000600282600060801b6040516020016144b9929190615ef0565b60408051601f19818403018152908290526144d391615f28565b602060405180830381855afa1580156144f0573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190611f53919061536b565b6040516001600160a01b03831660248201526044810182905261236c90849063a9059cbb60e01b9060640161425f565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015614593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145b7919061536b565b9050610d3b8463095ea7b360e01b856145d08686615408565b6040516001600160a01b039092166024830152604482015260640161425f565b600054610100900460ff166141a75760405162461bcd60e51b8152600401610dda90615ea5565b600061466c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166146ec9092919063ffffffff16565b905080516000148061468d57508080602001905181019061468d919061579f565b61236c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610dda565b6060611755848460008585600080866001600160a01b031685876040516147139190615f28565b60006040518083038185875af1925050503d8060008114614750576040519150601f19603f3d011682016040523d82523d6000602084013e614755565b606091505b509150915061476687838387614771565b979650505050505050565b606083156147e05782516000036147d9576001600160a01b0385163b6147d95760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610dda565b5081611755565b61175583838151156147f55781518083602001fd5b8060405162461bcd60e51b8152600401610dda9190615f3a565b60008083601f84011261482157600080fd5b5081356001600160401b0381111561483857600080fd5b6020830191508360208260051b850101111561485357600080fd5b9250929050565b6000806000806060858703121561487057600080fd5b84356001600160401b038082111561488757600080fd5b9086019060e0828903121561489b57600080fd5b909450602086013590808211156148b157600080fd5b506148be8782880161480f565b9598909750949560400135949350505050565b6000602082840312156148e357600080fd5b5035919050565b6001600160a01b03811681146126a257600080fd5b60006020828403121561491157600080fd5b8135614344816148ea565b600080600080600060a0868803121561493457600080fd5b853561493f816148ea565b9450602086013561494f816148ea565b9350604086013561495f816148ea565b9250606086013561496f816148ea565b9150608086013561497f816148ea565b809150509295509295909350565b600080600080604085870312156149a357600080fd5b84356001600160401b03808211156149ba57600080fd5b6149c68883890161480f565b909650945060208701359150808211156149df57600080fd5b506149ec8782880161480f565b95989497509550505050565b6000806000806000806000806080898b031215614a1457600080fd5b88356001600160401b0380821115614a2b57600080fd5b614a378c838d0161480f565b909a50985060208b0135915080821115614a5057600080fd5b614a5c8c838d0161480f565b909850965060408b0135915080821115614a7557600080fd5b614a818c838d0161480f565b909650945060608b0135915080821115614a9a57600080fd5b50614aa78b828c0161480f565b999c989b5096995094979396929594505050565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715614af357614af3614abb565b60405290565b604051601f8201601f191681016001600160401b0381118282101715614b2157614b21614abb565b604052919050565b60006001600160401b03821115614b4257614b42614abb565b5060051b60200190565b6001600160401b03811681146126a257600080fd5b60006020808385031215614b7457600080fd5b82356001600160401b03811115614b8a57600080fd5b8301601f81018513614b9b57600080fd5b8035614bae614ba982614b29565b614af9565b81815260059190911b82018301908381019087831115614bcd57600080fd5b928401925b82841015614766578335614be581614b4c565b82529284019290840190614bd2565b600060408284031215614c0657600080fd5b50919050565b60008060008060008060008060a0898b031215614c2857600080fd5b8835614c3381614b4c565b975060208901356001600160401b0380821115614c4f57600080fd5b614c5b8c838d01614bf4565b985060408b0135915080821115614c7157600080fd5b614c7d8c838d0161480f565b909850965060608b0135915080821115614c9657600080fd5b614ca28c838d0161480f565b909650945060808b0135915080821115614a9a57600080fd5b60008060408385031215614cce57600080fd5b8235614cd9816148ea565b946020939093013593505050565b60008060408385031215614cfa57600080fd5b8235614d05816148ea565b91506020830135614d15816148ea565b809150509250929050565b8035614d2b816148ea565b919050565b600080600060608486031215614d4557600080fd5b8335614d50816148ea565b92506020848101356001600160401b0380821115614d6d57600080fd5b9086019060408289031215614d8157600080fd5b614d89614ad1565b823582811115614d9857600080fd5b8301601f81018a13614da957600080fd5b803583811115614dbb57614dbb614abb565b614dcd601f8201601f19168701614af9565b93508084528a86828401011115614de357600080fd5b80868301878601376000908401860152509081529082013591810191909152929592945050506040919091013590565b600060208284031215614e2557600080fd5b813561434481614b4c565b60008083601f840112614e4257600080fd5b5081356001600160401b03811115614e5957600080fd5b60208301915083602082850101111561485357600080fd5b600080600080600060608688031215614e8957600080fd5b85356001600160401b0380821115614ea057600080fd5b614eac89838a01614e30565b90975095506020880135915080821115614ec557600080fd5b50614ed288828901614e30565b96999598509660400135949350505050565b600060208284031215614ef657600080fd5b81356001600160401b03811115614f0c57600080fd5b8201610100818503121561434457600080fd5b600082601f830112614f3057600080fd5b81356020614f40614ba983614b29565b82815260059290921b84018101918181019086841115614f5f57600080fd5b8286015b84811015614f7a5780358352918301918301614f63565b509695505050505050565b600080600060608486031215614f9a57600080fd5b83356001600160401b0380821115614fb157600080fd5b818601915086601f830112614fc557600080fd5b81356020614fd5614ba983614b29565b82815260059290921b8401810191818101908a841115614ff457600080fd5b948201945b8386101561501b57853561500c816148ea565b82529482019490820190614ff9565b9750508701359250508082111561503157600080fd5b5061503e86828701614f1f565b92505061504d60408501614d20565b90509250925092565b60008060006040848603121561506b57600080fd5b83356001600160401b038082111561508257600080fd5b61508e87838801614bf4565b945060208601359150808211156150a457600080fd5b506150b18682870161480f565b9497909650939450505050565b6000602082840312156150d057600080fd5b8151614344816148ea565b634e487b7160e01b600052601160045260246000fd5b81810381811115611f5357611f536150db565b6000808335601e1984360301811261511b57600080fd5b8301803591506001600160401b0382111561513557600080fd5b6020019150600581901b360382131561485357600080fd5b803563ffffffff81168114614d2b57600080fd5b6000808335601e1984360301811261517857600080fd5b83016020810192503590506001600160401b0381111561519757600080fd5b8060051b360382131561485357600080fd5b8183526000602080850194508260005b858110156151e75781356151cc816148ea565b6001600160a01b0316875295820195908201906001016151b9565b509495945050505050565b81835260006001600160fb1b0383111561520b57600080fd5b8260051b80836020870137939093016020019392505050565b60008135615231816148ea565b6001600160a01b03908116845260208301359061524d826148ea565b9081166020850152604083013590615264826148ea565b1660408401526060828101359084015263ffffffff6152856080840161514d565b16608084015261529860a0830183615161565b60e060a08601526152ad60e0860182846151a9565b9150506152bd60c0840184615161565b85830360c08701526152d08382846151f2565b9695505050505050565b8183526000602080850194508260005b858110156151e75781356152fd816148ea565b6001600160a01b0316875295820195908201906001016152ea565b60808152600061532b6080830188615224565b828103602084015261533e8187896152da565b604084019590955250509015156060909101529392505050565b6020815260006143446020830184615224565b60006020828403121561537d57600080fd5b5051919050565b85815260606020808301829052908201859052600090869060808401835b888110156153d05783356153b5816148ea565b6001600160a01b0316825292820192908201906001016153a2565b5084810360408601526153e48187896151f2565b9a9950505050505050505050565b634e487b7160e01b600052603260045260246000fd5b80820180821115611f5357611f536150db565b600081518084526020808501945080840160005b838110156151e75781516001600160a01b03168752958201959082019060010161542f565b600081518084526020808501945080840160005b838110156151e757815187529582019590820190600101615468565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561551057603f198984030185528151606081518186526154d18287018261541b565b915050888201518582038a8701526154e98282615454565b928901516001600160a01b03169589019590955250948701949250908601906001016154ab565b509098975050505050505050565b6000602080838503121561553157600080fd5b82516001600160401b0381111561554757600080fd5b8301601f8101851361555857600080fd5b8051615566614ba982614b29565b81815260059190911b8201830190838101908783111561558557600080fd5b928401925b828410156147665783518252928401929084019061558a565b8881526001600160a01b0388811660208301528781166040830152861660608201526bffffffffffffffffffffffff8516608082015260a0810184905261010060c082018190526000906155f98382018661541b565b905082810360e084015261560d8185615454565b9b9a5050505050505050505050565b81835260006020808501808196508560051b810191508460005b8781101561566c57828403895261564d8288615161565b6156588682846152da565b9a87019a9550505090840190600101615636565b5091979650505050505050565b80151581146126a257600080fd5b8183526000602080850194508260005b858110156151e75781356156aa81615679565b151587529582019590820190600101615697565b60808082528101889052600060a060058a901b830181019083018b835b8c81101561572257858403609f19018352368e900360de190182351261570057600080fd5b61570d848f843501615224565b935060209283019291909101906001016156db565b505050828103602084015261573881898b61561c565b9050828103604084015261574d8187896151f2565b9050828103606084015261560d818587615687565b6000823560de1983360301811261577857600080fd5b9190910192915050565b60006020828403121561579457600080fd5b813561434481615679565b6000602082840312156157b157600080fd5b815161434481615679565b6000602082840312156157ce57600080fd5b815161434481614b4c565b8082028115828204841417611f5357611f536150db565b6000808335601e1984360301811261580757600080fd5b83016020810192503590506001600160401b0381111561582657600080fd5b80360382131561485357600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b80358252600061587160208301836157f0565b60406020860152615886604086018284615835565b95945050505050565b81835260006020808501808196508560051b810191508460005b8781101561566c5782840389526158c082886157f0565b6158cb868284615835565b9a87019a95505050908401906001016158a9565b81835260006020808501808196508560051b810191508460005b8781101561566c5782840389526159108288615161565b61591b8682846151f2565b9a87019a95505050908401906001016158f9565b6001600160401b03891681526000602060a08184015261595260a084018b61585e565b8381036040850152888152899082016000805b8b81101561599557833564ffffffffff8116808214615982578384fd5b8452509284019291840191600101615965565b505084810360608601526159aa81898b61588f565b92505050828103608084015261560d8185876158df565b60005b838110156159dc5781810151838201526020016159c4565b50506000910152565b600081518084526159fd8160208601602086016159c1565b601f01601f19169290920160200192915050565b60018060a01b0384168152606060208201526000835160406060840152615a3b60a08401826159e5565b602095909501516080840152505060400152919050565b6000600160ff1b8201615a6757615a676150db565b5060000390565b634e487b7160e01b600052602160045260246000fd5b602081526000611755602083018486615835565b600060208284031215615aaa57600080fd5b81516003811061434457600080fd5b606081526000615acd606083018789615835565b8281036020840152615ae0818688615835565b9150508260408301529695505050505050565b600060018201615b0557615b056150db565b5060010190565b8035615b17816148ea565b6001600160a01b03168252602090810135910152565b8183526000602080850194508260005b858110156151e75763ffffffff615b538361514d565b1687529582019590820190600101615b3d565b81835260006020808501808196508560051b810191508460005b8781101561566c578284038952615b9782886157f0565b615ba2868284615835565b9a87019a9550505090840190600101615b80565b6000808335601e19843603018112615bcd57600080fd5b83016020810192503590506001600160401b03811115615bec57600080fd5b8060061b360382131561485357600080fd5b8183526000602080850194508260005b858110156151e7578135615c21816148ea565b6001600160a01b03168752818301358388015260409687019690910190600101615c0e565b60408152600063ffffffff80615c5b8661514d565b16604084015280615c6e6020870161514d565b16606084015250615c8260408501856157f0565b610100806080860152615c9a61014086018385615835565b9250615cac60a0860160608901615b0c565b615cb960a0880188615161565b9250603f19808786030160e0880152615cd3858584615b2d565b9450615ce260c08a018a615161565b94509150808786030183880152615cfa858584615b66565b9450615d0960e08a018a615bb6565b9450925080878603016101208801525050615d25838383615bfe565b935050505061434460208301846001600160a01b03169052565b6000808335601e19843603018112615d5657600080fd5b8301803591506001600160401b03821115615d7057600080fd5b6020019150600681901b360382131561485357600080fd5b606080825284519082018190526000906020906080840190828801845b82811015615dca5781516001600160a01b031684529284019290840190600101615da5565b50505083810382850152615dde8187615454565b9250505060018060a01b0383166040830152949350505050565b60006040808352615e0b8184018761585e565b602084820381860152818683528183019050818760051b840101886000805b8a811015615e9457868403601f190185528235368d9003605e19018112615e4f578283fd5b8c018035855286810135878601526060615e6b8a8301836157f0565b9250818b880152615e7f8288018483615835565b97890197965050509286019250600101615e2a565b50919b9a5050505050505050505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008351615f028184602088016159c1565b6fffffffffffffffffffffffffffffffff19939093169190920190815260100192915050565b600082516157788184602087016159c1565b60208152600061434460208301846159e556fea26469706673582212208001cfdbe132207efb84a9c435aa028e37d2a0470c4fe9796df7bff434a843eb64736f6c63430008130033
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.