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

Any `require` statement can be rewritten to an `if` statement with a function return. This saves gas.

[L-6] Any require statement can be rewritten to an if statement with a function return. This saves gas.

Description:

  • Found in src/ChoosingRam.sol

    require(!isRamSelected, "Ram is selected!");
    require(ramNFT.organiser() == msg.sender, "Only organiser can call this function!");
  • Found in src/Dussehra.sol

    require(choosingRamContract.isRamSelected(), "Ram is not selected yet!");
    require(choosingRamContract.selectedRam() == msg.sender, "Only Ram can call this function!");
    require(IsRavanKilled, "Ravan is not killed yet!");
    require(success, "Failed to send money to organiser");
    require(success, "Failed to send money to Ram");

Recommended Mitigation: Change require statement to an if statement. With the first example:

- require(!isRamSelected, "Ram is selected!");;
+ if (!isRamSelected) { ChoosingRam_RamIsAlreadySelected(); }

Change all require statements following the same logic.

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.