TokenLendingProgram.redeemReserveCollateral constructor

TokenLendingProgram.redeemReserveCollateral({
  1. required SolAddress sourceCollateral,
  2. required SolAddress destinationLiquidity,
  3. required SolAddress reserve,
  4. required SolAddress reserveCollateralMint,
  5. required SolAddress reserveLiquiditySupply,
  6. required SolAddress lendingMarket,
  7. required SolAddress lendingMarketAuthority,
  8. required SolAddress transferAuthority,
  9. required TokenLendingRedeemReserveCollateralLayout layout,
})

Redeem collateral from a reserve in exchange for liquidity.

Implementation

factory TokenLendingProgram.redeemReserveCollateral(
    {
    /// Source collateral token account.
    required SolAddress sourceCollateral,

    /// Destination liquidity token account.
    required SolAddress destinationLiquidity,

    /// Reserve account.
    required SolAddress reserve,

    /// Reserve collateral SPL Token mint.
    required SolAddress reserveCollateralMint,

    /// Reserve liquidity supply SPL Token account.
    required SolAddress reserveLiquiditySupply,

    /// Lending market account.
    required SolAddress lendingMarket,

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

    /// User transfer authority
    required SolAddress transferAuthority,
    required TokenLendingRedeemReserveCollateralLayout layout}) {
  return TokenLendingProgram(keys: [
    sourceCollateral.toWritable(),
    destinationLiquidity.toWritable(),
    reserve.toWritable(),
    reserveCollateralMint.toWritable(),
    reserveLiquiditySupply.toWritable(),
    lendingMarket.toReadOnly(),
    lendingMarketAuthority.toReadOnly(),
    transferAuthority.toSigner(),
    SystemProgramConst.sysvarClockPubkey.toReadOnly(),
    SPLTokenProgramConst.tokenProgramId.toReadOnly(),
  ], programId: TokenLendingProgramConst.lendingProgramId, layout: layout);
}