HyperCore execution
EL1Read and EL1Write, keeper mode before the hooks are live, and what happens when one leg succeeds and the other fails.
EL1Read and EL1Write
Elysium can read HyperCore state and send HyperCore orders from a contract. The Counterweight is built on both.
- EL1Read
- The HyperCore data precompile on Elysium. A contract reads the perp book (best bid and ask, depth), the vault's position and margin, the funding rate and the oracle price, in the same call that computes the hedge.
- EL1Write
- The ElysiumCoreWriter predeploy. A contract sends an order to HyperCore: open, resize or close the short from the vault's own HyperCore account, with the fill returned on-chain.
Kinetiq ships both as a post-launch upgrade of Elysium. Until they are live, the Counterweight runs in keeper mode.
Keeper mode
In keeper mode a keeper reads HyperCore through its API, places the short from the vault's HyperCore account, and writes the fill back to the Counterweight contract. The contract stores size, entry price, margin and accrued funding, exactly as the hook-backed version will, so the Vault, the Ledger and the share price do not change when the hooks go live.
On testnet, the Counterweight is a mock: the keeper sets prices on a feed and the mock computes PnL and funding from them. No order reaches HyperCore. Contracts
When one leg fails
Every change to the position touches both legs. The failure cases are explicit:
- LP leg succeeds, short fails. The vault is under-hedged. The Rebalancer retries the short every block. If the gap is still open after 50 blocks (5 seconds), the vault flips to Paused for deposits and shrinks the Yoke until the hedge ratio is back inside the band. Depositors can withdraw at any point; the Ledger reports the gap.
- Short succeeds, LP leg fails. The vault is over-hedged. The short is reduced in the next block to match the delta that exists.
- Both fail. Nothing changed; the vault is where it was.
- A loss is realised during a gap. It is covered from the Yoke's accrued fees first, then from the Reserve, and only then from NAV. Risks