Normal Behavior: The protocol intends to collect fees from "Sell" transactions to "generate protocol revenue" and allow the owner to withdraw these accumulated tokens.
Specific Issue: The _beforeSwap hook returns the LPFeeLibrary.OVERRIDE_FEE_FLAG. In Uniswap V4, this flag dictates that the specified fee is collected by the Pool Manager and distributed to the pool's liquidity providers (added to feeGrowthGlobal). The Hook contract itself does not receive these tokens. There is no logic (e.g., HOOK_SWAP_FEE flag or beforeSwapReturnDelta transfers) to capture these fees for the protocol.
Likelihood:
100%. The code implementation fundamentally routes fees to LPs, not the Hook/Protocol.
Impact:
Total Loss of Revenue: The protocol earns 0 fees.
Broken Admin Functionality: The withdrawTokens function is rendered useless as the contract never accumulates the fees it is supposed to withdraw.
I have developed a deterministic test case using Foundry that confirms the hook balance remains zero even after a high-fee swap is executed.
Step-by-Step Exploit:
Deploy ReFi and Hook.
Initialize Pool and add Liquidity.
Set Sell Fee to 10%.
Execute Swap (Sell ReFi).
Check Hook Balance.
Result: Hook Balance is 0.
POC Code:
(Paste this into test/RebateFiDeepExploit.t.sol)
To collect protocol revenue, the Hook should stop using the OVERRIDE_FEE_FLAG (which sends fees to LPs) and instead implement manual fee collection logic. This requires:
Enabling the ACCESS_LOCK_FLAG (or enabling access to take tokens) if not already available, or using the delta return to modify the swap balance.
Updating getHookPermissions to enable beforeSwapReturnDelta.
Returning a BeforeSwapDelta that reflects the fee taken by the hook, and transferring the tokens from the PoolManager to the Hook.
Implementation Example:
Alternatively, if the intention was only to direct fees to LPs, update the documentation and remove the withdrawTokens function to avoid misleading users about "protocol revenue".
Fee Scaling Mismatch: Event Logs Report 10x Higher Fees Than Actual Execution
Medium
Medium - Creates a critical discrepancy between the "observed" fee (via events/dashboard) and the "actual" fee charged. If admins set fees based on the event logs (e.g., aiming for "3%"), they will inadvertently set the actual protocol fee to "0.3%", resulting in 90% revenue loss (or 90% LP reward loss).
High - Deterministic math error.
Normal Behavior: Fee calculations in events should match the fee logic applied by the protocol to ensure transparency and correct administrative configuration.
Specific Issue:
Event Logic: The contract calculates the fee amount for the ReFiSold event using a denominator of 100,000. feeAmount = (swapAmount * sellFee) / 100000.
Protocol Logic: The contract passes sellFee directly to the Uniswap PoolManager via OVERRIDE_FEE_FLAG. Uniswap V4 typically interprets dynamic fees as having a denominator of 1,000,000 (100%).
Result: The event reports a fee percentage that is 10x higher than what Uniswap actually charges.
Likelihood:
100% of swaps with fees.
Impact:
Misleading Data: Users and Admins believe they are paying/charging X%, but are actually paying/charging X/10 %.
Configuration Error: An admin wanting a 3% fee might check the logs, see "3%", and leave the config. In reality, the fee is 0.3%.
I have developed a deterministic test case using Foundry that compares the fee reported in the event log vs the expected math.
Step-by-Step Exploit:
Set fee to 10,000.
Execute swap of 100 ETH.
Check Event Log.
Log says fee is 10 ETH (10%).
Actual Uniswap fee is 1 ETH (1%).
POC Code:
(Paste this into test/RebateFiDeepExploit.t.sol)
Align the denominators. If Uniswap V4 uses 1,000,000 scale (pips), update the event calculation to match.
still not sure about this
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.