Skip to content

Event specification

44 events, every one with a reason.

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.

Conventions

  • 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

AvailableCredited

topic00xde006e0e…d71c90
AvailableCredited(address indexed account, uint256 amount, uint8 kind)
ParameterTypeIndexed
accountaddressyes (topic)
amountuint256no (data)
kinduint8no (data)
Emitted by
creditAvailable
When
A realized gain is paid to free collateral (kind RealizedPnl). The PnL pool falls by the same amount, which is how the vault equation stays balanced.
Indexer tables
  • collateral_events (available_credited)
  • account_balances

BadDebtRecorded

topic00xf824141b…e3d1d6
BadDebtRecorded(address indexed account, uint256 amount, uint256 total)
ParameterTypeIndexed
accountaddressyes (topic)
amountuint256no (data)
totaluint256no (data)
Emitted by
coverFromInsurance
When
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).
Indexer tables
  • collateral_events (bad_debt_recorded)
  • insurance_fund_events (bad_debt)

Deposited

topic00x73a19dd2…b488ca
Deposited(address indexed account, uint256 tokenAmount, uint256 amount)
ParameterTypeIndexed
accountaddressyes (topic)
tokenAmountuint256no (data)
amountuint256no (data)
Emitted by
deposit(tokenAmount)
When
A trader's tokens enter the vault. tokenAmount is in token units; amount is the WAD ledger amount credited to available.
Indexer tables
  • collateral_events (deposited)
  • account_balances

FeeCharged

topic00xf95c12ee…ae4972
FeeCharged(address indexed account, uint256 amount, uint256 toInsurance, uint256 toProtocol)
ParameterTypeIndexed
accountaddressyes (topic)
amountuint256no (data)
toInsuranceuint256no (data)
toProtocoluint256no (data)
Emitted by
chargeFee, called by the risk engine on every fill
When
A trading fee leaves the trader's available collateral and is split between the insurance fund and protocol fees by the market's insuranceShareBps.
Indexer tables
  • collateral_events (fee_charged)
  • account_balances
  • insurance_fund_events (fee_share, when toInsurance > 0)

InsuranceCovered

topic00x500468a0…2a6609
InsuranceCovered(address indexed account, uint256 requested, uint256 covered, uint256 shortfall)
ParameterTypeIndexed
accountaddressyes (topic)
requesteduint256no (data)
covereduint256no (data)
shortfalluint256no (data)
Emitted by
coverFromInsurance, called by the risk engine when a loss exceeds a position's margin
When
requested is the shortfall, covered what the fund paid into the PnL pool, shortfall what it could not.
Indexer tables
  • collateral_events (insurance_covered)
  • insurance_fund_events (cover)

InsuranceFunded

topic00x3175d86e…d70df3
InsuranceFunded(address indexed from, uint256 amount, uint256 balance)
ParameterTypeIndexed
fromaddressyes (topic)
amountuint256no (data)
balanceuint256no (data)
Emitted by
fundInsurance (anyone), lockedToInsurance (risk engine)
When
The insurance fund grows by a voluntary contribution or by its share of a liquidation penalty. balance is the fund after the change.
Indexer tables
  • collateral_events (insurance_funded)
  • insurance_fund_events (funded)

LockedCredited

topic00x3bdaaed6…7c120c
LockedCredited(address indexed account, uint256 amount, uint8 kind)
ParameterTypeIndexed
accountaddressyes (topic)
amountuint256no (data)
kinduint8no (data)
Emitted by
creditLocked
When
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).
Indexer tables
  • collateral_events (locked_credited)
  • account_balances

LockedDebited

topic00x7c190893…2f8243
LockedDebited(address indexed account, uint256 amount, uint8 kind)
ParameterTypeIndexed
accountaddressyes (topic)
amountuint256no (data)
kinduint8no (data)
Emitted by
debitLocked, and lockedToInsurance
When
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)
ParameterTypeIndexed
fromaddressyes (topic)
toaddressyes (topic)
amountuint256no (data)
kinduint8no (data)
Emitted by
lockedToAvailable
When
The liquidator's incentive moves from the liquidated position's margin to the liquidator's free collateral (kind LiquidatorIncentive).
Indexer tables
  • collateral_events (locked_transferred)
  • account_balances (both accounts)

