20,000 USDC
View results
Submission Details
Severity: gas

## [G-09] SETTING THE CONSTRUCTOR TO PAYABLE

Summary

[G-09] 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: /src/Lender.sol
73 constructor() Ownable(msg.sender) {

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Lender.sol#L73

file: /src/Staking.sol
31 constructor(address _token, address _weth) Ownable(msg.sender) {

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Staking.sol#L31

file: /src/Beedle.sol
11 constructor() ERC20("Beedle", "BDL") ERC20Permit("Beedle") Ownable(msg.sender) {

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Beedle.sol#L11

file: /src/Fees.sol
19 constructor(address _weth, address _staking) {

https://github.com/Cyfrin/2023-07-beedle/blob/main/src/Fees.sol#L19

Support

FAQs

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