You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Primary outcome: The SubQuery schema models SO4 markets, pools, orders, positions, fees, referrals, and protocol events.
Background
The current starter schema indexes generic accounts, payments, credits, debits, and transfer events. SO4 needs protocol entities based on real contract events and market state: mkt_new, dep_*, wth_*, ord_*, pos_*, liq_*, adl_*, fee/referral events, and token/faucet activity.
Implementation checklist
Replace or extend apps/s03-indexer/schema.graphql with SO4-specific entities.
Add market and token metadata entities: ProtocolContract, Token, Market, and MarketConfigSnapshot.
Add liquidity lifecycle entities: Deposit, Withdrawal, PoolBalanceSnapshot, and MarketTokenTransfer.
Add trading lifecycle entities: Order, Position, PositionChange, Liquidation, and AdlEvent.
Add fee/referral entities: FeeClaim, UiFeeAccrual, FundingFeeClaim, ReferralCode, TraderReferral, and ReferralOwnershipTransfer.
Add useful indexed fields for app filters: account, market, key, status, ledger, timestamp, and transaction hash where available.
Preserve numeric precision by storing protocol-scale values as BigInt or strings where needed.
Do not downcast USD 1e30 values to JavaScript numbers in mappings.
Add schema comments explaining which contract event feeds each entity.
Remove starter-only entities unless they are intentionally still used for token/payment observability.
Acceptance checklist
subql codegen succeeds with the new schema.
Generated types are committed if the project convention requires them.
The schema can represent market creation.
The schema can represent deposit create, execute, and cancel.
The schema can represent withdrawal create, execute, and cancel.
The schema can represent order create, update, freeze, execute, and cancel.
The schema can represent position increase, decrease, close, liquidation, and ADL reduction.
The schema can represent fee claim and referral registration flows.
Primary outcome: The SubQuery schema models SO4 markets, pools, orders, positions, fees, referrals, and protocol events.
Background
The current starter schema indexes generic accounts, payments, credits, debits, and transfer events. SO4 needs protocol entities based on real contract events and market state:
mkt_new,dep_*,wth_*,ord_*,pos_*,liq_*,adl_*, fee/referral events, and token/faucet activity.Implementation checklist
apps/s03-indexer/schema.graphqlwith SO4-specific entities.ProtocolContract,Token,Market, andMarketConfigSnapshot.Deposit,Withdrawal,PoolBalanceSnapshot, andMarketTokenTransfer.Order,Position,PositionChange,Liquidation, andAdlEvent.FeeClaim,UiFeeAccrual,FundingFeeClaim,ReferralCode,TraderReferral, andReferralOwnershipTransfer.BigIntor strings where needed.1e30values to JavaScript numbers in mappings.Acceptance checklist
subql codegensucceeds with the new schema.Verification commands
bun run --cwd apps/s03-indexer codegen.bun run --cwd apps/s03-indexer build.