When a new player claims the throne, the contract intends to:
Pay 10% of the previous claim fee to the previous king as an incentive.
Charge a platform fee that doesn’t exceed the remaining balance after that payout.
However, in the original implementation:
The previousKingPayout is declared and set to 0.
As a result, the platform fee calculation is incorrect since it assumes previousKingPayout is 0.
This causes the bypassing the check of currentPlatformFee > (sentAmount - previousKingPayout).
This occurs every time a new king claims the throne.
Loss of Funds: The previous king never receives their intended 10% reward.
Excess Platform Fees: The platform takes more than the intended fee, breaking economic balance.
Trust Violation: Players will lose trust due to incorrect fund distribution.
In the broken contract, the previousKingPayout is not initialized or paid. So this line:
is effectively:
Which never triggers, because currentPlatformFee is a % of sentAmount. But in reality, sentAmount - previousKingPayout is meant to cap the fee after paying out the previous king.
Explicitly assign the previousKingPayout before platform fee logic.
Transfer the amount to currentKing (i.e., the previous king).
Adjust the fee cap to subtract that amount.
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.