MarginLocked

topic00x35cbbe11…eff8e7
MarginLocked(address indexed account, uint256 amount, bool fromReserved)
ParameterTypeIndexed
accountaddressyes (topic)
amountuint256no (data)
fromReservedboolno (data)
Emitted by
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.
Indexer tables
  • collateral_events (margin_locked)
  • account_balances

MarginUnlocked

topic00xbac7ca67…196d19
MarginUnlocked(address indexed account, uint256 amount)
ParameterTypeIndexed
accountaddressyes (topic)
amountuint256no (data)
Emitted by
unlockToAvailable
When
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)
ParameterTypeIndexed
toaddressyes (topic)
amountuint256no (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)
ParameterTypeIndexed
accountaddressyes (topic)
amountuint256no (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)
ParameterTypeIndexed
accountaddressyes (topic)
amountuint256no (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)
ParameterTypeIndexed
untiluint64no (data)
Emitted by
pauseWithdrawals (PAUSER_ROLE)
When
Withdrawals are paused until the given time, at most MAX_WITHDRAWAL_PAUSE (3 days) ahead.
Indexer tables
  • protocol_state (withdrawals_paused_until)

Withdrawn

topic00x92ccf450…66ebc6
Withdrawn(address indexed account, uint256 tokenAmount, uint256 amount)
ParameterTypeIndexed
accountaddressyes (topic)
tokenAmountuint256no (data)
amountuint256no (data)
Emitted by
withdraw(tokenAmount)
When
Free collateral leaves the vault. Reverts during a withdrawal pause or when available is short.
Indexer tables
  • collateral_events (withdrawn)
  • account_balances

Paused

Inherited (OpenZeppelin)topic00x62e78cea…05a258
Paused(address account)
ParameterTypeIndexed
accountaddressno (data)
Emitted by
pause (PAUSER_ROLE)
When
Vault: deposits paused. Order book: new orders and matching paused; cancellation keeps working.
Indexer tables
  • protocol_events (archive only)

RoleAdminChanged

Inherited (OpenZeppelin)topic00xbd79b86f…0b00ff
RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)
ParameterTypeIndexed
rolebytes32yes (topic)
previousAdminRolebytes32yes (topic)
newAdminRolebytes32yes (topic)
Emitted by
_setRoleAdmin (not called by any Elysta function)
When
Would record a change of which role administers another; Elysta never changes it from DEFAULT_ADMIN_ROLE.
Indexer tables
  • protocol_events (archive only)

RoleGranted

Inherited (OpenZeppelin)topic00x2f878811…656f0d
RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)
ParameterTypeIndexed
rolebytes32yes (topic)
accountaddressyes (topic)
senderaddressyes (topic)
Emitted by
grantRole (the role's admin), and the constructor and setOrderEngine for the initial grants
When
An account receives a role.
Indexer tables
  • protocol_events (archive only)

RoleRevoked

Inherited (OpenZeppelin)topic00xf6391f5c…39171b
RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)
ParameterTypeIndexed
rolebytes32yes (topic)
accountaddressyes (topic)
senderaddressyes (topic)
Emitted by
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)

Unpaused

Inherited (OpenZeppelin)topic00x5db9ee0a…b073aa
Unpaused(address account)
ParameterTypeIndexed
accountaddressno (data)
Emitted by
unpause (PAUSER_ROLE)
When
The pause above is lifted.
Indexer tables
  • protocol_events (archive only)

Market Registry & Oracle

Listings, parameter changes, status transitions with their reason, and every accepted or rejected price observation.

ElystaMarketRegistryOracle.sol · 12 own events, 3 inherited

DeviationConfirmed

