pub struct StateKey;Expand description
Compound key derivation for the state tree.
All state lives in a single JMT with compound keys: keccak256(address || namespace || sub_key)
Keys are derived using the Keccak256 hasher directly (no allocation) to avoid Vec overhead on the hot path.
Implementations§
Source§impl StateKey
impl StateKey
Sourcepub fn account(address: &[u8; 20]) -> KeyHash
pub fn account(address: &[u8; 20]) -> KeyHash
Account metadata: cash, nonce, margin_mode, liquidation_state
Sourcepub fn option_position(address: &[u8; 20], symbol: &str) -> KeyHash
pub fn option_position(address: &[u8; 20], symbol: &str) -> KeyHash
Option position for (address, symbol)
Sourcepub fn perp_position(address: &[u8; 20], coin: &str) -> KeyHash
pub fn perp_position(address: &[u8; 20], coin: &str) -> KeyHash
Perp position for (address, coin)
Sourcepub fn mmp_config(address: &[u8; 20], currency: &str) -> KeyHash
pub fn mmp_config(address: &[u8; 20], currency: &str) -> KeyHash
MMP config for (address, currency)
Sourcepub fn instrument(symbol: &str) -> KeyHash
pub fn instrument(symbol: &str) -> KeyHash
Instrument metadata (global, not per-account)
Auto Trait Implementations§
impl Freeze for StateKey
impl RefUnwindSafe for StateKey
impl Send for StateKey
impl Sync for StateKey
impl Unpin for StateKey
impl UnsafeUnpin for StateKey
impl UnwindSafe for StateKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more