Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: low
Invalid

Avoid use of magic numbers: Define and use `constant` variables instead of using literals

[L-9] Avoid use of magic numbers: Define and use constant variables instead of using literals.

Description: Using constant variables instead of literals increases readability of code and decreases chances of inadvertently introducing errors.

  • Found in src/ChoosingRam.sol

    if (block.timestamp > 1728691200) {
    revert ChoosingRam__TimeToBeLikeRamFinish();
    }
    if (block.timestamp < 1728691200) {
    revert ChoosingRam__TimeToBeLikeRamIsNotFinish();
    }
    if (block.timestamp > 1728777600) {
    revert ChoosingRam__EventIsFinished();
    }
  • Found in src/Dussehra.sol

    if (block.timestamp < 1728691069) {
    revert Dussehra__MahuratIsNotStart();
    }
    if (block.timestamp > 1728777669) {
    revert Dussehra__MahuratIsFinished();
    }
    totalAmountGivenToRam = (totalAmountByThePeople * 50) / 100;

Recommended Mitigation: Change these literal values to constants. With the first example:

+ uint256 public constant DEADLINE_ENTREE_TO_BE_LIKE_RAM = 1728691200;
- if (block.timestamp > 1728691200) {
+ if (block.timestamp > DEADLINE_ENTREE_TO_BE_LIKE_RAM) {
revert ChoosingRam__TimeToBeLikeRamFinish();
}

Apply the same logic to the other literal values.

Updates

Lead Judging Commences

bube Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Info/Gas/Invalid according to docs

Support

FAQs

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