Settle at a set time from a price already on chain: Pyth push feeds and HyperEVM precompiles
A market that settles at a set time needs the price at that time. A contract cannot see a feed's history, only its value now, so whoever calls 'settle' could wait for a price that suits them. Measured first (fabrknt/fivemin, 2026-11-15): on Monad, Pyth's sponsored BTC push updated every 17 s at the median and 90 s at worst over 30 minutes; on HyperEVM, the price precompiles return the current state whatever block a call names, so a past price cannot be re-read at all.
The rule fivemin uses: each checkpoint takes the first admissible reading at or after it, recorded by anyone, never changed. Admissible means the block and the reading's own time are both inside [T, T + maxDelay] and the reading is not ahead of the block. With Pyth the reading's time is its publishTime; with a HyperEVM precompile it is the block's, so the window is a choice of blocks and is kept to 3 s. A checkpoint with no reading by T + maxDelay voids the round.
What stays open, stated plainly: on Monad anyone holding signed Pyth updates can push the most favourable price inside the window before the sponsored pusher, then record it; closing that takes parsePriceFeedUpdatesUnique and an API key. On HyperEVM a HIP-3 oracle is set by the market's deployer; HLPriceGuard.read refuses an oracle the book does not agree with, which narrows what the deployer alone can do. A real Sunday NVDA round opened and closed at 161.110: stock oracles barely move outside market hours.
API at a glance
IPyth(pyth).getPriceUnsafe(id) -> Price { price, conf, expo, publishTime }- Pyth's stored price for a feed id, with the time Pyth published it. On a chain where Pyth pushes the feed (Monad: BTC, ETH, SOL and MON on a 0.02% deviation), this is a free read; place the reading by publishTime, not by when you read it.
event PriceFeedUpdate(bytes32 indexed id, uint64 publishTime, int64 price, uint64 conf)- Emitted by the Pyth contract on every stored update. Off chain, eth_getLogs over it finds the first update after a time. fivemin's fork test uses those blocks.
pyth.parsePriceFeedUpdatesUnique{value: fee}(updateData, ids, minPublishTime, maxPublishTime)- Verifies an update and accepts it only if the one before it was published before minPublishTime: the first update after a time, with no choice left to the caller. It takes update data from Hermes, which needs a Pyth API key since 2026-08. hl-price-guard wraps it as PythRef.readFirstAfter.
0x807.staticcall(abi.encode(uint32(dex * 10000 + index))) -> uint64 oracle- HyperEVM's oracle-price precompile for a perp (0x806 is the mark, 0x80e the best bid and ask, indexed 100000 + dex * 10000 + index for HIP-3). Prices come back with 6 - szDecimals decimals. They are the current state whatever block the call names: checked 2026-11-15 at blocks hours apart.
HLPriceGuard.read(asset, Bounds { maxMarkOracleBps, maxMidOracleBps, maxSpreadBps, maxRefOracleBps }, ref)- The oracle, or a revert naming the check that failed (PriceRejected(reason, observedBps, limitBps)). With no outside reference (ref.price == 0) it still refuses a wide spread or a mark or mid far from the oracle. fivemin's bounds are 20/50/50 bps, from a recording where they reached 3.11/3.72/11.79.
Checked against fabrknt/fivemin at dfb3353 (2026-11-15): src/FiveMin.sol, src/PriceSources.sol, docs/spec.md
Related parts
- fivemin
Five-minute up-or-down pools settled by the rule above, with a real BTC round on a Monad fork and a real NVDA round recorded on HyperEVM; written with Claude, every check measured with unproven.
- hl-price-guard
HLPriceGuard.read for the book check on a Hyperliquid oracle, and PythRef (readFresh, readFirstAfter) for Pyth.
- unproven
Deletes each check in turn and reruns the tests: in fivemin, 18 of 38 checks were caught by nothing at first.
Lessons on this topic
Shadowbook's hook runs on Monad without changing a line. All 49 tests pass. The only thing that changes is gas.
Funding turns the gap between two prices into a payment between traders. The gap is the premium, premium = (mark − index) / index. Each interval, the…