Unstake

Unstake Ether from Stakewise V3 vaults

To withdraw your ether from the vault, you need to use the exit queue module.

1. Enter to the exit queue

function enterExitQueue(
  uint256 shares,
  address receiver
) external returns (uint256 positionTicket);

First you need to lock assets in the exit queue. The shares to assets rate will be locked at the moment of the call.

Parameters

Return Values

2. Claim assets

function claimExitedAssets(
  uint256 positionTicket,
  uint256 timestamp,
  uint256 exitQueueIndex
) external;

Claims assets that were withdrawn by the Vault. It can be called only after the enterExitQueue call by the receiver.

Parameters

Return Values

Smart contracts

v2 vaults(current)

v1 vaults(legacy)

Vaults exit requests

You can fetch current vault exit requests from the Stakewise Graph service.

GraphQL request example

query {
  exitRequests {
    id
    receiver
    positionTicket
    timestamp
    totalShares
    totalAssets
    withdrawalTimestamp
    owner
    vault {
      id
    }
  }
}

Return Values

withdrawalTimestamp values

  • null - request has not been processed yet

  • 0 - ether can be claimed from the vault

  • int - UTC Unix timestamp, the time when Ether will be available for claim.

Check detail in the Withdrawal timestamp calculation section

GraphQL response example

{
  "data": {
    "exitRequests": [
      {
        "id": "0xe2fb521979f6c5c1447d5ad4abcb9adc90d4b2f6-541921419113499690567",
        "receiver": "0x9e75255193289d641e893a28e3474f71200b05e6",
        "positionTicket": "541921419113499690567",
        "timestamp": "1726081176",
        "totalShares": "40315878434153532",
        "totalAssets": "0",
        "withdrawalTimestamp": "0",
        "owner": "0x9e75255193289d641e893a28e3474f71200b05e6",
        "vault": {
          "id": "0xe2fb521979f6c5c1447d5ad4abcb9adc90d4b2f6"
        }
      },
    ]
  }
}

Withdrawal timestamp calculation

The withdrawal timestamp is an estimated time when Ether can be claimed. It isn't taken from contracts directly but is periodically calculated by the StakeWise backend service.

Ether withdrawal is initially taken from the free ether in the vault:

  • Ether that is not yet locked in validators.

  • New deposits are first used to cover the exit queue, and then for registration of new validators.

If this ether is insufficient, ether withdrawal from active validators in the vault is initiated. The exit of validators is triggered by the Stakewise oracle network.

To calculate the time for ether to be withdrawn from validators:

  1. Fetch validators with status ACTIVE_EXITING or higher.

  2. Iterate through them until enough ether has been accumulated.

  3. Use validator's withdrawable epoch considering current network withdrawals queue length.

The vault may not have sufficient free funds, or there might be less than needed to initiate validator withdrawal. In such cases, use an average time based on rewards accumulation:

  • 10.5 days for Mainnet

  • One month for Holesky

In any case, there is a delay of 24 hours after entering the Exit Queue before claiming can occur.

Exit Request Withdrawal Timestamp Processing

  • New requests are processed after block finalization (approximately 15 minutes for Mainnet).

  • The queue is recalculated every hour as new deposits may speed up request processing.

SDK

The official Javascript SDK designed for effortless data retrieval from the StakeWise platform. This SDK provides a streamlined interface over GraphQL requests and contract interactions.

Check Exit requests sections

Last updated