40,000 USDC
View results
Submission Details
Severity: gas

Payable constructor

Summary

Constructors can be made payable to save on gas

Vulnerability Details

Constructor in Escrow.sol line 32 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 the constructors payable as it reduces the amount of bytecode.

Impact

Gas Savings: Payable constructor avoids about 10 Opcodes e.g CALLVALUE DUP1 ISZERO PUSH1 JUMP1
PUSH1 DUP1 REVERT JUMPDEST POP. This leads to gas savings on deploying smaller bytecode.

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.