As stated in the comment, there is no way to recover it when protocol is insolvent. However, liquidation could become impossible, even when there is enough funding in the protocol, if the user's collateral ratio is low. An underflow issue during collateral redemption could cause protocol insolvency that cannot be recovered from.
During the liquidation process, the following steps are taken:
The liquidator calculates tokenAmountFromDebtCovered
based on the amount of DSC they are repaying on behalf of.
Multiply tokenAmountFromDebtCovered
by 1.1 to get totalCollateralToRedeem
.
Transfer totalCollateralToRedeem
from the person being liquidated to the liquidator.
Burn the DSC that the liquidator repaid on behalf of.
In the third step, if totalCollateralToRedeem
is greater than the amount of tokens the person being liquidated has provided as collateral, an underflow occurs, causing the transaction to revert.
Performing partial liquidation will not result in an underflow, but it will increase the health factor, causing a DSCEngine__HealthFactorNotImproved
error. This issue could occur even when the DSCEngine
contract has enough funds internally, and if accumulated, could negatively impact the protocol.
If this situation occurs frequently, it could lead to the protocol becoming insolvent. This could result in significant financial losses for users and could potentially make the protocol unusable.
VS Code
To prevent this from happening, you could consider removing the health factor check logic. So user can partial liquidate.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.