SwapRouter
Stateless multi-hop quoter. Holds no funds, executes no swaps. Call via eth_call (functions are non-view because pool quotes may be non-view).
Instance: 0x16e3F29dDe22eF75C081A764C4d200Cd48647bcC.
struct Hop { address pool; address tokenIn; address tokenOut; }
quoteExactInput(Hop[] path, uint256 amountIn) returns (uint256 amountOut)
quoteExactOutput(Hop[] path, uint256 amountOut) returns (uint256 amountIn)Empty path → EmptyPath. Any hop revert (including FeeTooHigh / InsufficientOutput) fails the whole quote. There is no 0 meaning "no route".
Exact-output walks the path backwards using getAmountIn. Roundtrip: quoteExactInput(path, quoteExactOutput(path, X)) >= X (+1 wei safety per hop).
Hop[] memory path = new Hop[](2);
path[0] = Hop(poolA, usdt, voucher);
path[1] = Hop(poolB, voucher, other);
uint256 out = router.quoteExactInput(path, 100e6);