GivingThanks

First Flight #28
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Refactor `GivingThanks::donate` function to follow CEI pattern to avoid a potential event reentrancy attack

Summary

Refactor the GivingThanks::donate function to follow the CEI pattern (Checks, Effects, Interactions) Pattern to avoid potential event reentrancy attack

Recommendations

function donate(address charity) public payable {
// Checks
require(registry.isVerified(charity), "Charity not verified");
(bool sent,) = charity.call{value: msg.value}("");
require(sent, "Failed to send Ether");
// Effects
string memory uri = _createTokenURI(msg.sender, block.timestamp, msg.value);
_setTokenURI(tokenCounter, uri);
tokenCounter += 1;
// Interactions
_mint(msg.sender, tokenCounter);
}
Updates

Lead Judging Commences

n0kto Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Too generic

Support

FAQs

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