Generated from the compiled ABIs, so no name, parameter or indexed flag here can differ from the contracts. What emits each event, when, and where Elysta’s indexer puts it is written from the Solidity and the indexer’s handlers.
Ordering. Across the chain, events are ordered by (blockNumber, logIndex). Within a market, OrderPlaced.seq and Fill.seq share one counter, so placements and fills are totally ordered without relying on log position.
Indexed parameters are log topics and can be filtered by node RPC: accounts, market ids and order ids wherever they appear. Everything else is in the log data.
Units. Prices, quantities and amounts are WAD (18 decimals). Vault events that move tokens also carry tokenAmount in token units.
Enumerations arrive as uint8; the values are below.
Topic 0 is keccak256 of the canonical signature, shown on each card for filters.
Inherited events from OpenZeppelin (roles, pause) are listed after each contract’s own events; the indexer archives them without building a projection.
One archive, many projections
Elysta’s indexer stores every decoded log in protocol_events and builds the other tables from it. A table named on a card is where the event’s effect becomes queryable; the archive always has the raw event too. The indexing guide describes the reorg handling that keeps the projections a pure function of the chain.
Collateral Vault
Every ledger movement is an event, and the indexer replays them into account balances it then reconciles against accountOf on chain.
ElystaCollateralVault.sol · 16 own events, 5 inherited
The part of a shortfall the insurance fund could not pay. total is cumulative bad debt. The risk engine halts the market in the same transaction (MarketStatusChanged, reason BadDebt).
Funding received is added to a position's margin (kind Funding); on liquidation, a gain on the liquidated quantity is added to margin before the penalty (kind RealizedPnl).
A loss or a funding payment is taken from margin (kinds RealizedPnl, Funding). lockedToInsurance also emits it with kind LiquidationPenalty for the insurance fund's share of a penalty, followed by InsuranceFunded.
Indexer tables
collateral_events (locked_debited)
account_balances
LockedTransferred
topic00x2c60c75b…7596bf
LockedTransferred(address indexed from, address indexed to, uint256 amount, uint8 kind)
Parameter
Type
Indexed
from
address
yes (topic)
to
address
yes (topic)
amount
uint256
no (data)
kind
uint8
no (data)
Emitted by
lockedToAvailable
When
The liquidator's incentive moves from the liquidated position's margin to the liquidator's free collateral (kind LiquidatorIncentive).
lockFromAvailable (a fill that opens or increases a position; addMargin) or lockFromReserved
When
Isolated margin is locked for a position. The current risk engine releases the reservation first and locks from available, so fromReserved is false in practice.
Margin returns to available: proportionally on a partial close, entirely on a close, whatever remains after loss and penalty on a full liquidation, or on removeMargin.
Indexer tables
collateral_events (margin_unlocked)
account_balances
ProtocolFeesSwept
topic00x6d795903…eaf623
ProtocolFeesSwept(address indexed to, uint256 amount)
Parameter
Type
Indexed
to
address
yes (topic)
amount
uint256
no (data)
Emitted by
sweepProtocolFees (TREASURY_ROLE)
When
Accrued protocol fees are transferred out. Sub-token dust stays in the fee balance so the ledger never exceeds the token balance.
Indexer tables
collateral_events (protocol_fees_swept)
Released
topic00xb21fb52d…2e619e
Released(address indexed account, uint256 amount)
Parameter
Type
Indexed
account
address
yes (topic)
amount
uint256
no (data)
Emitted by
release, called by the risk engine on cancel, expiry, and for the share of a filled quantity
When
A reservation, or part of one, returns to available.
Indexer tables
collateral_events (released)
account_balances
Reserved
topic00x904dcdc4…0783d8
Reserved(address indexed account, uint256 amount)
Parameter
Type
Indexed
account
address
yes (topic)
amount
uint256
no (data)
Emitted by
reserve, called by the risk engine from reserveForOrder during placeOrder
When
Collateral is set aside for an order: initial margin plus taker fee for its full quantity at its limit price. Reduce-only orders reserve nothing.
Indexer tables
collateral_events (reserved)
account_balances
WithdrawalsPausedUntil
topic00x3fde7441…280107
WithdrawalsPausedUntil(uint64 until)
Parameter
Type
Indexed
until
uint64
no (data)
Emitted by
pauseWithdrawals (PAUSER_ROLE)
When
Withdrawals are paused until the given time, at most MAX_WITHDRAWAL_PAUSE (3 days) ahead.
A market is listed in status Inactive. The five parameter events follow in the same transaction; the indexer reads getMarket for the full configuration.
setMarketStatus (market manager, pauser or risk engine), refreshIndex (oracle halt and recovery), clearOracleHalt
When
The status moves, with the reason: Admin, OracleStale, OracleDeviation, OracleRecovered, BadDebt or Listing. Not emitted when the status does not change.
An observation was refused: NoPrice (adapter returned zero or reverted), Stale (older than heartbeatSeconds), or Deviation (moved more than allowed from the last valid price).
placeOrder and replaceOrder, once per matched maker order
When
A fill settled by the risk engine in the same transaction. price is the maker's price; fees are what each side paid. seq shares the counter with OrderPlaced, so fills and placements are totally ordered.
cancelOrder, cancelOrders, replaceOrder (the old order), cancelExpired, and matching itself
When
reason says why: User, Expired, RiskRejected (the maker's constraints refused a fill), SelfTrade (a resting order of the taker's own), Remainder (an IOC or market remainder, or a GTC remainder that still crossed when the budget ran out), Admin.
Indexer tables
orders (status, cancel_reason, remaining)
OrderFilled
topic00xb59d4d4e…b70173
OrderFilled(uint64 indexed orderId)
Parameter
Type
Indexed
orderId
uint64
yes (topic)
Emitted by
matching, when an order's remaining quantity reaches zero
When
The order is complete; any leftover reservation was released.
placeOrder; replaceOrder for the replacement order
When
An order passed validation and reservation and is about to match. For market orders price is the protective limit the engine computed. seq is the order's position in the market's single sequence.
any function that touches a position: applyFill, liquidate, removeMargin
When
The position settled funding owed or received since its last settlement. Positive payment: the account paid. fundingIndex is the market's cumulative index it is now settled to.
qty was taken over at markPrice. penalty is the fee charged, split into liquidatorIncentive and insuranceContribution; badDebt is any shortfall the insurance fund could not cover; full says whether the position was closed entirely.
applyFill (both sides), liquidate (the liquidated account and the liquidator)
When
A position's quantity, entry price or margin changed. reason: 0 fill, 1 this account was liquidated, 2 liquidator takeover. (3, margin adjustment, is reserved; addMargin and removeMargin emit MarginAdjusted.) realizedPnl and fee are what this change settled; fillPrice and fillQty what executed.
revokeRole (the role's admin) or renounceRole (the holder)
When
An account loses a role. The deploy script's hand-over renounces every deployer role this way.
Indexer tables
protocol_events (archive only)
Keeper Oracle Adapter
Not one of the four protocol contracts: the price adapter the keeper posts to. Its events are archived for audit; the registry's IndexPriceUpdated is the authoritative price record.
oracle/ElystaKeeperOracleAdapter.sol · 3 own events, 3 inherited
The PostgreSQL schema Elysta’s indexer maintains (packages/db/migrations/0001_init.sql). Every financial row references its transaction, block and log.
Tables
What they hold
protocol_events
Every decoded log of the five contracts, keyed by (block_number, log_index), with its arguments as JSON. The archive every other table is replayed from.
indexed_blocks, indexer_checkpoints, reorgs
Block hashes and parent hashes for reorg detection, the indexer’s position, and a record of every reorg handled.
markets, market_status_events, market_holidays
Market configuration as of the latest parameter events, the full status history with reasons, and holidays.
Accepted and rejected observations, and the latest validated index per market.
market_samples
Periodic chain reads of mark, index, best bid and ask, open interest and the cumulative funding index: the only source of mark and open-interest history, since none of those is an event.
orders, fills, candles
The order lifecycle, every fill, and OHLCV buckets derived from fills.
Vault totals and other chain reads with the block they were read at; service heartbeats; the keeper’s posts and actions.
WAD integers are stored as NUMERIC(78,0) and served as decimal strings. The chain remains the source of truth: these tables are query-efficient projections of its events, and the indexer never creates a financial value they do not derive from.