Reader Contract
The Reader contract provides read-only functions to query protocol state, market data, and position information.
Reader is used for:
Querying market information
Calculating prices and fees
Simulating deposits and withdrawals
getMarket
Get market configuration.
function getMarket(
DataStore dataStore,
address key
) external view returns (Market.Props);
getMarketBySalt
Get market by salt.
getMarketInfo
Get detailed market information.
getMarketInfoList
Get market information for multiple markets.
getMarkets
Get all markets.
getMarketTokenPrice
Get current HM token price.
getAccountPositionInfoList
Get position information for all positions of an account.
getAccountPositions
Get all positions for an account.
getPosition
Get position details.
getPositionInfo
Get detailed position information including fees.
getPositionInfoList
Get position information for multiple positions.
getPositionPnlUsd
Get position PnL in USD.
isPositionLiquidatable
Check if a position can be liquidated.
getAccountOrders
Get all orders for an account.
getOrder
Get order details.
Deposit & Withdrawal Data
getDeposit
Get deposit details.
getShift
Get shift details.
getWithdrawal
Get withdrawal details.
Simulation Functions
getDepositAmountOut
Simulate deposit and get expected HM tokens out.
getExecutionPrice
Get execution price for a position change.
getSwapAmountOut
Simulate swap and get expected output.
getWithdrawalAmountOut
Simulate withdrawal and get expected tokens out.
PnL & Analytics
getNetPnl
Get net PnL for a market.
getOpenInterestWithPnl
Get open interest with PnL.
getPnl
Get PnL for a specific side.
getPnlToPoolFactor
Get PnL to pool factor.
getSwapPriceImpact
Calculate swap price impact.
getAdlState
Get ADL (Auto-Deleveraging) state.
getPendingPositionImpactPoolDistributionAmount
Get pending position impact pool distribution.