First Flight #18: T-Swap

First Flight #18
Beginner FriendlyDeFiFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

Fee miscalculation in TSwapPool::getInputAmountBasedOnOutput

Summary

Wrong value of numerator in TSwapPool::getInputAmountBasedOnOutput

Vulnerability Details

The function TSwapPool::getInputAmountBasedOnOutput uses the value of 10000 in it's numerator but it must use 1000 instead.
By doing that it will use the 0.3 % fee which is represented in this case by doing 997 / 1000 in the function calculations

Impact

The method miscalculates fee which makes all methods that rely on it not giving the expected output.

Tools Used

Manual Review

Recommendations

- ((inputReserves * outputAmount) * 10000) /
+ ((inputReserves * outputAmount) * 1000) /
Updates

Appeal created

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Incorrect fee calculation in TSwapPool::getInputAmountBasedOnOutput causes protocol to take too many tokens from users, resulting in lost fees

Support

FAQs

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

Give us feedback!