IStrategyManager

Git Source

Author: Layr Labs, Inc.

Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service

See the StrategyManager contract itself for implementation details.

Functions

depositIntoStrategy

Deposits amount of token into the specified strategy, with the resultant shares credited to msg.sender

The msg.sender must have previously approved this contract to transfer at least amount of token on their behalf.

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(address strategy, address token, uint256 amount) external returns (uint256 shares);

Parameters

Name
Type
Description

strategy

address

is the specified strategy where deposit is to be made,

token

address

is the denomination in which the deposit is to be made,

amount

uint256

is the amount of token to be deposited in the strategy by the staker

Returns

Name
Type
Description

shares

uint256

The amount of new shares in the strategy created as part of the action.

depositIntoStrategyWithSignature

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.

The msg.sender must have previously approved this contract to transfer at least amount of token on their behalf.

A signature is required for this function to eliminate the possibility of griefing attacks, specifically those targeting stakers who may be attempting to undelegate.

Cannot be called on behalf of a staker that is 'frozen' (this function will revert if the staker 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 depositIntoStrategyWithSignature(
    IStrategy strategy,
    IERC20 token,
    uint256 amount,
    address staker,
    uint256 expiry,
    bytes memory signature
) external returns (uint256 shares);

Parameters

Name
Type
Description

strategy

IStrategy

is the specified strategy where deposit is to be made,

token

IERC20

is the denomination in which the deposit is to be made,

amount

uint256

is the amount of token to be deposited in the strategy by the staker

staker

address

the staker that the deposited assets will be credited to

expiry

uint256

the timestamp at which the signature expires

signature

bytes

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

Returns

Name
Type
Description

shares

uint256

The amount of new shares in the strategy created as part of the action.

removeShares

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;

addShares

Used by the DelegationManager to award a Staker some shares that have passed through the withdrawal queue

function addShares(address staker, IStrategy strategy, uint256 shares) external;

withdrawSharesAsTokens

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;

stakerStrategyShares

Returns the current shares of user in strategy

function stakerStrategyShares(address user, address strategy) external view returns (uint256 shares);

getDeposits

Get all details on the staker's deposits and corresponding shares

function getDeposits(address staker) external view returns (IStrategy[] memory, uint256[] memory);

Returns

Name
Type
Description

<none>

IStrategy[]

(staker's strategies, shares in these strategies)

<none>

uint256[]

stakerStrategyListLength

Simple getter function that returns stakerStrategyList[staker].length.

function stakerStrategyListLength(address staker) external view returns (uint256);

addStrategiesToDepositWhitelist

Owner-only function that adds the provided Strategies to the 'whitelist' of strategies that stakers can deposit into

function addStrategiesToDepositWhitelist(address[] calldata strategiesToWhitelist) external;

Parameters

Name
Type
Description

strategiesToWhitelist

address[]

Strategies that will be added to the strategyIsWhitelistedForDeposit mapping (if they aren't in it already)

removeStrategiesFromDepositWhitelist

Owner-only function that removes the provided Strategies from the 'whitelist' of strategies that stakers can deposit into

function removeStrategiesFromDepositWhitelist(IStrategy[] calldata strategiesToRemoveFromWhitelist) external;

Parameters

Name
Type
Description

strategiesToRemoveFromWhitelist

IStrategy[]

Strategies that will be removed to the strategyIsWhitelistedForDeposit mapping (if they are in it)

delegation

Returns the single, central Delegation contract of EigenLayer

function delegation() external view returns (IDelegationManager);

slasher

Returns the single, central Slasher contract of EigenLayer

function slasher() external view returns (ISlasher);

eigenPodManager

Returns the EigenPodManager contract of EigenLayer

function eigenPodManager() external view returns (IEigenPodManager);

migrateQueuedWithdrawal

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

calculateWithdrawalRoot

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

Events

Deposit

Emitted when a new deposit occurs on behalf of staker.

event Deposit(address staker, IERC20 token, IStrategy strategy, uint256 shares);

Parameters

Name
Type
Description

staker

address

Is the staker who is depositing funds into EigenLayer.

token

IERC20

Is the token that staker deposited.

strategy

IStrategy

Is the strategy that staker has deposited into.

shares

uint256

Is the number of new shares staker has been granted in strategy.

StrategyWhitelisterChanged

Emitted when the strategyWhitelister is changed

event StrategyWhitelisterChanged(address previousAddress, address newAddress);

StrategyAddedToDepositWhitelist

Emitted when a strategy is added to the approved list of strategies for deposit

event StrategyAddedToDepositWhitelist(IStrategy strategy);

StrategyRemovedFromDepositWhitelist

Emitted when a strategy is removed from the approved list of strategies for deposit

event StrategyRemovedFromDepositWhitelist(IStrategy strategy);

Structs

DeprecatedStruct_WithdrawerAndNonce

struct DeprecatedStruct_WithdrawerAndNonce {
    address withdrawer;
    uint96 nonce;
}

DeprecatedStruct_QueuedWithdrawal

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

Last updated