A comprehensive subgraph for indexing the Symbiotic Protocol on Ethereum mainnet. This indexer captures all core on-chain activity including vaults, networks, operators, delegations, and transactions.
- Complete Protocol Coverage: Indexes all major Symbiotic contracts
- Real-time Data: Live tracking of deposits, withdrawals, and delegations
- Historical Metrics: Daily aggregated data for analytics
- Dynamic Vault Support: Automatically indexes new vaults as they're created
- Relationship Mapping: Tracks connections between vaults, networks, and operators
- Protocol: Global Symbiotic metrics and configuration
- Vaults: Individual vault data, configurations, and metrics
- Networks: Network information and operator relationships
- Operators: Operator details and opt-in status
- Deposits/Withdrawals: Complete transaction history
- Delegations: Network delegation tracking
- Daily Metrics: Aggregated daily statistics
- VaultFactory (
0xAEb6bdd95c502390db8f52c8909F703E9Af6a346) - NetworkRegistry (
0xC773b1011461e7314CF05f97d95aa8e92C1Fd8aA) - OperatorRegistry (
0xAd817a6Bc954F678451A71363f04150FDD81Af9F) - OperatorNetworkOptInService (
0x7133415b33B438843D581013f98A08704316633c) - OperatorVaultOptInService (
0xb361894bC06cbBA7Ea8098BF0e32EB1906A5F891)
- GraphQL Playground: https://thegraph.com/studio/subgraph/symbiotic-indexer
- Query Endpoint:
https://api.studio.thegraph.com/query/119891/symbiotic-indexer/v0.0.2 - Studio Dashboard: https://thegraph.com/studio/subgraph/symbiotic-indexer
- Node.js 16+
- The Graph CLI
npm install -g @graphprotocol/graph-cli
npm installgraph build# Set your deploy key
graph auth --studio <YOUR_DEPLOY_KEY>
# Deploy to Subgraph Studio
graph deploy --studio symbiotic-indexer{
protocol(id: "symbiotic") {
totalVaults
totalOperators
totalNetworks
totalTVL
}
}{
vaults(first: 10, orderBy: totalStaked, orderDirection: desc) {
address
collateralSymbol
totalStaked
userCount
}
}{
deposits(first: 20, orderBy: timestamp, orderDirection: desc) {
vault { address collateralSymbol }
depositor
amount
timestamp
transactionHash
}
}- Static Data Sources: Core protocol contracts with fixed addresses
- Dynamic Data Sources: Vault templates that index individual vaults as they're created
vaultFactory.ts: Handles vault creation and protocol initializationnetworkRegistry.ts: Manages network registration eventsoperatorRegistry.ts: Tracks operator registrationoperatorNetworkOptIn.ts: Handles network opt-in/out eventsoperatorVaultOptIn.ts: Manages vault opt-in/out eventsvault.ts: Processes vault-specific events (deposits, withdrawals, etc.)
The schema is designed for optimal querying with:
- Bidirectional relationships between entities
- Comprehensive indexing on key fields
- Daily metric aggregations for time-series analysis
- Efficient pagination support
βββ schema.graphql # GraphQL schema definition
βββ subgraph.yaml # Subgraph manifest
βββ src/
β βββ mappings/ # Event handlers
β βββ utils/ # Helper functions
βββ abis/ # Contract ABIs
βββ QUERY_GUIDE.md # Query examples and documentation
- Add the contract ABI to
abis/ - Update
subgraph.yamlwith the new data source - Create mapping functions in
src/mappings/ - Update the schema if needed
# Build to check for compilation errors
graph build
# Deploy to a test environment
graph deploy --node <TEST_NODE_URL>- Query Guide - Comprehensive query examples
- Symbiotic Docs - Protocol documentation
- The Graph Docs - Subgraph development guide
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details
- Join The Graph Discord
- Check Symbiotic Discord
- Open an issue for bugs or feature requests
Built for the Symbiotic Protocol ecosystem π
-
VaultFactory (
0xAEb6bdd95c502390db8f52c8909F703E9Af6a346)- Tracks vault creation events
- Creates dynamic vault data sources
-
NetworkRegistry (
0xC773b1011461e7314CF05f97d95aa8e92C1Fd8aA)- Indexes network registrations
-
OperatorRegistry (
0xAd817a6Bc954F678451A71363f04150FDD81Af9F)- Tracks operator registrations
-
OperatorNetworkOptInService (
0x7133415b33B438843D581013f98A08704316633c)- Handles operator-network opt-ins/outs
-
OperatorVaultOptInService (
0xb361894bC06cbBA7Ea8098BF0e32EB1906A5F891)- Handles operator-vault opt-ins/outs
-
Vault Template (Dynamic)
- Individual vault events (deposits, withdrawals, slashes, claims)
Protocol- Global protocol state and metricsVault- Individual vault data and metricsNetwork- Network configurations and metricsOperator- Operator data and metrics
Deposit- Deposit transactionsWithdrawal- Withdrawal transactionsSlash- Slashing eventsClaim- Claim events
OperatorNetworkOptIn- Operator-network relationshipsVaultOperatorOptIn- Vault-operator relationshipsNetworkDelegation- Network delegation stateDelegationSnapshot- Historical delegation data
DailyProtocolMetric- Daily protocol-level metricsDailyVaultMetric- Daily vault-level metricsDailyNetworkMetric- Daily network-level metrics
- Node.js v18+ and npm
- The Graph CLI
-
Install dependencies:
npm install
-
Install The Graph CLI:
npm install -g @graphprotocol/graph-cli
-
Generate types:
npm run codegen
-
Build the subgraph:
npm run build
-
Create a subgraph in Subgraph Studio
-
Deploy:
graph deploy --studio symbiotic-indexer
-
Start local graph node (see Graph Node documentation)
-
Deploy locally:
npm run deploy-local
{
protocol(id: "symbiotic") {
totalVaults
totalOperators
totalNetworks
totalTVL
}
}{
vaults(
first: 10
orderBy: totalStaked
orderDirection: desc
) {
id
address
collateralSymbol
totalStaked
userCount
restakingRatio
}
}{
operator(id: "0x...") {
address
totalStake
networkCount
vaultCount
networkOptIns {
network {
id
address
}
isOptedIn
}
}
}{
networkDelegations(
where: { network: "0x..." }
first: 100
) {
network {
address
}
vault {
address
collateralSymbol
}
operator {
address
}
amount
shares
}
}{
deposits(
where: { vault: "0x..." }
first: 100
orderBy: timestamp
orderDirection: desc
) {
depositor
amount
shares
timestamp
}
}βββ src/
β βββ mappings/ # Event handlers
β β βββ vaultFactory.ts
β β βββ vault.ts
β β βββ networkRegistry.ts
β β βββ operatorRegistry.ts
β β βββ operatorNetworkOptIn.ts
β β βββ operatorVaultOptIn.ts
β βββ utils/ # Helper functions
β βββ constants.ts
β βββ protocol.ts
βββ abis/ # Contract ABIs
βββ schema.graphql # GraphQL schema
βββ subgraph.yaml # Subgraph manifest
βββ generated/ # Generated types
- Add contract ABI to
abis/ - Create mapping file in
src/mappings/ - Update
subgraph.yamlwith new data source - Run
npm run codegento generate types - Build and deploy
The subgraph includes comprehensive event handling for all major Symbiotic protocol activities. Test by:
- Deploying to a local graph node
- Simulating transactions on a fork
- Querying the GraphQL endpoint
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
MIT License - see LICENSE file for details.
- VaultFactory:
0xAEb6bdd95c502390db8f52c8909F703E9Af6a346 - DelegatorFactory:
0x985Ed57AF9D475f1d83c1c1c8826A0E5A34E8C7B - SlasherFactory:
0x685c2eD7D59814d2a597409058Ee7a92F21e48Fd - NetworkRegistry:
0xC773b1011461e7314CF05f97d95aa8e92C1Fd8aA - OperatorRegistry:
0xAd817a6Bc954F678451A71363f04150FDD81Af9F - VaultConfigurator:
0x29300b1d3150B4E2b12fE80BE72f365E200441EC
- OperatorNetworkOptInService:
0x7133415b33B438843D581013f98A08704316633c - OperatorVaultOptInService:
0xb361894bC06cbBA7Ea8098BF0e32EB1906A5F891 - NetworkMiddlewareService:
0xD7dC9B366c027743D90761F71858BCa83C6899Ad
See Symbiotic Documentation for complete list.