15,000 USDC
View results
Submission Details
Severity: gas

Using PRIVATE rather than PUBLIC FOR Constants, Saves Gas

Summary

[G-3] Using PRIVATE rather than PUBLIC FOR Constants, Saves Gas

If needed, the value can be read from the verified contract source code. Savings are due to the compiler not having to create non-payable getter functions for deployment calldata, and not adding another entry to the method ID table

file: /script/HelperConfig.s.sol
18 uint8 public constant DECIMALS = 8;
19 int256 public constant ETH_USD_PRICE = 2000e8;
20 int256 public constant BTC_USD_PRICE = 1000e8;

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/script/HelperConfig.s.sol#L18-L20

Support

FAQs

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