Skip to content

Instantly share code, notes, and snippets.

@erin-koen
Last active December 9, 2021 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erin-koen/acf6d8e0423007dd19d599de55ee9010 to your computer and use it in GitHub Desktop.
Save erin-koen/acf6d8e0423007dd19d599de55ee9010 to your computer and use it in GitHub Desktop.
How to run a local fork of mainnet along with the associated subgraphs
### PROTOCOL
- confirm node url:
ETHEREUM_NODE_MAINNET=https://eth-mainnet.alchemyapi.io/v2/ALxM6coYqWo1MUS12C4vQGTRVD0JfvYx
- `yarn`, `yarn compile`, `yarn build`
- `yarn hardhat node --export ../subgraphs/deployments/local/v4.json --hostname 0.0.0.0`
### SUBGRAPHS
- `yarn` in parent dir
- subgraphs/.env:
```
ETHEREUM_NETWORK=local
JSONRPC_ENDPOINT=http://host.docker.internal:8545
```
- docker-compose up -d
- in subgraphs/subgraphs/asset-universe `yarn deploy local`
- in subgraphs/subgraphs/enzyme-core `yarn deploy local`
### BACKEND
- change `asset-universe` and `enzyme-core` subgraph url env variables to `http://localhost:8000/{subgraph-url}`
- change ENZYME_ETHEREUM_NODE_MAINNET=http://localhost:8545
- from subgraphs dir, copy `../subgrahs/deployments/local/v4.json` to `../backend/src/graphql/release/data/json/mainnet/v4.json`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment