20,000 USDC
View results
Submission Details
Severity: gas

Payable Constructor

Summary

Constructors can be made payable to save on gas

Vulnerability Details

Constructor in Staking.sol line 31 is not payable
Constructor in Lender.sol line 73 is not payable
Constructor in Fees.sol line 19 is not payable
Constructor in Beedle.sol line 11 is not payable

By not making constructors not 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 constructors payable to save on deployment costs

Support

FAQs

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