esp staking contracts
EspressoFundFlowController: ESP Unbonding and Rewards
EspressoFundFlowController manages deposits and withdrawals for Espresso staking vaults, including unbonding, restaking, and reward management. It coordinates with the strategy and withdrawal pool contracts and exposes functions for vault and reward state queries.
View Functions
Section titled âView Functionsâstrategy
Section titled âstrategyâReturns the address of the staking strategy contract.
function strategy() public view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| strategy | address | Staking strategy address |
withdrawalPool
Section titled âwithdrawalPoolâReturns the address of the withdrawal pool contract.
function withdrawalPool() public view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| withdrawalPool | address | Withdrawal pool address |
depositController
Section titled âdepositControllerâReturns the address authorized to deposit queued tokens into vaults.
function depositController() public view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| depositController | address | Deposit controller address |
minTimeBetweenUnbonding
Section titled âminTimeBetweenUnbondingâReturns the minimum number of seconds between unbonding calls.
function minTimeBetweenUnbonding() public view returns (uint64)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| minTimeBetweenUnbonding | uint64 | Minimum seconds between unbonding |
timeOfLastUnbond
Section titled âtimeOfLastUnbondâReturns the time of the last unbonding call.
function timeOfLastUnbond() public view returns (uint64)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| timeOfLastUnbond | uint64 | Time of last unbonding |
shouldDepositQueuedTokens
Section titled âshouldDepositQueuedTokensâReturns whether tokens should be deposited and the amount available for deposit.
function shouldDepositQueuedTokens() external view returns (bool, uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| canDeposit | bool | true if deposit is allowed |
| amount | uint256 | Amount of tokens available to deposit |
shouldUnbondVaults
Section titled âshouldUnbondVaultsâReturns whether vaults should be unbonded.
function shouldUnbondVaults() external view returns (bool)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| shouldUnbond | bool | true if unbonding is needed |
shouldWithdrawVaults
Section titled âshouldWithdrawVaultsâReturns whether vaults are unbonded and ready to be withdrawn from, and the list of withdrawable vaults.
function shouldWithdrawVaults() external view returns (bool, uint256[] memory)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| canWithdraw | bool | true if withdrawal is possible |
| vaultIds | uint256[] | List of withdrawable vault IDs |
getVaultDeposits
Section titled âgetVaultDepositsâReturns a list of total deposits for all vaults.
function getVaultDeposits() external view returns (uint256[] memory)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| deposits | uint256[] | List of vault deposits |
getVaultRewards
Section titled âgetVaultRewardsâReturns a list of unclaimed rewards for all vaults.
function getVaultRewards() external view returns (uint256[] memory)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| rewards | uint256[] | List of vault rewards |
getUnbondingVaults
Section titled âgetUnbondingVaultsâReturns a list of currently unbonding vaults.
function getUnbondingVaults() external view returns (uint256[] memory)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| vaultIds | uint256[] | List of unbonding vaults |
getWithdrawableVaults
Section titled âgetWithdrawableVaultsâReturns a list of currently withdrawable vaults.
function getWithdrawableVaults() public view returns (uint256[] memory)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| vaultIds | uint256[] | List of withdrawable vaults |
getInactiveVaults
Section titled âgetInactiveVaultsâReturns a list of inactive vaults (validators that have exited).
function getInactiveVaults() public view returns (uint256[] memory)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| vaultIds | uint256[] | List of inactive vaults |
getInactiveWithdrawableVaults
Section titled âgetInactiveWithdrawableVaultsâReturns a list of inactive and currently withdrawable vaults.
function getInactiveWithdrawableVaults() public view returns (uint256[] memory)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| vaultIds | uint256[] | List of inactive withdrawable vaults |
Write Functions
Section titled âWrite Functionsâ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 |
unbondVaults
Section titled âunbondVaultsâUnbonds vaults if needed.
function unbondVaults() externalforceUnbondVaults
Section titled âforceUnbondVaultsâUnbonds vaults to rebalance deposits between vaults.
function forceUnbondVaults(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 |
withdrawVaults
Section titled âwithdrawVaultsâWithdraws from vaults and triggers withdrawal pool upkeep if needed.
function withdrawVaults(uint256[] calldata _vaultIds) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _vaultIds | uint256[] | List of vault IDs |
restakeRewards
Section titled ârestakeRewardsâRestakes vault rewards 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 vault rewards 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 |
setDepositController
Section titled âsetDepositControllerâSets the address authorized to deposit queued tokens.
function setDepositController(address _depositController) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _depositController | address | Deposit controller address |
setMinTimeBetweenUnbonding
Section titled âsetMinTimeBetweenUnbondingâSets the minimum time between unbonding calls.
function setMinTimeBetweenUnbonding(uint64 _minTimeBetweenUnbonding) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _minTimeBetweenUnbonding | uint64 | Minimum seconds between unbonding |