Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get the full and right address[] path for swapExactTokensForTokens ? #165

Open
lidd77 opened this issue Jun 19, 2022 · 1 comment

Comments

@lidd77
Copy link

lidd77 commented Jun 19, 2022

hey,
when I call the next function :

function swapExactTokensForTokens(
  uint amountIn,
  uint amountOutMin,
  address[] calldata path,
  address to,
  uint deadline
) external returns (uint[] memory amounts);

I need to find the full path data .
As we know , there will have more than two pairs for address[] path, so how to get the right and full path result ?

@ghost
Copy link

ghost commented Dec 31, 2023

Just guess the path ( pair ) with enough liquidity to trade.

For example if you want to swap USDT against ETH the pair would be

path := [USDT, WETH];

And if you want to swap USDC for ETH but you want to route the USDC-USDT pair then it would be

path := [USDC, USDT, WETH];

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

No branches or pull requests

1 participant