Skip to content

Commit

Permalink
update with 7th deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
mendesfabio committed Aug 27, 2024
1 parent 8306800 commit dbcf446
Show file tree
Hide file tree
Showing 51 changed files with 9,179 additions and 986 deletions.
11 changes: 0 additions & 11 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,3 @@ Please provide instructions so we can test. Please also list any relevant detail
- [ ] I have performed a self-review of my own code
- [ ] I have requested at least 1 review (If the PR is significant enough, use best judgement here)
- [ ] I have commented my code where relevant, particularly in hard-to-understand areas

### `dev` -> `master`

- [ ] I have [checked](https://balancer.github.io/balancer-subgraph-v2/status.html) that all beta deployments have synced
- [ ] I have [checked](https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-prune-v2-beta/graphql?query=%0A%7B%0A++balancers%28block%3A%7Bnumber%3A1%7D%29%7B%0A++++id%0A++%7D%0A%7D) that the earliest block in the polygon pruned deployment is [block, date/time](https://polygonscan.com/block/block)
- [ ] The earliest block is more than 24 hours old
- [ ] I have checked that core metrics are the same in the beta and production deployments

### Merges to `dev`

- [ ] I have checked that the graft base is not a pruned deployment
30 changes: 0 additions & 30 deletions .github/workflows/graph-studio.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/graph.yml
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
20 changes: 13 additions & 7 deletions .gitignore
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
21 changes: 21 additions & 0 deletions LICENSE
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.
86 changes: 85 additions & 1 deletion README.md
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 removed docs/.gitkeep
Empty file.
84 changes: 84 additions & 0 deletions docs/add-new-networks.md
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.
Loading

0 comments on commit dbcf446

Please sign in to comment.