Last Man Standing

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

Previous king does not receive portion of the new king claimFee

Root + Impact

Description

According to the documentation and to comments in the code, the previous king must receive part of the new king's claim fee. Function claimThrone declares a variable previousKingPayout taht is always 0 and that is never used to send ETH to the previous king.

uint256 sentAmount = msg.value;
uint256 previousKingPayout = 0;
uint256 currentPlatformFee = 0;
uint256 amountToPot = 0;
// Calculate platform fee
currentPlatformFee = (sentAmount * platformFeePercentage) / 100;
// Defensive check to ensure platformFee doesn't exceed available amount after previousKingPayout
if (currentPlatformFee > (sentAmount - previousKingPayout)) {
currentPlatformFee = sentAmount - previousKingPayout; //@audit no payment for previous
}

Risk

Likelihood: High

  • The previous king never receives ETH

Impact: High

  • The previous king loses funds

Recommended Mitigation

Add a mapping that will store pending payouts for previous kings so that they can claim their funds.

Updates

Appeal created

inallhonesty Lead Judge 10 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.

Give us feedback!