First Flight #18: T-Swap

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

`sellPoolTokens` is calculating w.r.to output instead of input

Summary

TSwapPoolTokens:sellPoolTokens() is called by user expecting protocol to give him weth by taking in his pool tokens i.e., he is trying to see pool tokens. instead, the sellPoolTokens is calling swapExactOutput() instead of swapExactInput considering user is inputing exact input tokens he wants to sell.

Also, the function should have a slippage protection additionally to protect user's from MEV attacks or any inflationary/deflationary attacks to help user get the value what he's expecting to get.

Recommendations

Make below code changes in TSwapPool.sol

function sellPoolTokens(
uint256 poolTokenAmount
) external returns (uint256 wethAmount) {
return
- swapExactOutput(...);
+ swapExactInput(...);
}
Updates

Appeal created

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

`sellPoolTokens` mismatches input and output tokens causing users to receive the incorrect amount of tokens

Support

FAQs

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