Normal behavior:
In king-of-the-hill-style blockchain games, it is common practice to reward the previous king with a portion of the ETH used by the new challenger to claim the throne. This incentivizes early participation and increases player engagement, since dethroned players can still earn partial rewards.
Issue:
While the claimThrone()
function defines a variable previousKingPayout
and includes a defensive check to ensure the platform fee doesn't exceed available funds after such a payout, the actual logic to compute or transfer the previous king's share is completely missing. The previousKingPayout
is never updated, and no ETH is reserved or assigned to the previous king.
This results in zero compensation for dethroned players, despite the code suggesting such a mechanism was intended.
Likelihood:
Always occurs when a new player claims the throne.
The previousKingPayout
variable is always 0
, because it is never set.
Impact:
The previous king receives no compensation, which reduces the game’s fairness.
Players have less incentive to participate early, resulting in lower claim activity and smaller pots.
Misleads readers or developers expecting a previous-king payout due to the presence of related logic.
Implement logic to allocate a portion of the new claim fee to the previous king, using a configurable percentage (previousKingRewardPercentage
) or a fixed share:
You would also need to add a new state variable:
And set it during the constructor or via an onlyOwner
setter.
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.