0

I want to be able to make dynamic multi pools swaps in my smart contract. My plan is to use the exactInput function found here: https://github.com/Uniswap/v3-periphery/blob/main/contracts/interfaces/ISwapRouter.sol#L26

However I can't figure out how I can create the path variable. I would think uniswap has a utility somewhere to interact with the Auto Router but I can't seem to find it

I'm pretty sure the Auto Router is exposed here, but I can't figure out where its deployed: https://github.com/Uniswap/routing-api

4
  • The auto routing part is done offchain. So you can use the API to get the path and pass it to your contract
    – 0xSanson
    Commented Jun 27 at 10:05
  • Thats what im trying to figure out. Which API? I cant seem to find any documentation about how to get the swap path
    – morraez
    Commented Jun 27 at 21:47
  • Maybe here docs.uniswap.org/sdk/v3/guides/swaps/routing
    – 0xSanson
    Commented Jun 28 at 9:27
  • Thanks this led me to the correct answer!
    – morraez
    Commented Jul 5 at 11:56

1 Answer 1

2

I figured it out. You can get the path if you copy the following code example

https://github.com/Uniswap/examples/blob/main/v3-sdk/routing/src/libs/routing.ts#L40

The example is broken if you use the latest versions of the uniswap sdks libraries. So make sure you are using the same version as the example

    "@uniswap/sdk-core": "^3.1.0",
    "@uniswap/smart-order-router": "^3.0.6",
    "@uniswap/v3-sdk": "^3.9.0",

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.