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:
Transaction Execution
When a transaction arrives:
RFQ Submit Validation
All of the following are validated when creating a thesis:
| # | Validation | Description |
|---|---|---|
| 1 | Deadline | Thesis expiration time not passed |
| 2 | Oracle Health | Last oracle update within 3 seconds |
| 3 | Market Status | Market is active |
| 4 | Blacklist | User not on blacklist |
| 5 | Bet Limits | Bet amount within min/max range |
| 6 | Market OI | Market total OI limit not exceeded |
| 7 | User OI | User individual OI limit not exceeded |
| 8 | Solver Signature | Solver agreed to this quote |
| 9 | Balances | User and solver have sufficient balance |
Transaction rejected if any fails.
Box Thesis Settlement
Box theses observe price range over the entire time window:
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 monitors active theses via WebSocket
- Settler receives oracle price updates in real-time
- For each thesis, checks price at 100ms intervals
- If breach found → Submit
SystemSettle(SolverWins)TX - If deadline passed without breach → Submit
SystemSettle(UserWins)TX
Thesis Types
Currently only Box theses are supported:
| Type | Description | Settlement |
|---|---|---|
| Box | Price must stay in range for entire window | Settler: 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.
