20,000 USDC
View results
Submission Details
Severity: gas
Valid

[G-01] The owner can be declared inside the constructor

Summary

In the Ownable library, the msg.sender can be assigned directly to the owner variable, since in all the contracts that use this library, the msg.sender is passed as a parameter, a value that can be associated within the constructor.

Impact

Optimization

Tools Used

Manual code review

Recommendations

You can do this change :

src/utils/Ownable.sol

- constructor(address _owner) {
+ constructor() {
- owner = _owner;
+ owner = msg.sender;
- emit OwnershipTransferred(address(0), _owner);
+ emit OwnershipTransferred(address(0), owner);
}

And update the other declarations in the other contracts, since the msg.sender does not need to be passed by parameter

Support

FAQs

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