Skip to main content

Execution service

execution-service is an internal service that submits fills on chain. It runs on a private network and takes matched orders only from the matcher, so you never call it. It validates each matched pair before submitting anything on chain.

Execution contracts

execution-contracts contains the Matching and action-verification contracts used by the backend. These contracts are responsible for:
  • verifying signed user actions
  • constraining which modules can execute those actions
  • forwarding matched transfers into the account system
The execution path is trusted-backend driven. The orderbook does not send raw orders directly onchain.

Risk core

risk-core is the account and margin layer underneath the orderbook. Important concepts:
  • SubAccounts stores {asset, subId, balance} state per account
  • managers validate final account state and can handle settlement and liquidation
  • assets define transfer semantics and settlement hooks
  • CashAsset is the main cash accounting rail
  • FutureAsset tracks each dated future series: its mark, fill band and settlement price
  • the MarginEngine margins futures positions and collateral in one account, settles variation margin and liquidates

Why this split exists

This architecture keeps concerns separate:
  • markets-service handles order intake and market data
  • execution-service handles verified transaction submission
  • execution-contracts handles onchain match execution
  • risk-core handles solvency, settlement, and liquidation