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

`Puppy Raffle:selectWinner()` variable declaration not required

Summary

Puppy Raffle:selectWinner() variable declaration not required ,can be directly calculated to save gas

Vulnerability Details

@> uint256 totalAmountCollected = players.length * entranceFee;
uint256 prizePool = (totalAmountCollected * 80) / 100;
uint256 fee = (totalAmountCollected * 20) / 100;

Impact

Gas Wastage

Tools Used

Manual review

Recommendations

- uint256 totalAmountCollected = players.length * entranceFee;
- uint256 prizePool = (totalAmountCollected * 80) / 100;
- uint256 fee = (totalAmountCollected * 20) / 100;
+ uint256 prizePool = (players.length * entranceFee * 80) / 100;
+ uint256 fee = (players.length * entranceFee * 20) / 100;
Updates

Lead Judging Commences

patrickalphac Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Gas optimizations

Support

FAQs

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