Enum port_variable_rate_lending_instructions::instruction::LendingInstruction[][src]

pub enum LendingInstruction {
    RefreshReserve,
    DepositReserveLiquidity {
        liquidity_amount: u64,
    },
    RedeemReserveCollateral {
        collateral_amount: u64,
    },
    InitObligation,
    RefreshObligation,
    DepositObligationCollateral {
        collateral_amount: u64,
    },
    WithdrawObligationCollateral {
        collateral_amount: u64,
    },
    BorrowObligationLiquidity {
        liquidity_amount: u64,
    },
    RepayObligationLiquidity {
        liquidity_amount: u64,
    },
    LiquidateObligation {
        liquidity_amount: u64,
    },
    FlashLoan {
        amount: u64,
    },
    DepositReserveLiquidityAndObligationCollateral {
        liquidity_amount: u64,
    },
}
Expand description

Instructions supported by the lending program.

Variants

RefreshReserve

Accrue interest and update market price of liquidity on a reserve.

Accounts expected by this instruction:

  1. [writable] Reserve account.
  2. [] Clock sysvar.
  3. [] Reserve liquidity oracle account. Must be the Pyth price account specified at InitReserve.

DepositReserveLiquidity

Fields

liquidity_amount: u64

Amount of liquidity to deposit in exchange for collateral tokens

Deposit liquidity into a reserve in exchange for collateral. Collateral represents a share of the reserve liquidity pool.

Accounts expected by this instruction:

  1. [writable] Source liquidity token account. $authority can transfer $liquidity_amount.
  2. [writable] Destination collateral token account.
  3. [writable] Reserve account.
  4. [writable] Reserve liquidity supply SPL Token account.
  5. [writable] Reserve collateral SPL Token mint.
  6. [] Lending market account.
  7. [] Derived lending market authority.
  8. [signer] User transfer authority ($authority).
  9. [] Clock sysvar.
  10. [] Token program id.

RedeemReserveCollateral

Fields

collateral_amount: u64

Amount of collateral tokens to redeem in exchange for liquidity

Redeem collateral from a reserve in exchange for liquidity.

Accounts expected by this instruction:

  1. [writable] Source collateral token account. $authority can transfer $collateral_amount.
  2. [writable] Destination liquidity token account.
  3. [writable] Reserve account.
  4. [writable] Reserve collateral SPL Token mint.
  5. [writable] Reserve liquidity supply SPL Token account.
  6. [] Lending market account.
  7. [] Derived lending market authority.
  8. [signer] User transfer authority ($authority).
  9. [] Clock sysvar.
  10. [] Token program id.

InitObligation

Initializes a new lending market obligation.

Accounts expected by this instruction:

  1. [writable] Obligation account - uninitialized.
  2. [] Lending market account.
  3. [signer] Obligation owner.
  4. [] Clock sysvar.
  5. [] Rent sysvar.
  6. [] Token program id.

RefreshObligation

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.

Accounts expected by this instruction:

  1. [writable] Obligation account.
  2. [] Clock sysvar. .. [] Collateral deposit reserve accounts - refreshed, all, in order. .. [] Liquidity borrow reserve accounts - refreshed, all, in order.

DepositObligationCollateral

Fields

collateral_amount: u64

Amount of collateral tokens to deposit

Deposit collateral to an obligation. Requires a refreshed reserve.

Accounts expected by this instruction:

  1. [writable] Source collateral token account. Minted by deposit reserve collateral mint. $authority can transfer $collateral_amount.
  2. [writable] Destination deposit reserve collateral supply SPL Token account.
  3. [] Deposit reserve account - refreshed.
  4. [writable] Obligation account.
  5. [] Lending market account.
  6. [] Derived lending market authority.
  7. [signer] Obligation owner.
  8. [signer] User transfer authority ($authority).
  9. [] Clock sysvar.
  10. [] Token program id. 10 [writable, optional] Stake account. 11 [writable, optional] Staking pool. 12 [optional] staking program id.

WithdrawObligationCollateral

Fields

collateral_amount: u64

Amount of collateral tokens to withdraw - u64::MAX for up to 100% of deposited amount

Withdraw collateral from an obligation. Requires a refreshed obligation and reserve.

Accounts expected by this instruction:

  1. [writable] Source withdraw reserve collateral supply SPL Token account.
  2. [writable] Destination collateral token account. Minted by withdraw reserve collateral mint.
  3. [] Withdraw reserve account - refreshed.
  4. [writable] Obligation account - refreshed.
  5. [] Lending market account.
  6. [] Derived lending market authority.
  7. [signer] Obligation owner.
  8. [] Clock sysvar.
  9. [] Token program id.
  10. [writable, optional] Stake account. 10 [writable, optional] Staking pool. 11 [optional] staking program id.

