15,000 USDC
View results
Submission Details
Severity: gas

Payable Constructor

Summary

Constructors can be made payable to save on gas

Vulnerability Details

Constructor in DSCEngine.sol line 112 is not payable. By not making it payable the compiler will have to do a check
if(msg.value != 0) so that is reverts if value is sent in. Therefore to save on gas make all constructors payable.

Impact

Gas Savings: Payable constructor avoids about 10 Opcodes e.g CALLVALUE DUP1 ISZERO PUSH1 JUMP1
PUSH1 DUP1 REVERT JUMPDEST POP. This reduces opcodes and reduces deployment costs

Tools Used

Manual Analysis

Recommendations

It is recommended to make constructor payable to save on deployment costs

Support

FAQs

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