Last Man Standing

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

Missing Previous King Payout Logic

Root + Impact

Description

  • Normally, when a new player claims the throne, a portion of the claim fee should be paid to the previous king as an incentive for participation.

  • The current implementation declares a previousKingPayout variable but never assigns it or pays the previous king, so dethroned players receive nothing.

uint256 previousKingPayout = 0; // @> This is always zero and never paid out
// No code to pay previous king

Risk

Likelihood:

  • This will occur every time a new player claims the throne after the first claim.

  • Previous kings will never receive any payout, regardless of how the game is played.

Impact:

  • Players have no incentive to participate, as they cannot earn rewards for being dethroned.

  • The game's economic model is broken, reducing user engagement and fairness.

Proof of Concept

// 1. Alice claims the throne (currentKing = Alice)
// 2. Bob claims the throne (currentKing = Bob)
// previousKingPayout is 0, Alice receives nothing

Recommended Mitigation

- uint256 previousKingPayout = 0;
- // No payout to previous king
+ uint256 previousKingPayout = (sentAmount * PREVIOUS_KING_PERCENTAGE) / 100;
+ if (currentKing != address(0)) {
+ (bool success, ) = payable(currentKing).call{value: previousKingPayout}("");
+ require(success, "Game: Failed to pay previous king");
+ }
Updates

Appeal created

inallhonesty Lead Judge about 2 months 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.