A strict contract Ether balance requirement can brick all withdrawals
The withdrawal function requires that the contract's Ether balance MUST be equal to the fee earned. This is based on an assumption the the fee will be the leftover after the contest has closed. However, this calculation ignores Solidity integer rounding-down.
Scenario:
contest fee = 51
final entries left = 13
contract balance before selectWinner= 51 * 13 = 663
winner = 663 * 80 / 100 = 530.4 => 530 rounded down
fee recipient = 663 * 20 / 100 = 132.6 => 132 rounded down
contract balance after winner gets paid= 663 - 530 = 133
withdrawal call expects = 133 == 132
Withdrawal fee are forever stuck in the contract
Fee recipient should receive the contract balance ie leftover after winner calculation.
Remove line 158
Change Ln 133
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.