fundContest() Can Be Called Multiple Times, Overfunding PotNormal behavior: The fundContest() function should only fund each contest once, transferring the exact totalRewards amount to the pot contract.
Issue: The function lacks a check to prevent multiple funding calls for the same contest. This allows the owner to repeatedly call fundContest() for the same contest index, transferring additional tokens beyond the intended totalRewards.
Each contest can be funded exactly once.
After funding, the pot contains exactly totalRewards tokens.
Subsequent calls to fundContest() for the same contest should revert.
fundContest() can be called multiple times for the same contest.
Each call transfers totalRewards tokens from owner to pot.
Pot becomes overfunded (balance > recorded totalRewards).
Extra tokens are permanently locked in the contract.
Can occur if owner accidentally calls function twice.
Possible in automated scripts or multi-step contest creation processes.
No technical barriers prevent multiple calls.
Financial waste: Owner loses extra tokens sent to pot.
Locked funds: Overfunded tokens cannot be recovered.
Accounting mismatch: Pot balance ≠ recorded totalRewards.
Direct financial loss for contest owner.
No recovery mechanism for overfunded tokens.
Breaks core contract invariant: one funding per contest.
This PoC demonstrates the bug in a real deployment scenario:
Normal operation: First fundContest() transfers correct amount.
Bug demonstration: Second fundContest() transfers another full amount, overfunding the pot.
Result: Pot contains double the intended tokens.
Expected Output:
Add a balance check before transferring tokens:
Prevents waste: Owner cannot accidentally send extra tokens.
Clear feedback: Reverts with descriptive error message.
Maintains invariant: One funding per contest guaranteed.
Backward compatible: Doesn't break existing contest logic.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.