The tide and feed contracts are fork-tested; the Elysium deploy is next.Read the log ›
Docs / Mechanism

The reference feed

SeleneFeed is a small contract on Elysium that stores one reference per market: market 1 is HYPE/USDC, read from the HyperCore spot book @107; market 2 is HYPE/KNTQ, the cross of @107 and the KNTQ/USDC book @334. Each post carries the mid (18 decimals), the measured basis in parts per million, and the HyperCore book time in milliseconds.

Why a basis

HYPE and USDC on Elysium are bridged, and leaving Elysium takes days, so HYPE on Elysium can trade a little above or below HyperCore for long stretches. The keeper measures that difference as the liquidity-weighted average price of HYPE across the main Elysium pools, divided by the HyperCore mid, minus one. The reference is the HyperCore mid times one plus that basis: the price the Elysium pool is actually pulled toward.

The contract does not take the basis on trust. Whatever the keeper sends, SeleneFeed clamps it to ± 30,000 ppm (± 3 %) and lets it move at most 1,000 ppm (0.1 %) per minute since the previous post.

Freshness

Book times must increase strictly per market and cannot be more than 60 seconds ahead of the block. A tide measures the age of a reference in HyperCore time and never uses one older than 900 seconds for anything that moves money: a rebalance, a compound or a single-sided deposit.

Who runs the keeper, and what it can do

The operator of Selene runs the keeper. It reads Hyperliquid's public info API (l2Book for @107 and @334) and posts to SeleneFeed when the mid has moved past its deviation threshold or when its heartbeat runs out. It can post a reference within the contract's bounds, and it can call rebalance() like any other address, for the same bounty.

It cannot move funds: no keeper or owner function touches depositors' liquidity or idle balances. It cannot block withdrawals: withdraw() reads no price and has no pause. A wrong post is bounded twice: by the basis clamp, and by the tide's own check that the pool trades within 100 ticks of the reference before it rebalances.

Cadence and cost

The keeper runs once a minute. It posts both markets in one transaction when a reference has moved 0.20 % (HYPE/USDC) or 0.30 % (HYPE/KNTQ) since the last post, or when 600 seconds have passed. In the same run it calls rebalance() on any tide whose status() is ready, and once a day at 00:00 UTC it calls payProtocol().

A post costs 56,000 to 66,000 gas, measured on an Elysium fork. Replaying the last three days of HyperCore one-minute candles through this rule gives about 335 posts and 3.6 rebalances a day: about 0.012 HYPE of gas a day at Elysium's 0.5 gwei base fee (posting every minute would cost about 0.049 HYPE a day).

If the keeper stops

After 900 seconds the last post ages out. Rebalances, compounding and single-sided deposits stop. Withdrawals and two-sided deposits keep working exactly as before, because they never read the reference. The position stays where it is; if the price leaves the range it stops earning fees until a fresh post lets the tide move it.

After the ArbOS upgrade

Elysium plans a HyperCore read precompile in a later ArbOS upgrade. When it is live, a tide could read the HyperCore mid inside the transaction instead of from a keeper post. Until then, the keeper is how the price gets there.