lending_repay_obligation_liquidity_v2
Repays Kamino Lending liquidity borrowed by a vault-owned obligation.
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 |
|---|---|---|
| obligation | writable | External lending obligation account used by the instruction. |
| lending_market | read-only | Instruction-specific account supplied by the caller or SDK. |
| repay_reserve | writable | External reserve account used by the instruction. |
| reserve_liquidity_mint | read-only | Token mint account used by the instruction. |
| reserve_destination_liquidity | writable | External reserve account used by the instruction. |
| user_source_liquidity | writable | Instruction-specific account supplied by the caller or SDK. |
| instruction_sysvar_account | read-only | Instruction-specific account supplied by the caller or SDK. |
| obligation_farm_user_state | writable, optional | External lending obligation account used by the instruction. |
| reserve_farm_state | writable, optional | External reserve account used by the instruction. |
| lending_market_authority | read-only | Instruction-specific account supplied by the caller or SDK. |
Arguments
| Argument | Type | Notes |
|---|---|---|
| liquidity_amount | u64 | Liquidity amount to repay to Kamino, in the borrowed asset's smallest unit. |
Policy & permissions
- Enable
KaminoLendon the vault integration ACL. Protocol bitflag:0b00000001. - Delegate permission: Kamino Lending
Repay(0b0000000000010000).
TypeScript SDK usage
await glamClient.kaminoLending.repay(
market,
usdcMint,
new BN(200_000_000),
);Cross-instruction constraints
- Kamino user metadata and the relevant obligation accounts must exist before lending movement instructions run.