Skip to main content
The Market contract is the single entry point. Integrators do not call pools directly.

Discovery

One pool per (token, quote asset) pair, so pair resolution is deterministic. Pool creation emits:
Indexing that single event is sufficient to discover the full pool set.

Quoting

Two properties are deliberate and worth relying on. The quoter does not revert. An unavailable pool, a failed oracle read, a paused market or an empty pool all return available: false rather than reverting. Oracle calls are wrapped so that an oracle failure degrades to an empty quote. It is simulatable by anyone. It is a plain view with no caller requirement, so any indexer, router backend or solver can simulate it with eth_call without privileges, allowances or state. quoteSellToPool mirrors it for the sell side where enabled. The sell side ships disabled, see How C1 Pools Work.

Execution

buyFromPool is exact-output in token terms. Name a token amount and the market computes and pulls the cost. buyFromPoolExactQuote is exact-input in quote-asset terms. Name the quote amount you are spending. The cost pulled never exceeds the amount offered. buyFromPoolExactOut is exact-output with an optional funding callback, for callers that source the quote asset during the call rather than holding it beforehand. It invokes IFlowstateBuyFunder.fundBuy(quoteAsset, cost) on the caller only when the caller is a contract and its balance or allowance is short. Callers that pre-fund are unaffected and need not implement the interface. The callback semantics for intent fillers are covered in Settlement Patterns.

Settlement

Settlement is quote-asset only. The buyer leg is an ERC-20 transferFrom with msg.value == 0. There is no native-ETH path. Integrators approve the Market as spender. The Market pulls exactly the computed cost and forwards it to the pool.

Attribution

resellerCode is an optional attribution string. Pass an empty string if unused. Attribution is what links settled volume to an integration partner.

Depositor interface

Deposit through createPool for a new pair or contributeTokens for an existing pool. Positions are withdrawable via withdrawTokens, and proceeds are claimable from the pool via claimQuote and claimTokens.

Summary for an integrating router

  • One entry point, one pool per pair, one event to index for discovery.
  • A non-reverting view quoter that anyone can simulate without privileges.
  • Quote and execution read the same rate through the same path in the same block.