Root + Impact
Description
The fee amount calculation for the `ReFiSold` event uses an incorrect denominator, resulting in fees being reported as 10x higher than actual.
**Description**:
* The normal behavior expects fees to be calculated correctly for event emission to reflect the actual fee charged by the protocol.
* The issue occurs in the `_beforeSwap` function where the fee amount is calculated using `/ 100000` instead of `/ 1000000`, causing the event to emit incorrect fee amounts (10x higher than actual).
**Root cause in the codebase**:
```solidity
uint256 feeAmount = (swapAmount * sellFee) / 100000;
```
According to `LPFeeLibrary.sol`, fees are represented in "hundredths of a bip" where `MAX_LP_FEE = 1,000,000` represents 100%. Therefore, a fee of 3000 represents 0.3% (3000/1,000,000), not 3% (3000/100,000).
Risk
Likelihood:
Impact:
-
* Off-chain systems monitoring events will receive incorrect fee data (10x inflated)
* Analytics dashboards and fee tracking systems will show wrong metrics
* Users and protocol monitoring tools will be misled about actual fees charged
Proof of Concept
The following demonstrates the incorrect fee calculation:
```solidity
uint256 swapAmount = 1000 ether;
uint24 sellFee = 3000;
uint256 feeAmount = (swapAmount * sellFee) / 100000;
uint256 feeAmount = (swapAmount * sellFee) / 1000000;
```
**Step-by-step execution:**
1. User initiates a sell swap of 1000 ReFi tokens
2. Hook's `_beforeSwap()` is called with `sellFee = 3000`
3. Fee calculation uses wrong denominator: `/ 100000` instead of `/ 1000000`
4. Event `ReFiSold` emits with `feeAmount = 300 ether` (10x inflated)
5. Off-chain systems reading the event see incorrect fee data
6. Analytics dashboards display wrong fee metrics to users
Recommended Mitigation
```diff
// src/RebateFiHook.sol:166
- uint256 feeAmount = (swapAmount * sellFee) / 100000;
+ uint256 feeAmount = (swapAmount * sellFee) / 1000000;
```