TokenLendingProgram.refreshObligation constructor

TokenLendingProgram.refreshObligation({
  1. required SolAddress obligation,
  2. required List<SolAddress> depositReserves,
  3. required List<SolAddress> borrowReserves,
})

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.

Implementation

factory TokenLendingProgram.refreshObligation(
    {
    /// Obligation account.
    required SolAddress obligation,

    /// Collateral deposit reserve accounts
    required List<SolAddress> depositReserves,

    /// Liquidity borrow reserve accounts
    required List<SolAddress> borrowReserves}) {
  return TokenLendingProgram(
      keys: [
        obligation.toWritable(),
        SystemProgramConst.sysvarClockPubkey.toReadOnly(),
        ...depositReserves.map((e) => e.toReadOnly()),
        ...borrowReserves.map((e) => e.toReadOnly())
      ],
      programId: TokenLendingProgramConst.lendingProgramId,
      layout: TokenLendingRefreshObligationLayout());
}