Interacting with HyperCore
Last updated
Last updated
The testnet EVM provides read precompiles that allows querying HyperCore information. The precompile addresses start at 0x0000000000000000000000000000000000000800 and have methods for querying information such as perps positions, spot balances, vault equity, staking delegations, oracle prices, and the L1 block number.
The values are guaranteed to match the latest HyperCore state at the time the EVM block is constructed.
Attached is a Solidity file L1Read.sol
describing the read precompiles. As an example, this call queries the third perp oracle price on testnet:
To convert to floating point numbers, divide the returned price by 10^(6 - szDecimals)
for perps and 10^(8 - base asset szDecimals)
for spot.
A system contract is available at 0x3333333333333333333333333333333333333333 for sending transactions from the HyperEVM to HyperCore. It supports sending IOC orders, vault transfers, staking, sending spot, and transferring between spot and perps. A solidity file L1Write.sol
for the write system contract is attached.
Happy building. Any feedback is appreciated.