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

Use PRECISION instead of 1e18

Summary

Instead of using the hardcoded value 1e18, it can be replaced with a constant named PRECISION

Vulnerability Details

Constant variables are used to represent different types of precision throghout the code. However, in this line (https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/d1c5501aa79320ca0aeaa73f47f0dbc88c7b77e2/src/DSCEngine.sol#L331), a hardcoded value of 1e18 is used. To enhance code readability and maintain consistency in style, it is good to use the constant variable PRECISION instead.

Impact

Tools Used

Manual Review

Recommendations

Use PRECISION instead of 1e18, eg: return (collateralAdjustedForThreshold * PRECISION) / totalDscMinted;

Support

FAQs

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