Expand description
HyperCore’s read precompiles: HyperCore state read from HyperEVM by an
eth_call to 0x...0800 through 0x...0814, as L1Read.sol in
Hyperliquid’s docs declares them.
The calldata is the ABI-encoded arguments with no selector.
L1Read.sol calls each as ADDRESS.staticcall(abi.encode(...)), so a
selector would be read as part of the first argument.
The numbers are HyperCore’s integers, unscaled:
- a perp’s
markPx,oraclePxandbboare in10^-(6 - szDecimals)(perp_price), a spot pair’sspotPxandbboin10^-(8 - szDecimals)of its base token (spot_price); - a position’s
sziis in the perp’s size decimals; - USDC amounts (
entryNtl,equity,withdrawable, margins) are 1e6; - token balances are in the token’s
weiDecimals, HYPE staking in 1e8; - an outcome’s
settledValueis 1e8 for 1.0.
An invalid input (an unknown asset or vault) is refused and uses all the
gas given. Gas is 2000 + 65 * (input + output bytes).
Re-exports§
pub use account::AccountMarginSummary;pub use account::Position;pub use account::SpotBalance;pub use account::UserVaultEquity;pub use account::account_margin_summary;pub use account::core_user_exists;pub use account::position;pub use account::position2;pub use account::spot_balance;pub use account::user_vault_equity;pub use account::withdrawable;pub use assets::PerpAssetInfo;pub use assets::SpotInfo;pub use assets::TokenInfo;pub use assets::TokenSupply;pub use assets::UserBalance;pub use assets::perp_asset_info;pub use assets::spot_info;pub use assets::token_info;pub use assets::token_supply;pub use lending::BasisAndValue;pub use lending::BorrowLendReserveState;pub use lending::BorrowLendUserState;pub use lending::borrow_lend_reserve_state;pub use lending::borrow_lend_user_state;pub use outcomes::OutcomeState;pub use outcomes::OutcomeStatus;pub use outcomes::SETTLED_DECIMALS;pub use outcomes::outcome_status;pub use prices::Bbo;pub use prices::bbo;pub use prices::l1_block_number;pub use prices::mark_px;pub use prices::oracle_px;pub use prices::perp_price;pub use prices::spot_price;pub use prices::spot_px;pub use read::Read;pub use read::ReadError;pub use staking::Delegation;pub use staking::DelegatorSummary;pub use staking::delegations;pub use staking::delegator_summary;pub use table::ALL;pub use table::Spec;pub use table::address;pub use table::spec;
Modules§
- account
- What an account holds on HyperCore: perp positions, spot balances, vault equity, what it can withdraw, its margin on a dex, and whether it exists.
- assets
- Market info: a perp’s asset info, a spot pair, a token and its EVM contract, and a token’s supply.
- lending
- Lending: one account’s borrow and supply in a token, and a token’s pool.
- outcomes
- HIP-4 outcomes: an outcome’s status, the only HIP-4 read on HyperEVM.
- prices
- Prices: a perp’s mark and oracle, a spot pair’s price, the best bid and offer, and HyperCore’s block height, with the scale each price is read at.
- read
- A typed
Read: where the call goes, its calldata and how its answer reads, and theRpcmethod that makes one. - staking
- Staking: an account’s delegations and its staking totals, HYPE at 1e8.
- table
- The read precompiles as
L1Read.soldeclares them, in address order, and the address each sits at.