topic00xb97a92bb…6312e3
DeviationConfirmed(uint32 indexed marketId, uint256 price)
ParameterTypeIndexed
marketIduint32yes (topic)
priceuint256no (data)
Emitted by
refreshIndex, clearOracleHalt(acceptPending)
When
A pending price was adopted as the new index, either because it persisted or because an oracle manager accepted it after review.
Indexer tables
  • protocol_events (archive only)

DeviationPending

topic00xb77cf88f…81f10c
DeviationPending(uint32 indexed marketId, uint256 pendingPrice, uint256 lastValidPrice)
ParameterTypeIndexed
marketIduint32yes (topic)
pendingPriceuint256no (data)
lastValidPriceuint256no (data)
Emitted by
refreshIndex
When
A deviating price is being held as pending; if later observations stay consistent with it for deviationConfirmSeconds it will be adopted.
Indexer tables
  • protocol_events (archive only)

ExecutionParamsUpdated

topic00xf478b532…de5de3
ExecutionParamsUpdated(uint32 indexed marketId, (uint128 tickSize, uint128 lotSize, uint128 minOrderQty, uint128 maxOrderQty, uint32 priceBandBps, uint32 maxImpactBps, uint32 markBandBps) params)
ParameterTypeIndexed
marketIduint32yes (topic)
params(uint128 tickSize, uint128 lotSize, uint128 minOrderQty, uint128 maxOrderQty, uint32 priceBandBps, uint32 maxImpactBps, uint32 markBandBps)no (data)
Emitted by
addMarket, setExecutionParams
When
Tick, lot, order size limits, price band, impact cap and mark band are set.
Indexer tables
  • markets

FeeParamsUpdated

topic00xb93dd76a…5f5a17
FeeParamsUpdated(uint32 indexed marketId, (uint64 makerFee, uint64 takerFee, uint32 insuranceShareBps) params)
ParameterTypeIndexed
marketIduint32yes (topic)
params(uint64 makerFee, uint64 takerFee, uint32 insuranceShareBps)no (data)
Emitted by
addMarket, setFeeParams
When
Maker fee, taker fee and the insurance share are set.
Indexer tables
  • markets

HolidaySet

topic00x9d86c85b…c6dafa
HolidaySet(uint32 indexed marketId, uint32 indexed day, bool closed)
ParameterTypeIndexed
marketIduint32yes (topic)
dayuint32yes (topic)
closedboolno (data)
Emitted by
setHoliday
When
A UTC day (unix time / 86400) is marked closed or reopened for a scheduled market.
Indexer tables
  • market_holidays

IndexPriceUpdated

topic00xc8f77f5f…358d68
IndexPriceUpdated(uint32 indexed marketId, uint256 price, uint64 publishedAt, address adapter, bool fromSecondary)
ParameterTypeIndexed
marketIduint32yes (topic)
priceuint256no (data)
publishedAtuint64no (data)
adapteraddressno (data)
fromSecondaryboolno (data)
Emitted by
refreshIndex (permissionless; the keeper calls it through postAndRefresh), clearOracleHalt(acceptPending)
When
An adapter observation passed validation and became the index. adapter says which adapter; fromSecondary whether the fallback was used.
Indexer tables
  • oracle_observations
  • market_index_state

MarketAdded

topic00xdfbd2954…c54352
MarketAdded(uint32 indexed marketId, string symbol, string underlying, uint8 assetClass)
ParameterTypeIndexed
marketIduint32yes (topic)
symbolstringno (data)
underlyingstringno (data)
assetClassuint8no (data)
Emitted by
addMarket (MARKET_MANAGER_ROLE)
When
A market is listed in status Inactive. The five parameter events follow in the same transaction; the indexer reads getMarket for the full configuration.
Indexer tables
  • markets

MarketStatusChanged

topic00x8d51a89d…d8cb96
MarketStatusChanged(uint32 indexed marketId, uint8 previous, uint8 current, uint8 reason)
ParameterTypeIndexed
marketIduint32yes (topic)
previousuint8no (data)
currentuint8no (data)
reasonuint8no (data)
Emitted by
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.
Indexer tables
  • market_status_events
  • markets (status)

