SDK

Elysium and HyperCore arbitrage

Two venues, one asset

HYPE trades in a Uniswap v4 pool on Elysium and on HyperCore's spot book. When they disagree, a contract can trade the difference and must know what really filled on HyperCore before it books anything. CoreArb.sol is that template, on AsyncClient.

How it acts

act(coreBid, coreAsk, ttl) reads the Elysium pool price on chain from StateView. If HyperCore's bid is above it by more than minEdgeBps, it sells on HyperCore; if HyperCore's ask is below it, it buys. Either way the order is an IOC whose limit is the Elysium price plus or minus the edge, so it can only fill while the dislocation is still there. The caller's prices pick the side; they never set the limit.

onReceipt books the HyperCore leg from the receipt alone: position, cash net of fees, and the edge captured against the Elysium price seen at request. Dropped and Unanswered book nothing and free the slot. The Elysium leg, the swap on the pool that closes the loop, is yours to add next to act.

Fork test

FORK_URL=https://rpc.elysium.kinetiq.xyz forge test --match-contract CoreArbFork -vv
# reads the live USDC/WHYPE pool, sends the leg on a 1% dislocation, books a Partial and a Dropped