esp staking contracts
EspressoStrategy: ESP Liquid Staking Strategy
EspressoStrategy is a staking strategy that manages multiple EspressoVault contracts by tracking the balance of each and moving tokens in and out of them.
View Functions
Section titled âView FunctionsâReturns the address of the staking token (ESP).
function token() public view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| token | address | ESP token address |
stakingPool
Section titled âstakingPoolâReturns the address of the staking pool that controls this strategy.
function stakingPool() public view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| stakingPool | address | Staking pool address |
espressoStaking
Section titled âespressoStakingâReturns the address of the Espresso delegation contract.
function espressoStaking() public view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| espressoStaking | address | Espresso delegation contract address |
espressoRewards
Section titled âespressoRewardsâReturns the address of the Espresso rewards contract.
function espressoRewards() public view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| espressoRewards | address | Espresso rewards contract address |
fundFlowController
Section titled âfundFlowControllerâReturns the address of the fund flow controller contract.
function fundFlowController() public view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| fundFlowController | address | Fund flow controller address |
rewardsOracle
Section titled ârewardsOracleâReturns the address of the rewards oracle.
function rewardsOracle() public view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| rewardsOracle | address | Rewards oracle address |
maxRewardChangeBPS
Section titled âmaxRewardChangeBPSâReturns the max reward change allowed per update in basis points.
function maxRewardChangeBPS() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| maxRewardChangeBPS | uint256 | Max reward change per update (bps) |
vaultImplementation
Section titled âvaultImplementationâReturns the address of the vault implementation contract.
function vaultImplementation() public view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| vaultImplementation | address | Vault implementation address |
totalQueued
Section titled âtotalQueuedâReturns the total number of tokens queued for deposit into vaults.
function totalQueued() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| totalQueued | uint256 | Total queued tokens |
numVaultsUnbonding
Section titled ânumVaultsUnbondingâReturns the total number of vaults currently unbonding.
function numVaultsUnbonding() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| numVaultsUnbonding | uint256 | Number of vaults unbonding |
vaultWithdrawalIndex
Section titled âvaultWithdrawalIndexâReturns the index of vault to withdraw from on next withdrawal.
function vaultWithdrawalIndex() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| vaultWithdrawalIndex | uint256 | Vault withdrawal index |
canDeposit
Section titled âcanDepositâReturns the available deposit room for this strategy.
function canDeposit() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| canDeposit | uint256 | Available deposit room |
canWithdraw
Section titled âcanWithdrawâReturns the available withdrawal room for this strategy.
function canWithdraw() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| canWithdraw | uint256 | Available withdrawal room |
getTotalDeposits
Section titled âgetTotalDepositsâReturns the total amount of deposits in this strategy.
function getTotalDeposits() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| totalDeposits | uint256 | Total deposits |
getMaxDeposits
Section titled âgetMaxDepositsâReturns the maximum that can be deposited into this strategy.
function getMaxDeposits() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| maxDeposits | uint256 | Maximum deposits |
getMinDeposits
Section titled âgetMinDepositsâReturns the minimum that must remain in this strategy.
function getMinDeposits() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| minDeposits | uint256 | Minimum deposits |
getVaults
Section titled âgetVaultsâReturns a list of all vaults controlled by this contract.
function getVaults() external view returns (IEspressoVault[] memory)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| vaults | IEspressoVault[] | List of vaults |
getDepositChange
Section titled âgetDepositChangeâReturns the deposit change since deposits were last updated.
function getDepositChange() public view returns (int)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| depositChange | int | Change in total deposits |
getFees
Section titled âgetFeesâReturns a list of all fees and fee receivers.
function getFees() external view returns (Fee[] memory)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| fees | Fee[] | List of fees |
Write Functions
Section titled âWrite Functionsâdeposit
Section titled âdepositâDeposits tokens from the staking pool into this strategy.
function deposit(uint256 _amount, bytes calldata) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _amount | uint256 | Amount to deposit |
withdraw
Section titled âwithdrawâWithdraws tokens from this strategy and sends them to staking pool.
function withdraw(uint256 _amount, bytes calldata) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _amount | uint256 | Amount to withdraw |
depositQueuedTokens
Section titled âdepositQueuedTokensâDeposits queued tokens into vaults.
function depositQueuedTokens(uint256[] calldata _vaultIds, uint256[] calldata _amounts) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaultIds | uint256[] | List of vault IDs |
| _amounts | uint256[] | Amounts to deposit per vault |
Unbonds token deposits in vaults.
function unbond(uint256 _toUnbond) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _toUnbond | uint256 | Amount to unbond |
forceUnbond
Section titled âforceUnbondâUnbonds token deposits in vaults (used to rebalance between vaults).
function forceUnbond(uint256[] calldata _vaultIds, uint256[] calldata _amounts) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaultIds | uint256[] | List of vault IDs |
| _amounts | uint256[] | Amounts to unbond per vault |
claimUnbond
Section titled âclaimUnbondâClaims and withdraws tokens from vaults that are unbonded.
function claimUnbond(uint256[] calldata _vaultIds) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaultIds | uint256[] | List of vault IDs |
updateDeposits
Section titled âupdateDepositsâUpdates deposit accounting and calculates fees on newly earned rewards.
function updateDeposits(bytes calldata) external returns (int256 depositChange, address[] memory receivers, uint256[] memory amounts)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| depositChange | int256 | Change in deposits since last update |
| receivers | address[] | List of fee receivers |
| amounts | uint256[] | List of fee amounts |
restakeRewards
Section titled ârestakeRewardsâRestakes rewards in the Espresso staking contract for given vaults.
function restakeRewards(uint256[] calldata _vaultIds, uint256[] calldata _lifetimeRewards, bytes[] calldata _authData) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaultIds | uint256[] | List of vault IDs |
| _lifetimeRewards | uint256[] | Lifetime rewards values for each vault |
| _authData | bytes[] | Authorization data for each vault |
withdrawRewards
Section titled âwithdrawRewardsâWithdraws rewards from the Espresso staking contract for given vaults.
function withdrawRewards(uint256[] calldata _vaultIds, uint256[] calldata _lifetimeRewards, bytes[] calldata _authData) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaultIds | uint256[] | List of vault IDs |
| _lifetimeRewards | uint256[] | Lifetime rewards values for each vault |
| _authData | bytes[] | Authorization data for each vault |
updateLifetimeRewards
Section titled âupdateLifetimeRewardsâUpdates lifetime rewards tracking for specified vaults. Used to sync lifetime rewards which is fetched off chain.
function updateLifetimeRewards(uint256[] calldata _vaultIds, uint256[] calldata _lifetimeRewards) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaultIds | uint256[] | List of vault IDs |
| _lifetimeRewards | uint256[] | Lifetime rewards values for each vault |
claimValidatorExits
Section titled âclaimValidatorExitsâClaims validator exits for specified vaults.
function claimValidatorExits(uint256[] calldata _vaultIds) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaultIds | uint256[] | List of vault IDs |
addVault
Section titled âaddVaultâAdds a new vault for a validator.
function addVault(address _validator) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _validator | address | Validator address |
removeVaults
Section titled âremoveVaultsâRemoves vaults. Withdraws any remaining principal deposits so vault must be empty or any unbonding periods must have elapsed for remaining deposits. Will not claim rewards so rewards must be claimed before removing a vault.
function removeVaults(uint256[] calldata _vaultIdxs) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaultIdxs | uint256[] | List of vault indices (must be ascending order) |
upgradeVaults
Section titled âupgradeVaultsâUpgrades vaults to a new implementation contract.
function upgradeVaults(address[] calldata _vaults, bytes[] memory _data) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaults | address[] | List of vault addresses |
| _data | bytes[] | Encoded function calls per vault |
Adds a new fee.
function addFee(address _receiver, uint256 _feeBasisPoints) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _receiver | address | Fee receiver address |
| _feeBasisPoints | uint256 | Fee in basis points |
updateFee
Section titled âupdateFeeâUpdates an existing fee. Set _feeBasisPoints to 0 to remove the fee.
function updateFee(uint256 _index, address _receiver, uint256 _feeBasisPoints) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _index | uint256 | Fee index |
| _receiver | address | Fee receiver address |
| _feeBasisPoints | uint256 | Fee in basis points |
setVaultImplementation
Section titled âsetVaultImplementationâSets a new vault implementation contract to be used when deploying/upgrading vaults.
function setVaultImplementation(address _vaultImplementation) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaultImplementation | address | Vault implementation address |
setFundFlowController
Section titled âsetFundFlowControllerâSets the fund flow controller.
function setFundFlowController(address _fundFlowController) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _fundFlowController | address | Fund flow controller address |
setRewardsOracle
Section titled âsetRewardsOracleâSets the rewards oracle.
function setRewardsOracle(address _rewardsOracle) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _rewardsOracle | address | Rewards oracle address |
setMaxRewardChangeBPS
Section titled âsetMaxRewardChangeBPSâSets the max reward change allowed per update in basis points.
function setMaxRewardChangeBPS(uint256 _maxRewardChangeBPS) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _maxRewardChangeBPS | uint256 | Max reward change per update (bps) |