pub fn encode_v3_path_exact_output(
token_in: Address,
path: &[SwapHop],
) -> Result<Vec<u8>, Web3Error>Expand description
Encodes a multi-hop swap path for Uniswap V3’s exactOutput function.
For exactOutput swaps, the path must be encoded in reverse order (tokenOut first, tokenIn last). This function takes a path in the logical order (tokenIn to tokenOut) and reverses it automatically.
§Arguments
token_in- The input token address (first token in the logical path)path- The swap path as a sequence of (token, fee) hops
§Returns
The encoded path as bytes in reversed order, suitable for exactOutput calls