Program
Last updated
Last updated
Program Code Repository:
Functions in the program are created by bundling one or more instructions into a transaction. This document will first explain what each instruction does on its own and then how they are bundled together into various user-facing functions in the SDK.
Creates a new vault
Exchanges reserve tokens for vault LP tokens
Exchanges vault LP tokens for reserve tokens
Calculates and stores the desired allocations to integrated lending markets based on the vault strategy type
Also emits and anchor event containing the new allocations
Required before any reconcile IX is called
Refreshes the reserves of the given lending reserve, which is required before any deposit or withdrawal
Calculates the value of the vault held in the given lending reserve, denominated in the reserve token
Calculates the total value of the vault, denominated in the reserve token. This is required before any deposit or withdrawal from the vault
Deposits and withdraws from the given lending market according to the allocations stored by the rebalance IX
IXs
Initialize
IXs
(if reserve token is SOL) Wrap SOL into SPL token
(if doesn't exist already) Create account for LP token
Refresh
Deposit
(if reserve token is SOL) Close intermediate account created during wrapping
IXs
Refresh
(if withdraw amount is less than in vault reserves) Reconcile
(if doesn't exist already) Create account for reserve token
Withdraw
(if reserve token is SOL) Unwrap from SPL token to SOL
IXs
Refresh
Rebalance
Reconcile IXs