ILidoWithdrawalQueue
balanceOf
function balanceOf(address) external view returns (uint256)
ownerOf
function ownerOf(uint256 tokenId) external view returns (address owner)
_Returns the owner of the tokenId
token.
Requirements:
tokenId
must exist._
WithdrawalRequestStatus
output format struct for _getWithdrawalStatus()
method
struct WithdrawalRequestStatus {
uint256 amountOfStETH;
uint256 amountOfShares;
address owner;
uint256 timestamp;
bool isFinalized;
bool isClaimed;
}
getLastCheckpointIndex
function getLastCheckpointIndex() external view returns (uint256)
length of the checkpoint array. Last possible value for the hint. NB! checkpoints are indexed from 1, so it returns 0 if there is no checkpoints
requestWithdrawals
function requestWithdrawals(uint256[] _amounts, address _owner) external returns (uint256[] requestIds)
Request the batch of stETH for withdrawal. Approvals for the passed amounts should be done before.
Parameters
Name | Type | Description |
---|---|---|
_amounts | uint256 | an array of stETH amount values. The standalone withdrawal request will be created for each item in the passed list. |
_owner | address | address that will be able to manage the created requests. If address(0) is passed, msg.sender will be used as owner. |
Return Values
Name | Type | Description |
---|---|---|
requestIds | uint256 | an array of the created withdrawal request ids |
claimWithdrawal
function claimWithdrawal(uint256 _requestId) external
Claim one_requestId
request once finalized sending locked ether to the owner
use unbounded loop to find a hint, which can lead to OOG @dev Reverts if requestId or hint are not valid Reverts if request is not finalized or already claimed Reverts if msg sender is not an owner of request
Parameters
Name | Type | Description |
---|---|---|
_requestId | uint256 | request id to claim |
claimWithdrawals
function claimWithdrawals(uint256[] _requestIds, uint256[] _hints) external
Claim a batch of withdrawal requests if they are finalized sending locked ether to the owner
Parameters
Name | Type | Description |
---|---|---|
_requestIds | uint256 | array of request ids to claim |
_hints | uint256 | checkpoint hint for each id. Can be obtained with findCheckpointHints() @dev Reverts if requestIds and hints arrays length differs Reverts if any requestId or hint in arguments are not valid Reverts if any request is not finalized or already claimed Reverts if msg sender is not an owner of the requests |
getWithdrawalRequests
function getWithdrawalRequests(address _owner) external view returns (uint256[] requestsIds)
WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that this function has an unbounded cost, and using it as part of a state-changing function may render the function uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
findCheckpointHints
function findCheckpointHints(uint256[] _requestIds, uint256 _firstIndex, uint256 _lastIndex) external view returns (uint256[] hintIds)
Finds the list of hints for the given _requestIds
searching among the checkpoints with indices
in the range [_firstIndex, _lastIndex]
.
NB! Array of request ids should be sorted
NB! _firstIndex
should be greater than 0, because checkpoint list is 1-based array
Usage: findCheckpointHints(_requestIds, 1, getLastCheckpointIndex())
Parameters
Name | Type | Description |
---|---|---|
_requestIds | uint256 | ids of the requests sorted in the ascending order to get hints for |
_firstIndex | uint256 | left boundary of the search range. Should be greater than 0 |
_lastIndex | uint256 | right boundary of the search range. Should be less than or equal to getLastCheckpointIndex() |
Return Values
Name | Type | Description |
---|---|---|
hintIds | uint256 | array of hints used to find required checkpoint for the request |
getWithdrawalStatus
function getWithdrawalStatus(uint256[] _requestIds) external view returns (struct ILidoWithdrawalQueue.WithdrawalRequestStatus[] statuses)
Returns status for requests with provided ids
Parameters
Name | Type | Description |
---|---|---|
_requestIds | uint256 | array of withdrawal request ids |
MAX_STETH_WITHDRAWAL_AMOUNT
function MAX_STETH_WITHDRAWAL_AMOUNT() external view returns (uint256)
maximum amount of stETH that is possible to withdraw by a single request Prevents accumulating too much funds per single request fulfillment in the future.
To withdraw larger amounts, it's recommended to split it to several requests
MIN_STETH_WITHDRAWAL_AMOUNT
function MIN_STETH_WITHDRAWAL_AMOUNT() external view returns (uint256)
minimum amount of stETH that is possible to withdraw by a single request
finalize
function finalize(uint256 _lastRequestIdToBeFinalized, uint256 _maxShareRate) external payable
Finalize requests from last finalized one up to _lastRequestIdToBeFinalized
ether to finalize all the requests should be calculated using prefinalize()
and sent along