How settlers work
Onchain rules that turn signed Pyth prices into a result.
A settler is a small contract on Base that holds one payoff rule. Each product names its settler and its parameters, such as the strike tick and the offsets of its levels. At the end of a cycle, the settler turns signed Pyth prices into a settlement value from 0 to 1. No person decides the result of a price market.
What a settler does
Every settler answers the same four questions for its product:
| Question | Example, for the hourly Spread |
|---|---|
| Are the product's parameters valid? | One price feed, and a strike offset larger than zero. |
| Which prices does it need? | BTC/USD at the first second and at the last second of the cycle. |
| What are the levels? | The rounded start price −$150 and +$150. |
| What is the settlement value, and its score? | Where the end price sits between the strikes, from 0 to 1. |
The settlement value is the payout ratio: the share of the $10 that the long side gets. The score tells the protocol how strong a proof is. The next section explains it.
Optimistic settlement
Scalar settles markets optimistically. The protocol accepts the first valid proof, then gives everyone a window to show a better one. This design is called a fault-proof optimistic settlement.
Anyone submits a proof
A proof is a set of signed Pyth Lazer price updates, one for each price that the settler needs. Anyone can call submitProof on the Scalar contract with one. Scalar runs a prover service that submits a proof for every market, but it has no special right to.
The contract checks every price
The contract checks the Pyth signature on each update. It also checks that each price is for the right feed, that it falls inside the cycle, that it is at a whole second and, where the settler asks for one, that it is at the exact second required. A forged or out-of-cycle price is rejected.
The settler scores the proof
The settler computes the settlement value and a score from the prices. A new proof replaces the current one only if its score is higher.
The window closes
If a proof has the top score, nothing can beat it, so the market resolves at once, after a 1-minute buffer. If not, the challenge window runs. When it closes, the best proof is final.
What the score means
A path-dependent payoff can hide its result. One second at a level is enough to touch it, and a proof that shows a quiet second does not show the touch. The score solves this. It is highest for the evidence that one side of the trade would want to hide:
- For a One-touch, a touch scores the top score, and a price with no touch scores 0. Anyone who saw the touch can prove it, and the touch always wins.
- For a Range accrual, the score is the short side's share. An earlier exit gives the short side more, so it scores higher. The earliest exit that anyone can prove wins.
- For a Knockout, a touch of the barrier scores the top score. Without a touch, the score is the short side's share.
- For an Above / Below or a Spread, the settler reads only fixed seconds. There is one correct proof, so it always has the top score.
A proof can only replace a weaker one. The result can move toward the truth, never away from it.
The settlers at a glance
| Settler | Prices it needs | When it resolves |
|---|---|---|
| Above / Below | Start price, end price | 1 minute after the first proof, after the cycle ends. |
| Spread | Start price, end price | 1 minute after the first proof, after the cycle ends. |
| One-touch | Start price, one price from any second of the cycle | 1 minute after a touch is proven, even mid-cycle. With no touch, when the window closes. |
| Range accrual | Start price, one price from any second of the cycle | When the window closes. An exit opens the window at once, even mid-cycle. |
| Knockout | Start price, end price, one price from any second | 1 minute after a touch is proven, after the cycle ends. With no touch, when the window closes. |
The challenge window is 1 hour on testnet today. Proofs are accepted until the window closes, which is one window after the cycle ends. If nobody proves a market by then, an operator resolves it.
Event markets
Some markets have no price to read, for example the number of goals in a tournament. These products have no settler. An operator submits their result, and the product's page says so. Every price market on Scalar uses a settler.
The settlers
Above / Below
Pays $10 if the price ends at or above the strike.
Spread
Pays in proportion to where the price ends between two strikes.
One-touch
Pays $10 the moment the price touches the level.
Range accrual
Pays more the longer the price stays inside the range.
Knockout
A ramp from the strike to the barrier, or $0 if the barrier is touched.
More settlers are in development, for example a payoff on the high-to-low range of a cycle and a payoff on one asset against another. A new payoff is a new settler. The order book, the collateral and the payout stay the same.