TokenLendingProgram.flashLoan constructor

TokenLendingProgram.flashLoan({
  1. required SolAddress sourceLiquidity,
  2. required SolAddress destinationLiquidity,
  3. required SolAddress liquidityReserve,
  4. required SolAddress flashLoanFeeReceiver,
  5. required SolAddress hostFeeReceiver,
  6. required SolAddress lendingMarket,
  7. required SolAddress lendingMarketAuthority,
  8. required SolAddress flashLoanProgram,
  9. required SolAddress transferAuthority,
  10. required TokenLendingFlashLoanLayout layout,
})

Make a flash loan.

Implementation

factory TokenLendingProgram.flashLoan(
    {
    /// Source liquidity token account.
    required SolAddress sourceLiquidity,

    /// Destination liquidity token account
    required SolAddress destinationLiquidity,

    /// Reserve account.
    required SolAddress liquidityReserve,

    /// Flash loan fee receiver account.
    required SolAddress flashLoanFeeReceiver,

    /// Host fee receiver.
    required SolAddress hostFeeReceiver,

    /// Lending market account.
    required SolAddress lendingMarket,

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

    /// Flash loan receiver program id.
    required SolAddress flashLoanProgram,
    required SolAddress transferAuthority,
    required TokenLendingFlashLoanLayout layout}) {
  return TokenLendingProgram(keys: [
    sourceLiquidity.toWritable(),
    destinationLiquidity.toWritable(),
    liquidityReserve.toWritable(),
    flashLoanFeeReceiver.toWritable(),
    hostFeeReceiver.toWritable(),
    lendingMarket.toReadOnly(),
    lendingMarketAuthority.toReadOnly(),
    SPLTokenProgramConst.tokenProgramId.toReadOnly(),
    flashLoanProgram.toReadOnly(),
    transferAuthority.toSigner()
  ], programId: TokenLendingProgramConst.lendingProgramId, layout: layout);
}