RebateFi Hook

First Flight #53
Beginner FriendlyDeFi
100 EXP
View results
Submission Details
Severity: high
Valid

Incorrect Buy/Sell Classification in _isReFiBuy()

Root + Impact

Description

// Root cause in the codebase with @> marks to highlight the relevant section

Risk

Likelihood:

  • Every swap calling _beforeSwap relies on this logic. Thus, misclassification affects all swaps** **in ReFi pools.

Impact:

  • Incorrect fee applied (buyers charged sell fee and vice-versa)

Proof of Concept

Recommended Mitigation

  • Use correct swap direction logic:

- if (IsReFiCurrency0) {
- return zeroForOne;
- }
- else {
- return !zeroForOne;
- }
+ if (IsReFiCurrency0) {
+ return !zeroForOne;
+ }
+ else {
+ return zeroForOne;
+ }
Updates

Lead Judging Commences

chaossr Lead Judge 12 days ago
Submission Judgement Published
Validated
Assigned finding tags:

Inverted buy/sell logic when ReFi is currency0, leading to incorrect fee application.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!