15,000 USDC
View results
Submission Details
Severity: gas

[I-02] - Set the Internal Layout of Contracts, Interfaces, and Libraries.

Details

According to the Solidity Style Guide consistency in the project's layout is very important. If all projects apply the style guides provided by solidity docs then understanding the projects and their code will be much easier for developers, and auditors.

Solidity docs;

A style guide is about consistency. Consistency with this style guide is important. Consistency within a project is more important. Consistency within one module or function is most important.

According to the solidity styles guide;

Inside each contract, library or interface, this order should be followed:

  1. Type declarations

  2. State variables

  3. Events

  4. Errors

  5. Modifiers

  6. Functions

And this should be the order of functions:

  • constructor

  • receive function (if exists)

  • fallback function (if exists)

  • external

  • public

  • internal

  • private

  • View and pure functions last

Recommendations

Apply the recommended layout structure in all mentioned contracts according to the solidity styles guide.

Support

FAQs

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