Last Man Standing

First Flight #45
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: medium
Valid

Previous King Does Not Receive Promised Payout

Description

In the claimThrone() function, the game promises that the previous King should get a small cut of the new claim fee (as stated in the comment):

// If there's a previous king, a small portion of the new claim fee is sent to them.

However, in the actual code:

uint256 previousKingPayout = 0;

This silently violates the core game rule and causes the previous King to receive nothing, even though they were supposed to earn a reward for holding the throne.

This not only makes the game unfair but also damages user trust, and may cause players to stop participating once they realize the system is rigged or broken


Proof of Concept

Alice claims the throne with 0.1 ETH.
Bob claims the throne with 0.11 ETH.
Alice should receive a small payout from Bobs fee (e.g., 0.01 ETH).
But in the current implementation:
previousKingPayout = 0
No ETH is assigned or transferred to Alice.
Her reward is lost permanently.
This happens for every throne transfer.

Recommended Mitigation

Add a percentage value that defines how much of the claim fee should go to the previous king (e.g., previousKingCutPercentage).
Then, calculate the previous king’s payout from the amount sent by the new player (sentAmount), and store it safely like this

- uint256 previousKingPayout = 0;
+ previousKingPayout = (sentAmount * previousKingCutPercentage) / 100;
Updates

Appeal created

inallhonesty Lead Judge about 1 month ago
Submission Judgement Published
Validated
Assigned finding tags:

Missing Previous King Payout Functionality

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.