_calculateDebt
Last updated
Last updated
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)
healthFactor
was obtained previously through calculateUserAccountData
If 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%)
The close factor determines the maximum liquidatable debt, per valid liquidationCall().
close factor = 0.5, means only a maximum of 50% of the debt can be liquidated within that liquidationCall.
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
.