Skip to main content

Module leaves

Module leaves 

Source

Structs§

AccountLeaf
Account metadata leaf. Key: keccak256(address || “account”)
GlobalLeaf
Global counters leaf (singleton). Key: keccak256(“global”)
InstrumentLeaf
Instrument metadata leaf (global). Key: keccak256(“instrument” || symbol)
MmpConfigLeaf
MMP config leaf. Key: keccak256(address || “mmp” || currency)
OptionPositionLeaf
Option position leaf. Key: keccak256(address || “pos” || symbol)
OracleLeaf
Oracle anchor leaf (global). Key: keccak256(“oracle” || underlying)
OrderLeaf
Open order leaf. Key: keccak256(address || “order” || order_id_be_bytes)
PerpPositionLeaf
Perp position leaf. Key: keccak256(address || “perp” || coin)
RiskLeaf
Risk leaf (separate JMT). Key: keccak256(address)

Constants§

PRICE_SCALE
Fixed-point scale: 1e8 (same as engine contract units). All monetary values in leaves are stored as i128 scaled by 1e8. Example: $95,000.50 = 9_500_050_000_000i128

Functions§

leaf_from_bytes
Deserialize a leaf from borsh bytes.
leaf_to_bytes
Serialize a leaf to bytes using borsh for deterministic encoding.