OracleParamsUpdated

topic00xee632951…eb423f
OracleParamsUpdated(uint32 indexed marketId, (address primaryAdapter, bytes32 primaryFeedId, address secondaryAdapter, bytes32 secondaryFeedId, uint32 heartbeatSeconds, uint32 maxDeviationBps, uint32 reopenDeviationBps, uint32 reopenGapSeconds, uint32 deviationConfirmSeconds) params)
ParameterTypeIndexed
marketIduint32yes (topic)
params(address primaryAdapter, bytes32 primaryFeedId, address secondaryAdapter, bytes32 secondaryFeedId, uint32 heartbeatSeconds, uint32 maxDeviationBps, uint32 reopenDeviationBps, uint32 reopenGapSeconds, uint32 deviationConfirmSeconds)no (data)
Emitted by
addMarket, setOracleParams (ORACLE_MANAGER_ROLE)
When
Adapters, feed ids, heartbeat, deviation and reopening thresholds are set. The indexer re-reads the adapter's feed source string.
Indexer tables
  • markets (incl. feed_source)

PriceRejected

topic00x5e343fb9…c754ed
PriceRejected(uint32 indexed marketId, uint256 price, uint64 publishedAt, uint8 reason)
ParameterTypeIndexed
marketIduint32yes (topic)
priceuint256no (data)
publishedAtuint64no (data)
reasonuint8no (data)
Emitted by
refreshIndex
When
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).
Indexer tables
  • oracle_rejections

RiskParamsUpdated

topic00xfbbacd59…f74f49
RiskParamsUpdated(uint32 indexed marketId, (uint64 initialMarginFraction, uint64 maintenanceMarginFraction, uint128 maxOpenInterest, uint128 maxPositionQty, uint32 fundingIntervalSeconds, uint64 maxFundingRatePerInterval, uint32 liquidationFeeBps, uint32 liquidatorShareBps) params)
ParameterTypeIndexed
marketIduint32yes (topic)
params(uint64 initialMarginFraction, uint64 maintenanceMarginFraction, uint128 maxOpenInterest, uint128 maxPositionQty, uint32 fundingIntervalSeconds, uint64 maxFundingRatePerInterval, uint32 liquidationFeeBps, uint32 liquidatorShareBps)no (data)
Emitted by
addMarket, setRiskParams
When
Margin fractions, position and open-interest caps, funding interval and cap, liquidation fee and liquidator share are set.
Indexer tables
  • markets

SessionUpdated

topic00xc097cc71…e7a9db
SessionUpdated(uint32 indexed marketId, uint8 policy, (uint16[7] openMinute, uint16[7] closeMinute) session)
ParameterTypeIndexed
marketIduint32yes (topic)
policyuint8no (data)
session(uint16[7] openMinute, uint16[7] closeMinute)no (data)
Emitted by
addMarket, setSession
When
The session policy (Continuous or Scheduled) and the weekly UTC schedule are set.
Indexer tables
  • markets (session_policy, session)

RoleAdminChanged

Inherited (OpenZeppelin)topic00xbd79b86f…0b00ff
RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)
ParameterTypeIndexed
rolebytes32yes (topic)
previousAdminRolebytes32yes (topic)
newAdminRolebytes32yes (topic)
Emitted by
_setRoleAdmin (not called by any Elysta function)
When
Would record a change of which role administers another; Elysta never changes it from DEFAULT_ADMIN_ROLE.
Indexer tables
  • protocol_events (archive only)

RoleGranted

Inherited (OpenZeppelin)topic00x2f878811…656f0d
RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)
ParameterTypeIndexed
rolebytes32yes (topic)
accountaddressyes (topic)
senderaddressyes (topic)
Emitted by
grantRole (the role's admin), and the constructor and setOrderEngine for the initial grants
When
An account receives a role.
Indexer tables
  • protocol_events (archive only)

RoleRevoked

Inherited (OpenZeppelin)topic00xf6391f5c…39171b
RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)
ParameterTypeIndexed
rolebytes32yes (topic)
accountaddressyes (topic)
senderaddressyes (topic)
Emitted by
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)

