Kamino Integration StagingStaging
vaults_withdraw
Withdraws shares or assets from a Kamino vault back to the GLAM vault.
Handler narrative
- Load the GLAM state or program account required by the instruction and verify the signer.
- Verify that the integration is enabled on the vault and that the caller has the required delegate permission or owner authority.
- Validate the instruction-specific policy, then invoke the external protocol with the vault authority where required.
Required conditions
- The submitted accounts must match the declared account list, signer requirements, writable requirements, fixed program addresses, and account relationships shown below.
- The GLAM state account is the source of truth for owner, enabled integrations, delegate permissions, policies, assets, borrowable assets, timelock settings, mint linkage, and pricing records.
- The vault account must be the PDA controlled by the core protocol program and derived conceptually from the state account; instructions use it as the vault authority for SOL, token accounts, and external positions.
- The vault integration ACL must enable this integration before the instruction is accepted; that enablement is defined on the GLAM state account.
- If the signer is not the owner, the delegate ACL on the GLAM state must contain the exact protocol permission required by this instruction; registering a delegate alone is insufficient.
- Instruction-specific destination accounts must satisfy the external protocol's own account model; GLAM validates the accounts it needs for authorization and policy enforcement, then passes the remaining protocol accounts through CPI.
Accounts
Uses the standard Big Seven account pattern, plus the instruction-specific accounts below.
| Account | Role | Description |
|---|---|---|
| withdraw_from_available_vault_state | writable | Vault or external protocol account used by the instruction. |
| withdraw_from_available_global_config | read-only | Instruction-specific account supplied by the caller or SDK. |
| withdraw_from_available_token_vault | writable | Vault or external protocol account used by the instruction. |
| withdraw_from_available_base_vault_authority | read-only | Vault or external protocol account used by the instruction. |
| withdraw_from_available_user_token_ata | writable | Token account read or written by the instruction. |
| withdraw_from_available_token_mint | writable | Token mint account used by the instruction. |
| withdraw_from_available_user_shares_ata | writable | Token account read or written by the instruction. |
| withdraw_from_available_shares_mint | writable | Token mint account used by the instruction. |
| withdraw_from_available_token_program | read-only | Instruction-specific account supplied by the caller or SDK. |
| withdraw_from_available_shares_token_program | read-only | Instruction-specific account supplied by the caller or SDK. |
| withdraw_from_available_klend_program | read-only | Instruction-specific account supplied by the caller or SDK. |
| withdraw_from_available_event_authority | read-only | Instruction-specific account supplied by the caller or SDK. |
| withdraw_from_available_program | read-only | Instruction-specific account supplied by the caller or SDK. |
| withdraw_from_reserve_vault_state | writable | Vault or external protocol account used by the instruction. |
| withdraw_from_reserve_reserve | writable | External reserve account used by the instruction. |
| withdraw_from_reserve_ctoken_vault | writable | Vault or external protocol account used by the instruction. |
| withdraw_from_reserve_lending_market | read-only | External reserve account used by the instruction. |
| withdraw_from_reserve_lending_market_authority | read-only | External reserve account used by the instruction. |
| withdraw_from_reserve_reserve_liquidity_supply | writable | External reserve account used by the instruction. |
| withdraw_from_reserve_reserve_collateral_mint | writable | Token mint account used by the instruction. |
| withdraw_from_reserve_reserve_collateral_token_program | read-only | External reserve account used by the instruction. |
| withdraw_from_reserve_instruction_sysvar_account | read-only | External reserve account used by the instruction. |
| event_authority | read-only | Instruction-specific account supplied by the caller or SDK. |
Arguments
| Argument | Type | Notes |
|---|---|---|
| shares_amount | u64 | Kamino vault share amount to burn or redeem. |
Policy & permissions
- Enable
KaminoVaultson the vault integration ACL. Protocol bitflag:0b00000010. - Delegate permission: Kamino Vaults
Withdraw(0b0000000000000010).
TypeScript SDK usage
await glamClient.kaminoVaults.withdraw(
kaminoVault,
new BN(500_000_000),
);Cross-instruction constraints
- The target Kamino vault must be allowed by the Kamino vaults policy before deposit or withdrawal.