@somnia-chain/markets-sdk


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

Interface: SomniaMarketsAddresses

Defined in: packages/sdk/src/config.ts:16

Protocol contract addresses (all optional — features degrade if unset).

Properties

fakeOracle?

optional fakeOracle?: `0x${string}`

Defined in: packages/sdk/src/config.ts:18

FakeOracle resolver (demo resolve/void).


collateral?

optional collateral?: `0x${string}`

Defined in: packages/sdk/src/config.ts:24

Per-venue collateral ERC-20 (the venue's quote/collateral token; on test environments this is the faucet-capable TestUSDC). Preferred over testUsdc, which remains as the legacy/fallback alias.


testUsdc?

optional testUsdc?: `0x${string}`

Defined in: packages/sdk/src/config.ts:29

TestUSDC collateral (faucet + balances). Legacy/fallback alias for SomniaMarketsAddresses.collateral.


binaryModule?

optional binaryModule?: `0x${string}`

Defined in: packages/sdk/src/config.ts:35

BinaryMarketsModule — the binary product's core module (complete-set mint/redeem, market creation, adapter approval). Needed by the trader writes, the hub-approval reads, and /system diagnostics.


marketCreator?

optional marketCreator?: `0x${string}`

Defined in: packages/sdk/src/config.ts:40

MarketCreator factory. When set, the live tail watches MarketCreated and picks up new binary markets the block they deploy — no indexer round-trip.


clobFactory?

optional clobFactory?: `0x${string}`

Defined in: packages/sdk/src/config.ts:45

ClobFactory — /system-diagnostics fallback when the module's live clobFactory() read fails; a live/config mismatch is flagged.


binaryPoolImpl?

optional binaryPoolImpl?: `0x${string}`

Defined in: packages/sdk/src/config.ts:53

BinaryPool implementation behind the fleet (distinct from the factory's binaryMarketImpl). On beacon-generation deploys this is the impl the SomniaMarketsAddresses.binaryPoolBeacon points at; on pre-beacon deploys it is the EIP-1167 master copy the factory cloned. Not read by the SDK itself, but surfaced to apps — the explorer's system overview renders it.


binaryPoolBeacon?

optional binaryPoolBeacon?: `0x${string}`

Defined in: packages/sdk/src/config.ts:60

The fleet's UpgradeableBeacon (beacon generation onwards). Every pool the factory deploys is a BeaconProxy against it, so upgrading the beacon moves the whole fleet at once. Absent on pre-beacon manifests, where pools are independent clones of SomniaMarketsAddresses.binaryPoolImpl.


binarySettlement?

optional binarySettlement?: `0x${string}`

Defined in: packages/sdk/src/config.ts:68

The permanent BinarySettlement singleton (settlement-extraction v2). Every pool finalizes its markets into it and every redemption routes through it, so a pool can be recycled onto the next market. Needed by the low-level redeemDirect / claimOwed / getSettlement trader methods, which throw if it is unset. Absent on pre-v2 (pool-redeem) deploys.


operatorPermissionsRegistry?

optional operatorPermissionsRegistry?: `0x${string}`

Defined in: packages/sdk/src/config.ts:73

Shared OperatorPermissionsRegistry — users operator-approve a SpotStopOrderRegistry here (once, globally) so it can place their stop order via the pool at trigger time.


marketsCore?

optional marketsCore?: `0x${string}`

Defined in: packages/sdk/src/config.ts:79

MarketsCore — the control-plane registry of operators, typed venues, and the module binding per market type. Needed by the operator/venue admin reads + createOperatorAdmin writes.


collateralRouter?

optional collateralRouter?: `0x${string}`

Defined in: packages/sdk/src/config.ts:86

CollateralRouter periphery — the native-token (wrap/unwrap) + Permit2 entry over BinaryMarketsModule's complete-set flow. May be absent for an environment where only the plain-ERC-20 path is deployed; the router-based trader methods throw if it is unset rather than sending to the zero address.


marketCreatorFactory?

optional marketCreatorFactory?: `0x${string}`

Defined in: packages/sdk/src/config.ts:92

MarketCreatorFactory — stamps out per-operator/venue MarketCreator (+ its policy) instances, the operator "market machinery" layer. Needed by createMarketCreatorAdmin writes; the admin throws if it is unset.


marketCreatorFactoryV2?

optional marketCreatorFactoryV2?: `0x${string}`

Defined in: packages/sdk/src/config.ts:101

v2 sibling of SomniaMarketsAddresses.marketCreatorFactory — stamps out MarketCreatorV2 (interval/bucket-mode rolling series) instances. Additive: coexists with the v1 factory. Not read by createMarketCreatorAdmin automatically — pass it explicitly via that call's factory override to mint a v2 creator instead of v1. Undefined on deploys that predate it.


oracleHub?

optional oracleHub?: `0x${string}`

Defined in: packages/sdk/src/config.ts:112

The OracleHub proxy (Oracle v2 §8e) — the protocol's ONE governance-approved oracle adapter. Every market creation binds through it (content-addressed scheduleQuestion dedup, earmark-at-creation resolution funding + bounded-drain exact metering, payout-vector delivery). Needed by the OracleHub reads (quoteCreateMarketValue, getSchedulingCost, earmarkedOf, resolveReserve) and the createOracleHubAdmin writes; those throw if it is unset. Also the default adapter for createMarketCreatorAdmin.createMarketCreator.


oracleAdapterFactory?

optional oracleAdapterFactory?: `0x${string}`

Defined in: packages/sdk/src/config.ts:120

Legacy OracleAdapterFactory address retained for source compatibility.

Deprecated

LEGACY (pre-oracle-v2): OracleAdapterFactory. The factory contract was deleted in Oracle v2 — use SomniaMarketsAddresses.oracleHub. Kept only so old configs keep type-checking; nothing in the SDK reads it.


sharedOracleAdapter?

optional sharedOracleAdapter?: `0x${string}`

Defined in: packages/sdk/src/config.ts:128

Legacy shared oracle-adapter address retained for source compatibility.

Deprecated

LEGACY (pre-oracle-v2): the shared ProphecyOracleAdapter proxy. Replaced by SomniaMarketsAddresses.oracleHub. Kept only so old configs keep type-checking; nothing in the SDK reads it.


perpPoolFactory?

optional perpPoolFactory?: `0x${string}`

Defined in: packages/sdk/src/config.ts:157

PerpPoolFactory — the on-chain authority on which perp markets exist.

Unnecessary ONLY while the indexer carries at least one perp row. SomniaMarkets.loadMarkets finds the factory from such a row: it carries its marginBank, and MarginBank.getSystemConfig() reports the factory the bank actually calls. That is the better source — it is the deployment's own view of its wiring, so it cannot drift from a stale config the way a hardcoded address can.

Set this for the one case the bootstrap cannot cover: an indexer with NO perp rows at all, where there is no marginBank to ask. That happens on a fresh reindex, and while an indexer is catching up below the factory's first deploy block. Without it, loadMarkets does not look for perps at all and returns an empty perp set with every error accessor clean; SomniaMarkets.perpDiscoverySkipped is what reports that state.

When set it takes precedence, so it also serves as an override while a bank's reported factory is being rotated.

SOMNIA_TESTNET_ADDRESSES and SOMNIA_HIDEKI_TESTNET_ADDRESSES set it, so a binding with either preset lists its perps without an indexer. SOMNIA_MAINNET_ADDRESSES does not set it. Because a set value takes precedence, these presets do not use the bank's factory. The preset value is fixed when the SDK version is released, so it can become stale after a perps redeploy. To use the bank's factory, pass a copy of the preset without this field.


lend?

optional lend?: LendAddresses

Defined in: packages/sdk/src/config.ts:184

SomniaLend money-market addresses — a THIRD-PARTY Aave v3 fork (docs.somnialend.finance), so unlike the first-party fields above these are NOT in the deployments manifests. Set SOMNIA_MAINNET_LEND or SOMNIA_TESTNET_LEND (from the root entry) for the published deployments. Backs the client.lend namespace; its methods throw a clear error when the address they need is unset.

Gotchas

This is the ONLY way to point the lend surface at a deployment — and the addresses must belong to this client's chain. A testnet deployment needs a testnet client; there is no way to graft one chain's lend addresses onto another chain's socket.

Example (Configuring SomniaLend)

ts
const exchange = new SomniaMarkets({
  ...config,
  addresses: { lend: SOMNIA_MAINNET_LEND },
});
const account = await exchange.client.lend.getAccount(me);
console.log(`health factor ${account.healthFactor}`);