-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(subgraph): add subgraph support
- [x] Use the same subgraph from maci - [x] Add registry related entities - [x] Update events for contracts
- Loading branch information
Showing
34 changed files
with
1,728 additions
and
45 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 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 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 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 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 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 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,44 @@ | ||
const path = require("path"); | ||
|
||
module.exports = { | ||
root: true, | ||
extends: ["../../.eslintrc.js"], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
project: path.resolve(__dirname, "./tsconfig.json"), | ||
sourceType: "module", | ||
typescript: true, | ||
ecmaVersion: 2022, | ||
experimentalDecorators: true, | ||
requireConfigFile: false, | ||
ecmaFeatures: { | ||
classes: true, | ||
impliedStrict: true, | ||
}, | ||
warnOnUnsupportedTypeScriptVersion: true, | ||
}, | ||
rules: { | ||
"@typescript-eslint/no-shadow": [ | ||
"error", | ||
{ | ||
builtinGlobals: true, | ||
allow: [ | ||
"BigInt", | ||
"location", | ||
"event", | ||
"history", | ||
"name", | ||
"status", | ||
"Option", | ||
"Request", | ||
"test", | ||
"expect", | ||
"describe", | ||
"afterEach", | ||
"beforeEach", | ||
"beforeAll", | ||
], | ||
}, | ||
], | ||
}, | ||
}; |
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,9 @@ | ||
node_modules | ||
data | ||
build | ||
generated | ||
subgraph.yaml | ||
schema.graphql | ||
tests/.bin/ | ||
tests/.latest.json | ||
|
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,19 @@ | ||
# maci-platform-subgraph | ||
|
||
1. Make sure you have `{network}.json` file in `config` folder, where network is a CLI name supported for subgraph network [https://thegraph.com/docs/en/developing/supported-networks/](https://thegraph.com/docs/en/developing/supported-networks/). | ||
|
||
2. Add network, maci contract address and maci contract deployed block. | ||
|
||
```json | ||
{ | ||
"network": "optimism-sepolia", | ||
"maciContractAddress": "0xD18Ca45b6cC1f409380731C40551BD66932046c3", | ||
"registryManagerContractAddress": "0xbE6e250bf8B5F689c65Cc79667589A9EBF6Fe8E3", | ||
"registryManagerContractStartBlock": 13160483, | ||
"maciContractStartBlock": 11052407 | ||
} | ||
``` | ||
|
||
3. Run `pnpm run build`. You can use env variables `NETWORK` and `VERSION` to switch config files. | ||
4. Run `graph auth --studio {key}`. You can find the key in subgraph studio dashboard. | ||
5. Run `pnpm run deploy` to deploy subgraph |
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,7 @@ | ||
{ | ||
"network": "optimism-sepolia", | ||
"maciContractAddress": "0xbE6e250bf8B5F689c65Cc79667589A9EBF6Fe8E3", | ||
"registryManagerContractAddress": "0xbE6e250bf8B5F689c65Cc79667589A9EBF6Fe8E3", | ||
"registryManagerContractStartBlock": 13160483, | ||
"maciContractStartBlock": 13160483 | ||
} |
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,40 @@ | ||
version: "3" | ||
services: | ||
graph-node: | ||
image: graphprotocol/graph-node | ||
ports: | ||
- "8000:8000" | ||
- "8001:8001" | ||
- "8020:8020" | ||
- "8030:8030" | ||
- "8040:8040" | ||
depends_on: | ||
- ipfs | ||
- postgres | ||
environment: | ||
postgres_host: postgres | ||
postgres_user: graph-node | ||
postgres_pass: let-me-in | ||
postgres_db: graph-node | ||
ipfs: "ipfs:5001" | ||
ethereum: "localhost:http://host.docker.internal:8545" | ||
GRAPH_LOG: info | ||
ipfs: | ||
image: ipfs/kubo:v0.14.0 | ||
ports: | ||
- "5001:5001" | ||
volumes: | ||
- ./data/ipfs:/data/ipfs | ||
postgres: | ||
image: postgres:14-alpine | ||
ports: | ||
- "5432:5432" | ||
command: ["postgres", "-cshared_preload_libraries=pg_stat_statements", "-cmax_connections=200"] | ||
environment: | ||
POSTGRES_USER: graph-node | ||
POSTGRES_PASSWORD: let-me-in | ||
POSTGRES_DB: graph-node | ||
PGDATA: "/var/lib/postgresql/data" | ||
POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C" | ||
volumes: | ||
- ./data/postgres:/var/lib/postgresql/data |
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,3 @@ | ||
testsFolder: ./tests | ||
libsFolder: ./node_modules | ||
manifestPath: ./subgraph.yaml |
Oops, something went wrong.