The _isReFiBuy function determines whether a swap is buying or selling the ReFi token by checking the pool's currency ordering and swap direction. In a Uniswap V4 pool, zeroForOne = true means swapping currency0 for currency1, and zeroForOne = false means swapping currency1 for currency0.
The function contains inverted logic: when ReFi is currency0 and zeroForOne is true, the user is selling ReFi (giving ReFi to get currency1), but the function incorrectly returns true indicating a buy. Similarly, when ReFi is currency1 and zeroForOne is false, the user is selling ReFi, but the function returns false (sell), which happens to be correct by coincidence of the double inversion.
Likelihood:
Any swap involving the pool will trigger this incorrect logic.
Impact:
Buy transactions (which should have 0% fee) will incorrectly be charged the sell fee (default 3000 = 0.3%)
Sell transactions (which should have 0.3% fee) will incorrectly be charged the buy fee (0%)
Users buying ReFi tokens pay unexpected fees, reducing their received amount
Users selling ReFi tokens pay no fees when they should, causing protocol revenue loss
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.