Instruction

InitLendingMarket

  • Description: Initializes a new lending market.
  • Tag: 0
  • Accounts
0. `[signer]` Init lending market authority
1. `[writable]` Lending market account - uninitialized.
2. `[]` Rent sysvar.
3. `[]` Token program id.
4. `[]` Pyth oracle program id.
5. `[]` Larix oracle program id.
6. `[]` Larix oracle id.
  • Parameters
/// Owner authority which can add new reserves
owner: Pubkey,
/// Currency market prices are quoted in
/// e.g. "USD" null padded (`*b"USD\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ 0\0\0\0\0\0\0\0\0"`) or a SPL token mint pubkey
quote_currency: [u8; 32],

SetLendingMarketOwner

  • Description: Sets the new owner of a lending market
  • Tag: 1
  • Accounts
0. `[writable]` Lending market account.
1. `[signer]` Current owner.
  • Parameters
/// The new owner
new_owner: Pubkey,

InitReserve

  • Description: Initializes a new lending market reserve
  • Tag: 2
  • Accounts
0. `[writable]` Reserve account - uninitialized.
1. `[]` Reserve liquidity SPL Token mint.
2. `[]` Reserve liquidity supply SPL Token account.
3. `[]` Reserve liquidity fee receiver.
4. `[]` Pyth product account when is_lp is false
Any account when is_lp is true
5. `[]` Reserve liquidity pyth oracle account when is_lp is
false; BridgePool account of bridge program when
is_lp is true
6. `[]` Reserve liquidity larix oracle account when
is_lp is false
LpPrice account of bridge program when is_lp is true
7. `[]` Reserve collateral SPL Token mint.
8. `[]` Reserve collateral token supply.
9 `[]` Lending market account.
10 `[signer]` Lending market owner.
11 `[]` Un_coll_supply_account
12 `[]` Clock sysvar.
13 `[]` Rent sysvar.
14 `[]` Token program id.
  • Parameters
/// Reserve configuration values
config: ReserveConfig,
total_mining_speed: u64,
kink_util_rate: u64,
use_pyth_oracle:bool,
is_lp:bool,

RefreshReserve

  • Description: Accrue interest and update market price of liquidity on a reserve.
  • Tag: 3
  • Accounts:
0. `[writable]` Reserve account.
1. `[]` Reserve liquidity oracle account.
Must be the Pyth price account specified at
InitReserve.
2. `[]` Larix oracle

DepositReserveLiquidity

  • Description: Deposit liquidity into a reserve in exchange for collateral. Collateral represents a share
  • Tag: 4
  • Accounts
0. `[writable]` Source liquidity token account.
$authority can transfer $liquidity_amount.
1. `[writable]` Destination collateral token account.
2. `[writable]` Reserve account.
3. `[writable]` Reserve collateral SPL Token mint.
4. `[writable]` Reserve liquidity supply SPL Token account.
5. `[]` Lending market account.
6. `[]` Derived lending market authority.
7. `[signer]` User transfer authority ($authority).
8. `[]` Token program id.
  • Parameters
/// Amount of liquidity to deposit in exchange for collateral tokens
liquidity_amount: u64,

RedeemReserveCollateral

  • Description: Redeem collateral from a reserve in exchange for liquidity.
  • Tag: 5
  • Accounts
0. `[writable]` Source collateral token account.
$authority can transfer $collateral_amount.
1. `[writable]` Destination liquidity token account.
2. `[writable]` Reserve account.
3. `[writable]` Reserve collateral SPL Token mint.
4. `[writable]` Reserve liquidity supply SPL Token account.
5. `[]` Lending market account.
6. `[]` Derived lending market authority.
7. `[signer]` User transfer authority ($authority).
8. `[]` Token program id.
  • Parameters
/// Amount of collateral tokens to redeem in exchange for liquidity
collateral_amount: u64,

InitObligation

  • Description: Initializes a new lending market obligation
  • Tag: 6
  • Accounts
0. `[writable]` Obligation account - uninitialized.
1. `[]` Lending market account.
2. `[signer]` Obligation owner.
3. `[]` Token program id.

RefreshObligation

  • Description: Refresh an obligation's accrued interest and collateral and liquidity prices. Requires refreshed reserves, as all obligation collateral deposit reserves in order, followed by all liquidity borrow reserves in order.
  • Tag: 7
  • Accounts
0. `[writable]` Obligation account.
1. `[]` Collateral deposit reserve accounts - refreshed, all, in order.
2. `[]` Liquidity borrow reserve accounts - refreshed, all, in order.

DepositObligationCollateral

  • Description: Deposit collateral to an obligation. Requires a refreshed reserve.
  • Tag: 8
  • Accounts
