As per design, liquidate()
function allows partial liquidation of bad loans. Liquidator can specify the amount of debt to liquidate via the parameter in debtToCover
inside function liquidate(address collateral, address user, uint256 debtToCover)
, and get a 10% liquidation bonus.
However, the function always reverts with DSCEngine__HealthFactorNotImproved
if debtToCover
is less than (price feed retuned by Chainlink)/1e8
, robbing liquidator the opportunity to earn a bonus.
Add the following test to DSCEngine.t.sol and run via forge test --mt testLiquidateSmallDebt -vv
. The liquidator should have received 1 wei by partially liquidating 17 wETH, but is not allowed to do so.
Bad loans can not be partially liquidated if debtToCover is small. Robs liquidators the chance to earn a bonus. Impacts overall liquidity of the protocol.
Manual review, forge test.
Either implement a minimum amount of debt required to be covered, so that liquidators know this upfront,
Or fix the health factor calculation.
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.