-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8306800
commit dbcf446
Showing
51 changed files
with
9,179 additions
and
986 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Deploy Graph Studio Prod | ||
on: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
deploy-pools-sepolia: | ||
runs-on: ubuntu-latest | ||
environment: graph | ||
defaults: | ||
run: | ||
working-directory: subgraphs/pools | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 7 | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Generate manifests | ||
run: pnpm generate-manifests | ||
- name: Graph Codegen | ||
run: pnpm codegen | ||
- name: Graph Build | ||
run: pnpm build | ||
- uses: balancer-labs/[email protected] | ||
with: | ||
graph_deploy_key: ${{secrets.GRAPH_DEPLOY_KEY}} | ||
graph_version_label: ${GITHUB_SHA::8} | ||
graph_subgraph_name: "balancer-pools-v3-sepolia-7th" | ||
graph_account: "mendesfabio" | ||
graph_config_file: "subgraph.sepolia.yaml" | ||
graph_deploy_studio: true | ||
|
||
deploy-vault-sepolia: | ||
runs-on: ubuntu-latest | ||
environment: graph | ||
defaults: | ||
run: | ||
working-directory: subgraphs/vault | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install pnpm | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 7 | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Generate manifests | ||
run: pnpm generate-manifests | ||
- name: Graph Codegen | ||
run: pnpm codegen | ||
- name: Graph Build | ||
run: pnpm build | ||
- uses: balancer-labs/[email protected] | ||
with: | ||
graph_deploy_key: ${{secrets.GRAPH_DEPLOY_KEY}} | ||
graph_version_label: ${GITHUB_SHA::8} | ||
graph_subgraph_name: "balancer-v3-sepolia-7th" | ||
graph_account: "mendesfabio" | ||
graph_config_file: "subgraph.sepolia.yaml" | ||
graph_deploy_studio: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
build/ | ||
node_modules/ | ||
src/types/ | ||
generated | ||
build | ||
dist | ||
node_modules | ||
package-lock.json | ||
pnpm-lock.yaml | ||
subgraph*.yaml | ||
subgraphs/**/src/types | ||
subgraphs/*/node_modules | ||
subgraph.yaml | ||
.DS_STORE | ||
.idea | ||
.pnp.* | ||
**/tests/.*/ | ||
.vscode | ||
data/ipfs | ||
data/postgres | ||
*.js | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 The Graph | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,85 @@ | ||
# Balancer V3 Subgraphs | ||
# 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 | 6th | https://api.studio.thegraph.com/query/31386/balancer-v3-sepolia-6th/version/latest | | ||
| Pools | 6th | https://api.studio.thegraph.com/query/31386/balancer-pools-v3-sepolia-6th/version/latest | | ||
| Vault | 7th | https://api.studio.thegraph.com/query/31386/balancer-v3-sepolia-7th/version/latest | | ||
| Pools | 7th | https://api.studio.thegraph.com/query/31386/balancer-pools-v3-sepolia-7th/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 <command> # For pools subgraph | ||
pnpm vault <command> # 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 | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Adding Support for New Networks | ||
|
||
To add support for a new network in the Balancer v3 subgraphs, follow these steps: | ||
|
||
## 1. Update networks.json | ||
|
||
Add the new network configuration to the `networks.json` file in the root of the repository. | ||
|
||
Example: | ||
|
||
```json | ||
{ | ||
"network-name": { | ||
"Vault": { | ||
"address": "0x...", | ||
"startBlock": 0 | ||
}, | ||
"WeightedPoolFactory": { | ||
"address": "0x...", | ||
"startBlock": 0 | ||
}, | ||
"StablePoolFactory": { | ||
"address": "0x...", | ||
"startBlock": 0 | ||
} | ||
} | ||
} | ||
``` | ||
|
||
Replace `"network-name"` with the CLI name found in TheGraph docs, and fill in the correct contract addresses and starting block numbers for the new network. | ||
|
||
For more information on supported networks and their naming conventions, refer to [The Graph's documentation](https://thegraph.com/docs/en/developing/supported-networks/). | ||
|
||
## 2. Update GitHub Actions Workflow | ||
|
||
Duplicate the existing deployment jobs in the `.github/workflows/graph.yml` file for the new network. Here's an example of how to add deployment jobs for a new network: | ||
|
||
```yaml | ||
deploy-pools-network-name: | ||
needs: generate-configs | ||
runs-on: ubuntu-latest | ||
environment: graph | ||
defaults: | ||
run: | ||
working-directory: subgraphs/pools | ||
steps: | ||
# ... (copy steps from existing deploy-pools-sepolia job) | ||
- uses: balancer-labs/[email protected] | ||
with: | ||
graph_deploy_key: ${{secrets.GRAPH_DEPLOY_KEY}} | ||
graph_version_label: ${GITHUB_SHA::8} | ||
graph_subgraph_name: "balancer-v3-network-name" # Update the Subgraph name | ||
graph_account: "balancer-labs" | ||
graph_config_file: "subgraph.network-name.yaml" # Make sure this matches the manifest file name | ||
graph_deploy_studio: true | ||
|
||
deploy-vault-network-name: | ||
needs: generate-configs | ||
runs-on: ubuntu-latest | ||
environment: graph | ||
defaults: | ||
run: | ||
working-directory: subgraphs/vault | ||
steps: | ||
# ... (copy steps from existing deploy-vault-sepolia job) | ||
- uses: balancer-labs/[email protected] | ||
with: | ||
graph_deploy_key: ${{secrets.GRAPH_DEPLOY_KEY}} | ||
graph_version_label: ${GITHUB_SHA::8} | ||
graph_subgraph_name: "balancer-pools-v3-network-name" # Update the Subgraph name | ||
graph_account: "balancer-labs" | ||
graph_config_file: "subgraph.network-name.yaml" # Make sure this matches the manifest file name | ||
graph_deploy_studio: true | ||
``` | ||
Make sure to replace `network-name` with your actual network name and update the `graph_subgraph_name` and `graph_config_file` for the new network. | ||
|
||
## 3. Generate Configs and Deploy | ||
|
||
After updating `networks.json` and the GitHub Actions files: | ||
|
||
1. Run `pnpm generate-manifests` to create the new manifests. | ||
2. Commit and push the changes to trigger the Actions workflow. | ||
3. The new subgraphs will be built and deployed automatically. |
Oops, something went wrong.