Submitted by cmichel
UniswapV3 expects a path object like (tokenA, feeAB, tokenB, feeBC, tokenC).
The UniV3Trader.swapExactOutput code tries to reverse this path to get to (tokenC, feeBC, tokenB, feeAB, tokenA) but thats not what the _reverseBytes function does.
Note that it reverts the entire encoded path byte array byte-by-byte which breaks the byte-order in a token.
For example, tokenA would have every single byte reversed and lead to a different token.
The UniV3Trader.swapExactOutput function with multi-hops is broken and cannot be used.
Dont reverse the path byte-by-byte but element-by-element.
0xleastwood (judge) commented:
0xleastwood (judge) commented:
