_isReFiBuy Function Leads to Incorrect LP Fee CollectionIn normal ReFi token transactions, the hook contract should apply different fee rates based on the transaction direction: 0% fee for buying ReFi to encourage accumulation, and 0.3% fee for selling ReFi to discourage selling.
Due to a logical error in the _isReFiBuy function, the buy and sell directions are completely reversed, resulting in actual fee collection that is the opposite of the expected economic model.
Likelihood:
This erroneous logic is triggered every time a user executes a ReFi token transaction.
All pools using this hook contract will continuously be affected by the incorrect fee strategy.
The incorrect direction judgment cannot be fixed through simple configuration after contract deployment and requires redeployment.
Impact:
The economic model is completely ineffective: high fees are actually charged for buying behavior, while zero fees are provided for selling behavior.
User behavior is incorrectly incentivized: encouraging users to sell ReFi tokens instead of accumulating, which contradicts the goal of regenerative finance.
Protocol revenue loss: Due to charging fees in the wrong direction, the actual fee income may be much lower than expected.
User trust damage: The user experience does not match the advertised economic incentives, which may cause community dissatisfaction and trust crisis.
Add the function test__beforeSwap_Wrong_isReFiBuy in RebateFiHookTest.t.sol as follows:
Run: forge test --mt test__beforeSwap_Wrong_isReFiBuy -vv
Console output:
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.