Order Book & Matching

The order lifecycle: placed, rested, filled, cancelled. Fills carry both order ids, both fees and a sequence number shared with placements.

ElystaOrderBookEngine.sol · 6 own events, 5 inherited

Fill

topic00x66b63208…ef61f7
Fill(uint32 indexed marketId, uint64 indexed makerOrderId, uint64 indexed takerOrderId, address maker, address taker, uint8 takerSide, uint128 price, uint128 qty, uint256 makerFee, uint256 takerFee, uint64 seq)
ParameterTypeIndexed
marketIduint32yes (topic)
makerOrderIduint64yes (topic)
takerOrderIduint64yes (topic)
makeraddressno (data)
takeraddressno (data)
takerSideuint8no (data)
priceuint128no (data)
qtyuint128no (data)
makerFeeuint256no (data)
takerFeeuint256no (data)
sequint64no (data)
Emitted by
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.
Indexer tables
  • fills
  • orders (filled, remaining of both orders)
  • candles (every interval)

MatchingLimitsUpdated

topic00xb1c8257a…6e90a6
MatchingLimitsUpdated((uint16 maxFillsPerTx, uint16 maxLevelsPerTx, uint16 maxOpenOrdersPerAccount) limits)
ParameterTypeIndexed
limits(uint16 maxFillsPerTx, uint16 maxLevelsPerTx, uint16 maxOpenOrdersPerAccount)no (data)
Emitted by
constructor, setMatchingLimits (DEFAULT_ADMIN_ROLE)
When
The per-transaction fill and level budgets and the open-order cap are set.
Indexer tables
  • protocol_state (matching_limits)

OrderCancelled

topic00x4c69603b…399f51
OrderCancelled(uint64 indexed orderId, address indexed trader, uint128 remaining, uint8 reason)
ParameterTypeIndexed
orderIduint64yes (topic)
traderaddressyes (topic)
remaininguint128no (data)
reasonuint8no (data)
Emitted by
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)
ParameterTypeIndexed
orderIduint64yes (topic)
Emitted by
matching, when an order's remaining quantity reaches zero
When
The order is complete; any leftover reservation was released.
Indexer tables
  • orders (status Filled)

OrderPlaced

topic00xb39bef89…bd04dd
OrderPlaced(uint64 indexed orderId, address indexed trader, uint32 indexed marketId, uint8 side, uint8 kind, uint8 tif, uint128 price, uint128 qty, bool reduceOnly, uint64 expiresAt, uint64 seq)
ParameterTypeIndexed
orderIduint64yes (topic)
traderaddressyes (topic)
marketIduint32yes (topic)
sideuint8no (data)
kinduint8no (data)
tifuint8no (data)
priceuint128no (data)
qtyuint128no (data)
reduceOnlyboolno (data)
expiresAtuint64no (data)
sequint64no (data)
Emitted by
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.
Indexer tables
  • orders

OrderRested

topic00x8628ac88…744b22
OrderRested(uint64 indexed orderId, uint128 remaining, uint128 reserved)
ParameterTypeIndexed
orderIduint64yes (topic)
remaininguint128no (data)
reserveduint128no (data)
Emitted by
placeOrder
When
A GTC or post-only limit remainder entered the book, with its remaining quantity and reservation. Orders that fill at once never rest.
Indexer tables
  • orders (rested, remaining, reserved)

Paused

Inherited (OpenZeppelin)topic00x62e78cea…05a258
Paused(address account)
ParameterTypeIndexed
accountaddressno (data)
Emitted by
pause (PAUSER_ROLE)
When
Vault: deposits paused. Order book: new orders and matching paused; cancellation keeps working.
Indexer tables
  • protocol_events (archive only)

RoleAdminChanged

