Docs
How routing works
What the quoter compares before it picks a route.
Every venue
The quote route reads pools from the factories and quoters in routing/src/addresses.ts, then calls each venue's quote function on the Elysium RPC. A venue that reverts or returns no output is dropped.
Hops and splits
A direct route is one hop. A two-hop route sells into WHYPE, USDC, or KNTQ, then into the token you receive. A split sends two shares of the input, after the fee, through two different direct pools. Share weights are in basis points and sum to 10000.
Fee and gas
The fee is taken from the input before the venue quote. feeAmount is amountIn times feeBps divided by 10000. The default feeBps is 20 when KNITX_FEE_BPS is unset. The contract rejects a fee above 100.
Gas for a route is 80000 plus the gas reported for each hop. That gas is multiplied by the RPC gas price, converted into output tokens using the best direct quote, and subtracted from the output. The largest remainder wins. Price impact compares the chosen route with a trade of one two-hundredth of the same input on the same path.