The emergencyWithdraw() function in FeeCollector withdraws all tokens to treasury without resetting collectedFees state. This causes fee distribution to revert after emergency withdrawal since there are no tokens to distribute despite non-zero accounting.
The emergencyWithdraw() function transfers all tokens to treasury:
However, it doesn't reset collectedFees mapping. This means:
Contract's token balance becomes 0
collectedFees still shows non-zero amounts
Next distributeCollectedFees() call will revert due to insufficient balance
Contract becomes unusable after emergency withdrawal since fee distribution will always revert. Requires redeployment or manual token return.
Manual Review
Track emergency withdrawn amounts in state variables to maintain accounting. This on-chain tracking ensures fee distribution can resume correctly after treasury returns the withdrawn tokens to the contract.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.