liquidate
is used to liquidate users with healthFactor
< MIN_HEALTH_FACTOR (1e18).
If healthFalctor drops to < 0.55, user can't get liquidated due to the fixed 10% liquidation bonus.
liquidate
will calculate the totalCollateralToRedeem
to liquidate based on debtToCover
and adds a 10% liquidation incentive.
If user collateral value drops from > 200% (for a healthy healthFactor) to < 110% (corresponding to a healthyFactor of < 0.55), that user can't get liquidated due to underflow in _redeemCollateral
:
s_collateralDeposited[from][tokenCollateralAddress] -= amountCollateral;
Add import {stdError} from "forge-std/StdError.sol";
to DSCEngine.t.sol
;
Add above code to DSCEngine.t.sol
file;
Run forge test --mt testLiquidateReverts -vvv
;
Users with a health factor under a certain threshold (0.55) can't get liquidated. This increase the chances protocol becomes insolvent.
Manual review, Foundry
Allow liquidation to happen even if healthFactor is in [0.5, 0.55) interval (0.5 <= userHealthFactor < 0.55): clear user debt and send his collateral amount to liquidator. Liquidator will get a smaller % bonus in this case.
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.