Skip to main content

Module state

Module state 

Source

Structs§

MarketHeader
Market account header (v1.0 layout) — stored at the beginning of the account data. The RiskEngine state follows immediately after, accessed via raw pointer because RiskEngine is ~1.165 MB and doesn’t derive Copy.

Constants§

MARKET_ACCOUNT_SIZE
Total account size (v1 layout): discriminator + header + engine
MARKET_ACCOUNT_SIZE_V0
Total account size for the legacy v0.9 layout. Used by migrate_header_v1 to validate that the account being migrated is a pre-v1 market.
MARKET_DISCRIMINATOR_V1
8-byte discriminator for v1 market accounts: 7 fixed bytes (b"percmrk") followed by a 1-byte layout version (0x01).

Functions§

engine_from_account_data
Helper to get a mutable reference to the RiskEngine from raw account data.
engine_from_account_data_ref
header_from_account_data
is_v1_market
Returns true iff data starts with the v1 discriminator.
market_signer_seeds
Market PDA signer seeds: [b“market“, authority_key, &[bump]]
write_header