Skip to main content

Crate equanetwork_math

Crate equanetwork_math 

Source

Structs§

PriceBand
Inclusive Q64.64 interval.
SwapQuote
VaultSwapLimits

Enums§

SkewExponent
Polynomial degree for inventory skew outside the dead zone.

Constants§

AMOUNT_EXCEEDS_MAX_I32
AMOUNT_EXCEEDS_MAX_U64
ARITHMETIC_OVERFLOW
BPS_DENOMINATOR
Basis-point denominator retained for wasm API compatibility.
DIVISION_BY_ZERO
INSUFFICIENT_LIQUIDITY
INVALID_FEE
INVALID_MARGIN
INVALID_PRICE
INVALID_SKEW
MAX_PRICE_MARGIN_PER_1M
Max oracle margin vs peg (10%).
MAX_SWAP_EXCEEDED
MAX_SWAP_FEE_PER_1M
Max swap fee per vault (10%).
MAX_TOTAL_SKEW_PER_1M
Max combined skew applied to a quote (10%).
MAX_VAULT_SKEW_PER_1M
Max positive or negative skew contribution per vault (5%).
PER_1M_DENOMINATOR
Parts-per-million denominator (100% = 1_000_000).
Q64_ONE
Q64.64 one (= 2^64), used for prices and exchange rates.

Functions§

apply_swap_fee_per_1m
Retain fee_per_1m ppm of amount in the vault (returns the swapped portion).
apply_total_skew_per_1m
Apply combined skew (ppm) to fair output.
assert_synthetic_oracle_within_execution
Combined synthetic oracle band must lie inside the combined execution-price band.
average_skew_per_m
Path-average skew (ppm) over [balance_pre, balance_post].
base_out_1_to_1
Decimal-aware 1:1 conversion (UI-unit parity).
bitmap_contains
bitmap_set
bitmap_unset
combine_feed_band
Combined feed band from two [mid ± conf] observations.
combine_price_band
Combined band from two price intervals: lo = in_lo / out_hi, hi = in_hi / out_lo.
combine_prices_q64
Combined pair rate price_in / price_out in Q64.64.
compute_skew_per_m
Instantaneous vault skew contribution (ppm) at balance for a move in increasing direction.
default_price_q64
Identity Q64.64 price (1.0) used when no price source or feed is configured.
deviation_per_m
Map inventory balance to signed deviation in ppm (−1e6..=+1e6). Dead zone → 0; outer limits → ±1e6.
div_q64
Convert amount / Q64.64 price → amount (floor or ceil).
fair_out_with_prices
Fair output from Q64.64 prices (no skew, no fee).
mul_q64
Convert amount · Q64.64 price → amount (floor or ceil).
one_q64
Identity price (1.0 in Q64.64).
price_band_with_margin
[price * (1 − margin), price * (1 + margin)] in Q64.64.
quote_network_swap
Quote a network swap (prices + fees + skew). No oracle input.
ratio_to_q64
Q64.64 ratio numerator / denominator.
vault_skew_contribution_per_1m
Inventory skew contribution for one vault (signed ppm): path-average over the fill.

Type Aliases§

CoreError
U128