The sellPoolTokens function is intended to allow users to sell pool tokens in exchange for WETH. Users input how many pool tokens they want to sell in the poolTokenAmount parameter. However, the function currently miscalculates the swapped amount.
This is because the swapExactOutput function is called, whereas the swapExactInput function is the one that should be called. Because users specify the amount of input tokens, not output tokens.
Users will swap the wrong amount of tokens, this is unintended for what the user wants.
The test below fails showing that the user does not receive the expected amount of WETH back
--Foundry
It is recommended to use the swapExactInput function instead of the swapExactOutput function. This will also require changing the sellPoolTokens function to accept a new parameter.
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.