Santa's List

AI First Flight #3
Beginner FriendlyFoundry
EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

Missing Event on Gift Collection

Missing Event on Gift Collection


Description

The collectPresent() function mints an NFT for users but does not emit any event indicating that the NFT was successfully minted or collected. Emitting an event would allow off-chain tools, analytics, and front-end applications to easily track gift collection and improve transparency.


Impact

Low — does not affect functionality, but reduces transparency and makes off-chain monitoring harder.


Recommended Mitigation

Emit an event, e.g., PresentCollected(address user, uint256 tokenId), after successfully minting the NFT in collectPresent().

event CheckedOnce(address person, Status status);
event CheckedTwice(address person, Status status);
+ event PresentCollected(address person, uint256 tokenId);
function collectPresent() external {
if (block.timestamp < CHRISTMAS_2023_BLOCK_TIME) {
revert SantasList__NotChristmasYet();
}
if (balanceOf(msg.sender) > 0) {
revert SantasList__AlreadyCollected();
}
if (s_theListCheckedOnce[msg.sender] == Status.NICE && s_theListCheckedTwice[msg.sender] == Status.NICE) {
_mintAndIncrement();
+ emit PresentCollected(msg.sender, s_tokenCounter);
return;
} else if (
s_theListCheckedOnce[msg.sender] == Status.EXTRA_NICE
&& s_theListCheckedTwice[msg.sender] == Status.EXTRA_NICE
) {
_mintAndIncrement();
+ emit PresentCollected(msg.sender, s_tokenCounter);
i_santaToken.mint(msg.sender);
return;
}
revert SantasList__NotNice();
}
Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge about 23 hours ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!