NEMESISDocs
The gameSettlement and refunds

Settlement and refunds

A ticket settles once its expiry has passed. The settlement price is the median of on-chain samples in the 15 minutes up to expiry. If that window is too thin, or the market was paused, the ticket voids and everyone gets back exactly what they put in.

Strike

At open, the strike is the lower of two readings:

  • the live pool price from PriceFeed.live, and
  • the median of samples with timestamps in the last 15 minutes.

The short cannot open (PriceNotReady) if the live price cannot be read, or the 15 minute window has fewer than minSamples samples (30 today), or the window is not continuous (any gap over maxGap, 90 seconds today).

The 15 minute median

The settlement price is the median of every sample with a timestamp from expiry − 15 min to expiry, inclusive. With an odd count it is the middle value. With an even count it is the average of the two middle values. The contract reads up to 128 samples in a window, and samples can be at most one every 20 seconds per market, so a full window holds about 45.

Samples are append-only and stored forever, so the window can be read back no matter how late settle is called.

Every void rule

When settle runs, the ticket voids in these cases:

Reason codeRuleWhy
1 · pausedThe ticket's market is paused at settle time, or was paused at any point while the ticket was open (the market's pause counter changed since open).Nobody should win or lose on a market that was stopped.
2 · samplesFewer than 30 samples in the 15 minute window.Too few readings to trust the median.
2 · samplesThe first sample is more than 90 seconds after the window starts.The window must be covered from the start.
2 · samplesAny two consecutive samples are more than 90 seconds apart.No gaps.
2 · samplesThe last sample is more than 90 seconds before expiry.The window must be covered to the end.
2 · samplesThe median is zero.A broken reading.

These also lead to a void through the sample rules: a pool that cannot be read (sampling reverts, so no samples are recorded), and a market that has been delisted (sampling stops).

A global pause does not void tickets. It only stops new shorts and new deposits.

What a void pays

  • The shorter is credited stake + premium + fee in full.
  • Every backer slice is released back to free, untouched.
  • The treasury gets nothing.

What a normal settlement pays

  • The shorter is credited the payout (see Maths).
  • Backers' slices are credited their share of 2 × stake − payout + premium + fee − ⌊fee/2⌋.
  • The treasury is credited ⌊fee / 2⌋.

Shorter and treasury credits go to a claimable balance. Call claim() (or use the app) to receive the HYPE. Backer credits go into their positions.

Anyone can settle

settle(ticketId) works for any caller once block.timestamp > expiry. The keeper calls it for every expired ticket, but you never have to wait for it: you can call it yourself from the explorer or a script. Settle, withdraw and claim cannot be paused by anyone.