@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / PerpHealthSnapshot

Type Alias: PerpHealthSnapshot

PerpHealthSnapshot = { priceable: true; oneBase: bigint; markPrice: bigint; projectedCumulativeFunding: bigint; effectiveImfBps: bigint; maintenanceMarginBps: bigint; closeOutMarginBps: bigint; } | { priceable: false; }

Defined in: packages/sdk/src/perp/margin.ts:177

Every per-market input a margin or health calculation needs, sampled together.

A discriminated union rather than a nullable struct because the contract's non-reverting variant returns an ALL-ZERO snapshot when the market is not priceable — and a maintenanceMarginBps of 0 silently reads as "no maintenance requirement", which is far more dangerous than a missing price. Narrow on priceable and the zeros are unreachable.

Union Members

Type Literal

{ priceable: true; oneBase: bigint; markPrice: bigint; projectedCumulativeFunding: bigint; effectiveImfBps: bigint; maintenanceMarginBps: bigint; closeOutMarginBps: bigint; }

priceable

priceable: true

The pool's mark feed is fresh; every field below is real.

oneBase

oneBase: bigint

10^decimals of the synthetic base asset — the divisor for notional math.

markPrice

markPrice: bigint

Fresh mark price, raw quote units per whole base.

projectedCumulativeFunding

projectedCumulativeFunding: bigint

Cumulative funding per unit INCLUDING unsettled intervals (1e18-scaled, signed).

effectiveImfBps

effectiveImfBps: bigint

The initial-margin factor actually in force, bps — OI-scaled when dynamic IMF is enabled, otherwise equal to PerpRiskParams.initialMarginBps. This, not the static base, is what the pool charges a new order.

maintenanceMarginBps

maintenanceMarginBps: bigint

Maintenance-margin threshold, bps (does not scale with OI).

closeOutMarginBps

closeOutMarginBps: bigint

Close-out / takeover threshold, bps.


Type Literal

{ priceable: false; }

priceable

priceable: false

The pool's mark feed is stale or zero, so the contract declined to produce a snapshot. Skip this market — do NOT substitute zeros or a previous reading.