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

There is no variable to track winner address to NFT

Summary

No variable in this contract tracks previous winners. previousWinner gets overwritten each time a lottery is run.

Impact

You don't have an orderly record of the previous winners. If someone comes to you and says that they won a raffle but didn't get their NFT or their money, you won't be able to verify that because everything gets overwritten and you don't have a record of who won that raffle. You only have tokenIdToRarity but that doesn't help you in terms of who won.

Tools Used

Manual review

Recommendations

Add a mapping for tokenIdToWinner:

mapping(uint256 => address) public tokenIdToWinner;

Update it when you update state in the selectWinner function:

tokenIdToWinner[tokenId] == previousWinner;
Updates

Lead Judging Commences

patrickalphac Lead Judge about 2 years ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

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

Give us feedback!