Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Commit 6ff97d0

Browse files
committed
update readme
1 parent fe73b63 commit 6ff97d0

File tree

2 files changed

+65
-12
lines changed

2 files changed

+65
-12
lines changed

.husky/pre-commit

100644100755
File mode changed.

README.md

Lines changed: 65 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ Indexer of Set Protocol v2 events. Built on [The Graph](https://thegraph.com/).
66

77
Requirements:
88

9-
- [Bash >= 5.0](https://gist.github.com/Rican7/44081a9806595704fa7b289c32fcd62c)
9+
- Bash >= 5.0 [Mac](https://gist.github.com/Rican7/44081a9806595704fa7b289c32fcd62c) / [Win](https://nickjanetakis.com/blog/a-linux-dev-environment-on-windows-with-wsl-2-docker-desktop-and-more)
1010
- [Node.js >= 14.0](https://nodejs.org/en/download/)
11-
- [Yarn >= 1.22](https://yarnpkg.com)
12-
- [Docker >= 19.0](https://www.docker.com/get-started).
11+
- Yarn 1.x (`npm install -g yarn`)
12+
- [Docker >= 19.0](https://www.docker.com/get-started)
1313

1414
Steps:
1515

16-
1. `yarn install`
17-
2. `yarn gen-deployment <NETWORK_NAME>` hardhat or mainnet
18-
3. (If deploying to hosted service) `yarn graph auth https://api.thegraph.com/deploy/ <ACCESS_TOKEN>`
16+
1. `git clone https://github.com/Desert-Defi/set-protocol-v2-subgraph.git && cd set-protocol-v2-subgraph`
17+
2. `yarn install`
18+
3. `yarn gen-deployment <NETWORK_NAME>` hardhat or mainnet
19+
4. (If deploying to hosted service) `yarn graph auth https://api.thegraph.com/deploy/ <ACCESS_TOKEN>`
1920

2021
## Commands
2122

@@ -43,35 +44,87 @@ Commands:
4344

4445
## Local development (hardhat)
4546

46-
### Clone Set Protocol v2 fork (in separate directory)
47+
### Clone Set Protocol v2 fork
48+
49+
In separate directory:
4750

4851
1. `git clone https://github.com/jgrizzled/set-protocol-v2.git -b subgraph-dev && cd set-protocol-v2`
4952
2. `cp .env.default .env`
5053
3. `yarn install`
51-
4. `yarn chain`
52-
5. `yarn deploy-mock`
5354

54-
Restart `yarn chain` if redeploying.
55+
To run the hardhat node:
56+
57+
1. `yarn chain --hostname 0.0.0.0`
58+
2. Wait for node to start
59+
3. (in separate terminal) `yarn deploy-mock`
5560

5661
### Install Graph Node
5762

63+
In separate directory:
64+
5865
1. `git clone -q --depth=1 https://github.com/graphprotocol/graph-node.git && cd graph-node/docker`
59-
2. Edit line 20 of docker-compose.yml to `ethereum: hardhat:http://host.docker.internal:8545` (May need to replace host.docker.internal with local IP)
66+
2. Edit line 20 of docker-compose.yml to `ethereum: hardhat:http://host.docker.internal:8545` (May need to replace host.docker.internal with LAN IP)
6067
3. Run with `sudo docker-compose up`
6168

62-
`rm -rf ./data` and restart containers if hardhat chain changes
69+
`rm -rf ./data` and restart containers if blockchain changes.
6370

6471
`sudo docker-compose build` if updated via `git pull`
6572

6673
### Deploy subgraph locally
6774

75+
From subgraph repo:
76+
6877
1. `yarn gen-deployment hardhat`
6978
2. `yarn deploy-local`
7079

7180
Graph-node may take a few minutes to sync the subgraph.
7281

7382
Visit `http://localhost:8000/subgraphs/name/desert-defi/setprotocolv2/graphql` to view subgraph data
7483

84+
## Syncing to mainnet
85+
86+
Syncing the subgraph to mainnet requires an Ethereum archive node. We recommend [Turbogeth](https://github.com/ledgerwatch/turbo-geth) as it syncs fast and will fit on a 2TB SSD at present. Note that it takes a few hours for the subgraph to sync and re-deploying the subgraph will re-sync from scratch.
87+
88+
### Turbogeth
89+
90+
In separate directory:
91+
92+
1. `git clone -q --depth=1 https://github.com/ledgerwatch/turbo-geth.git && cd turbo-geth`
93+
2. `sudo docker-compose build` (re-run if updated via `git pull`)
94+
3. `sudo XDG_DATA_HOME=/preferred/data/folder docker-compose up -d`
95+
96+
Watch logs with:
97+
98+
`sudo docker logs $(sudo docker container ls | grep tg | cut -d' ' -f1) -f --since 10m`
99+
100+
### Graph Node
101+
102+
From graph-node repo:
103+
104+
Ensure `docker/docker-compose.yml` is configured for mainnet on line 20: `ethereum: mainnet:`
105+
106+
If you previously synced to hardhat, `rm -rf docker/data`.
107+
108+
Don't start Graph Node until Turbogeth is fully synced.
109+
110+
Start with:
111+
112+
1. `cd docker`
113+
2. `sudo docker-compose up -d`
114+
115+
Watch logs with:
116+
117+
`sudo docker logs $(sudo docker container ls | grep graph-node | cut -d' ' -f1) -f --since 10m`
118+
119+
### Deploy to mainnet
120+
121+
From subgraph repo:
122+
123+
1. `yarn gen-deployment mainnet`
124+
2. `yarn deploy-local` or `yarn deploy-to <IP>` if Graph Node on another machine.
125+
126+
Watch graph-node logs for sync status and errors. Subgraph URL same as above.
127+
75128
## Files
76129

77130
`schema.graphql` - Subgraph schema

0 commit comments

Comments
 (0)