Onchain Market Data
ONyc market data is published on-chain through the MarketStats PDA. It provides the current NAV, APY, circulating supply, NAV adjustment, TVL, and freshness metadata.
Integrations that need ONyc accounting data can read MarketStats directly without relying on the OnRe REST API or an oracle.
Market Data vs Spot Price
MarketStats and secondary-market price feeds serve different purposes. MarketStats.nav represents ONyc's program accounting value, while a spot-price feed reflects the price at which ONyc trades on a secondary market.
Risk systems may use both, but should treat them as separate inputs.
Mainnet Reference
Network
Solana Mainnet
Program ID
onreuGhHHgVzMWSkj2oQDLDtvvGvoepBPkqyaubFcwe
PDA seed
market_stats
MarketStats PDA
BuPMet2URHuTVKSHpj32AjsXxHgdsqeA1i82dr1b4Mi5
Account discriminator
[240, 45, 182, 233, 92, 118, 209, 83]
For integrations that support multiple environments, derive the MarketStats address rather than hard-coding it:
Account Layout
All integer fields in the raw account data use little-endian encoding.
apy
u64
Fixed point with scale 1_000_000 = 100%. Divide by 1_000_000 for a ratio, or by 10_000 for a percentage.
circulating_supply
u64
ONyc base units. ONyc has 9 decimals.
nav
u64
USD NAV with 9 decimals. 1_000_000_000 = $1.00.
nav_adjustment
i64
Signed NAV adjustment with the same 9-decimal price scale.
tvl
u64
circulating_supply × nav / 1_000_000_000, stored with 9 decimals.
last_updated_at
i64
Unix timestamp of the last successful recomputation.
last_updated_slot
u64
Solana slot of the last successful recomputation.
bump
u8
PDA bump.
reserved
[u8; 95]
Reserved for forward-compatible expansion. Do not interpret.
Keep raw values as BN or bigint until formatting, as ONyc supply and TVL can exceed JavaScript's safe integer range.
Reading MarketStats
With Anchor
Use the IDL from the same release as the deployed program:
Depending on the Anchor client and generated types, decoded field names may remain snake_case rather than camelCase. Treat the release IDL as authoritative.
Without Anchor
When reading the account directly, validate the account owner and discriminator before decoding:
Formatting Fixed-Point Values
Avoid converting raw values to JavaScript number. Format fixed-point values directly from bigint:
Freshness
MarketStats is a cached on-chain snapshot rather than a streaming feed. Protocol activity refreshes the account, and any signer can call refresh_market_stats when a newer snapshot is required.
Consumers should:
Read
last_updated_atorlast_updated_slotalongside the market data.Apply a freshness threshold appropriate to the integration.
Reject, warn, or refresh when the snapshot exceeds that threshold.
Freshness requirements should reflect the use case. A user interface, lending market, and liquidation engine may require different thresholds.
Permissionless Refresh
refresh_market_stats can be called by any signer. The signer pays the transaction fee and, if the PDA has not yet been created in that environment, the associated rent.
The instruction recomputes MarketStats using state.main_offer, the canonical ONyc mint, and the cached circulating-supply exclusion balance.
main_offer must match state.main_offer, and its output mint must be the canonical ONyc mint.
Read-only Views
The program also exposes read-only views:
get_navget_apyget_nav_adjustmentget_tvl_v2get_circulating_supply_v2
For integrations that need the full market state, a single MarketStats fetch is simpler and keeps all values internally consistent. Read-only views are useful when a single value is needed during transaction construction or should be recomputed from supplied accounts.
Legacy: New integrations should use get_tvl_v2 and get_circulating_supply_v2 rather than get_tvl or get_circulating_supply. The legacy instructions use the pre-v5 supply-exclusion path.
Emergency Stop Behavior
The global kill switch pauses guarded value-moving instructions but does not affect access to MarketStats. Direct account reads and unguarded read-only views remain available.
Applications should continue displaying the latest available snapshot and its timestamp while indicating that execution is paused.
REST APIs and Oracle Feeds
The OnRe REST API provides convenience endpoints for off-chain consumers:
Oracle feeds can be used by protocols that standardize on an oracle interface or require secondary-market pricing. They provide distribution and market-observation layers rather than a separate source of ONyc accounting data.
Integration Guidance
For new Solana integrations:
Use
MarketStatsfor NAV, APY, circulating supply, and TVL.Use an appropriate market feed when a tradable spot price is required.
Define how the integration should behave when spot price and NAV diverge.
Last updated

