The first step is to run a local node, by following the instructions at the docs. You can either run a node connected to a local ganache private network, or a node connected to a testnet (like ropsten) or mainnet.
The following commands illustrate the scenario to deploy a graph from information available at goerli
testnet. So you also need to run the node connected to goerli
.
Some of the steps require a Infura application id to be specified as an environment variable called PROJECT_ID
.
yarn
yarn prepare:goerli
yarn codegen subgraph.goerli.yaml
yarn build subgraph.goerli.yaml
yarn create-local
yarn deploy-local
- need to replace deployment/ folder with latest compiled/deployed version from contracts project
- replace abi/* with latest changes from contract
- run above scripts
To run the project on the local we suppose the latest version of contract
has been deployed on the BSC TestNet and the latest ABIs are provided in the
contracts/deployments/bsc_testnet
folder. We also use the subgraph.template.dev.yaml
as template for generating and building sub-graph, So the source addresses
must be set correctly on it.
At this point the docker-compose uses a BSC TestNet node as a local node. Maybe in the future we use Ganache (or any other developing node) as a local node.
- Create two folders for Ipfs and PostgreSql file system
next to the
totem-subgraph
folder:
cd ..
mkdir totem-subgraph-ipfs
mkdir totem-subgraph-postgres
cd totem-subgraph/
- Run the docker-compose local file:
docker-compose -f docker-compose-graph-localhost.yaml up -d
- Install node_modules:
yarn
- Now we can generate new sub-graph based on
subgraph.template.dev.yaml
template:
yarn prepare:bsc_testnet
yarn codegen subgraph.bsc_testnet.yaml
yarn build subgraph.bsc_testnet.yaml
- Deploy generated sub-graph to the graph-node:
yarn create-local
yarn deploy:bsc_testnet
- If everything goes well and the sub-graph deployed you can access the GrappQl panel of your sub-graph on this path by HTTPS & WS:
http://localhost:8000/subgraphs/name/totemfi/predictor/graphql