Skip to content

State Transition Function (STF)

STF is a pure function that takes a block and current state and returns new state. No external dependencies, operates deterministically.

Streaming Execution Flow

With streaming execution, transactions execute immediately:

Streaming Execution Flow

Transaction Execution

When a transaction arrives:

Transaction Execution

RFQ Submit Validation

All of the following are validated when creating a thesis:

#ValidationDescription
1DeadlineThesis expiration time not passed
2Oracle HealthLast oracle update within 3 seconds
3Market StatusMarket is active
4BlacklistUser not on blacklist
5Bet LimitsBet amount within min/max range
6Market OIMarket total OI limit not exceeded
7User OIUser individual OI limit not exceeded
8Solver SignatureSolver agreed to this quote
9BalancesUser and solver have sufficient balance

Transaction rejected if any fails.

Box Thesis Settlement

Box theses observe price range over the entire time window:

Box Settlement

Settler-Based Settlement

Settlement is primarily handled by the external Settler service via SystemSettle transactions.

:::info Internal Settlement Function The engine also contains an internal auto_settle_eligible_theses() function used for testing and as a fallback mechanism. In production, the Settler service is the primary settlement mechanism for better scalability and fault isolation. :::

Settler Sequence

Settlement Flow:
  1. Settler monitors active theses via WebSocket
  2. Settler receives oracle price updates in real-time
  3. For each thesis, checks price at 100ms intervals
  4. If breach found → Submit SystemSettle(SolverWins) TX
  5. If deadline passed without breach → Submit SystemSettle(UserWins) TX

Thesis Lifecycle

Thesis Types

Currently only Box theses are supported:

TypeDescriptionSettlement
BoxPrice must stay in range for entire windowSettler: breach detected or user wins on timeout

User wins if price never leaves the range during the observation window. Solver wins if the Settler service detects a breach and submits a SystemSettle(SolverWins) transaction.