RebateFi Hook

First Flight #53
Beginner FriendlyDeFi
100 EXP
View results
Submission Details
Severity: low
Valid

Error calculating the feeAmount inside the _beforeSwap function

Description

The _beforeSwap function has an incorrect calculation of the feeAmount, because the Uniswap V4 uses the basis points system:

  • 1_000_000: 100%

  • 100_000: 10%

  • 10_000: 1%

  • 1_000: 0,1%

  • 100: 0,01%

Where the number that represents 100% is 1_000_000, but the code is using the 100_000 value.

Impact

With the wrong calculation of feeAmount, the value emitted will be wrong, and they will be emitting false data.

Proof of Concept

Line 166:

fee = sellFee;
uint256 feeAmount = (swapAmount * sellFee) / 100000; // HERE
emit ReFiSold(sender, swapAmount, feeAmount);

Recommended Mitigation

Change 100000 (10%) to 1_000_000 (100%):

fee = sellFee;
- uint256 feeAmount = (swapAmount * sellFee) / 100000;
+ uint256 feeAmount = (swapAmount * sellFee) / 1_000_000;
emit ReFiSold(sender, swapAmount, feeAmount);
Updates

Lead Judging Commences

chaossr Lead Judge 11 days ago
Submission Judgement Published
Validated
Assigned finding tags:

Incorrect denominator (100000 instead of likely 1000000 or 10000) in fee calculation for ReFiSold event.

Support

FAQs

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

Give us feedback!