@somnia-chain/markets-sdk


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

Variable: marginBankEventsAbi

const marginBankEventsAbi: readonly [{ type: "event"; name: "PositionUpdated"; inputs: readonly [{ name: "account"; type: "address"; indexed: true; }, { name: "perpPool"; type: "address"; indexed: true; }, { name: "newSize"; type: "int128"; indexed: false; }, { name: "avgEntryPrice"; type: "uint128"; indexed: false; }, { name: "realizedPnl"; type: "int256"; indexed: false; }, { name: "entryFundingIndex"; type: "int256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "FundingSettled"; inputs: readonly [{ name: "account"; type: "address"; indexed: true; }, { name: "perpPool"; type: "address"; indexed: true; }, { name: "payment"; type: "int256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "Deposited"; inputs: readonly [{ name: "account"; type: "address"; indexed: true; }, { name: "amount"; type: "uint256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "DepositedFor"; inputs: readonly [{ name: "account"; type: "address"; indexed: true; }, { name: "perpPool"; type: "address"; indexed: true; }, { name: "amount"; type: "uint256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "Withdrawn"; inputs: readonly [{ name: "account"; type: "address"; indexed: true; }, { name: "amount"; type: "uint256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "CollateralLocked"; inputs: readonly [{ name: "account"; type: "address"; indexed: true; }, { name: "perpPool"; type: "address"; indexed: true; }, { name: "amount"; type: "uint256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "CollateralUnlocked"; inputs: readonly [{ name: "account"; type: "address"; indexed: true; }, { name: "perpPool"; type: "address"; indexed: true; }, { name: "amount"; type: "uint256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "FeeCharged"; inputs: readonly [{ name: "account"; type: "address"; indexed: true; }, { name: "perpPool"; type: "address"; indexed: true; }, { name: "amount"; type: "uint256"; indexed: false; }, { name: "insurancePortion"; type: "uint256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "BuilderFeeCharged"; inputs: readonly [{ name: "payer"; type: "address"; indexed: true; }, { name: "builder"; type: "address"; indexed: true; }, { name: "perpPool"; type: "address"; indexed: true; }, { name: "amount"; type: "uint256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "RebatePaid"; inputs: readonly [{ name: "account"; type: "address"; indexed: true; }, { name: "perpPool"; type: "address"; indexed: true; }, { name: "amount"; type: "uint256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "AutoDeleveraged"; inputs: readonly [{ name: "counterparty"; type: "address"; indexed: true; }, { name: "perpPool"; type: "address"; indexed: true; }, { name: "bankrupt"; type: "address"; indexed: true; }, { name: "sizeReduced"; type: "int128"; indexed: false; }, { name: "bankruptcyPrice"; type: "uint256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "CloseOutMarginSettled"; inputs: readonly [{ name: "from"; type: "address"; indexed: true; }, { name: "to"; type: "address"; indexed: true; }, { name: "amount"; type: "uint256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "BadDebtAbsorbed"; inputs: readonly [{ name: "account"; type: "address"; indexed: true; }, { name: "badDebt"; type: "uint256"; indexed: false; }, { name: "covered"; type: "uint256"; indexed: false; }, { name: "absorbedBy"; type: "address"; indexed: true; }]; anonymous: false; }, { type: "event"; name: "PositionTransferred"; inputs: readonly [{ name: "from"; type: "address"; indexed: true; }, { name: "to"; type: "address"; indexed: true; }, { name: "perpPool"; type: "address"; indexed: true; }, { name: "size"; type: "int128"; indexed: false; }, { name: "collateralTransferred"; type: "uint256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "LiquidationOrderPanicked"; inputs: readonly [{ name: "account"; type: "address"; indexed: true; }, { name: "perpPool"; type: "address"; indexed: true; }, { name: "panicCode"; type: "uint256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "MainFundedChild"; inputs: readonly [{ name: "child"; type: "address"; indexed: true; }, { name: "payer"; type: "address"; indexed: true; }, { name: "amount"; type: "uint256"; indexed: false; }, { name: "outstandingPrincipal"; type: "uint256"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "IsolatedModeSet"; inputs: readonly [{ name: "account"; type: "address"; indexed: true; }, { name: "enabled"; type: "bool"; indexed: false; }]; anonymous: false; }, { type: "event"; name: "MaxLeverageSet"; inputs: readonly [{ name: "account"; type: "address"; indexed: true; }, { name: "perpPool"; type: "address"; indexed: true; }, { name: "leverageX"; type: "uint16"; indexed: false; }]; anonymous: false; }]

Defined in: packages/sdk/src/eventsAbi.ts:232

MarginBank events — the perp ACCOUNT plane. MarginBank is a singleton, so one subscription carries every account and every pool; filter on the indexed account / perpPool topics, or at read time.

Three groups, in declaration order: position and funding (PositionUpdated, FundingSettled), collateral flow (DepositedCollateralUnlocked), then money charged or moved (fees, rebates, and the settlement legs the liquidation waterfall books here rather than on LiquidationEngine — including the panic marker, which is a waterfall outcome despite the contract it fires from).

Owner-parameter *Updated events are deliberately absent: they carry admin wiring, not market data. AccountCredited / CreditReclaimed and the funded-principal pair are absent for the same reason — they belong to the voucher programme, which has no client surface yet.

Signatures are generated from indexer/abis/MarginBank.json and pinned by topic0 in test/perpEventsAbi.test.ts. Hand-typing is the documented failure mode here: three of these were wrong in the indexer config for exactly that reason, and the plane indexed nothing while looking healthy.