core staking contracts
WithdrawalPool Contract: Queued LST Withdrawals
The WithdrawalPool allows users to queue LST withdrawals if there is insufficient liquidity in the PriorityPool to satisfy the withdrawal amount. LST withdrawals will be added to a FIFO queue and will be fulfilled as the PriorityPool receives new deposits and/or as funds become available for withdrawal within the StakingPool.
View Functions
Section titled âView FunctionsâReturns the address of the token this pool handles
function token() external view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| token | address | address of token |
Returns the address of the liquid staking token this pool handles
function lst() external view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| lst | address | address of lst |
priorityPool
Section titled âpriorityPoolâReturns the address of the priority pool
function priorityPool() external view returns (address)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| priorityPool | address | address of Priority Pool |
indexOfNextWithdrawal
Section titled âindexOfNextWithdrawalâReturns the index of the withdrawal thatâs at the front of the queue
function indexOfNextWithdrawal() external view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| indexOfNextWithdrawal | uint256 | index of withdrawal at front of queue |
withdrawalBatchIdCutoff
Section titled âwithdrawalBatchIdCutoffâReturns the index where all batches before have had all withdrawal requests fully withdrawn
function withdrawalBatchIdCutoff() external view returns (uint128)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| withdrawalBatchIdCutoff | uint128 | batch id cutoff |
withdrawalIdCutoff
Section titled âwithdrawalIdCutoffâReturns the index where all requests before have been fully withdrawn
function withdrawalIdCutoff() external view returns (uint128)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| withdrawalIdCutoff | uint128 | withdrawal id cutoff |
minWithdrawalAmount
Section titled âminWithdrawalAmountâReturns the min amount of LSTs that can be queued for withdrawal
function minWithdrawalAmount() external view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| minWithdrawalAmount | uint256 | min withdrawal amount |
minTimeBetweenWithdrawals
Section titled âminTimeBetweenWithdrawalsâReturns the min amount of time between execution of withdrawals
function minTimeBetweenWithdrawals() external view returns (uint64)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| minTimeBetweenWithdrawals | uint64 | min time between withdrawals |
timeOfLastWithdrawal
Section titled âtimeOfLastWithdrawalâReturns the time of last execution of withdrawals
function timeOfLastWithdrawal() external view returns (uint64)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| timeOfLastWithdrawal | uint64 | time of last withdrawal |
getTotalQueuedWithdrawals
Section titled âgetTotalQueuedWithdrawalsâReturns the total amount of liquid staking tokens queued for withdrawal
function getTotalQueuedWithdrawals() external view returns (uint256)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| totalQueuedWithdrawals | uint256 | total amount queued for withdrawal |
getAccountTotalQueuedWithdrawals
Section titled âgetAccountTotalQueuedWithdrawalsâReturns the total amount of liquid staking tokens queued for withdrawal by an account
function getAccountTotalQueuedWithdrawals(address _account) external view returns (uint256)Parameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _account | address | address of account |
Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| accountTotalQueuedWithdrawals | uint256 | total amount queued across all withdrawals |
getWithdrawals
Section titled âgetWithdrawalsâReturns a list of withdrawals
function getWithdrawals(uint256[] _withdrawalIds) external view returns (struct WithdrawalPool.Withdrawal[])Parameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _withdrawalIds | uint256[] | list of withdrawal ids |
Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| withdrawals | struct WithdrawalPool.Withdrawal[] | list of withdrawals corresponding to withdrawal ids |
getBatchIds
Section titled âgetBatchIdsâReturns batch ids for a list of withdrawals
function getBatchIds(uint256[] _withdrawalIds) public view returns (uint256[])Parameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _withdrawalIds | uint256[] | list of withdrawal ids |
Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| batchIds | uint256[] | list of batch ids corresponding to withdrawal ids |
getWithdrawalIdsByOwner
Section titled âgetWithdrawalIdsByOwnerâReturns a list of withdrawal ids owned by an account
function getWithdrawalIdsByOwner(address _account) public view returns (uint256[])Parameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _account | address | address of account |
Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| withdrawalIds | uint256[] | list of withdrawal ids |
getFinalizedWithdrawalIdsByOwner
Section titled âgetFinalizedWithdrawalIdsByOwnerâReturns a list of finalized and partially finalized withdrawal ids owned by an account
These withdrawals have funds available for the owner to withdraw
function getFinalizedWithdrawalIdsByOwner(address _account) external view returns (uint256[], uint256)Parameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _account | address | address of account |
Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| withdrawalIds | uint256[] | list of withdrawal ids |
| withdrawable | uint256 | total withdrawable across all accountâs withdrawals |
checkUpkeep
Section titled âcheckUpkeepâReturns whether withdrawals should be executed based on available withdrawal space
function checkUpkeep(bytes) external view returns (bool, bytes)Return Values
Section titled âReturn Valuesâ| Name | Type | Description |
|---|---|---|
| upkeepNeeded | bool | true if withdrawal should be executed, false otherwise |
| bytes |
Write Functions
Section titled âWrite Functionsâwithdraw
Section titled âwithdrawâExecutes a group of fully and/or partially finalized withdrawals owned by the sender
function withdraw(uint256[] _withdrawalIds, uint256[] _batchIds) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _withdrawalIds | uint256[] | list of withdrawal ids to execute |
| _batchIds | uint256[] | list of batch ids corresponding to withdrawal ids |
forceWithdraw
Section titled âforceWithdrawâExecutes a group of fully finalized withdrawals (owner-only)
function forceWithdraw(uint256[] _withdrawalIds, uint256[] _batchIds) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _withdrawalIds | uint256[] | list of withdrawal ids to execute |
| _batchIds | uint256[] | list of batch ids corresponding to withdrawal ids |
queueWithdrawal
Section titled âqueueWithdrawalâQueues a withdrawal of liquid staking tokens for an account
function queueWithdrawal(address _account, uint256 _amount) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _account | address | address of account |
| _amount | uint256 | amount of LST |
deposit
Section titled âdepositâDeposits asset tokens in exchange for liquid staking tokens, finalizing withdrawals
starting from the front of the queue
function deposit(uint256 _amount) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _amount | uint256 | amount of tokens to deposit |
performUpkeep
Section titled âperformUpkeepâExecutes withdrawals if there is sufficient available withdrawal space
function performUpkeep(bytes _performData) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _performData | bytes | encoded list of withdrawal data passed to staking pool strategies |
updateWithdrawalBatchIdCutoff
Section titled âupdateWithdrawalBatchIdCutoffâUpdates the withdrawalBatchIdCutoff
This value is used to more efficiently return data in getBatchIds by skipping old withdrawal batches
function updateWithdrawalBatchIdCutoff() externalsetMinWithdrawalAmount
Section titled âsetMinWithdrawalAmountâSets the minimum amount of liquid staking tokens that can be queued for withdrawal
function setMinWithdrawalAmount(uint256 _minWithdrawalAmount) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _minWithdrawalAmount | uint256 | minimum token amount |
setMinTimeBetweenWithdrawals
Section titled âsetMinTimeBetweenWithdrawalsâSets the minimum amount of of time between calls to performUpkeep to finalize withdrawals
function setMinTimeBetweenWithdrawals(uint64 _minTimeBetweenWithdrawals) externalParameters
Section titled âParametersâ| Name | Type | Description |
|---|---|---|
| _minTimeBetweenWithdrawals | uint64 | minimum time |