BorrowObligationLiquidity

Fields

liquidity_amount: u64

Amount of liquidity to borrow - u64::MAX for 100% of borrowing power

Borrow liquidity from a reserve by depositing collateral tokens. Requires a refreshed obligation and reserve.

Accounts expected by this instruction:

  1. [writable] Source borrow reserve liquidity supply SPL Token account.
  2. [writable] Destination liquidity token account. Minted by borrow reserve liquidity mint.
  3. [writable] Borrow reserve account - refreshed.
  4. [writable] Borrow reserve liquidity fee receiver account. Must be the fee account specified at InitReserve.
  5. [writable] Obligation account - refreshed.
  6. [] Lending market account.
  7. [] Derived lending market authority.
  8. [signer] Obligation owner.
  9. [] Clock sysvar.
  10. [] Token program id.

RepayObligationLiquidity

Fields

liquidity_amount: u64

Amount of liquidity to repay - u64::MAX for 100% of borrowed amount

Repay borrowed liquidity to a reserve. Requires a refreshed obligation and reserve.

Accounts expected by this instruction:

  1. [writable] Source liquidity token account. Minted by repay reserve liquidity mint. $authority can transfer $liquidity_amount.
  2. [writable] Destination repay reserve liquidity supply SPL Token account.
  3. [writable] Repay reserve account - refreshed.
  4. [writable] Obligation account - refreshed.
  5. [] Lending market account.
  6. [signer] User transfer authority ($authority).
  7. [] Clock sysvar.
  8. [] Token program id.

LiquidateObligation

Fields

liquidity_amount: u64

Amount of liquidity to repay - u64::MAX for up to 100% of borrowed amount

Repay borrowed liquidity to a reserve to receive collateral at a discount from an unhealthy obligation. Requires a refreshed obligation and reserves.

Accounts expected by this instruction:

  1. [writable] Source liquidity token account. Minted by repay reserve liquidity mint. $authority can transfer $liquidity_amount.
  2. [writable] Destination collateral token account. Minted by withdraw reserve collateral mint.
  3. [writable] Repay reserve account - refreshed.
  4. [writable] Repay reserve liquidity supply SPL Token account.
  5. [] Withdraw reserve account - refreshed.
  6. [writable] Withdraw reserve collateral supply SPL Token account.
  7. [writable] Obligation account - refreshed.
  8. [] Lending market account.
  9. [] Derived lending market authority.
  10. [signer] User transfer authority ($authority). 10 [] Clock sysvar. 11 [] Token program id. 14 [writable, optional] Deposit stake account. 15 [writable, optional] Deposit staking pool. 16 [optional] staking program id.

FlashLoan

Fields

amount: u64

The amount that is to be borrowed - u64::MAX for up to 100% of available liquidity

Make a flash loan.

Accounts expected by this instruction:

  1. [writable] Source liquidity token account. Minted by reserve liquidity mint. Must match the reserve liquidity supply.
  2. [writable] Destination liquidity token account. Minted by reserve liquidity mint.
  3. [writable] Reserve account.
  4. [] Lending market account.
  5. [] Derived lending market authority.
  6. [] Flash loan receiver program account. Must implement an instruction that has tag of 0 and a signature of (repay_amount: u64) This instruction must return the amount to the source liquidity account.
  7. [] Token program id.
  8. [writable] Flash loan fee receiver account. Must match the reserve liquidity fee receiver.
  9. [writable] Host fee receiver. .. [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:

  1. [writable] Source liquidity (matching the destination from above).
  2. [writable] Destination liquidity (matching the source from above).
  3. [] Token program id .. [any] Additional accounts provided to the lending program’s FlashLoan instruction above. ReceiveFlashLoan { // Amount that is loaned to the receiver program amount: u64 }

DepositReserveLiquidityAndObligationCollateral

Fields

liquidity_amount: u64

Amount of liquidity to deposit in exchange

Combines DepositReserveLiquidity and DepositObligationCollateral

Accounts expected by this instruction:

  1. [writable] Source liquidity token account. $authority can transfer $liquidity_amount.
  2. [writable] Destination collateral token account.
  3. [writable] Reserve account.
  4. [writable] Reserve liquidity supply SPL Token account.
  5. [writable] Reserve collateral SPL Token mint.
  6. [] Lending market account.
  7. [] Derived lending market authority.
  8. [writable] Destination deposit reserve collateral supply SPL Token account.
  9. [writable] Obligation account.
  10. [signer] Obligation owner. 10 [signer] User transfer authority ($authority). 11 [] Clock sysvar. 12 [] Token program id. 13 [writable, optional] Stake account. 14 [writable, optional] Staking pool. 15 [optional] staking program id.

Implementations

Unpacks a byte buffer into a LendingInstruction.

Packs a LendingInstruction into a byte buffer.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.