When calculating _calculateHealthFactor
, there is an accuracy error of first dividing and then multiplying, which leads to underestimating the user's health.
collateralValueInUsd
will first multiply by 50 divided by 100, which is the same as dividing by 2, which has a precision error with only one point.
collateralAdjustedForThreshold
will multiply by 1e18, which magnifies the precision error to 1e18.
Let me give you a specific example:
collateralValueInUsd = 101, collateralAdjustedForThreshold = 101 / 2 = 50
totalDscMinted = 50, _calculateHealthFactor = 1e18
liquidate needs healthFactor >= MIN_HEALTH_FACTOR
, So the user can be liquidated
But actually the user's healthFactor = 101 * 1e18 / 2 / 50 = 1.01e18 > MIN_HEALTH_FACTOR, users should not be liquidated
User health rate is underestimated to be liquidated
Manual review
Like the above method, you should multiply by 1e18 before dividing
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.