Eggstravaganza

First Flight #37
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Invalid

Unusual Constructor Syntax in `EggVault.sol

Location: EggVault.sol

Issue:

The constructor in the EggVault contract is defined as:

constructor() Ownable(msg.sender) {}

In OpenZeppelin's standard Ownable contract, the constructor does not accept any parameters and automatically assigns the deployer (msg.sender) as the owner. Explicitly passing msg.sender to the Ownable constructor, as done here, may indicate a reliance on a modified version of Ownable that accepts a parameter. If this is not the case, this syntax could lead to confusion or misinitialization.

Recommendation:

  • Verify the Ownable Implementation: Ensure that the imported Ownable contract supports a constructor with a parameter. If using OpenZeppelin's standard Ownable, this is not the case.

  • Align Constructor Syntax with Ownable Implementation:

    • If using the standard Ownable, remove the parameter and utilize the default constructor:

      constructor() Ownable() {}
    • Alternatively, since the Ownable constructor is parameterless, the EggVault constructor can omit the explicit call:

      constructor() {}

By ensuring consistency between the EggVault constructor and the Ownable implementation, the contract's clarity and maintainability are enhanced.

Updates

Lead Judging Commences

m3dython Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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