---
name: protos
description: Read HyperCore data (prices, positions, balances, markets, staking, lending) the way Elysium contracts read it through Protos soft precompiles. Use when an agent or a contract on Elysium needs a HyperCore value, its block, or Solidity code to read it.
---

# Protos

Protos mirrors the twenty HyperCore read precompiles of HyperEVM (addresses 0x0800 to 0x0813) to contracts on Elysium (chain 99901) called soft precompiles. Same input bytes, same output bytes, plus the block each value was read at.

## Encoding
- Input: `abi.encode(args)` with no function selector. Call with STATICCALL.
- Output: `abi.encode(result)`.
- Perp prices (markPx, oraclePx, bbo) have `6 - szDecimals` decimals; spot prices `8 - szDecimals`. Perp index 0 = BTC, 1 = ETH, 5 = SOL, 159 = HYPE. Spot index 107 = HYPE/USDC. Token 0 = USDC, 150 = HYPE.

## Reads
position(address,uint16) · spotBalance(address,uint64) · userVaultEquity(address,address) · withdrawable(address) · delegations(address) · delegatorSummary(address) · markPx(uint32) · oraclePx(uint32) · spotPx(uint32) · l1BlockNumber() · perpAssetInfo(uint32) · spotInfo(uint32) · tokenInfo(uint32) · tokenSupply(uint32) · bbo(uint32) · accountMarginSummary(uint32,address) · coreUserExists(address) · borrowLendUserState(address,uint64) · borrowLendReserveState(uint64) · position2(address,uint32)

## HTTP (no key)
- `GET /api/read?key=oraclePx&args=0` live read: input, output bytes, decoded value, HyperEVM block
- `GET /api/feeds` default feeds with blocks on HyperEVM, HyperCore and Elysium; `mode` is `preview` until the Elysium contracts are deployed
- `GET /api/precompiles` the list with addresses
- `GET /api/quote?items=4` cost in HYPE of one canonical update
- `GET /api/wishlist`, `GET /api/status`

## MCP (no key)
`POST /api/mcp`, JSON-RPC. Tools: `list_precompiles`, `read_precompile {key, args[]}`, `get_feeds`, `quote_update {items}`, `generate_interface {keys[]}`.

## SDK
`curl -sO <site>/sdk/protos.js` then `import { Protos } from "./protos.js"; await new Protos().read("bbo", [0])`. Use `new Protos({ source: "elysium" })` to read the soft precompiles, plus `meta()` and `isFresh()`.

## Freshness on Elysium
`meta(bytes input) -> (uint64 hyperBlock, uint64 hyperTimestamp, uint64 coreBlock, uint64 updatedAt)` and `isFresh(bytes input, uint256 maxAge) -> bool` on each soft precompile. Always check age before acting on a value.

## Updates
On Elysium: `hub.request(uint16 id, bytes input)` paid in HYPE, or `requestUsdc`. On HyperEVM: `ProtosReader.push(reads, gasLimit, maxFeePerGas)` pays the retryable ticket directly. The hub only accepts writes from the reader's aliased address.
