TSwapPool::sellPoolTokens
Description:
The sellPoolTokens
function description states that it should swap a give amount of PoolTokens for weth, as such it should use swapExactInput
.But is uses swapExactOutput
which can cause for incorrect amount of tokens to swap instead of what user intended.
Impact:
Since the 3rd input parameter in swapExactOutput
is the outputAmount
and in the sellPoolTokens
sets i_wethToken
as outputToken as a result the poolTokenAmount
is set as outputAmount
which is actually wethAmount
not PT amount. this will result in reverts if the max approval is not made by user or if user doesnt have enough funds. but it also can cause higher or lower amount of PT tokens to be traded if the max approval is made and user has enough funds.
Proof of Concept:
in the test below we can see that user intended to sell 1e18 PTs, but more than intended amount was reducted from his balance.
Recommended Mitigation:
Use swapExactInput
instead of swapExactOutput
:
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.