Under normal behavior, the _isReFiBuy function should correctly determine whether the current swap is buying the ReFi token or selling it.
To do this, the function must consider two things:
whether ReFi is currency0 or currency1 in the pool
the direction of the swap, defined by the zeroForOne flag:
zeroForOne = true means swapping currency0 → currency1
zeroForOne = false means swapping currency1 → currency0
However, the current implementation only checks whether ReFi is currency0 and does not properly combine this with the swap direction.
Because of this, the function often returns the wrong result — identifying a sell as a buy, or a buy as a sell.
Likelihood:
Every swap that involves the ReFi token goes through _isReFiBuy. Since the function misclassifies buy/sell direction, the wrong branch is taken on every single swap involving ReFi.
Any user, bot, or LP (=liquidity provider) interacting with this pool triggers the faulty logic automatically — no special conditions or rare edge cases are required.
Impact:
Buy swaps can be treated as sells and charged a high sell fee, creating unexpected losses for users.
Sell swaps can be treated as buys and charged the low buy fee, causing the protocol to lose revenue and completely breaking the intended tokenomics.
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.