TokenLendingProgram.liquidateObligation constructor

TokenLendingProgram.liquidateObligation({
  1. required SolAddress sourceLiquidity,
  2. required SolAddress destinationCollateral,
  3. required SolAddress repayReserve,
  4. required SolAddress repayReserveLiquiditySupply,
  5. required SolAddress withdrawReserve,
  6. required SolAddress withdrawReserveCollateralSupply,
  7. required SolAddress obligation,
  8. required SolAddress lendingMarket,
  9. required SolAddress lendingMarketAuthority,
  10. required SolAddress transferAuthority,
  11. required TokenLendingLiquidateObligationLayout layout,
})

Repay borrowed liquidity to a reserve to receive collateral at a discount from an unhealthy obligation. Requires a refreshed obligation and reserves.

Implementation

factory TokenLendingProgram.liquidateObligation(
    {
    /// Source liquidity token account. Minted by repay
    /// reserve liquidity mint.
    required SolAddress sourceLiquidity,

    /// Destination collateral token account.
    required SolAddress destinationCollateral,

    /// Repay reserve account
    required SolAddress repayReserve,

    /// Repay reserve liquidity supply SPL Token account.
    required SolAddress repayReserveLiquiditySupply,

    /// Withdraw reserve account
    required SolAddress withdrawReserve,

    /// Withdraw reserve collateral supply SPL Token account.
    required SolAddress withdrawReserveCollateralSupply,

    /// Obligation account
    required SolAddress obligation,

    /// Lending market account.
    required SolAddress lendingMarket,

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

    /// User transfer authority
    required SolAddress transferAuthority,
    required TokenLendingLiquidateObligationLayout layout}) {
  return TokenLendingProgram(keys: [
    sourceLiquidity.toWritable(),
    destinationCollateral.toWritable(),
    repayReserve.toWritable(),
    repayReserveLiquiditySupply.toWritable(),
    withdrawReserve.toReadOnly(),
    withdrawReserveCollateralSupply.toWritable(),
    obligation.toWritable(),
    lendingMarket.toReadOnly(),
    lendingMarketAuthority.toReadOnly(),
    transferAuthority.toSigner(),
    SystemProgramConst.sysvarClockPubkey.toReadOnly(),
    SPLTokenProgramConst.tokenProgramId.toReadOnly(),
  ], programId: TokenLendingProgramConst.lendingProgramId, layout: layout);
}