Primary outcome: The indexer decodes SO4 Soroban contract events and keeps GraphQL entities in sync with protocol state transitions.
Background
The contracts emit short symbol topics and tuple payloads. Important events include mkt_new, dep_crt, dep_exe, dep_can, wth_crt, wth_exe, wth_can, ord_crt, ord_exe, ord_can, ord_upd, ord_frz, pos_inc, pos_dec, liq_req, liq_exe, adl_req, adl_exe, fee_clm, fnd_clm, ui_fee_acc, ui_fee_clm, ui_fee_set, ref_reg, ref_set, ref_xfr, token events, and faucet events.
Implementation checklist
Replace the starter transfer-only handleEvent mapping with SO4 event dispatch.
Add decoding helpers for symbol topics.
Add decoding helpers for Soroban addresses.
Add decoding helpers for BytesN<32> keys.
Add decoding helpers for booleans.
Add decoding helpers for signed and unsigned integer ScVal values.
Add decoding helpers for tuple payloads emitted by SO4 contracts.
Restrict handlers to configured SO4 contract IDs and token IDs from Issue 2.
Implement mkt_new indexing from market_factory.
Implement deposit lifecycle mappings for dep_crt, dep_exe, and dep_can.
Implement withdrawal lifecycle mappings for wth_crt, wth_exe, and wth_can.
Implement order lifecycle mappings for ord_crt, ord_exe, ord_can, ord_upd, and ord_frz.
Implement position lifecycle mappings for pos_inc and pos_dec.
Implement liquidation mappings for liq_req and liq_exe.
Implement ADL mappings for adl_req and adl_exe.
Implement fee mappings for fee_clm, fnd_clm, ui_fee_acc, ui_fee_clm, and ui_fee_set.
Implement referral mappings for ref_reg, ref_set, and ref_xfr.
Implement token/faucet mappings for transfers, mints, burns, approvals, and claims where useful to the app.
Make entity writes idempotent so reprocessing a ledger does not duplicate rows.
Store ledger, timestamp, event id, contract id, and transaction hash if SubQuery exposes them.
Log and skip unknown events without crashing the indexer.
Acceptance checklist
Verification commands
Primary outcome: The indexer decodes SO4 Soroban contract events and keeps GraphQL entities in sync with protocol state transitions.
Background
The contracts emit short symbol topics and tuple payloads. Important events include
mkt_new,dep_crt,dep_exe,dep_can,wth_crt,wth_exe,wth_can,ord_crt,ord_exe,ord_can,ord_upd,ord_frz,pos_inc,pos_dec,liq_req,liq_exe,adl_req,adl_exe,fee_clm,fnd_clm,ui_fee_acc,ui_fee_clm,ui_fee_set,ref_reg,ref_set,ref_xfr, token events, and faucet events.Implementation checklist
handleEventmapping with SO4 event dispatch.BytesN<32>keys.ScValvalues.mkt_newindexing frommarket_factory.dep_crt,dep_exe, anddep_can.wth_crt,wth_exe, andwth_can.ord_crt,ord_exe,ord_can,ord_upd, andord_frz.pos_incandpos_dec.liq_reqandliq_exe.adl_reqandadl_exe.fee_clm,fnd_clm,ui_fee_acc,ui_fee_clm, andui_fee_set.ref_reg,ref_set, andref_xfr.Acceptance checklist
Verification commands
bun run --cwd apps/s03-indexer codegen.bun run --cwd apps/s03-indexer build.bun run --cwd apps/s03-indexer test.