TokenLendingProgram.borrowObligationLiquidity constructor

TokenLendingProgram.borrowObligationLiquidity({
  1. required SolAddress destinationLiquidity,
  2. required SolAddress sourceLiquidity,
  3. required SolAddress borrowReserve,
  4. required SolAddress borrowReserveLiquidityFeeReceiver,
  5. required SolAddress obligation,
  6. required SolAddress lendingMarket,
  7. required SolAddress lendingMarketAuthority,
  8. required SolAddress obligationOwner,
  9. required TokenLendingBorrowObligationLiquidityLayout layout,
  10. SolAddress? hostFeeReceiver,
})

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

Implementation

factory TokenLendingProgram.borrowObligationLiquidity({
  /// Destination liquidity token account. Minted by borrow
  /// reserve liquidity mint.
  required SolAddress destinationLiquidity,

  /// Source borrow reserve liquidity supply SPL Token
  /// account.
  required SolAddress sourceLiquidity,

  /// Borrow reserve account
  required SolAddress borrowReserve,

  /// Borrow reserve liquidity fee receiver account. Must be
  /// the fee account specified at InitReserve.
  required SolAddress borrowReserveLiquidityFeeReceiver,

  /// Obligation account
  required SolAddress obligation,

  /// Lending market account.
  required SolAddress lendingMarket,

  /// Derived lending market authority.
  required SolAddress lendingMarketAuthority,

  /// Obligation owner.
  required SolAddress obligationOwner,
  required TokenLendingBorrowObligationLiquidityLayout layout,
  SolAddress? hostFeeReceiver,
}) {
  return TokenLendingProgram(keys: [
    sourceLiquidity.toWritable(),
    destinationLiquidity.toWritable(),
    borrowReserve.toWritable(),
    borrowReserveLiquidityFeeReceiver.toWritable(),
    obligation.toWritable(),
    lendingMarket.toReadOnly(),
    lendingMarketAuthority.toReadOnly(),
    obligationOwner.toSigner(),
    SystemProgramConst.sysvarClockPubkey.toReadOnly(),
    SPLTokenProgramConst.tokenProgramId.toReadOnly(),
    if (hostFeeReceiver != null) hostFeeReceiver.toWritable()
  ], programId: TokenLendingProgramConst.lendingProgramId, layout: layout);
}