Inherited (OpenZeppelin)topic00xbd79b86f…0b00ff
RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)
ParameterTypeIndexed
rolebytes32yes (topic)
previousAdminRolebytes32yes (topic)
newAdminRolebytes32yes (topic)
Emitted by
_setRoleAdmin (not called by any Elysta function)
When
Would record a change of which role administers another; Elysta never changes it from DEFAULT_ADMIN_ROLE.
Indexer tables
  • protocol_events (archive only)

RoleGranted

Inherited (OpenZeppelin)topic00x2f878811…656f0d
RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)
ParameterTypeIndexed
rolebytes32yes (topic)
accountaddressyes (topic)
senderaddressyes (topic)
Emitted by
grantRole (the role's admin), and the constructor and setOrderEngine for the initial grants
When
An account receives a role.
Indexer tables
  • protocol_events (archive only)

RoleRevoked

Inherited (OpenZeppelin)topic00xf6391f5c…39171b
RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)
ParameterTypeIndexed
rolebytes32yes (topic)
accountaddressyes (topic)
senderaddressyes (topic)
Emitted by
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)

Unpaused

Inherited (OpenZeppelin)topic00x5db9ee0a…b073aa
Unpaused(address account)
ParameterTypeIndexed
accountaddressno (data)
Emitted by
unpause (PAUSER_ROLE)
When
The pause above is lifted.
Indexer tables
  • protocol_events (archive only)

Perpetual Risk Engine

Position changes with the PnL and fee they settled, funding accrual, settlement and payments, liquidations and margin adjustments.

ElystaPerpRiskEngine.sol · 7 own events, 3 inherited

FundingApplied

topic00x02b88158…4cd976
FundingApplied(address indexed account, uint32 indexed marketId, int256 payment, int256 fundingIndex)
ParameterTypeIndexed
accountaddressyes (topic)
marketIduint32yes (topic)
paymentint256no (data)
fundingIndexint256no (data)
Emitted by
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.
Indexer tables
  • funding_payments
  • positions (funding_paid)

FundingSettled

topic00x9f64f489…8a877f
FundingSettled(uint32 indexed marketId, int256 rate, int256 cumulativeIndex, uint256 markPrice, uint256 indexPrice, int256 premiumTwap, uint64 timestamp)
ParameterTypeIndexed
marketIduint32yes (topic)
rateint256no (data)
cumulativeIndexint256no (data)
markPriceuint256no (data)
indexPriceuint256no (data)
premiumTwapint256no (data)
timestampuint64no (data)
Emitted by
settleFunding (permissionless; the keeper calls it at each interval boundary)
When
The interval's time-weighted premium became a capped rate and rate × mark was added to the cumulative funding index.
Indexer tables
  • funding_settlements

Liquidated

topic00xe55729b5…2f800d
Liquidated(address indexed account, address indexed liquidator, uint32 indexed marketId, uint128 qty, uint128 markPrice, uint256 penalty, uint256 liquidatorIncentive, uint256 insuranceContribution, uint256 badDebt, bool full)
ParameterTypeIndexed
accountaddressyes (topic)
liquidatoraddressyes (topic)
marketIduint32yes (topic)
qtyuint128no (data)
markPriceuint128no (data)
penaltyuint256no (data)
liquidatorIncentiveuint256no (data)
insuranceContributionuint256no (data)
badDebtuint256no (data)
fullboolno (data)
Emitted by
liquidate (permissionless)
When
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.
Indexer tables
  • liquidations

MarginAdjusted

