Rock Paper Scissors

First Flight #38
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: medium
Valid

Use `accumulatedFees` instead of this.balance causing some ether locked in the contract

Summary

When calculating the fees, in _finishGame and _handleTiefunction,due to the loss of precision by division,causing some ether left in the contract .

Use accumulatedFees instead of this.balance causing some ether locked in the contract.

Vulnerability Details

division will causing loss of precision,meaning some ether will be locked in the contract

function _handleTie()
uint256 fee = (totalPot * PROTOCOL_FEE_PERCENT) / 100;
uint256 refundPerPlayer = (totalPot - fee) / 2;
function _finishGame()
uint256 fee = (totalPot * PROTOCOL_FEE_PERCENT) / 100;

Impact

division will causing loss of precision,meaning some ether

Tools Used

manual review

Recommendations

use this.balance instead of accumulatedFees

Updates

Appeal created

m3dython Lead Judge 2 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Orphaned ETH due to Unrestricted receive() or Canceled Game

ETH sent directly to the contract via the receive function or after a canceled game becomes permanently locked

m3dython Lead Judge 2 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Orphaned ETH due to Unrestricted receive() or Canceled Game

ETH sent directly to the contract via the receive function or after a canceled game becomes permanently locked

Support

FAQs

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