SwapX Subgraph
Blockchain2024

SWAPXSUBGRAPH

Nine data sources on Sonic — Algebra V3, V2 pairs, ICHI vaults, ve/gauge voting, Goldsky deploy.

9
Consolidated data sources
1
Sonic chain deployment
4+
Protocol primitive families
SCROLL
Client
Domain
Blockchain / DeFi
Platform
Subgraph
Duration
Core Stack
AssemblyScript · Sonic
The Brief

THE
PROBLEM

SwapX on Sonic needed one analytics subgraph spanning Algebra V3, legacy V2 pairs, ICHI vaults, and ve/gauge voting so frontends could chart liquidity, volume, and incentives without stitching nine bespoke indexers.

Consolidated handler modules per source family, shared entity IDs for cross-module joins, and Goldsky CLI pipelines for repeatable deploys and manifest promotion.

Core Engineering Challenge

Heterogeneous event shapes across sources plus bribe lifecycle accounting — handlers had to stay deterministic when Goldsky redeployed or when new gauges appeared mid-epoch.

Sonic
Chains
Extended stack
blockchain
The Graph
blockchain
Sonic
SwapX
SwapX
How we built it

THE ARCHITECTURE

01
Source catalog

Inventory Algebra V3, V2 pairs, ICHI vaults, voting, and bribe contracts with ABIs and start blocks.

SonicSolidity
02
Handler consolidation

Shared helpers for pricing, pool IDs, and user positions to avoid divergent math per module.

AssemblyScript
03
Bribe lifecycle

Track proposal epochs, distributions, and claims without double-counting pending rewards.

DeFiThe Graph
04
Goldsky deploy

CLI-driven deploys with versioned subgraph names and CI hooks.

GoldskyDevOps
05
Data QA

Spot-check TVL and volume vs on-chain explorers per source.

QAAnalytics
System Data Flow
Ingestion
CrawlerContent Hash10K+ pages
Processing
ChunkerDeduplicatorEmbedding API
Storage
pgvectorPostgreSQLRedis Cache
Auth
Identity ProviderJWT BridgeSessions
Query
HNSW SearchRe-rankerLLM Stream
Delivery
Web AppMobile AppUsers
What we delivered

THE RESULTS

Sonic

EVM-compatible Sonic deployment with nine wired data sources — enough coverage that product could ship protocol-wide charts instead of partial DEX slices that confuse LPs.

Sonic
Chains

EVM-compatible Sonic deployment with nine wired data sources — enough coverage that product could ship protocol-wide charts instead of partial DEX slices that confuse LPs.

Engineering decisions

TECH
DEEP DIVE

9S
Nine sources, one graph

Single endpoint beats nine subgraphs for mobile clients with tight bundle budgets.

Shared pool keying prevented duplicate liquidity when Algebra and V2 touched the same underlying pair.

GS
Goldsky ops

Managed pipeline sped up iteration versus hand-rolled Graph Node ops for a short-lived engagement.

Bribe tables were modeled append-only to simplify reorg handling on Sonic.

Next Case Study
Infrastructure
CloudWorkflowActivityWorker

Rust on Cloud Run

RustGCP
Start a project

LET'S
BUILD
SOMETHING.

We take on a small number of projects at a time. If the problem is hard, we're interested.

Email
hello@techmusketeers.com
Response time
Within 24 hours
Availability
Open for new projects · 2025