topic00x2ad61d93…5460cf
MarginAdjusted(address indexed account, uint32 indexed marketId, int256 delta, uint128 margin)
ParameterTypeIndexed
accountaddressyes (topic)
marketIduint32yes (topic)
deltaint256no (data)
marginuint128no (data)
Emitted by
addMargin, removeMargin (the position's owner)
When
Margin was added from, or returned to, free collateral. delta is signed; margin is the position's margin after.
Indexer tables
  • margin_adjustments
  • positions (margin)

OrderEngineSet

topic00xc8b26210…3e6700
OrderEngineSet(address indexed orderEngine)
ParameterTypeIndexed
orderEngineaddressyes (topic)
Emitted by
setOrderEngine (DEFAULT_ADMIN_ROLE), once
When
The order book engine was bound and granted ORDER_ENGINE_ROLE. The binding cannot be changed.
Indexer tables
  • protocol_state (order_engine)

PositionChanged

topic00xc4a4ab2a…12fa40
PositionChanged(address indexed account, uint32 indexed marketId, int128 qty, uint128 avgEntryPrice, uint128 margin, int256 realizedPnl, uint256 fee, uint128 fillPrice, uint128 fillQty, uint8 reason)
ParameterTypeIndexed
accountaddressyes (topic)
marketIduint32yes (topic)
qtyint128no (data)
avgEntryPriceuint128no (data)
marginuint128no (data)
realizedPnlint256no (data)
feeuint256no (data)
fillPriceuint128no (data)
fillQtyuint128no (data)
reasonuint8no (data)
Emitted by
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.
Indexer tables
  • position_events
  • positions

PremiumAccrued

topic00x4e20cf0a…8ecb94
PremiumAccrued(uint32 indexed marketId, int256 premium, uint64 elapsed)
ParameterTypeIndexed
marketIduint32yes (topic)
premiumint256no (data)
elapseduint64no (data)
Emitted by
every state change and accruePremium (permissionless)
When
The premium (mark − index) / index was accrued for the elapsed seconds. Not emitted while the index is invalid: a halted market accrues no premium.
Indexer tables
  • protocol_events (archive only)

RoleAdminChanged

Inherited (OpenZeppelin)topic00xbd79b86f…0b00ff
RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)
ParameterTypeIndexed
rolebytes32yes (topic)
previousAdminRolebytes32yes (topic)
newAdminRolebytes32yes (topic)
Emitted by
_setRoleAdmin (not called by any Elysta function)
When
Would record a change of which role administers another; Elysta never changes it from DEFAULT_ADMIN_ROLE.
Indexer tables
  • protocol_events (archive only)

RoleGranted

Inherited (OpenZeppelin)topic00x2f878811…656f0d
RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)
ParameterTypeIndexed
rolebytes32yes (topic)
accountaddressyes (topic)
senderaddressyes (topic)
Emitted by
grantRole (the role's admin), and the constructor and setOrderEngine for the initial grants
When
An account receives a role.
Indexer tables
  • protocol_events (archive only)

RoleRevoked

Inherited (OpenZeppelin)topic00xf6391f5c…39171b
RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)
ParameterTypeIndexed
rolebytes32yes (topic)
accountaddressyes (topic)
senderaddressyes (topic)
Emitted by
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

FeedConfigured

topic00x1cca6f2a…419744
FeedConfigured(bytes32 indexed feedId, string source)
ParameterTypeIndexed
feedIdbytes32yes (topic)
sourcestringno (data)
Emitted by
configureFeed (DEFAULT_ADMIN_ROLE)
When
A feed id (keccak256 of its source string, e.g. hypercore:BTC) is declared with that string.
Indexer tables
  • protocol_events (archive only)

PricePosted

topic00x9c66a9ad…c1a92a
PricePosted(bytes32 indexed feedId, uint128 price, uint64 publishedAt, address updater)
ParameterTypeIndexed
feedIdbytes32yes (topic)
priceuint128no (data)
publishedAtuint64no (data)
updateraddressno (data)
Emitted by
post, postAndRefresh (UPDATER_ROLE, the keeper)
When
An observation was stored for a feed. It becomes an index price only if the registry's refreshIndex accepts it.
Indexer tables
  • protocol_events (archive only)

RegistrySet

topic00x27fe5f0c…b5dc3b
RegistrySet(address registry)
ParameterTypeIndexed
registryaddressno (data)
Emitted by
setRegistry (DEFAULT_ADMIN_ROLE)
When
The registry that postAndRefresh calls was set.
Indexer tables
  • protocol_events (archive only)

RoleAdminChanged

Inherited (OpenZeppelin)topic00xbd79b86f…0b00ff
RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)
ParameterTypeIndexed
rolebytes32yes (topic)
previousAdminRolebytes32yes (topic)
newAdminRolebytes32yes (topic)
Emitted by
_setRoleAdmin (not called by any Elysta function)
When
Would record a change of which role administers another; Elysta never changes it from DEFAULT_ADMIN_ROLE.
Indexer tables
  • protocol_events (archive only)

RoleGranted

Inherited (OpenZeppelin)topic00x2f878811…656f0d
RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)
ParameterTypeIndexed
rolebytes32yes (topic)
accountaddressyes (topic)
senderaddressyes (topic)
Emitted by
grantRole (the role's admin), and the constructor and setOrderEngine for the initial grants
When
An account receives a role.
Indexer tables
  • protocol_events (archive only)

RoleRevoked

Inherited (OpenZeppelin)topic00xf6391f5c…39171b
RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)
ParameterTypeIndexed
rolebytes32yes (topic)
accountaddressyes (topic)
senderaddressyes (topic)
Emitted by
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)

Enumerations

The uint8 values event arguments carry, identical to ElystaTypes.sol.

EnumerationValuesUsed in
SettlementKind (vault `kind`)
  • 0 RealizedPnl
  • 1 Funding
  • 2 TradingFee
  • 3 LiquidationPenalty
  • 4 LiquidatorIncentive
  • 5 BadDebtCover
  • 6 MarginAdjustment
AvailableCredited, LockedCredited, LockedDebited, LockedTransferred
MarketStatus
  • 0 Inactive
  • 1 Active
  • 2 ReduceOnly
  • 3 Paused
  • 4 Halted
MarketStatusChanged previous/current
StatusReason
  • 0 Admin
  • 1 OracleStale
  • 2 OracleDeviation
  • 3 OracleRecovered
  • 4 BadDebt
  • 5 Listing
MarketStatusChanged reason
PriceHealth
  • 0 NoPrice
  • 1 Ok
  • 2 Stale
  • 3 Deviation
PriceRejected reason
AssetClass
  • 0 Crypto
  • 1 Equity
  • 2 Commodity
  • 3 Index
MarketAdded
SessionPolicy
  • 0 Continuous
  • 1 Scheduled
SessionUpdated policy
Side
  • 0 Buy
  • 1 Sell
OrderPlaced side, Fill takerSide
OrderKind
  • 0 Limit
  • 1 Market
OrderPlaced kind
TimeInForce
  • 0 GTC
  • 1 IOC
  • 2 FOK
  • 3 PostOnly
OrderPlaced tif
CancelReason
  • 0 User
  • 1 Expired
  • 2 RiskRejected
  • 3 SelfTrade
  • 4 Remainder
  • 5 Admin
OrderCancelled reason
PositionChanged.reason
  • 0 Fill
  • 1 Liquidated
  • 2 Liquidator
  • 3 Margin (reserved)
PositionChanged

Indexer tables

The PostgreSQL schema Elysta’s indexer maintains (packages/db/migrations/0001_init.sql). Every financial row references its transaction, block and log.

TablesWhat they hold
protocol_eventsEvery 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, reorgsBlock hashes and parent hashes for reorg detection, the indexer’s position, and a record of every reorg handled.
markets, market_status_events, market_holidaysMarket configuration as of the latest parameter events, the full status history with reasons, and holidays.
oracle_observations, oracle_rejections, market_index_stateAccepted and rejected observations, and the latest validated index per market.
market_samplesPeriodic 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, candlesThe order lifecycle, every fill, and OHLCV buckets derived from fills.
positions, position_events, funding_settlements, funding_payments, liquidations, margin_adjustmentsPositions as of the latest PositionChanged, with the history of every change, funding settlement and payment, liquidation and margin adjustment.
collateral_events, account_balances, insurance_fund_eventsEvery vault ledger movement, the balances replayed from them (with the last reconciliation against accountOf), and the insurance fund’s history.
protocol_state, service_health, oracle_posts, keeper_actionsVault 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.