MyCut

First Flight #23
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Valid

There are no events emitted in `ContentManager` contract when critical functions are called

Summary

There are no events emitted when critical functions like ContestManager::createContest, ContestManager::fundContest, or ContestManager::closeContest are called. This makes it harder to track and audit contract interactions on the blockchain.

Impact

Events are critical for off-chain systems to track state changes in a contract. If certain actions are not logged via events, external applications (such as user interfaces or analytics platforms) may miss important information, reducing transparency and usability.

Tools Used

Manual code inspection

Recommendations

Add events for tracking critical functions like ContestManager::createContest, ContestManager::fundContest, and ContestManager::closeContest:

+ event ContestCreated(address indexed contest, uint256 totalRewards);
+ event ContestFunded(address indexed contest, uint256 amount);
+ event ContestClosed(address indexed contest);
function createContest(address[] memory players, uint256[] memory rewards, IERC20 token, uint256 totalRewards) public onlyOwner returns (address) {
// Create a new Pot contract
Pot pot = new Pot(players, rewards, token, totalRewards);
contests.push(address(pot));
contestToTotalRewards[address(pot)] = totalRewards;
+ emit ContestCreated(address(pot), totalRewards);
return address(pot);
}
function fundContest(uint256 index) public onlyOwner {
Pot pot = Pot(contests[index]);
IERC20 token = pot.getToken();
uint256 totalRewards = contestToTotalRewards[address(pot)];
if (token.balanceOf(msg.sender) < totalRewards) {
revert ContestManager__InsufficientFunds();
}
token.transferFrom(msg.sender, address(pot), totalRewards);
+ emit ContestFunded(address(pot), totalRewards);
}
function closeContest(address contest) public onlyOwner {
_closeContest(contest);
+ emit ContestClosed(contest);
}
Updates

Lead Judging Commences

equious Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Missing Events

Support

FAQs

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