Skip to content

[L-4] Constants should be defined rather than using magic numbers #14

@juniormp

Description

@juniormp

Comments

Using magic numbers (hardcoded values) in the code makes it harder to understand and maintain. When a magic number is used, it is not immediately clear what the value represents or why it is being used. If the value needs to be changed in the future, you would have to search for all instances of the magic number in the code, which can be time-consuming and error-prone.

By using constants, you can avoid these issues and make your code more robust, readable, and maintainable. Additionally, Solidity provides built-in support for constants, which allows you to define them in a way that optimizes gas usage and makes them easier to work with in the context of smart contract development.

Instances

https://github.com/juniormp/audit-2023-04-rubicon/blob/511636d889742296a54392875a35e4c0c4727bb7/contracts/RubiconMarket.sol#L583
https://github.com/juniormp/audit-2023-04-rubicon/blob/511636d889742296a54392875a35e4c0c4727bb7/contracts/RubiconMarket.sol#L586

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions