The _isReFiBuy() function determines whether a swap is buying or selling ReFi tokens based on the swap direction (zeroForOne) and which currency is ReFi. When zeroForOne is true, the user is swapping from currency0 to currency1. If ReFi is currency0, this means the user is selling ReFi, not buying it.
The function incorrectly returns true (indicating a buy) when ReFi is currency0 and zeroForOne is true, which is actually a sell operation. This inverts the entire fee structure.
Likelihood:
Every swap through a pool where ReFi is currency0 will have inverted fee logic
Every swap through a pool where ReFi is currency1 will have inverted fee logic
This affects 100% of all swaps in all pool configurations
Impact:
Users pay 0% fees when selling ReFi (intended: 0.3% to discourage dumping)
Users pay 0.3% fees when buying ReFi (intended: 0% to encourage accumulation)
The entire economic incentive model is backwards
Protocol fails to discourage sell pressure on ReFi tokens
Protocol fails to encourage ReFi token accumulation
Revenue model is broken as sells generate no fees
a simple solidity test to show how this can be implemented in the real world
A quick and simple mitigation to stop this and use the correct buying/selling logic
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.