Skip to content

#4. Sync Deployed Contract and Market Manifests Into the Indexer #181

Description

@IbrahimIjai

Depends on: Issue 3
Primary outcome: The indexer can discover SO4 contracts, tokens, and markets from deployment outputs instead of hardcoded IDs.

Background

The contracts repo writes deployment outputs to .deployed/<NETWORK>.env, .stellar/contract-ids/<NETWORK>.json, .stellar/wasm-hashes/<NETWORK>.json, and frontend exports such as .deployed/frontend-<NETWORK>.env and .deployed/frontend-<NETWORK>.ts. The indexer must consume these outputs for testnet and local runs.

Implementation checklist

  • Add a manifest ingestion script under apps/s03-indexer/scripts/.
  • Support a configurable contracts repo path, defaulting to ../contracts or an env var, not a hidden absolute path.
  • Read deployment files from /home/sunny/zero/so4-market-project/contracts when using the default local repo layout.
  • Generate an indexer-local JSON config such as apps/s03-indexer/config/contracts.testnet.json.
  • Include network name and network passphrase in the generated config.
  • Include Horizon and Soroban RPC endpoints in the generated config.
  • Include core contracts: role_store, data_store, oracle, market_factory, deposit_handler, withdrawal_handler, order_handler, liquidation_handler, adl_handler, fee_handler, referral_storage, reader, and exchange_router.
  • Include test token contracts: TUSDC, TWBTC, TETH, TXLM, and faucet.
  • Include market tokens and their index/long/short token triplets.
  • Validate every contract ID shape before writing config.
  • Fail with actionable errors when deployment files are missing or incomplete.
  • Allow missing MARKET_TOKEN_* values only before bootstrap, and report them clearly.
  • Add package scripts such as sync:contracts:testnet and sync:contracts:local.
  • Update project.ts to read contract IDs and endpoints from generated config/env.

Acceptance checklist

  • A contributor can deploy/bootstrap contracts, run one sync command, and see indexer config update.
  • Local and testnet configs can coexist without overwriting each other.
  • The indexer no longer relies on the starter template's generic hardcoded transfer filter.
  • Missing or malformed deployment data fails fast with useful error text.

Verification commands

  • Run bun run --cwd apps/s03-indexer sync:contracts:testnet.
  • Run bun run --cwd apps/s03-indexer build.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignStellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions