_calculateDebt
Overview

Execution flow
_calculateDebt
Calculates the total debt of the user and the actual amount to liquidate depending on the health factor. Returns:
userVariableDebt
userTotalDebt
actualDebtToLiquidate
getUserCurrentDebt will return the user's balance of debt tokens (stable & variable)
healthFactorwas obtained previously throughcalculateUserAccountDataIf user's
healthFactor> 0.95: liquidation close factor is 0.5 (50%.00)If user's
healthFactor<= 0.95: liquidation close factor is 1.0 (100.00%)
On Partial and Full liquidation: actualDebtToLiquidate
If the liquidator's debtToCover is > maxLiquidatableDebt, set the actualDebtToLiquidate to be maxLiquidatableDebt.
Else, If the liquidator's debtToCover is <= maxLiquidatableDebt, set the actualDebtToLiquidate to be debtToCover.
Last updated
Was this helpful?