init_obligation
Initialize a new obligation (user lending position) in a lending market.Signature
Parameters
Initialization arguments containing:
tag: u8- The obligation type tag (0-3)- 0: Default (no seed accounts)
- 1: Two mint seeds
- 2: Single mint seed (repeated)
- 3: Two mint seeds (same as 1)
id: u8- The obligation ID (must be 0 for current version)
Accounts
The owner of the obligation.
The account paying for initialization.
- Must be mutable
The obligation account to initialize.
- Seeds:
[[tag], [id], obligation_owner.key(), lending_market.key(), seed1_account.key(), seed2_account.key()] - Initialized by this instruction
The lending market this obligation belongs to.
First seed account (must be default pubkey for tag 0, mint for tags 1-3).
Second seed account (must be default pubkey for tag 0, mint for tags 1 and 3, same as seed1 for tag 2).
The owner’s user metadata account (for referrer tracking).
- Seeds:
["user_metadata", obligation_owner.key()]
Returns
ReturnsOk(()) on success.
Errors
InvalidObligationSeedsValue: Seed accounts don’t match the tag requirements- Standard Anchor errors if account validation fails
init_obligation_farms_for_reserve
Initialize farming state for an obligation on a specific reserve.Signature
Parameters
The farm type:
0: Collateral farming1: Debt farming
Accounts
The account paying for initialization.
- Must be mutable
The owner of the obligation.
The obligation.
- Must be mutable
- Must have the specified owner
PDA authority for the lending market.
The reserve.
- Must be mutable
The farm state account for the reserve.
- Must be mutable
- Must match the reserve’s stored farm for the specified mode
The obligation’s farm account (initialized via CPI).
- Must be mutable
The lending market.
The Kamino Farms program.
Returns
ReturnsOk(()) on success.
Errors
ReserveObsolete: Reserve is marked as obsoleteReserveDeprecated: Reserve version is outdatedNoFarmForReserve: Reserve doesn’t have a farm for the specified modeInvalidAccountInput: Farm state account doesn’t match reserve’s stored farm
refresh_obligation
Refresh an obligation’s state, recalculating borrowed and deposited values based on current reserve states.Signature
Parameters
None.Accounts
The lending market.
The obligation to refresh.
- Must be mutable
- Must belong to the lending market
Remaining Accounts
Provide accounts in this order:- All deposit reserve accounts (in order of obligation deposits)
- All borrow reserve accounts (in order of obligation borrows)
- If obligation has a referrer: referrer token state accounts for each borrow reserve
Returns
ReturnsOk(()) on success.
Errors
InvalidAccountInput: Wrong number or order of remaining accountsGlobalEmergencyMode: Emergency mode is enabled (via access control)
refresh_obligation_farms_for_reserve
Refresh the farming state for an obligation on a specific reserve.Signature
Parameters
The farm type:
0: Collateral farming1: Debt farming
Accounts
Any account (anyone can refresh farms).
The obligation account.
PDA authority for the lending market.
The reserve.
The farm state account for the reserve.
- Must be mutable
The obligation’s farm user state.
- Must be mutable
- Must have
delegateematching the obligation
The lending market.
The Kamino Farms program.
Returns
ReturnsOk(()) on success.
Errors
NoFarmForReserve: Reserve doesn’t have a farm for the specified modeInvalidAccountInput: Farm state or obligation farm doesn’t match expected valuesGlobalEmergencyMode: Emergency mode is enabled (via access control)