Open Linch1 opened 3 years ago
Hi @Linch1 and anyone else looking for an answer,
The best option for routing at the moment is the Universal Router or the corresponding SDK. To take a deep dive into the routing logic Uniswap uses take a look at the Smart Order Router.
I didn't find an option provided by Uniswap to only consider V2 pairs. You could use the V2 Subgraph to query all pairs and use a pathfinding algorithm to find routes between them, for example Bellman-Ford.
How can i retrive the Route for two tokens that have not a pair ?
The following code uses two tokens that doesn't have a pair on uniswap, and during the execution encouter an error that is reported below. The same code if applied on tokens with a pair works well ( forx example WETH and DAI ) , so i am wondering what i have to change to make this works also with tokens without a pair?
CODE
OUTPUT