Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

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

Open
JulioSarda opened this issue Aug 12, 2022 · 0 comments

Comments

@JulioSarda
Copy link

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 ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant