MyCut

AI First Flight #8
Beginner FriendlyFoundry
EXP
View results
Submission Details
Severity: low
Valid

Missing events for contest creation, funding, and closing

Root + Impact

Description

  • The protocol performs critical state-changing and fund-moving actions — creating a contest, funding it, and closing/distributing it — without emitting any events.

  • Without events, off-chain systems (indexers, dashboards, monitoring, users) cannot reliably observe contest lifecycle actions, making the protocol harder to track, audit, and integrate with.

/ src/ContestManager.sol — no events emitted
function createContest(...) public onlyOwner returns (address) {
Pot pot = new Pot(players, rewards, token, totalRewards);
contests.push(address(pot));
contestToTotalRewards[address(pot)] = totalRewards;
@> return address(pot); // no ContestCreated event
}
function fundContest(uint256 index) public onlyOwner { ... } // no ContestFunded event
function closeContest(address contest) public onlyOwner { ... } // no ContestClosed event

Risk

Likelihood:

  • Always — no events exist for any lifecycle action.


Impact:

  • Reduced transparency and observability; harder monitoring, debugging, and third-party integration. No direct loss of funds.


Proof of Concept

N/A

Recommended Mitigation

Declare and emit events for each significant action:

+ event ContestCreated(address indexed contest, address indexed token, uint256 totalRewards);
+ event ContestFunded(address indexed contest, uint256 amount);
+ event ContestClosed(address indexed contest);
function createContest(...) public onlyOwner returns (address) {
Pot pot = new Pot(players, rewards, token, totalRewards);
contests.push(address(pot));
contestToTotalRewards[address(pot)] = totalRewards;
+ emit ContestCreated(address(pot), address(token), totalRewards);
return address(pot);
}
Updates

Lead Judging Commences

ai-first-flight-judge Lead Judge about 2 hours ago
Submission Judgement Published
Validated
Assigned finding tags:

[L-02] Lack of events which reduces transparency and difficulty in monitoring

**Description** The `ContestManager` contract lacks event emissions for critical actions such as creating, funding, and closing contests. Events are crucial in Solidity contracts for logging important actions, as they provide an immutable record on the blockchain that can be indexed and queried by off-chain applications. Without these events, tracking the state and history of the contract becomes difficult, which can hinder monitoring, debugging, and auditing efforts. **Impact** - **Visibility**: Without events, external parties (such as users or monitoring systems) cannot easily track when contests are created, funded, or closed. This lack of visibility can lead to difficulties in verifying the correct operation of the contract. - **Debugging**: Developers and auditors will find it more challenging to diagnose issues or verify contract behavior without event logs. In the event of a bug or issue, the absence of events makes it harder to trace the sequence of actions leading up to the problem. - **Transparency**: Participants in the contests might not have a clear understanding of the state of the contract, which could lead to mistrust or uncertainty. **Proof of Concepts** The following functions in the `ContestManager` contract are identified as lacking event emissions: - `createContest` - `fundContest` - `closeContest` For example, in the `createContest` function: ```solidity function createContest(address[] memory players, uint256[] memory rewards, IERC20 token, uint256 totalRewards) public onlyOwner returns (address) { Pot pot = new Pot(players, rewards, token, totalRewards); contests.push(address(pot)); contestToTotalRewards[address(pot)] = totalRewards; // No event emitted to signal that a new contest has been created. return address(pot); } ``` **Recommended Mitigation:** Add event declarations and emit statements in the contract to log significant actions. ```solidity event ContestCreated(address indexed contestAddress, uint256 totalRewards); event ContestFunded(address indexed contestAddress, uint256 amount); event ContestClosed(address indexed contestAddress); ```

Support

FAQs

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

Give us feedback!