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:
[writable]
Reserve account.[]
Clock sysvar.[]
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:
[writable]
Source liquidity token account. $authority can transfer $liquidity_amount.[writable]
Destination collateral token account.[writable]
Reserve account.[writable]
Reserve liquidity supply SPL Token account.[writable]
Reserve collateral SPL Token mint.[]
Lending market account.[]
Derived lending market authority.[signer]
User transfer authority ($authority).[]
Clock sysvar.[]
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:
[writable]
Source collateral token account. $authority can transfer $collateral_amount.[writable]
Destination liquidity token account.[writable]
Reserve account.[writable]
Reserve collateral SPL Token mint.[writable]
Reserve liquidity supply SPL Token account.[]
Lending market account.[]
Derived lending market authority.[signer]
User transfer authority ($authority).[]
Clock sysvar.[]
Token program id.
InitObligation
Initializes a new lending market obligation.
Accounts expected by this instruction:
[writable]
Obligation account - uninitialized.[]
Lending market account.[signer]
Obligation owner.[]
Clock sysvar.[]
Rent sysvar.[]
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:
[writable]
Obligation account.[]
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:
[writable]
Source collateral token account. Minted by deposit reserve collateral mint. $authority can transfer $collateral_amount.[writable]
Destination deposit reserve collateral supply SPL Token account.[]
Deposit reserve account - refreshed.[writable]
Obligation account.[]
Lending market account.[]
Derived lending market authority.[signer]
Obligation owner.[signer]
User transfer authority ($authority).[]
Clock sysvar.[]
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:
[writable]
Source withdraw reserve collateral supply SPL Token account.[writable]
Destination collateral token account. Minted by withdraw reserve collateral mint.[]
Withdraw reserve account - refreshed.[writable]
Obligation account - refreshed.[]
Lending market account.[]
Derived lending market authority.[signer]
Obligation owner.[]
Clock sysvar.[]
Token program id.[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:
[writable]
Source borrow reserve liquidity supply SPL Token account.[writable]
Destination liquidity token account. Minted by borrow reserve liquidity mint.[writable]
Borrow reserve account - refreshed.[writable]
Borrow reserve liquidity fee receiver account. Must be the fee account specified at InitReserve.[writable]
Obligation account - refreshed.[]
Lending market account.[]
Derived lending market authority.[signer]
Obligation owner.[]
Clock sysvar.[]
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:
[writable]
Source liquidity token account. Minted by repay reserve liquidity mint. $authority can transfer $liquidity_amount.[writable]
Destination repay reserve liquidity supply SPL Token account.[writable]
Repay reserve account - refreshed.[writable]
Obligation account - refreshed.[]
Lending market account.[signer]
User transfer authority ($authority).[]
Clock sysvar.[]
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:
[writable]
Source liquidity token account. Minted by repay reserve liquidity mint. $authority can transfer $liquidity_amount.[writable]
Destination collateral token account. Minted by withdraw reserve collateral mint.[writable]
Repay reserve account - refreshed.[writable]
Repay reserve liquidity supply SPL Token account.[]
Withdraw reserve account - refreshed.[writable]
Withdraw reserve collateral supply SPL Token account.[writable]
Obligation account - refreshed.[]
Lending market account.[]
Derived lending market authority.[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:
[writable]
Source liquidity token account. Minted by reserve liquidity mint. Must match the reserve liquidity supply.[writable]
Destination liquidity token account. Minted by reserve liquidity mint.[writable]
Reserve account.[]
Lending market account.[]
Derived lending market authority.[]
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.[]
Token program id.[writable]
Flash loan fee receiver account. Must match the reserve liquidity fee receiver.[writable]
Host fee receiver. ..[any]
Additional accounts expected by the receiving program’sReceiveFlashLoan
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:
[writable]
Source liquidity (matching the destination from above).[writable]
Destination liquidity (matching the source from above).[]
Token program id ..[any]
Additional accounts provided to the lending program’sFlashLoan
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:
[writable]
Source liquidity token account. $authority can transfer $liquidity_amount.[writable]
Destination collateral token account.[writable]
Reserve account.[writable]
Reserve liquidity supply SPL Token account.[writable]
Reserve collateral SPL Token mint.[]
Lending market account.[]
Derived lending market authority.[writable]
Destination deposit reserve collateral supply SPL Token account.[writable]
Obligation account.[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
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for LendingInstruction
impl Send for LendingInstruction
impl Sync for LendingInstruction
impl Unpin for LendingInstruction
impl UnwindSafe for LendingInstruction
Blanket Implementations
pub default fn example() -> T
Mutably borrows from an owned value. Read more