Uniswap/v3-sdk

Wrong minimumAmountOut calculation

hieuvo opened this issue · 1 comments

https://github.com/Uniswap/v2-sdk/blob/main/src/entities/trade.ts#L186
https://github.com/Uniswap/v3-sdk/blob/main/src/entities/trade.ts#L438

In both v2 and v3 sdk, the formula to calculate minimumAmountOut is
minimumAmountOut = amountOut / (1 + slippage)

But I believe it should be
minimumAmountOut = amountOut * (1 - slippage)

which one is correct? can you please explain about it @hieuvo