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

Use constant variable instead of magic number in DSCEngine._calculateHealthFactor

Summary

In the _calculateHealthFactor method, a magic number 1e18 is used in the calculation:

return (collateralAdjustedForThreshold * 1e18) / totalDscMinted;

The best practice is to use constant variable instead of magic number for code readability.

Vulnerability Details

n/a

Impact

n/a

Tools Used

Manual review

Recommendations

Replace the magic number 1e18 with the constant variable PRECISION.

Support

FAQs

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

Give us feedback!