GLAMIDL Reference

lending_liquidate_obligation_and_redeem_reserve_collateral_v2

Liquidates a Kamino obligation and redeems reserve collateral through the GLAM integration.

Handler narrative

  1. Load the GLAM state or program account required by the instruction and verify the signer.
  2. Verify that the integration is enabled on the vault and that the caller has the required delegate permission or owner authority.
  3. 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.

AccountRoleDescription
obligationwritableExternal lending obligation account used by the instruction.
lending_marketread-onlyInstruction-specific account supplied by the caller or SDK.
lending_market_authorityread-onlyInstruction-specific account supplied by the caller or SDK.
repay_reservewritableExternal reserve account used by the instruction.
repay_reserve_liquidity_mintread-onlyToken mint account used by the instruction.
repay_reserve_liquidity_supplywritableExternal reserve account used by the instruction.
withdraw_reservewritableExternal reserve account used by the instruction.
withdraw_reserve_liquidity_mintread-onlyToken mint account used by the instruction.
withdraw_reserve_collateral_mintwritableToken mint account used by the instruction.
withdraw_reserve_collateral_supplywritableExternal reserve account used by the instruction.
withdraw_reserve_liquidity_supplywritableExternal reserve account used by the instruction.
withdraw_reserve_liquidity_fee_receiverwritableExternal reserve account used by the instruction.
user_source_liquiditywritableInstruction-specific account supplied by the caller or SDK.
user_destination_collateralwritableInstruction-specific account supplied by the caller or SDK.
user_destination_liquiditywritableInstruction-specific account supplied by the caller or SDK.
collateral_token_programread-onlyInstruction-specific account supplied by the caller or SDK.
repay_liquidity_token_programread-onlyInstruction-specific account supplied by the caller or SDK.
withdraw_liquidity_token_programread-onlyInstruction-specific account supplied by the caller or SDK.
instruction_sysvar_accountread-onlyInstruction-specific account supplied by the caller or SDK.
collateral_obligation_farm_user_statewritable, optionalExternal lending obligation account used by the instruction.
collateral_reserve_farm_statewritable, optionalExternal reserve account used by the instruction.
debt_obligation_farm_user_statewritable, optionalExternal lending obligation account used by the instruction.
debt_reserve_farm_statewritable, optionalExternal reserve account used by the instruction.

Arguments

ArgumentTypeNotes
liquidity_amountu64Repayment liquidity amount used for the liquidation flow.
min_acceptable_received_liquidity_amountu64Minimum liquidity amount the vault must receive after redeeming collateral.
max_allowed_ltv_override_percentu64Optional LTV override ceiling accepted for the liquidation path.

Policy & permissions

  • Enable KaminoLend on the vault integration ACL. Protocol bitflag: 0b00000001.
  • Caller must be the owner or a delegate with the explicit protocol permission required by this instruction.

Cross-instruction constraints

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