previewFill, so a quote here cannot drift from the fill it predicts.
The swapper sits near the EIP-170 bytecode limit. Keeping convenience reads in the Lens leaves the
settlement contract smaller. Lens functions hold no state and never receive approvals or writes.
openOrders — the whole read, in one call
nextOffset stops advancing once the sweep reaches the end of the set, so a caller loops until it
does not move.
quoteFill — guard-aware preflight
previewFill prices only — by design it will happily quote a cancelled or expired
order. quoteFill adds the state, access, size, oracle, balance and allowance checks that a read-only
helper can evaluate, then returns the first problem instead of reverting. An interface can render
that reason rather than decode a revert.
The problems are checked in the order
fillOrder checks them, so the first one reported is the
first one a real call would hit. Pricing is delegated to previewFill and never recomputed here;
its maker-floor revert is caught rather than duplicated, because reproducing that comparison would
be a second copy of the rule, free to drift from the one that actually gates the fill.
config — the settings in one call
totalEscrowed — the solvency check
token, across every open order. Compare it against
token.balanceOf(swapper) − accruedFees(token) to audit solvency from outside.
It walks the whole open set, so it is for eth_call and ops dashboards — never for on-chain use.
When not to use the lens
Reach for the swapper directly when you are sending a transaction. The lens is a read path; the fill itself takes its arguments frompreviewFill on the swapper, which is the contract that will
execute them. For a responsive client, quote locally for display, confirm against previewFill
before building a transaction, and use the lens to read the book and explain why a fill would fail.
