GLAMIDL Reference

lending_withdraw_obligation_collateral_and_redeem_reserve_collateral_v2

Withdraws Kamino obligation collateral and redeems it back to reserve liquidity for the vault.

Required conditions

  • 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

AccountRoleDescription
glam_statewritableGLAM state account that stores vault configuration, integration ACLs, delegate permissions, policies, assets, mint linkage, and pricing records.
glam_vaultwritableVault PDA associated with the GLAM state and used as the vault authority.
glam_signersigner, writableCalling authority or fee payer.
integration_authorityread-onlyProgram-derived authority used by the integration for downstream invocation.
cpi_programread-onlyDownstream program invoked by this instruction.
glam_protocol_programread-onlyGLAM Protocol program account used for authorization or CPI.
system_programread-onlySolana System Program.
obligationwritableKamino lending obligation account.
lending_marketread-onlyKamino lending market account for the reserves and obligations touched by this instruction.
lending_market_authorityread-onlyKamino market authority PDA that authorizes reserve and obligation operations.
withdraw_reservewritableKamino reserve account.
reserve_liquidity_mintread-onlyToken mint account used or validated by this instruction.
reserve_source_collateralwritableKamino reserve account.
reserve_collateral_mintwritableToken mint account used or validated by this instruction.
reserve_liquidity_supplywritableKamino reserve account.
user_destination_liquiditywritableVault-owned token account that receives liquidity borrowed or withdrawn from Kamino.
placeholder_user_destination_collateraloptionalOptional collateral destination placeholder required by Kamino account ordering when collateral is not received.
collateral_token_programread-onlyToken program account.
liquidity_token_programread-onlyToken program account.
instruction_sysvar_accountread-onlySolana sysvar account.
obligation_farm_user_statewritable, optionalKamino lending obligation account.
reserve_farm_statewritable, optionalKamino reserve account.
farms_programread-onlyKamino farm account.

Arguments

ArgumentTypeNotes
collateral_amountu64

Policy & permissions

  • Enable KaminoLend on the vault integration ACL.
  • Delegate permission: Kamino Lending Withdraw.

TypeScript SDK usage

await glamClient.kaminoLending.withdraw(
  market,
  usdcMint,
  new BN(500_000_000),
);

Cross-instruction constraints

  • Kamino user metadata and the relevant obligation accounts must exist before lending movement instructions run.