Quote and Swap Flow
The reference quote flow is pay-first, receive-second.
quoteMultiswap
-> quotePay
-> quoteReceive
Pay quote
Pay legs produce positive value flow. Each pay leg updates token reserve, token scale, and total scale.
valueFlow > 0
Receive quote
Receive legs consume the pay value flow through allocations.
valueFlow < 0
Allocation example:
60% USDT
40% ETH
The engine allocates receive-side value flow, solves reserve amounts, applies fees, and updates state for each receive leg.
Validation
A valid quote conserves value flow subject to fee handling and numerical tolerances.
sum pay valueFlow + sum receive valueFlow >= tolerance
Minimum receive
Integrators should submit minimum receive amounts for user protection. Minimums should reflect quote output, user slippage tolerance, and route risk.
Ordering
Receive allocations are processed in order. Use deterministic ordering for reproducible quotes.