Constants§
- AMM_
RESERVE_ PRECISION - Drift AMM reserve precision (used for size normalisation).
- SPOT_
IMF_ PRECISION - Drift IMF factor precision.
- SPOT_
WEIGHT_ PRECISION - Drift spot market weight precision: 10_000 = 100%.
Functions§
- calculate_
asset_ weight - Calculate the effective initial asset weight for a position, applying both scale-down (when market deposits are large) and IMF size discount.
- calculate_
liability_ weight - Calculate the effective initial liability weight for a position, applying IMF size premium.
- calculate_
scaled_ initial_ asset_ weight - Scales the initial asset weight down when total market deposits exceed a threshold.
- calculate_
size_ discount_ asset_ weight - Applies IMF size discount to asset weight — larger deposits get less collateral credit.
- calculate_
size_ premium_ liability_ weight - Applies IMF size premium to liability weight — larger borrows need more margin.
- get_
strict_ price - Get a conservative oracle price for margin calculations.
- to_
amm_ precision - Convert a token balance from native decimals to AMM_RESERVE_PRECISION (1e9).