Uniswap / v3-sdk

🛠 An SDK for building applications on top of Uniswap V3
MIT License
544 stars 416 forks source link

Difference in result between "quoteExactInputSingle" and "ExactInputSingleParams" #139

Open JulioSarda opened 1 year ago

JulioSarda commented 1 year ago

I have a process of monitoring price in TypeScript:

In Uniswap V3 ... let quotedAmountOut = await quoterContract.callStatic.quoteExactInputSingle( tokenIn, tokenOut, fee, amountIn.toString(), 0 ); ..

I have a Smart Contract: ... amountOut = swaprouter3.exactInputSingle( ISwapRouter.ExactInputSingleParams( { tokenIn: path[0], tokenOut: path[1], fee: fee, recipient: address(this),
deadline: block.timestamp, amountIn: amount, amountOutMinimum: 0, sqrtPriceLimitX96: 0 }) ); ...

return values ​​DO NO MATCH !!

In Uniswap v2:

Typescript: const amountsOut = await V2Router.getAmountsOut(amountIn, [tokenIn, tokenOut]);

Smart Contract amountOut = router2.swapExactTokensForTokens( amount, 0, path, address(this), // DESTINO: Contrato block.timestamp )[1];

return values YES MATCH !!

Why ?