Request Withdraw

The request_withdraw_vault instruction initiates a withdrawal by transferring the user's LP tokens into an escrow receipt account. This is the first step of the two-step withdrawal process.

circle-exclamation

Discriminator

/// sha256("global:request_withdraw_vault")[0..8]
fn get_request_withdraw_vault_discriminator() -> [u8; 8] {
    [248, 225, 47, 22, 116, 144, 23, 143]
}

Parameters

Parameter
Type
Description

amount

u64

The withdrawal amount (interpretation depends on is_amount_in_lp)

is_amount_in_lp

bool

If true, amount is in LP tokens. If false, amount is in underlying asset tokens

is_withdraw_all

bool

If true, withdraws the user's entire LP balance regardless of amount

Accounts

Account
Mutability
Signer
Description

payer

Mutable

Yes

Pays rent for the receipt account

user_transfer_authority

Immutable

Yes

The user requesting the withdrawal

protocol

Immutable

No

Global Voltr protocol state account

vault

Immutable

No

The vault to withdraw from

vault_lp_mint

Immutable

No

The vault's LP mint

user_lp_ata

Mutable

No

The user's LP token account (source)

request_withdraw_lp_ata

Mutable

No

The receipt's ATA to hold escrowed LP tokens

request_withdraw_vault_receipt

Mutable

No

PDA receipt account storing the request details

lp_token_program

Immutable

No

Token Program for LP tokens

system_program

Immutable

No

Solana System Program

CPI Struct

Implementation

circle-info

The request_withdraw_vault_receipt PDA is derived from seeds ["request_withdraw_vault_receipt", vault_key, user_key]. This means each user can have one active withdrawal request per vault at a time.

Full reference implementation: request_withdraw_vault.rsarrow-up-right

Last updated