RebateFi Hook

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

Fee Amount in ReFiSold Event Is Mis-Scaled

Root + Impact

Description

The hook emits a ReFiSold event that includes a calculated feeAmount.
This value is intended to reflect the actual fee charged, which in Uniswap V4 uses 1e6 precision (e.g., 3000 = 0.3%).

However, the fee calculation in the event incorrectly divides by 100,000 (1e5) instead of 1,000,000 (1e6).
This makes the logged fee 10x larger than the real fee applied to the swap.

The issue only affects event reporting, not actual fee logic, but still leads to misleading economic and analytical data.

uint256 feeAmount = (swapAmount * sellFee) / @> 100000; // WRONG SCALE
emit ReFiSold(sender, swapAmount, feeAmount);

Risk

Likelihood:

  • Happens on every sell transaction.

  • Event systems, indexers, analytics, or dashboards will always record incorrect fee sizes.

Impact:

  • Logged fee values appear 10× larger than what users actually paid.

  • Misleads internal accounting, revenue tracking, dashboards, and data models.

  • Difficult for ecosystem participants to evaluate protocol performance or fee generation.

  • Can cause incorrect conclusions during audits or tokenomics reviews.

Proof of Concept

// Fee settings:
sellFee = 3000; // Should represent 0.3%
swapAmount = 100_000;
// Actual fee using correct scale:
// fee = 100000 * 3000 / 1e6 = 30 tokens
// Logged fee in the event:
// feeAmount = 100000 * 3000 / 1e5 = 300 tokens (10x too large)
// Event log example:
// ReFiSold(sender, 100000, 300) // Should have been 30

Event consumers now believe the user paid 300 tokens in fees instead of the real 30.

Recommended Mitigation

Use the correct Uniswap fee precision of 1e6.

- uint256 feeAmount = (swapAmount * sellFee) / 100000;
+ uint256 feeAmount = (swapAmount * sellFee) / 1000000;

This ensures event logs accurately reflect the same fee amount applied by the dynamic fee engine.

Updates

Lead Judging Commences

chaossr Lead Judge 8 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!