• Stars
    star
    118
  • Rank 299,181 (Top 6 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 25 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Subgraph (Graph Protocol) data layer for Balancer v2 vault, swaps, txs, users

Balancer Subgraph

The graphql schema is still under heavy development and will likely have major breaking changes.

This repo tracks both the subgraph and a docker configuration that allows you to run the subgraph and frontend against the core v2 contracts.

Setup

Prerequisites

  • Global Yarn Packages
    • truffle
    • graph-cli
  • Docker

Clone the pool-management-v2 repo and core repo submodules

Recommended setup: Running V2 contracts, frontend and subgraph against development parity chain

Docker compose can be started in various configurations to start a local etherem chain, a graph-node, and it's requisite services.

Start a parity chain and a graph node by running

yarn restart:parity

Then deploy V2 contracts, seed data and deploy subgraph

cd core && yarn redeploy:docker && popd
yarn codegen && yarn create:local && yarn deploy:local

now you should be able to interact with the graphql server at http://localhost:8000/subgraphs/name/balancer-labs/balancer-v2

Start the pool management frontend:

cd pool-management-v2 && yarn serve

Once setup, you can access the services at the addresses below

Services

Service address
JSON-RPC Server http://localhost:8545
GraphQL HTTP server http://localhost:8000
Graph Node JSON-RPC admin server http://localhost:8020
Graph Node IndexNode server http://localhost:8030
Graph Node Metrics server http://localhost:8040
Graph Node WebSocket server ws://localhost:8001

Alternative Docker Compose Settings

Running services against a hardhat chain

The docker-compose can be overridden to test contracts, subgraph, frontend against other networks. This is not generally recommended because the hardhat VM doesn't support call tracing which the subgraph uses to track contract calls. YMMV

Start a hardhat chain and a graph node by running

docker-compose -f docker-compose.yml -f docker-compose.hardhat.yml up

Start a ganache chain and a graph node by running

docker-compose -f docker-compose.yml -f docker-compose.ganache.yml up

To blow away graph-node settings

docker-compose kill && docker-compose rm -f && rm -rf data

Components

Contracts

Deploy balancer contracts using truffle. Using the yarn deploy script in balancer-v2 also makes this easy to test out the subgraph using the frontend.

Subgraph

Clone the balancer subgraph

git clone [email protected]:balancer-labs/balancer-subgraph-v2.git

Update deployed contract address in subgraph.yaml to the ones listed as part of the deploy

Install dependencies

yarn

Generate the graph code

yarn codegen

Create local node

yarn create:local

Deploy locally

yarn deploy:local

Any updates can be made to this repo and re-running yarn deploy:local without needing to re-initialize the environment.

Running Locally With Parity Kovan Node

Start Parity:

parity --chain=kovan --jsonrpc-interface=0.0.0.0

Update ethereum value in docker-compose.yml to kovan:http://host.docker.internal:8545

Comment out try_ functions in pool.ts LN52-64

docker-compose up

Create local node

yarn create:local

Deploy locally

yarn deploy:local

More Repositories

1

balancer-core

Balancer on the EVM
Solidity
333
star
2

balancer-v2-monorepo

Balancer V2 Monorepo
TypeScript
309
star
3

balancer-sor

Smart order router: off-chain linear optimization of routing orders across pools for best price execution
TypeScript
218
star
4

frontend-v2

Frontend app for the Balancer protocol
TypeScript
187
star
5

balancer-exchange

Exchange dapp for token swaps
TypeScript
95
star
6

bal-mining-scripts

TypeScript
88
star
7

erc20-redeemable

Vue
79
star
8

balancer-sdk

TypeScript
77
star
9

frontend-v1

V1 Pool Management
Vue
75
star
10

balancer-subgraph

Subgraph (Graph Protocol) data layer for Balancer pools, swaps, txs, users
TypeScript
67
star
11

balpy

Tools for interacting with Balancer Protocol V2 in Python.
Python
64
star
12

docs

Documentation for Balancer
Vue
44
star
13

balancer-deployments

TypeScript
41
star
14

balancer-v3-monorepo

Solidity
38
star
15

configurable-rights-pool

JavaScript
34
star
16

tokenlists

TypeScript
30
star
17

assets

JavaScript
27
star
18

scaffold-balancer-v3

Starter kit for creating custom pools and hooks contracts on Balancer v3
TypeScript
24
star
19

pool-management

Pool management dapp
TypeScript
22
star
20

swap-frontend-v1

Balancer Protocol Frontend
Vue
21
star
21

exchange-proxy

Solidity
21
star
22

b-sdk

TypeScript
20
star
23

balancer-api

Deprecated
TypeScript
18
star
24

backend

TypeScript
16
star
25

docs-developers

15
star
26

balancer-registry

Solidity
14
star
27

docs-v1

13
star
28

bactions-proxy

Solidity
11
star
29

code-review

JavaScript
10
star
30

balancer-examples

Template repository to begin building on Balancer V2
TypeScript
9
star
31

frontend-v3

Official web application for the Balancer protocol.
TypeScript
9
star
32

docs-v2-archive

7
star
33

linear-pools

TypeScript
6
star
34

scaffold-balancer

TypeScript
5
star
35

brand-assets

4
star
36

balancer-sor-v1

Legacy SOR for V1
TypeScript
3
star
37

ipfs-push

TypeScript
3
star
38

balancer-cred

Shell
3
star
39

pebbles

grug stack rock
HTML
3
star
40

docs-v3

Vue
3
star
41

gauges-subgraph

Subgraph for Liquidity Gauges of the Balancer Protocol
TypeScript
3
star
42

cow-amm

Solidity
3
star
43

dune_queries

PLpgSQL
2
star
44

balancer-bounties

https://bounties.balancer.finance
Vue
2
star
45

helpers

Collection of contracts and JS code for common data dependencies
Solidity
2
star
46

frontend-monorepo

Balancer frontend apps and packages. Includes the official Balancer UI application.
TypeScript
2
star
47

metastable-rate-providers

Rate provider adaptors used by MetaStable pools
Solidity
1
star
48

marketing-site

Marketing site
Vue
1
star
49

frontend-e2e

TypeScript
1
star
50

sor-benchmark

TypeScript
1
star
51

metadata

1
star
52

pool-creator

A user friendly interface for creating and initializing pools
TypeScript
1
star