GivingThanks

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

Missing Event Emissions in Key Contract Functions

Summary

Vulnerability Details

Several critical functions (GivingThanks::donate, Charity::registerCharity, Charity::verifyCharity) execute important state changes without emitting corresponding events, reducing transparency and hindering monitoring, auditing, and debugging. Adding events for these functions would improve traceability, allowing stakeholders to better observe and verify contract activities. Increased transparency would enhance the overall auditability and debuggability of the system.

Impact

The absence of events for critical functions reduces transparency and hinders monitoring, auditing, and debugging.

Tools Used

Manual Review

Recommendations

I would recommend emitting event in this key functions in enhance transparency.

  • GivingThanks.sol file

+ event Donate(address donor, address charity, uint256 donatedAmount);
function donate(address charity) public payable {
require(registry.isVerified(charity), "Charity not verified");
(bool sent,) = charity.call{value: msg.value}("");
require(sent, "Failed to send Ether");
_mint(msg.sender, tokenCounter); // @audit-issue _mint is discouraged.
// Create metadata for the tokenURI
string memory uri = _createTokenURI(msg.sender, block.timestamp, msg.value);
_setTokenURI(tokenCounter, uri);
tokenCounter += 1;
+ emit Donate(msg.sender, charity, msg.value);
}
  • CharityRegistry.sol file

+ event RegisterCharity(address charity);
+ event VerifyCharity(address charity, bool _charityVerified);
function registerCharity(address charity) public {
registeredCharities[charity] = true;
+ emit RegisterCharity(charity);
}
function verifyCharity(address charity) public {
require(msg.sender == admin, "Only admin can verify");
require(registeredCharities[charity], "Charity not registered");
verifiedCharities[charity] = true;
+ emit VerifyCharity(charity, verifiedCharities[charity]);
}
Updates

Lead Judging Commences

n0kto Lead Judge 10 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.