DSCEngine._calculateHealthFactor(uint256,uint256) (src/DSCEngine.sol#324-334) performs a multiplication on the result of a division:
collateralAdjustedForThreshold = (collateralValueInUsd * LIQUIDATION_THRESHOLD) / LIQUIDATION_PRECISION
(src/DSCEngine.sol#330)
(collateralAdjustedForThreshold * 1e18) / totalDscMinted
(src/DSCEngine.sol#331)
Dividing before multiplying can lead to potential loss of precision and performing potential rounding errors.
The potential impact of this bug includes:
Loss of Precision
Incorrect Health Factor
Vulnerability to Exploitation
Inconsistent Behavior
Slither - static analysis framework.
Rearrange the order of operations to perform the multiplication before the division.
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.