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

Missing event

Summary

SantasList::collectPresent and SantasList::buyPresent do not emit events.

Vulnerability Details

For proper off-chain monitoring, functions SantasList::collectPresent and SantasList::buyPresent should emit events.

Impact

For the lack of emission of events, claims of presents from and for other users cannot be viewed off-chain.

Tools Used

Remix IDE

Recommendations

Emit events for state-changing transactions:

+ event PresentCollected(address from);
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);
return;
} else if (
s_theListCheckedOnce[msg.sender] == Status.EXTRA_NICE
&& s_theListCheckedTwice[msg.sender] == Status.EXTRA_NICE
) {
_mintAndIncrement();
i_santaToken.mint(msg.sender);
+ emit PresentCollected(msg.sender);
return;
}
revert SantasList__NotNice();
}
+ event PresentBought(address from, address to);
function buyPresent(address presentReceiver) external {
i_santaToken.burn(presentReceiver);
_mintAndIncrement();
+ emit PresentBought(msg.sender, presentReceiver);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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