0. `[writable]` Source collateral token account.
Minted by deposit reserve collateral mint.
$authority can transfer $collateral_amount.
1. `[writable]` Destination deposit reserve collateral supply SPL Token account.
2. `[]` Deposit reserve account - refreshed.
3. `[writable]` Obligation account.
4. `[]` Lending market account.
5. `[]` Derived lending market authority.
6. `[signer]` Obligation owner.
7. `[signer]` User transfer authority ($authority).
8. `[]` Token program id.
  • Parameters
/// Amount of collateral tokens to deposit
collateral_amount: u64,

WithdrawObligationCollateral

  • Description: Withdraw collateral from an obligation. Requires a refreshed obligation and reserve.
  • Tag: 9
  • Accounts
0. `[writable]` Source withdraw reserve collateral supply SPL Token account.
1. `[writable]` Destination collateral token account.
Minted by withdraw reserve collateral mint.
2. `[]` Withdraw reserve account - refreshed.
3. `[writable]` Obligation account - refreshed.
4. `[]` Lending market account.
5. `[]` Derived lending market authority.
6. `[signer]` Obligation owner.
7. `[]` Token program id.
  • parameters
/// Amount of collateral tokens to withdraw - u64::MAX for up to 100% of deposited amount
collateral_amount: u64,

BorrowObligationLiquidity

  • Description: Borrow liquidity from a reserve by depositing collateral tokens; Requires a refreshed obligation and reserve.
  • Tag: 10
  • Accounts
::Useless
The current account will not be used.
It is used to make up the account number, in order to keep the size of the current instruction is equals to liquidate obligation instruction, to avoid the situation that the current transaction is successful but the liquidate cannot be performed.
0. `[writable]` Source borrow reserve liquidity supply SPL Token account.
1. `[writable]` Destination liquidity token account.
Minted by borrow reserve liquidity mint.
2. `[writable]` Borrow reserve account - refreshed.
3. `[writable]` Obligation account - refreshed.
4. `[]` Lending market account.
5. `[]` Derived lending market authority.
6. `[signer]` Obligation owner.
7. `[]` Token program id.
8. `[]` Larix oracle program account- Useless
9. `[]` Mine mint account - Useless
10.`[]` Mine supply account - Useless
  • Parameters
/// Amount of liquidity to borrow - u64::MAX for 100% of borrowing power
liquidity_amount: u64,

RepayObligationLiquidit

  • Description: Repay borrowed liquidity to a reserve; Requires a refreshed obligation and reserve.
  • Tag: 11
  • Accounts
0. `[writable]` Source liquidity token account.
Minted by repay reserve liquidity mint.
$authority can transfer $liquidity_amount.
1. `[writable]` Destination repay reserve liquidity supply SPL Token account.
2. `[writable]` Repay reserve account - refreshed.
3. `[writable]` Obligation account - refreshed.
4. `[]` Lending market account.
5. `[signer]` User transfer authority ($authority).
6. `[]` Token program id.
  • Parameters
/// Amount of liquidity to repay - u64::MAX for 100% of borrowed amount
liquidity_amount: u64,

LiquidateObligation

  • Description: Repay borrowed liquidity to a reserve to receive collateral at a discount from an unhealthy obligation; Requires a refreshed obligation and reserves.
  • Tag: 12
  • Accounts
0. `[writable]` Source liquidity token account.
Minted by repay reserve liquidity mint.
$authority can transfer $liquidity_amount.
1. `[writable]` Destination collateral token account.
Minted by withdraw reserve collateral mint.
2. `[writable]` Repay reserve account - refreshed.
3. `[writable]` Repay reserve liquidity supply SPL Token account.
4. `[]` Withdraw reserve account - refreshed.
5. `[writable]` Withdraw reserve collateral supply SPL Token account.
6. `[writable]` Obligation account - refreshed.
7. `[]` Lending market account.
8. `[]` Derived lending market authority.
9. `[signer]` User transfer authority ($authority).
10 `[]` Clock sysvar.
11 `[]` Token program id.
  • Parameters
/// Amount of liquidity to repay - u64::MAX for up to 100% of borrowed amount
liquidity_amount: u64,

FlashLoan

  • Description: Make a flash loan
  • Tag: 13
  • Accounts
