This repository contains the subgraph implementations for Balancer v3, including pools and vault subgraphs. It's structured as a monorepo using pnpm workspaces.
- Node.js (v18 or later)
- pnpm (v7 or later)
-
Install dependencies:
pnpm install
-
Generate manifests:
pnpm generate-manifests
Note: Subgraph manifests (subgraph.yaml) define the smart contracts to index and how to map event data to entities.
-
Generate types for all subgraphs:
pnpm codegen
Note: Codegen creates AssemblyScript classes for each smart contract ABI in subgraph.yaml.
To run commands for a specific subgraph:
pnpm pools <command> # For pools subgraph
pnpm vault <command> # For vault subgraph
For example, to build the pools subgraph:
pnpm pools build
As Balancer expands to new networks or introduces new pool types, you may need to extend the subgraphs. We've provided detailed documentation to guide you through these processes:
- Adding Support for New Pool Types If you're building your own pools on Balancer and want to integrate them with the subgraph, this provides a step-by-step guide on how to extend the subgraph to support your new pool type. This ensures that your pool is integrated with Balancer's infraestructure.
- Adding Support for New Networks
This guide walks you through the process of adding a new network to the subgraph. It covers updating the
networks.json
file, modifying the GitHub Actions workflow, and generating the necessary manifests.
Deployment is handled automatically by GitHub Actions when pushing to the main
branch. The workflow will:
- Generate manifests for all subgraphs
- Generate code for all subgraphs
- Build and deploy each subgraph to The Graph's hosted service
To deploy manually, ensure you have the necessary credentials and run:
pnpm pools build
pnpm pools deploy
pnpm vault build
pnpm vault deploy