Withdraw

The withdraw_vault instruction completes a withdrawal by burning the escrowed LP tokens and transferring the underlying assets back to the user. This is the second step of the two-step withdrawal process.

triangle-exclamation

Discriminator

/// sha256("global:withdraw_vault")[0..8]
fn get_withdraw_vault_discriminator() -> [u8; 8] {
    [135, 7, 237, 120, 149, 94, 95, 7]
}

Parameters

This instruction takes no parameters beyond the discriminator.

Accounts

Account
Mutability
Signer
Description

user_transfer_authority

Mutable

Yes

The user finalizing the withdrawal

protocol

Immutable

No

Global Voltr protocol state account

vault

Mutable

No

The vault state account

vault_asset_mint

Immutable

No

The mint of the asset being withdrawn

vault_lp_mint

Mutable

No

The vault's LP mint

request_withdraw_lp_ata

Mutable

No

The receipt's ATA holding escrowed LP tokens (source for burn)

vault_asset_idle_ata

Mutable

No

The vault's idle asset token account (source for transfer)

vault_asset_idle_auth

Mutable

No

PDA authority over vault_asset_idle_ata

user_asset_ata

Mutable

No

The user's asset token account (destination)

request_withdraw_vault_receipt

Mutable

No

The PDA receipt account (closed after withdrawal)

asset_token_program

Immutable

No

Token Program or Token-2022 for assets

lp_token_program

Immutable

No

Token Program for LP tokens

system_program

Immutable

No

Solana System Program

CPI Struct

Implementation

circle-info

After a successful withdraw_vault call, the request_withdraw_vault_receipt account is closed and its rent is returned. The user can then create a new withdrawal request if needed.

Full reference implementation: withdraw_vault.rsarrow-up-right

Last updated