Skip to main content

Quote Engine

The quote modules compute Reserve Asset exchanges from pool state. Call their public selectors through the Dispatcher.

FunctionOutput and purpose
quoteMultiswapCore reserve-only quote plus USD conversion; useful for inspecting the curve.
quoteMultiswapForExecutionSettlement quote including eligible Surplus behavior; returns token and accounting quantities.
quoteMultiswapForSettlementThe same settlement accounting plus priceOfUSD for display.

Each quote takes the pool address, pay QuoteAmount[], and receive QuoteAllocation[]. The latter two contain participating Reserve Asset snapshots encoded with packed Float values.

Calculation

The engine validates roles, amounts, uniqueness, and receive allocations. It evaluates pay value flows, allocates their sum across receive assets, inverts the PTE function for receive amounts, and separates receive fees. Settlement quotation then applies eligible Surplus behavior.

The normalized curve is monotone over the supported domain. Explicit inverse paths handle scale elasticities 0 and 1/2; other supported values use the bounded numerical solver.

Preview versus execution

Quotes can contain caller-supplied asset snapshots. Those snapshots support preview calculations. Execution rebuilds the participating asset state from the ledger and quotes the submitted intent again.

Preserve array order and derive token-unit minimums from current receive amounts. The source of a payout can change when Surplus inventory changes.

Other operations

LP liquidity has dedicated quote functions and proportionality rules. Deposit epochs use oracle-valued capitalization. Neither is represented by an arbitrary LP-and-reserve basket sent to multiswap.

Implementation sources: src/modules/quote/QuoteMultiswap.sol, QuoteMultiswapLib.sol, QuoteMathLib.sol, and QuoteValidationLib.sol.

Continue with Quote a Trade.