Skip to main content

Constants

Protocol-wide constants used throughout the Omnipair program.

Global Constants

NAD
u64
default:"1_000_000_000"
Nine-decimal fixed point unit (1e9 scaling), similar to WAD (1e18) by Maker. Used for price and rate calculations.
NAD_DECIMALS
u8
default:"9"
Number of decimal places for NAD scaling.
BPS_DENOMINATOR
u16
default:"10_000"
Basis points denominator (100% = 10000 bps).
CLOSE_FACTOR_BPS
u16
default:"5_000"
Close factor for liquidations (50%). Percentage of debt that can be liquidated per transaction.
MAX_COLLATERAL_FACTOR_BPS
u16
default:"8_500"
Maximum collateral factor cap (85%) for dynamic collateral factor calculation.
LTV_BUFFER_BPS
u16
default:"500"
LTV buffer (5%) between borrow limit and liquidation threshold. Creates safety margin.
FLASHLOAN_FEE_BPS
u16
default:"5"
Flash loan fee (0.05%) charged on flash loan amount.
LIQUIDATION_INCENTIVE_BPS
u16
default:"300"
Liquidation incentive (3%) paid to liquidator from liquidated collateral.
PAIR_CREATION_FEE_LAMPORTS
u64
default:"200_000_000"
Pair creation fee in lamports (0.2 SOL).

EMA Constants

MIN_HALF_LIFE
u64
default:"60"
Minimum EMA half-life in seconds (1 minute).
MAX_HALF_LIFE
u64
default:"43_200"
Maximum EMA half-life in seconds (12 hours).
TAYLOR_TERMS
u64
default:"5"
Number of terms in Taylor series expansion for exponential calculations.
NATURAL_LOG_OF_TWO_NAD
u64
default:"693_147_180"
Natural logarithm of 2 scaled by NAD (ln(2) * 1e9).

Pair Constants

MIN_LIQUIDITY
u64
default:"1_000"
Minimum liquidity (10^3) permanently locked in each pair to prevent share inflation attacks.
INITIAL_RATE_BPS
u64
default:"200"
Initial interest rate (2%) in basis points.
MIN_RATE_BPS
u64
default:"100"
Minimum interest rate (1%) in basis points.

Rate Model Constants

TARGET_UTIL_START_BPS
u64
default:"5_000"
Lower bound of target utilization band (50%).
TARGET_UTIL_END_BPS
u64
default:"8_500"
Upper bound of target utilization band (85%).
SECONDS_PER_YEAR
u64
default:"31_536_000"
Number of seconds in a year (365 days).

Seed Prefixes

PAIR_SEED_PREFIX
&[u8]
default:"b\"gamm_pair\""
Seed prefix for pair PDA derivation.
POSITION_SEED_PREFIX
&[u8]
default:"b\"gamm_position\""
Seed prefix for user position PDA derivation.
FUTARCHY_AUTHORITY_SEED_PREFIX
&[u8]
default:"b\"futarchy_authority\""
Seed prefix for futarchy authority PDA derivation.
METADATA_SEED_PREFIX
&[u8]
default:"b\"metadata\""
Seed prefix for metadata PDA derivation.
VERSION
u8
default:"1"
Current protocol version.