esp staking contracts
EspressoVault: ESP Validator Delegation Vault
EspressoVault manages deposits of ESP into an Espresso validator delegation contract.
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 |
vaultController
Section titled âvaultControllerâReturns the address of the strategy that controls this vault.
function vaultController() public view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| vaultController | address | Vault controller 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 |
validator
Section titled âvalidatorâReturns the address of the validator that this vault delegates to.
function validator() public view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| validator | address | Validator address |
getTotalDeposits
Section titled âgetTotalDepositsâReturns the total balance of this contract (principal, rewards, queued withdrawals, and tokens held).
function getTotalDeposits() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| totalDeposits | uint256 | Total balance |
getPrincipalDeposits
Section titled âgetPrincipalDepositsâReturns the principal balance of this contract in the validator pool.
function getPrincipalDeposits() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| principalDeposits | uint256 | Principal balance |
getRewards
Section titled âgetRewardsâReturns the claimable rewards balance of this contract in the validator pool.
function getRewards() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| rewards | uint256 | Claimable rewards |
getQueuedWithdrawals
Section titled âgetQueuedWithdrawalsâReturns the amount of queued withdrawals for this contract in the validator pool.
function getQueuedWithdrawals() public view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| queuedWithdrawals | uint256 | Queued withdrawals |
isWithdrawable
Section titled âisWithdrawableâReturns whether deposits can be withdrawn from the validator pool.
function isWithdrawable() external view returns (bool)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| withdrawable | bool | true if withdrawable, false otherwise |
isUnbonding
Section titled âisUnbondingâReturns whether this vault is currently unbonding.
function isUnbonding() external view returns (bool)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| unbonding | bool | true if unbonding, false otherwise |
isActive
Section titled âisActiveâReturns whether the validator this vault delegates to is active.
function isActive() external view returns (bool)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| active | bool | true if active, false otherwise |
exitIsWithdrawable
Section titled âexitIsWithdrawableâReturns whether deposits can be withdrawn from the pool for an inactive validator.
function exitIsWithdrawable() external view returns (bool)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| withdrawable | bool | true if withdrawable, false otherwise |
Write Functions
Section titled âWrite Functionsâdeposit
Section titled âdepositâDeposits tokens from the vault controller into the validator pool.
function deposit(uint256 _amount) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _amount | uint256 | Amount to deposit |
withdraw
Section titled âwithdrawâWithdraws tokens from the validator pool and sends them to the vault controller.
function withdraw() external returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| amount | uint256 | Amount withdrawn |
Queues tokens for withdrawal in the validator pool.
function unbond(uint256 _amount) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _amount | uint256 | Amount to unbond |
restakeRewards
Section titled ârestakeRewardsâRestakes rewards in the validator pool.
function restakeRewards(uint256 _lifetimeRewards, bytes calldata _authData) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _lifetimeRewards | uint256 | Total lifetime rewards for vault |
| _authData | bytes | Authorization data for claiming |
withdrawRewards
Section titled âwithdrawRewardsâClaims rewards from the validator pool and transfers them to the vault controller.
function withdrawRewards(uint256 _lifetimeRewards, bytes calldata _authData) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _lifetimeRewards | uint256 | Total lifetime rewards for vault |
| _authData | bytes | Authorization data for claiming |
updateLifetimeRewards
Section titled âupdateLifetimeRewardsâUpdates the lifetime rewards tracking for this vault. Used to sync lifetime rewards which is fetched off chain.
function updateLifetimeRewards(uint256 _lifetimeRewards) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _lifetimeRewards | uint256 | New lifetime rewards value |
claimValidatorExit
Section titled âclaimValidatorExitâWithdraws tokens from the validator pool when a validator has exited, and sends them to the vault controller.
function claimValidatorExit() external