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

Replace `1e18` by constant `PRECISION` in `DSCEngine::_calculateHealthFactor`

Summary

Replace 1e18 by constant PRECISION to improve readability and maintain consistency throughout the code.

File: src/DSCEngine.sol
324: function _calculateHealthFactor(uint256 totalDscMinted, uint256 collateralValueInUsd)
325: internal
326: pure
327: returns (uint256)
328: {
329: if (totalDscMinted == 0) return type(uint256).max;
330: uint256 collateralAdjustedForThreshold = (collateralValueInUsd * LIQUIDATION_THRESHOLD) / LIQUIDATION_PRECISION;
331: return (collateralAdjustedForThreshold * 1e18) / totalDscMinted;
332: }

Support

FAQs

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