0. `[writable]` Source liquidity token account.
Minted by reserve liquidity mint.
Must match the reserve liquidity supply.
1. `[writable]` Destination liquidity token account.
Minted by reserve liquidity mint.
2. `[writable]` Reserve account.
3. `[writable]` Flash loan fee receiver account.
Must match the reserve liquidity fee receiver.
4. `[writable]` Host fee receiver.
5. `[]` Lending market account.
6. `[]` Derived lending market authority.
7. `[]` Token program id.
8. `[]` Flash loan receiver program id.
Must implement an instruction that has tag of 0 and a signature
of `(amount: u64)`
This instruction must return the amount to the source liquidity account.
9. `[signer]` Flash loan authority
10. `[any]` Additional accounts expected by the receiving program's
`ReceiveFlashLoan` instruction.
The flash loan receiver program that is to be invoked should contain an
instruction with tag `0` and accept the total amount (including fee) that
needs to be returned back after its execution has completed.
Flash loan receiver should have an instruction with the following signature:
0. `[writable]` Source liquidity (matching the destination from above).
1. `[writable]` Destination liquidity (matching the source from above).
2. `[]` Token program id
3. `[any]` Additional accounts provided to the lending program's `FlashLoan`
instruction above
ReceiveFlashLoan {
// Amount that must be repaid by the receiver program
amount: u64
}
  • Parameters
/// The amount that is to be borrowed - u64::MAX for up to 100% of available liquidity
amount: u64,
call_back_data: Vec<u8>

SetConfig

  • Description: Set Configures
  • Tag: 14
  • Parameters
config_type:ConfigType

InitMining

  • Description: Initializes mining int he obligation account.
  • Tag: 16
  • Accounts
0. `[]` Mining account
1. `[signer]` Mining owner
2. `[]` Lending market account

DepositMining

  • Description: Deposits the mining benefits to the obligation account.
  • Tag: 18
  • Account
0. `[Writable]` Source account
1. `[Writable]` UnColl deposit supply SPL Token account.
2. `[Writable]` Mining account
3. `[]` Bonus account
4. `[]` Lending market account.
5. `[]` Derived lending market authority.
6. `[]` Mining owner.
7. `[signer]` User transfer authority ($authority).
8. `[]` Token program id.
  • Parameters
/// The amount of mining benefits
amount:u64

WithdrawMining

  • Description: Withdraws mining benefits.
  • Tag: 19
  • Account
0. `[writable]` Source account
1. `[writable]` UnColl deposit supply SPL Token account.
2. `[writable]` Mining account
3. `[writable]` Reserve account
4. `[]` Lending market account.
5. `[]` Derived lending market authority.
6. `[]` Mining owner.
7. `[]` Token program id.
  • Parameters
/// The amount of mining benefits
amount:u64

ClaimMiningMine

  • Description: Claims the owner of the mining benefits.
  • Tag: 20
  • Account
0. `[writable]` Mining account
1. `[]` Mine supply
2. `[]` Destination account
3. `[Signer]` Mining owner
4. `[]` Lending market info
5. `[]` Lending market authority
6. `[]` Token program id
7. `[]`
... Reserves

ClaimObligationMine

  • Description: Claims the obligation.
  • Tag: 21
  • Account
0. `[writable]` Obligation account
1. `[]` Mine supply
2. `[]` Destination account
3. `[Signer]` Mining owner
4. `[]` Lending market info
5. `[]` Lending market authority
6. `[]` Token program id
7. `[]`
... Deposit reserves
8. `[]`
... Borrow reserves

ClaimOwnerFee

  • Description: Claim owner's fee.
  • Tag: 22
  • Account
0. `[]` Source account (liquidity supply account)
1. `[]` Destination account receive owner fee
2. `[]` Lending market account
3. `[singer]` Lending market owner

ReceivePendingOwner

  • Description: Receive pending owner.
  • Tag: 23
  • Account
0. `[Write]` Lending Market
1. `[Signer]` Pending owner
RefreshReserves
  • Description: Refresh the current reserves
  • Tag: 24
  • Account
0. `[writable]` Reserve account.
1. `[]` Oracle account larix oracle or pyth price account .
LiquidateObligation2
  • Description: Repay borrowed liquidity to a reserve to receive collateral at a discount from an unhealthy obligation. Requires a refreshed obligation and reserves.
  • Tag: 25
  • Account
0. `[writable]` Source liquidity token account.
Minted by repay reserve liquidity mint.
$authority can transfer $liquidity_amount.
1. `[writable]` Destination collateral token account.
Minted by withdraw reserve collateral mint.
2. `[writable]` Repay reserve account - refreshed.
3. `[writable]` Repay reserve liquidity supply SPL Token account.
4. `[]` Withdraw reserve account - refreshed.
5. `[writable]` Withdraw reserve collateral supply SPL Token account.
6. `[writable]` Obligation account - refreshed.
7. `[]` Lending market account.
8. `[]` Derived lending market authority.
9. `[signer]` User transfer authority ($authority).
10 `[]` Token program id.
  • Parameters
/// Amount of liquidity to repay - u64::MAX for up to 100% of borrowed amount
liquidity_amount: u64,
Copy link
On this page