https://github.com/balancer/balancer-subgraph-v3
https://github.com/balancer/balancer-subgraph-v3
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/balancer/balancer-subgraph-v3
- Owner: balancer
- License: mit
- Created: 2024-01-01T09:41:29.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-08T10:59:05.000Z (about 1 year ago)
- Last Synced: 2025-04-08T11:34:46.414Z (about 1 year ago)
- Language: TypeScript
- Size: 568 KB
- Stars: 4
- Watchers: 1
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Balancer v3 Subgraphs
This repository contains the subgraph implementations for Balancer v3, including pools and vault subgraphs. It's structured as a monorepo using pnpm workspaces.
## Preliminary Deployments
| Subgraph | Version | Endpoint |
| -------- | ------- | ----------------------------------------------------------------------------------------- |
| Vault | 10 | https://api.studio.thegraph.com/query/31386/balancer-v3-sepolia-10th/version/latest |
| Pools | 10 | https://api.studio.thegraph.com/query/31386/balancer-pools-v3-sepolia-10th/version/latest |
| Vault | 9th | https://api.studio.thegraph.com/query/31386/balancer-v3-sepolia-9th/version/latest |
| Pools | 9th | https://api.studio.thegraph.com/query/31386/balancer-pools-v3-sepolia-9th/version/latest |
## Prerequisites
- Node.js (v18 or later)
- pnpm (v7 or later)
## Setup
1. Install dependencies:
```
pnpm install
```
2. Generate manifests:
```
pnpm generate-manifests
```
Note: Subgraph manifests (subgraph.yaml) define the smart contracts to index and how to map event data to entities.
3. Generate types for all subgraphs:
```
pnpm codegen
```
Note: Codegen creates AssemblyScript classes for each smart contract ABI in subgraph.yaml.
## Development
### Working on a Specific Subgraph
To run commands for a specific subgraph:
```
pnpm pools # For pools subgraph
pnpm vault # For vault subgraph
```
For example, to build the pools subgraph:
```
pnpm pools build
```
### Extending the Subgraphs
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](docs/new-pool-types.md)
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](docs/support-new-networks.md)
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
Deployment is handled automatically by GitHub Actions when pushing to the `main` branch. The workflow will:
1. Generate manifests for all subgraphs
2. Generate code for all subgraphs
3. 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
```