Hyperliquid's HIP-3 lets anyone deploy a synthetic market — xyz:SP500,
xyz:CL, tokenized equities — on top of an external price feed. That feed
is the whole market. If the oracle print diverges from what the order
book is actually doing, or the book itself thins out to nothing, there's
no exchange-level circuit breaker watching for it on your behalf. Whoever
built the deployer's risk parameters did — but you, holding a position,
have no independent check.
So I built one. Read-only, no private keys, checks two things every cycle:
1. Oracle vs. mark divergence, in basis points
Pull metaAndAssetCtxs for the dex you care about (HIP-3 synthetics
live under builder-deployed sub-markets, not the native perp universe —
you have to pass dex explicitly or you'll query the wrong book entirely,
which is not documented clearly anywhere and cost me an afternoon).
dev_oracle_bps = abs(oracle_px - ref) / ref * 10000
dev_mark_bps = abs(mark_px - ref) / ref * 10000
where ref is mid price if available, mark price otherwise. Compare
against a per-asset band — SP500 gets a tight 200bps, thinner names like
PLTR get 1000bps, because a tight band on an illiquid synthetic just
means constant false triggers.
2. Order book depth collapse
This is the one that actually matters more, and it's the one nobody
checks. Divergence tells you the price moved; depth collapse tells you
nobody's there to trade at that price. I pull l2Book, sum notional
within the same band width, keep a rolling median over the last 30
readings, and fire if current depth drops more than 70% below that
median — not below some absolute number, because "normal" depth for
xyz:PLTR and xyz:SP500 aren't the same order of magnitude.
Both checks share one cooldown timer per symbol (300s default) so a
sustained bad state doesn't spam you every 5 seconds.
What it doesn't do: it doesn't cancel your orders, close your
position, or touch anything on-chain. It's a monitor, not an execution
layer — deliberately, because a read-only tool with no keys is a very
different trust surface than one that can act for you.
Full tool with the per-asset spec table, webhook alerting, and CLI:
https://theglitchlist.com/product/oracle-kill-switch-for-hyperliquid-hip-3/?utm_source=devto&utm_medium=article&utm_campaign=n01_oracle








