There are 2 main ways in which a staker can deposit new funds into EigenLayer -- depositing into an InvestmentStrategy through the InvestmentManager, and depositing "Beacon Chain ETH" (or proof thereof) through the EigenPodManager.
The InvestmentManger has two functions for depositing funds into InvestmentStrategy contracts -- depositIntoStrategy
and depositIntoStrategyOnBehalfOf
. In both cases, a specified amount
of an ERC20 token
is transferred from the caller to a specified InvestmentStrategy-type contract strategy
. New shares in the strategy are created according to the return value of strategy.deposit
; when calling depositIntoStrategy
these shares are credited to the caller, whereas when calling depositIntoStrategyOnBehalfOf
the new shares are credited to a specified staker
, who must have also signed off on the deposit (this enables more complex, contract-mediated deposits, while a signature is required to mitigate the possibility of griefing or dusting-type attacks).
We note as well that deposits cannot be made to a 'frozen' address, i.e. to the address of an operator who has been slashed or to a staker who is actively delegated to a slashed operator.
When performing a deposit through the InvestmentManager, the flow of calls between contracts looks like the following:
- The depositor makes the initial call to either
InvestmentManager.depositIntoStrategy
orInvestmentManager.depositIntoStrategyOnBehalfOf
- The InvestmentManager calls
Slasher.isFrozen
to verify that the recipient (either the caller or the specifiedstaker
input) is not 'frozen' on EigenLayer - The InvestmentManager calls the specified
token
contract, transferring specifiedamount
of tokens from the caller to the specifiedstrategy
- The InvestmentManager calls
strategy.deposit
, and then credits the returnedshares
value to the recipient - The InvestmentManager calls
EigenLayerDelegation.increaseDelegatedShares
to ensure that -- if the recipient has delegated to an operator -- the operator's delegated share amounts are updated appropriately
This section covers depositing new ETH into the Beacon Chain, with withdrawal credentials pointed to an EigenLayer-controlled contract (an EigenPod) and proving your deposit so it is credited in EigenLayer; this is a multi-step process. For more details on the EigenPods' design in general, see the EigenPods doc.
The initial deposit of ETH into the Beacon Chain is performed through the EigenPodManager:
- The depositor calls
EigenPodManager.stake
- The EigenPodManager deploys a new EigenPod for the caller – if they do not already have one – and then calls
EigenPod.stake
- The EigenPod deposits ETH into the Beacon Chain through the "ETH2 Deposit Contract". The deposited ETH was supplied as part of the initial call (1), which was passed along to the EigenPod by the EigenPodManager in its own call (2)
After depositing ETH, the depositor waits for the Beacon Chain state root to be updated through EigenLayer's BeaconChainOracle. After an update has been posted that reflects the EigenPod's increased Beacon Chain balance (resulting from the deposit above), then the depositor can call EigenPod.verifyWithdrawalCredentials
to initiate the following flow:
- The depositor calls EigenPod.verifyWithdrawalCredentials on the EigenPod deployed for them above
- The EigenPod gets the most recent Beacon Chain state root from the EigenPodManager by calling
EigenPodManager.getBeaconChainStateRoot
(the EigenPodManager further passes this query along to the BeaconChainOracle, prior to returning the most recently-posted state root). - The EigenPod calls
EigenPodManager.updateBeaconChainBalance
to update the EigenPodManager's accounting of EigenPod balances - The EigenPodManager fetches the Slasher's address from the InvestmentManager
- If the operator has been slashed on the Beacon Chain (and this is reflected in the latest BeaconChainOracle update), then the EigenPodManager calls
Slasher.freezeOperator
to freeze the staker - The EigenPod calls
EigenPodManager.depositBeaconChainETH
to trigger an update in EigenLayer which will reflect the staker's new beacon chain balance - The EigenPodManager forwards the information through a call to
InvestmentManager.depositBeaconChainETH
, which updates the staker's balance in the enshrined 'beaconChainETHStrategy' after... - The InvestmentManager makes a call to
Slasher.isFrozen
to verify that the depositor is not 'frozen' in EigenLayer