An example Subgraph initially forked from The Graph example subgraph. Created by PureStake to get you started with The Graph on Moonbeam.
Install the node dependencies using yarn
:
yarn
Create the TS types for The Graph (requires the artifacts
folder created by contract compilation):
yarn codegen
For deploying contracts on Moonbase Alpha, you'll need a funded account and its private key. Store your private key for Moonbase Alpha deployment as an ENV variable:
export MOON_PRIVATE_KEY="YOUR-PRIVATE-KEY-HERE"
Compile the contracts:
# compiles using hardhat and solc 0.8.3
yarn contract-build
To deploy to a development Moonbeam node you can run:
# deploys to moonbase alpha
yarn contract-deploy-local
To deploy to Moonbase Alpha you can run:
# deploys to moonbase alpha
yarn contract-deploy
For more information see The Graph docs on https://thegraph.com/docs/. Or the Moonbeam docs on https://docs.moonbeam.network/.