IStrategy
Author: Layr Labs, Inc.
Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service
Custom Strategy
implementations may expand extensively on this interface.
Functions
deposit
Used to deposit tokens into this Strategy
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.
Parameters
token
IERC20
is the ERC20 token being deposited
amount
uint256
is the amount of token being deposited
Returns
<none>
uint256
newShares is the number of new shares issued at the current exchange ratio.
withdraw
Used to withdraw tokens from this Strategy, to the recipient
's address
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.
Parameters
recipient
address
is the address to receive the withdrawn funds
token
IERC20
is the ERC20 token being transferred out
amountShares
uint256
is the amount of shares being withdrawn
sharesToUnderlying
Used to convert a number of shares to the equivalent amount of underlying tokens for this strategy.
In contrast to sharesToUnderlyingView
, this function may make state modifications
Implementation for these functions in particular may vary significantly for different strategies
Parameters
amountShares
uint256
is the amount of shares to calculate its conversion into the underlying token
Returns
<none>
uint256
The amount of underlying tokens corresponding to the input amountShares
underlyingToShares
Used to convert an amount of underlying tokens to the equivalent amount of shares in this strategy.
In contrast to underlyingToSharesView
, this function may make state modifications
Implementation for these functions in particular may vary significantly for different strategies
Parameters
amountUnderlying
uint256
is the amount of underlyingToken
to calculate its conversion into strategy shares
Returns
<none>
uint256
The amount of underlying tokens corresponding to the input amountShares
userUnderlying
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
shares
convenience function for fetching the current total shares of user
in this strategy, by querying the strategyManager
contract
sharesToUnderlyingView
Used to convert a number of shares to the equivalent amount of underlying tokens for this strategy.
In contrast to sharesToUnderlying
, this function guarantees no state modifications
Implementation for these functions in particular may vary significantly for different strategies
Parameters
amountShares
uint256
is the amount of shares to calculate its conversion into the underlying token
Returns
<none>
uint256
The amount of shares corresponding to the input amountUnderlying
underlyingToSharesView
Used to convert an amount of underlying tokens to the equivalent amount of shares in this strategy.
In contrast to underlyingToShares
, this function guarantees no state modifications
Implementation for these functions in particular may vary significantly for different strategies
Parameters
amountUnderlying
uint256
is the amount of underlyingToken
to calculate its conversion into strategy shares
Returns
<none>
uint256
The amount of shares corresponding to the input amountUnderlying
userUnderlyingView
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
underlyingToken
The underlying token for shares in this Strategy
totalShares
The total number of extant shares in this Strategy
explanation
Returns either a brief string explaining the strategy's goal & purpose, or a link to metadata that explains in more detail.
Last updated