15,000 USDC
View results
Submission Details
Severity: low
Valid

Loss of precision

Summary

Loss of precision

Vulnerability Details

DSCEngine._calculateHealthFactor(uint256,uint256) (src/DSCEngine.sol#324-332) 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)

Tools Used

slither

Recommendations

I suggest calculating with maximal possible precision.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.