15,000 USDC
View results
Submission Details
Severity: gas

SETTING THE CONSTRUCTOR TO PAYABLE

Summary

[G-7] SETTING THE CONSTRUCTOR TO PAYABLE

You can cut out 10 opcodes in the creation-time EVM bytecode if you declare a constructor payable. Making the constructor payable eliminates the need for an initial check of msg.value == 0 and saves 13 gas on deployment with no security risks.

file: /script/HelperConfig.s.sol
25 constructor() {

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

file: /src/DSCEngine.sol
112 constructor(address[] memory tokenAddresses, address[] memory priceFeedAddresses, address dscAddress) {

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L112

file: /src/DecentralizedStableCoin.sol
44 constructor() ERC20("DecentralizedStableCoin", "DSC") {}

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DecentralizedStableCoin.sol#L44

Support

FAQs

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