Skip to main content

WithdrawalVault

What is WithdrawalVault​

A simple contract that accumulates partial and full withdrawals that come from the Beacon Chain. Its address corresponds to the Lido withdrawal credentials (both 0x01 and 0x02 types). During the accounting oracle report, the vault is emptied by Lido into the internal buffer; see Lido contract docs for details.

The vault is recoverable, so the DAO can transfer any ERC-20 and ERC-721 tokens to the treasury.

WithdrawalVault submits execution-layer requests on behalf of the protocol:

The currently deployed version is upgradable because of anticipated Ethereum withdrawal mechanics changes.

View methods​

getContractVersion()​

Returns the current contract version.

function getContractVersion() returns (uint256)

Methods​

withdrawWithdrawals()​

Transfers the _amount of accumulated withdrawals to the Lido contract.

note

It can be called only by the Lido contract.

function withdrawWithdrawals(uint256 _amount)

recoverERC20()​

Transfers the given amount of the ERC20-token (defined by the provided token contract address) currently belonging to the vault contract address to the Lido treasury address.

Emits a ERC20Recovered event.

function recoverERC20(address _token, uint256 _amount) external

Parameters:​

NameTypeDescription
_tokenaddressERC20-compatible token
_amountuint256token amount to recover

recoverERC721()​

Transfers the given tokenId of the ERC721-compatible NFT (defined by the provided token contract address) currently belonging to the vault contract address to the Lido treasury address.

Emits an ERC721Recovered event.

function recoverERC721(address _token, uint256 _tokenId) external

Parameters:​

NameTypeDescription
_tokenaddressERC721-compatible token
_tokenIduint256minted token id

addWithdrawalRequests()​

Submits EIP-7002 full or partial withdrawal requests for the specified public keys. Each full withdrawal request instructs a validator to fully withdraw its stake and exit its duties as a validator. Each partial withdrawal request instructs a validator to withdraw a specified amount of ETH.

note

It can be called only by the TriggerableWithdrawalsGateway contract.

function addWithdrawalRequests(bytes[] pubkeys, uint64[] amounts) payable

Parameters:​

NameTypeDescription
pubkeysbytes[]48-byte public keys of validators requesting withdrawals
amountsuint64[]Amounts in gwei to be withdrawn for each corresponding public key: 0 for a full withdrawal, greater than 0 for a partial one
note

Reverts if the caller is not TriggerableWithdrawalsGateway, the public key array is empty or malformed, the arrays are of unequal length, or the provided total withdrawal fee value is invalid.

addConsolidationRequests()​

Submits EIP-7251 consolidation requests, one per (source, target) pair. Each request instructs a source validator to consolidate its stake into the target validator.

note

It can be called only by the ConsolidationGateway contract.

function addConsolidationRequests(bytes[] sourcePubkeys, bytes[] targetPubkeys) payable

Parameters:​

NameTypeDescription
sourcePubkeysbytes[]48-byte public keys of validators requesting the consolidation
targetPubkeysbytes[]48-byte public keys of validators receiving the consolidation
note

Reverts if the caller is not ConsolidationGateway, the public key arrays are empty or malformed, the arrays are of unequal length, or the provided total consolidation fee value is invalid.

getWithdrawalRequestFee​

Returns fee amount required per withdrawal request.

function getWithdrawalRequestFee() public view returns (uint256);

Returns:​

NameTypeDescription
withdrawalRequestFeeuint256Current withdrawal request fee.

getConsolidationRequestFee​

Returns fee amount required per consolidation request.

function getConsolidationRequestFee() external view returns (uint256);

Returns:​

NameTypeDescription
consolidationRequestFeeuint256Current consolidation request fee.