Docs: Built for EL1 precompiles

Integrate

Built for EL1 precompiles

Kinetiq has announced read and write precompiles for Elysium. They are not live yet. This page describes the adapter HIP-ID has ready for when EL1 precompiles go live.

Status

Not live

Kinetiq has announced read and write precompiles for Elysium, including a CoreWriter for HyperCore actions. They are not live, and no ABI or address has been published. The HIP-ID adapter below is written against an assumption, ships disabled and is not deployed. Nothing on this page works today.

HipAccountpasskey or session key op, execute()El1CoreOrdersplaceLimitOrder, not deployedisLive?todayrevert NotLivecoreWriter unsetwhen EL1 precompiles go liveElysiumCoreWritersendRawAction(bytes), assumedHyperCorelimit order
Solid lines: logic written in the contracts. Dashed: not deployed, or not published by Kinetiq yet. As written, every order stops at NotLive until the CoreWriter address is set.

The assumption

The adapter assumes the Elysium CoreWriter mirrors HyperEVM's CoreWriter at 0x3333333333333333333333333333333333333333: one function, sendRawAction(bytes), where the bytes are a 1-byte encoding version, a 3-byte action id, and the ABI-encoded action.

interface IElysiumCoreWriter {
    function sendRawAction(bytes calldata data) external;
}

If Kinetiq publishes a different interface, the adapter changes before it is deployed. The account needs no change: it calls whatever contract an operation names.

El1CoreOrders

contracts/src/adapters/El1CoreOrders.sol places HyperCore limit orders from a HipAccount through execute().

MemberWhat
placeLimitOrder(uint32 asset, bool isBuy, uint64 limitPx, uint64 sz, bool reduceOnly, uint8 tif, uint128 cloid)Reverts with NotLive until the CoreWriter is set; then sends the encoded action and emits OrderSent with the calling account
tif1 = ALO, 2 = GTC, 3 = IOC, as in HyperEVM's CoreWriter encoding
encodeLimitOrder(...)Pure: returns the exact bytes that would be sent
setCoreWriter(address)Owner only, once. After that the address can never change
isLive()True once the CoreWriter address is set
builderFixed at deployment. Reserved for the builder fee once Kinetiq publishes how builder codes attach to EL1 orders

Action encoding

ENCODING_VERSION   = 1        // uint8, 1 byte
ACTION_LIMIT_ORDER = 1        // uint24, 3 bytes

data = abi.encodePacked(
    ENCODING_VERSION,
    ACTION_LIMIT_ORDER,
    abi.encode(asset, isBuy, limitPx, sz, reduceOnly, tif, cloid)
)
// 0x01 000001 <7 ABI words>

Session keys for orders

When EL1 precompiles go live, an app could trade for you without a prompt per order by holding a session key scoped to the adapter. The size argument sz is argument index 3, so amountArg = 3 caps the total size the key may place over the session:

{ target: EL1_CORE_ORDERS,
  selector: toFunctionSelector("placeLimitOrder(uint32,bool,uint64,uint64,bool,uint8,uint128)"),
  amountArg: 3,          // sz
  maxValue: 0n,          // no HYPE
  maxAmount: <total size> }

The key could only place orders through that one function, within the size cap, the rate limit and the expiry. It could not withdraw, transfer or change the account. See Session keys.

When EL1 precompiles go live

  1. Kinetiq publishes the CoreWriter address and ABI.
  2. We check the ABI against the assumption above and adjust the adapter if it differs, with tests on an Elysium fork.
  3. The adapter is deployed and verified, and the owner calls setCoreWriter once.
  4. The address is added to Contracts, and this page drops its status notice.