Documentation for eth_defi.uniswap_v3.utils.encode_path function.

encode_path(path, fees, exact_output=False)[source]

Encode the routing path to be suitable to use with Quoter and SwapRouter.

For example if we would like to route the swap from token1 -> token3 through 2 pools:
  • pool1: token1/token2

  • pool2: token2/token3

then encoded path would have this format: token1 - pool1’s fee - token2 - pool2’s - token3, in which each token address length is 20 bytes and fee length is 3 bytes

Read more.

  • path (list[eth_typing.evm.HexAddress]) – List of token addresses how to route the trade

  • fees (list) – List of trading fees of the pools in the route

  • exact_output (bool) – Whether the encoded path be used for exactOutput quote or swap

Return type