ILidoWithdrawalQueue

Git Source

Functions

balanceOf

function balanceOf(address) external view returns (uint256);

ownerOf

*Returns the owner of the tokenId token. Requirements:

  • tokenId must exist.*
function ownerOf(uint256 tokenId) external view returns (address owner);

getLastCheckpointIndex

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

function getLastCheckpointIndex() external view returns (uint256);

requestWithdrawals

Request the batch of stETH for withdrawal. Approvals for the passed amounts should be done before.

function requestWithdrawals(uint256[] calldata _amounts, address _owner)
    external
    returns (uint256[] memory requestIds);

Parameters

NameTypeDescription
_amountsuint256[]an array of stETH amount values. The standalone withdrawal request will be created for each item in the passed list.
_owneraddressaddress that will be able to manage the created requests. If address(0) is passed, msg.sender will be used as owner.

Returns

NameTypeDescription
requestIdsuint256[]an array of the created withdrawal request ids

claimWithdrawal

Claim one_requestId request once finalized sending locked ether to the owner

use unbounded loop to find a hint, which can lead to OOG

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*

function claimWithdrawal(uint256 _requestId) external;

Parameters

NameTypeDescription
_requestIduint256request id to claim

claimWithdrawals

Claim a batch of withdrawal requests if they are finalized sending locked ether to the owner

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*

function claimWithdrawals(uint256[] calldata _requestIds, uint256[] calldata _hints) external;

Parameters

NameTypeDescription
_requestIdsuint256[]array of request ids to claim
_hintsuint256[]checkpoint hint for each id. Can be obtained with findCheckpointHints()

getWithdrawalRequests

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.

function getWithdrawalRequests(address _owner) external view returns (uint256[] memory requestsIds);

findCheckpointHints

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())

function findCheckpointHints(uint256[] calldata _requestIds, uint256 _firstIndex, uint256 _lastIndex)
    external
    view
    returns (uint256[] memory hintIds);

Parameters

NameTypeDescription
_requestIdsuint256[]ids of the requests sorted in the ascending order to get hints for
_firstIndexuint256left boundary of the search range. Should be greater than 0
_lastIndexuint256right boundary of the search range. Should be less than or equal to getLastCheckpointIndex()

Returns

NameTypeDescription
hintIdsuint256[]array of hints used to find required checkpoint for the request

getWithdrawalStatus

Returns status for requests with provided ids

function getWithdrawalStatus(uint256[] calldata _requestIds)
    external
    view
    returns (WithdrawalRequestStatus[] memory statuses);

Parameters

NameTypeDescription
_requestIdsuint256[]array of withdrawal request ids

MAX_STETH_WITHDRAWAL_AMOUNT

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

function MAX_STETH_WITHDRAWAL_AMOUNT() external view returns (uint256);

MIN_STETH_WITHDRAWAL_AMOUNT

minimum amount of stETH that is possible to withdraw by a single request

function MIN_STETH_WITHDRAWAL_AMOUNT() external view returns (uint256);

finalize

Finalize requests from last finalized one up to _lastRequestIdToBeFinalized

ether to finalize all the requests should be calculated using prefinalize() and sent along

function finalize(uint256 _lastRequestIdToBeFinalized, uint256 _maxShareRate) external payable;

Structs

WithdrawalRequestStatus

output format struct for _getWithdrawalStatus() method

struct WithdrawalRequestStatus {
    uint256 amountOfStETH;
    uint256 amountOfShares;
    address owner;
    uint256 timestamp;
    bool isFinalized;
    bool isClaimed;
}