Skip to main content

Market resolution

Layrs markets are binary contracts on a price boundary. Every market resolves to exactly one of three outcomes — UP, DOWN, or PUSH — determined entirely inside the attested enclave from a signed price oracle. This page describes precisely how that determination is made, what inputs are required, and what happens when those inputs are unavailable.

What resolution decides

Each market is a binary UP/DOWN/PUSH contract on a price boundary. Resolution compares the market's price at two moments: the opening boundary and the closing boundary. The comparison of two median prices — one at each boundary — yields the outcome.

There is no discretionary component, no human adjudication, and no external "resolver" role. The outcome is a deterministic function of the oracle samples collected at the two boundaries.

The oracle: signed Pyth Pro

Resolution uses the signed Pyth Pro feed (feed 245). The oracle adapter does not consume a single price point. Instead, at each boundary it collects a fixed, authenticated sample set and reduces it to a single median value.

For each of the opening and closing boundaries, the adapter must collect:

  • Exactly 25 authenticated samples, taken at 200 ms spacing, across the 5 seconds ending at the boundary — the half-open interval (T-5s, T].
  • Each of those 25 samples must report at least 3 publishers.
  • Each sample retains its signed EVM payload.

The 25 samples spaced 200 ms apart span exactly the 5-second window (T-5s, T]. The requirement of at least three publishers per sample is a per-sample gate: a sample that does not meet it does not count toward a complete window.

From 25 samples to one price

At each boundary, the adapter takes the 25 collected samples, sorts them by price in E8 fixed-point representation, and selects the 13th sorted E8 price — the median of the 25. This is done independently for the opening boundary and the closing boundary, producing an opening median and a closing median.

The adapter commits the underlying signed payloads, computes the 13th-sorted-E8 median at each boundary, signs the resulting statement, and sends it to the enclave. The enclave applies the outcome rule.

The outcome rule

Given the opening median and the closing median:

ConditionOutcome
closing median > opening medianUP
closing median < opening medianDOWN
closing median = opening median (exact equality)PUSH

Equality is exact equality on the E8 median values. Any nonzero difference resolves directionally to UP or DOWN; only an exact tie produces a PUSH.

No fallback, no deadline

Layrs deliberately does not provide an alternate price source or a recovery deadline for resolution:

  • No recovery deadline. There is no time limit after which resolution is forced through with degraded inputs.
  • No alternate source. There is no secondary oracle or backup feed that substitutes for the required Pyth window.
  • A missing valid Pyth window pauses resolution indefinitely. If a complete, valid window cannot be assembled at a boundary — for example, insufficient authenticated samples, or samples failing the three-publisher requirement — resolution does not proceed. It pauses, and it stays paused until a valid window exists.
  • Binance is intentionally not a launch fallback. This is a deliberate design decision, not an omission.

The design choice here is explicit: a market resolves only on a fully valid signed Pyth window, or it does not resolve at all. Correctness is preferred over liveness at the boundary — the protocol would rather pause a resolution indefinitely than settle on inputs that do not meet the sampling and publisher requirements.

Where resolution runs

Signed Pyth resolution executes inside the attested enclave. Chain and Pyth connectivity live outside the enclave (on the host), but the resolution logic that consumes the signed samples and produces the UP/DOWN/PUSH statement is part of the enclave's authoritative boundary, alongside deterministic price-time matching, balance accounting, and the encrypted hash-chained journal.

Because resolution is enclave-side, the same guarantees that protect matching apply: the outcome is derived deterministically from authenticated inputs, and the computation is bound to the enclave measurement (PCR0, SHA-384) that clients verify via attestation.

After resolution: settlement

Resolution determines the outcome; settlement moves the result on-chain. On-chain settlement occurs via batchSettle on the MatchSettlement contract, using the EIP-712 domain { name: 'LayrsMatchSettlement', version: '1', chainId: 26514 }. A batch is a list of netted fills plus a deadline, signed by the enclave — what reaches the chain is the netted batch, not per-user orders.

Reading a resolution

The public API exposes resolutions per market:

GET /v1/resolutions/{marketId}

This is a public read model. As with all Layrs public surfaces, it reflects published results rather than any per-user private state.