v3-sdk icon indicating copy to clipboard operation
v3-sdk copied to clipboard

Doesn't seem like this library can execute trades without a TickDataProvider

Open drachs opened this issue 3 years ago • 10 comments

The library doesn't include the code for one (Just the interface), and there's no instructions for how to write one in the documents. None of the functionality for executing trades or estimating the price of trades works without one.

Am I missing something?

drachs avatar Jul 14 '21 00:07 drachs

Can someone please give a solution for this problem? Can’t implement anything without TickDataProvider and no one tells me how I can make it.

NoahChoi00 avatar Jul 19 '21 13:07 NoahChoi00

a common pattern is to use createUncheckedTrade and use the Quoter, see e.g. https://github.com/Uniswap/uniswap-interface/blob/main/src/hooks/useBestV3Trade.ts

sorry, docs on this coming soon.

NoahZinsmeister avatar Jul 28 '21 19:07 NoahZinsmeister

Any update here ?

Ryanklingert avatar Aug 16 '21 21:08 Ryanklingert

Related: Using Trade.exactIn() fails with error No tick data provider was given:

const swapRoute = new Route([swapPool], wethToken, usdcToken)
const trade: Trade<Currency, Currency, TradeType> = await Trade.exactIn(swapRoute, amountToSwap)

I don't want to use Trade.createUncheckedTrade(). That takes an input amount and an output amount. I don't know or care much what the output amount is. I know my input amount (and my route).

Are you saying that Trade.exactIn() isn't really implemented in the SDK?

Also, the source URL above from @NoahZinsmeister is now a 404.

eliotstock avatar Mar 21 '22 01:03 eliotstock

Hey, bumping this up. Having the same issue

a-straus avatar May 07 '22 19:05 a-straus

https://discord.com/channels/597638925346930701/607978109089611786/972959141402386482

This seemed to help. I am not sure why the code requires that there be an equal amount of netLiquidity between all ticks in a tickListDataProvider.

@NoahZinsmeister could you perhaps comment on this? I'm happy to put in a PR that gets rid of this necessity, because it seems unnecessary. If I remove the invariant() that requires netLiquidity=ZERO from my local package, then my pool swaps work just fine in their estimation. It seems needlessly complicated to require users to have a tickList that has net 0 liquidity

EDIT: @Yorkemartin because I see this has been assigned to you

a-straus avatar May 15 '22 21:05 a-straus

I too have the same issue. any pointers?

emadtps avatar Jun 17 '22 11:06 emadtps

I'm having this exact same issue, seems this is not resolved yet? I see that the example uses quote (https://github.com/Uniswap/examples/blob/main/v3-sdk/trading/src/libs/trading.ts#L58), which I will have to do as well I suppose, but as mentioned above, I don't want to care about the output amount if there's an exactIn function.

bsproul avatar Jan 09 '23 16:01 bsproul

Any Clear solution for that Trying to use Trade.bestTradeExactIn but getting this error

Taha-daboussi avatar Aug 11 '23 16:08 Taha-daboussi

If you construct a Pool without a TickDataProvider it's not possible to make accurate simulations. You can read the whitepaper to understand why Pools will always have 0 net liquidity in total. If you try to make a trade on any Uniswap Pool and "not care" about the output, i.e. accept 100% slippage, a sandwich bot will exploit your trade and steal most of it.

There are solutions to prevent that, for example using an MEV protection service, but this was not available when this sdk was written.

Florian-S-A-W avatar Sep 14 '23 12:09 Florian-S-A-W