In the sellPoolTokens
function users specify the number of pool tokens they want to sell using the poolTokenAmount
parameter. However, the function currently miscalculates the swapped amount as shown on the PoC below. This issue arises because the swapExactOutput
function is called instead of the correct swapExactInput
function. Users provide the exact amount of input tokens, not the output amount.
sellPoolTokens
tokens is also missing a deadline check meaning users might inadvertently be selling at an unfavorable rate.
PoC - Copy this test into TSwapPool.t.sol
According to the test below, the user's actual balance is lower than the expected balance, indicating the user is selling for less.
Users will swap the wrong amount, resulting in losses.
Seeling tokens without deadline may occur at an unfavorable rates.
Manual review
Add a new parameter, for example, expectedWethAmount
, which represents the minimum amount of weth to be received
Add a deadline
parameter to be passed to swapExactInput
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.