deposit_reserve_liquidity
Deposit liquidity tokens into a reserve and receive collateral tokens (cTokens) in return.Signature
Parameters
The amount of liquidity to deposit (in token native units).
Accounts
The owner of the source liquidity tokens.
The reserve to deposit into.
- Must be mutable
The lending market.
PDA authority for the lending market.
The reserve’s liquidity token mint.
The reserve’s liquidity supply vault.
- Must be mutable
The reserve’s collateral token mint.
- Must be mutable
The user’s source liquidity token account.
- Must be mutable
The user’s destination collateral token account.
- Must be mutable
The SPL Token program (for collateral).
The token program for liquidity (SPL Token or Token-2022).
The Solana instructions sysvar.
Returns
ReturnsOk(()) on success.
Errors
GlobalEmergencyMode: Emergency mode is enabled (via access control)WithdrawTooSmall: Deposit amount is too smallDepositLimitExceeded: Deposit would exceed reserve’s deposit limit
deposit_reserve_liquidity_and_obligation_collateral
Deposit liquidity into a reserve and immediately add the collateral to an obligation in a single transaction.Signature
Use the v2 variant which includes farming support. The v1 variant is deprecated.
Parameters
The amount of liquidity to deposit.
Accounts
The owner of the obligation and source liquidity.
- Must be mutable
The obligation to add collateral to.
- Must be mutable
- Must have the specified owner
The lending market.
PDA authority for the lending market.
The reserve.
- Must be mutable
The reserve’s liquidity token mint.
The reserve’s liquidity supply vault.
- Must be mutable
The reserve’s collateral token mint.
- Must be mutable
The reserve’s collateral supply vault.
- Must be mutable
The user’s source liquidity token account.
- Must be mutable
Optional farming accounts (v2 only).
The Kamino Farms program (v2 only).
Returns
ReturnsOk(()) on success.
Errors
GlobalEmergencyMode: Emergency mode is enabledObligationReserveLimit: Obligation has too many different collateral typesIsolatedAssetTierViolation: Collateral violates isolated asset rules
borrow_obligation_liquidity
Borrow liquidity from a reserve against an obligation’s collateral.Signature
Use the v2 variant which includes farming support. The v1 variant is deprecated.
Parameters
The amount of liquidity to borrow. Use
u64::MAX to borrow the maximum available.Accounts
The owner of the obligation.
The obligation.
- Must be mutable
- Must have the specified owner
The lending market.
PDA authority for the lending market.
The reserve to borrow from.
- Must be mutable
The borrow reserve’s liquidity token mint.
The reserve’s liquidity supply vault.
- Must be mutable
The reserve’s fee receiver vault.
- Must be mutable
The user’s destination liquidity token account.
- Must be mutable
- Must have owner as authority
Optional referrer token state (required if obligation has a referrer).
- Must be mutable
The token program.
Optional farming accounts (v2 only).
The Kamino Farms program (v2 only).
Remaining Accounts
All deposit reserves for the obligation (to calculate collateral value).Returns
ReturnsOk(()) on success.
Errors
GlobalEmergencyMode: Emergency mode is enabledBorrowTooSmall: Borrow amount is too smallBorrowTooLarge: Insufficient collateral for borrowInsufficientLiquidity: Reserve doesn’t have enough liquidityBorrowingDisabled: Borrowing is disabled globally or for this reserveReferrerAccountMissing: Obligation has referrer but no referrer account provided
repay_obligation_liquidity
Repay borrowed liquidity for an obligation.Signature
Use the v2 variant which includes farming support. The v1 variant is deprecated.
Parameters
The amount of liquidity to repay. Use
u64::MAX to repay all.Accounts
The owner of the obligation (or anyone repaying on their behalf).
The obligation.
- Must be mutable
The lending market.
The reserve to repay.
- Must be mutable
The reserve’s liquidity token mint.
The reserve’s liquidity supply vault.
- Must be mutable
The user’s source liquidity token account.
- Must be mutable
The token program.
Optional farming accounts (v2 only).
PDA authority (v2 only).
The Kamino Farms program (v2 only).
Remaining Accounts
All deposit reserves for the obligation (to update health factor).Returns
ReturnsOk(()) on success.
Errors
RepayTooSmall: Repay amount is too smallTransactionIncludesRestrictedPrograms: Transaction contains restricted programs
flash_borrow_reserve_liquidity
Borrow liquidity from a reserve with a flash loan. Must be repaid in the same transaction withflash_repay_reserve_liquidity.
Signature
Parameters
The amount of liquidity to flash borrow.
Accounts
The authority for the user’s token account.
PDA authority for the lending market.
The lending market.
The reserve to borrow from.
- Must be mutable
The reserve’s liquidity token mint.
The reserve’s liquidity supply vault.
- Must be mutable
The user’s destination liquidity token account.
- Must be mutable
The reserve’s fee receiver vault.
- Must be mutable
Optional referrer token state.
- Must be mutable
The Solana instructions sysvar.
Returns
ReturnsOk(()) on success.
Errors
GlobalEmergencyMode: Emergency mode is enabledFlashLoansDisabled: Flash loans are disabled for this reserveFlashBorrowCpi: Flash borrows cannot be called via CPIMultipleFlashBorrows: Multiple flash borrows in same transaction
flash_repay_reserve_liquidity
Repay a flash loan borrowed withflash_borrow_reserve_liquidity.
Signature
Parameters
The amount originally borrowed (fees are added automatically).
The index in the transaction of the corresponding
flash_borrow_reserve_liquidity instruction.Accounts
The authority for the user’s token account.
PDA authority for the lending market.
The lending market.
The reserve.
- Must be mutable
The reserve’s liquidity token mint.
The reserve’s liquidity supply vault.
- Must be mutable
The user’s source liquidity token account.
- Must be mutable
The reserve’s fee receiver vault.
- Must be mutable
Optional referrer token state.
- Must be mutable
The Solana instructions sysvar.
Returns
ReturnsOk(()) on success.
Errors
GlobalEmergencyMode: Emergency mode is enabledNoFlashRepayFound: No matching flash borrow foundInvalidFlashRepay: Repay doesn’t match borrowFlashRepayCpi: Flash repays cannot be called via CPI