GivingThanks

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

Missing Event in `verifyCharity` Function


Description
The verifyCharity function allows the admin to verify a registered charity by adding its address to the verifiedCharities mapping. However, there is currently no event emitted to log this verification. Emitting an event is crucial for tracking charity verifications on the blockchain.

Code Snippet

function verifyCharity(address charity) public {
require(msg.sender == admin, "Only admin can verify");
require(registeredCharities[charity], "Charity not registered");
verifiedCharities[charity] = true;
}

Recommendation
Add an event declaration for charity verifications and emit this event within the verifyCharity function after successfully verifying the charity. This will provide a clear log of charity verifications on the blockchain.

Code Snippet

// Declare the CharityVerified event
event CharityVerified(address indexed charity);
function verifyCharity(address charity) public {
require(msg.sender == admin, "Only admin can verify");
require(registeredCharities[charity], "Charity not registered");
verifiedCharities[charity] = true;
emit CharityVerified(charity); // Emit the CharityVerified event
}

Updates

Lead Judging Commences

n0kto Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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