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

In 'Airdrop.sol::claim' the emission of the 'TokenClaimed' event should occur after the transfer

Summary

The emission of the 'TokenClaimed' event should occur after the loveToken.transferFrom.

Vulnerability Details

Events should occur after state changes because of the possibility that they fail. If the loveToken.transferFrom fails, the 'TokenClaimed' event would still be included in the transaction's logs. This could cause issues for off-chain indexers that use events to track state changes.

Impact

Event emission before the transfer could cause issues for indexers if the transfer were to fail.

Tools Used

--Foundry

Recommendations

It is recommended to emit the event after the transfer.

_claimedBy[msg.sender] += tokenAmountToDistribute;
- emit TokenClaimed(msg.sender, tokenAmountToDistribute);
loveToken.transferFrom(
address(airdropVault),
msg.sender,
tokenAmountToDistribute
);
+ emit TokenClaimed(msg.sender, tokenAmountToDistribute);
}
Updates

Lead Judging Commences

0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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