The TSwapPool::sellPoolTokens
function is intended to allow users to easily sell pool tokens and receive WETH in exchange. Users indicate how many pool tokens they're willing to sell in the poolTokenAmount
parameter. However, the function currently miscalculates the swapped amount, making the user spend more than intended to get the exact amount of WETH specified in the parameter.
Users will swap the wrong amount of tokens, which breaks the protocol functionality.
Add this to test/uint/TSwapPool.t.sol
Foundry and manual review
Recommended Mitigation: Consider changing the implementation to use swapExactInput
instead of swapExactOutput
. Note that this would also require changing the sellPoolTokens
function to accept a new parameter (ie minWethToReceive
to be passed to swapExactInput
).
Additionally, it might be wise to add a deadline to the function, as there is currently no deadline. Could expose users to MEV attacks.
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.