ElyraElyraOpen the app

Docs

Conditions and the feed

Kinds

kind 0: none. kind 1: the source value is at or above threshold. kind 2: at or below. The source is either ElyraFeed (a HyperCore value) or ElyraPoolOracle (a v4 pool TWAP). The settlement calls observe(key, window, maxAge) on the source at the settlement block and fills only when it returns a usable value that meets the threshold.

ElyraFeed

A keeper reads Hyperliquid's public info API (allMids and metaAndAssetCtxs) and posts values to ElyraFeed with the HyperCore time they were read at. Values are scaled 1e18: a price in USD, funding as a rate per hour (0.0000125 per hour is 1.25e13). The keeper posts a key on a 480 s heartbeat, or sooner when a mid moves 0.3 % or funding changes sign or moves by 0.000002 per hour, checked every 10 s.

Challenge window

A posted value is pending for 60 s before it can be used. During the window a guardian, a different key on a different host that compares every pending value with the info API, can dispute it. A disputed value is dropped and the key is suspended until the owner or a guardian resumes it. A guardian can delay a value, never write one.

Freshness

A value is usable only when it is final, not suspended, and its HyperCore time is at most maxAge seconds old (the order's own maxAge, capped at 600 s in code). A stale value never opens an order: the condition reads as not met. A posted value trails HyperCore by up to its window plus the time since the last post, which is why the limit, not the condition, sets your price.

Pool TWAP

ElyraPoolOracle keeps a ring of observations per pool, written by poke(poolId) (the keeper pokes pools that carry open TWAP conditions every 120 s, and anyone can poke). Each poke accumulates the previous tick over the elapsed time and moves the recorded tick by at most 100 ticks plus 50 per elapsed second, so a price pushed inside one transaction weighs little in the average. On a thin pool, prefer a longer window. observe returns the TWAP tick over the order's window (up to 1 hour) when observations cover it and the last poke is within maxAge (at most 600 s).

Keys

Feed keys are ASCII strings left aligned in bytes32: HYPE.mid, HYPE.funding, BTC.mid, BTC.funding, ETH.mid, ETH.funding, SOL.mid, SOL.funding. Live values: /api/conditions.

When Elysium's HyperCore read precompile ships with the ArbOS upgrade, a source contract reading it directly can replace the keeper for these keys; orders name their source, so both can live side by side.