#[repr(C)]pub struct Account {Show 15 fields
pub account_id: u64,
pub capital: U128,
pub kind: AccountKind,
pub pnl: I128,
pub reserved_pnl: u64,
pub warmup_started_at_slot: u64,
pub warmup_slope_per_step: U128,
pub position_size: I128,
pub entry_price: u64,
pub funding_index: I128,
pub matcher_program: [u8; 32],
pub matcher_context: [u8; 32],
pub owner: [u8; 32],
pub fee_credits: I128,
pub last_fee_slot: u64,
}Expand description
Unified account - can be user or LP
LPs are distinguished by having kind = LP and matcher_program/context set. Users have kind = User and matcher arrays zeroed.
This unification ensures LPs receive the same risk management protections as users:
- PNL warmup
- ADL (Auto-Deleveraging)
- Liquidations
Fields§
§account_id: u64Unique account ID (monotonically increasing, never recycled) Note: Field order matches on-chain slab layout (account_id at offset 0)
capital: U128Deposited capital (user principal or LP capital) NEVER reduced by ADL/socialization (Invariant I1)
kind: AccountKindAccount kind (User or LP) Note: Field is at offset 24 in on-chain layout, after capital
pnl: I128Realized PNL from trading (can be positive or negative)
reserved_pnl: u64PNL reserved for pending withdrawals Note: u64 to match on-chain slab layout (8 bytes, not 16)
warmup_started_at_slot: u64Slot when warmup started
warmup_slope_per_step: U128Linear vesting rate per slot
position_size: I128Current position size (+ long, - short)
entry_price: u64Last oracle mark price at which this account’s position was settled (variation margin). NOT an average trade entry price.
funding_index: I128Funding index snapshot (quote per base, 1e6 scale)
matcher_program: [u8; 32]Matching engine program ID (zero for user accounts)
matcher_context: [u8; 32]Matching engine context account (zero for user accounts)
owner: [u8; 32]Owner pubkey (32 bytes, signature checks done by wrapper)
fee_credits: I128Fee credits in capital units (can go negative if fees owed)
last_fee_slot: u64Last slot when maintenance fees were settled for this account
Implementations§
Trait Implementations§
impl Copy for Account
impl Eq for Account
impl StructuralPartialEq for Account
Auto Trait Implementations§
impl Freeze for Account
impl RefUnwindSafe for Account
impl Send for Account
impl Sync for Account
impl Unpin for Account
impl UnwindSafe for Account
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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