Skip to main content

Module percolator

Module percolator 

Source

Re-exports§

pub use i128_types::I128;
pub use i128_types::U128;

Modules§

i128_types
wide_math

Structs§

Account
Unified account (spec §2.1)
CrankOutcome
Outcome of a keeper crank operation
InstructionContext
Instruction context for deferred reset scheduling (spec §5.7-5.8)
InsuranceFund
Insurance fund state
RiskEngine
Main risk engine state (spec §2.2)
RiskParams
Risk engine parameters

Enums§

LiquidationPolicy
Liquidation policy (spec §10.6)
RiskError
Side
Determine which side a signed position is on. Positive = long, negative = short.
SideMode
Side mode for OI sides (spec §2.4)

Constants§

ACCOUNTS_PER_CRANK
ADL_ONE
ADL_ONE = 1_000_000 (spec §1.3)
BITMAP_WORDS
GC_CLOSE_BUDGET
LIQ_BUDGET_PER_CRANK
MAX_ABS_FUNDING_BPS_PER_SLOT
MAX_ABS_FUNDING_BPS_PER_SLOT = 10000 (spec §1.4)
MAX_ACCOUNTS
MAX_ACCOUNT_NOTIONAL
MAX_ACCOUNT_POSITIVE_PNL
MAX_FUNDING_DT
MAX_FUNDING_DT = 65535 (spec §1.4)
MAX_LIQUIDATION_FEE_BPS
MAX_MAINTENANCE_FEE_PER_SLOT
MAX_MARGIN_BPS
MAX_MATERIALIZED_ACCOUNTS
MAX_OI_SIDE_Q
MAX_ORACLE_PRICE
MAX_ORACLE_PRICE = 1_000_000_000_000 (spec §1.4)
MAX_PNL_POS_TOT
MAX_POSITION_ABS_Q
MAX_PROTOCOL_FEE_ABS
MAX_ROUNDING_SLACK
MAX_TRADE_SIZE_Q
MAX_TRADING_FEE_BPS
MAX_VAULT_TVL
MIN_A_SIDE
MIN_A_SIDE = 1_000 (spec §1.4)
POS_SCALE
POS_SCALE = 1_000_000 (spec §1.2)

Functions§

checked_u128_mul_i128
Multiply a u128 by an i128 returning i128 (checked). Computes u128 * i128 → i128. Used for A_side * delta_p in accrue_market_to.
compute_trade_pnl
Compute trade PnL: floor_div_signed_conservative(size_q * price_diff, POS_SCALE) Uses native i128 arithmetic (spec §1.5.1 shows trade slippage fits in i128).

Type Aliases§

Result