The purpose of _beforeInitialize in ReFiSwapRebateHook is to ensure that the ReFi token is present in every pool that uses this hook (so rebates can be paid in ReFi).
The current check contains a copy-paste error: it compares currency1 with ReFi twice, making the condition always true when currency1 is not ReFi and completely ignoring currency0. As a result, pools where ReFi is currency0 (the conventional ordering for most pairs) are rejected, while only pools with ReFi as currency1 are allowed.
Likelihood:
Every pool creation where ReFi is sorted as currency0 (the vast majority of pairs, because Uniswap V4 canonical ordering puts the lower-address token as currency0) triggers the revert
Any front-end or script that follows the standard token ordering will fail to create the pool
Impact:
Intended pools (e.g., USDC/ReFi, WETH/ReFi) cannot be initialized when ReFi has the higher address and therefore becomes currency1
The hook becomes effectively limited to only exotic pairs where ReFi is the lower-address token, severely restricting usability
Users and integrators waste time and gas on failed transactions
Add the following code snippet to the RebateFiHookTest.t.sol test file.
This snippet of code is to demonstrate that the pool will revert when trying to initialize the pool with ReFi token as currency 0 and ERC20 token as currency 1.
Possible mitigation is to check if the currency 0 token is ReFi.
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.