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

Constants should be be used for hardcoded values

Description

Constants should be be used for hardcoded values, especially if the constants already exist, as it is in this case in DSCEngine.

uint256 private constant PRECISION = 1e18;

In DSCEngine::_calculateHealthFactor the 1e18 can be safely (and contextually) replaced with the already declared PRECISION constant.

return (collateralAdjustedForThreshold * 1e18) / totalDscMinted;

Recommend Mitigation

Use the PRECISION constant instead of 1e18.

Support

FAQs

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