If we talk in simple terms, this protocol lets users join the tournament/event after they deposit some assets, takes a fee from them, and distributes the assets to the winners.
Interestingly enough, there's a question one would ask, "What would happen if there were no winner?". Turns out, it will be a major critical scenario as only those users are allowed to withdraw who are termed as winners.
With this, all assets are literally stuck in the contract with no escape route. The shares users hold are nothing but some funny pixels on the screen. At the end, this protocol will act like a black hole for funds.
Likelihood: Medium/Low
Reaching such a condition won't be a piece of cake. In case a lot of people tend to participate, then the chances of all teams being selected increase.
Only requires one team to be unpicked
Impact: High
Total loss of all user funds (post-fee)
Irrecoverable - no user or owner can access funds
Shares become worthless.
Erodes trust in the protocol among users.
Break core protocol promise.
Add this test_ZeroWinners_LockAllFunds test in briVault.t.sol:
Run the above test using:
Logs:
Apply an if-else condition in the withdraw() function, which refunds in case we have no winner, i.e. totalWinnerShares == 0
Additionally, we can auto-refund all with the help of ChainLink Automation after a timeout if totalWinnerShares == 0
When no one bet on the winning team, making totalWinnerShares = 0, causing division by zero in withdraw and preventing any withdrawals.
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.