A subgraph to index the PoCo Smart Contracts.
Run local services:
- blockchain with iExec PoCo deployed
- graph node (with ipfs + DB)
docker-compose -f docker/test/docker-compose.yml up -dInstall project dependencies
npm ciBuild the project and generate the necessary files:
npm run buildDeploy the subgraph on local node
npm run start-test-stackRun integration tests
npm run itestThe subgraph test/poco graphql API is accessible at:
In order for Matchstick to check which handlers are being run, those handlers need to be exported from the test file.
Check how to export handlers with Matchstick - Test Coverage documentation.
Note
Since Matchstick code coverage is in very early stages, Matchstick cannot check for branch coverage, but rely on the assertion that a given handler has been called.
The recommended approach to deploy the subgraph on The Graph network is to use the dedicated Github Actions workflow:
-
Set up the Github environment for the target network (e.g.
arbitrum) with the required environnment variables and secrets:vars.SUBGRAPH_SLUGsecrets.SUBGRAPH_DEPLOY_KEYvars.SUBGRAPH_NETWORK_NAMEVERSION_LABELis a workfow input
-
Trigger the deployment Action on Github and specify the
version_labelinput.
To deploy this subgraph on Thegraph network manually:
-
Set up environment variables in
.envfile:SUBGRAPH_SLUG=<subgraph-slug> SUBGRAPH_DEPLOY_KEY=<deploy-key> SUBGRAPH_NETWORK_NAME=<network-name> VERSION_LABEL=<version-label>
-
Deploy using the npm script:
npm run deploy-studio
The subgraph is deployed via a generated Docker image.
docker build -f docker/Dockerfile . -t poco-subgraph-deployerenv:
NETWORK_NAME(optional): custom graphnode network name (default bellecour)IPFS_URL: IPFS admin api urlGRAPHNODE_URL: graphnode admin api url
docker run --rm \
-e NETWORK_NAME=fork-test \
-e IPFS_URL="http://ipfs:5001" \
-e GRAPHNODE_URL="http://graphnode:8020" \
poco-subgraph-deployerTo deploy the subgraph manually using the deploy script, follow these steps:
-
Set up environment variables in the
.envfile:NETWORK_NAME=<network-name> DEPLOY_ENV=<deploy-environment> IPFS_URL=<ipfs-url> GRAPHNODE_URL=<graphnode-url> VERSION_LABEL=<version-label>
Example:
NETWORK_NAME=bellecour DEPLOY_ENV=staging IPFS_URL=http://localhost:5001 GRAPHNODE_URL=http://localhost:8020 VERSION_LABEL=1.0.0
DEPLOY_ENV Possible Values:
'': For production deployment.'tmp': For temporary indexing and avoiding downtime during production deployment.'staging': For staging environment deployment.
-
Run the deploy script:
npm run deploy
This will deploy the subgraph using the specified values, including the
DEPLOY_ENVvariable for environment-specific configurations.
The subgraph can be deployed using Github Actions (recommended). The dedicated job can be triggered with the desired configuration (environment, version, ...).
- Network: Choose the target blockchain network
- Environment: Select deployment environment
staging: Deploy to staging environmenttmp: Deploy to temporary environmentprod: Deploy to production environment
- Version Label: Specify the version of the deployment (e.g.,
v1.0.0) - Subgraph Name: Name of the subgraph (default:
poco-v5)
Each environment has specific host configurations:
To add support for a new network, update the networks.json file with the network configuration:
{
"network-name": {
"Core": {
"address": "0x...",
"startBlock": 1234567
},
"AppRegistry": {
"address": "0x...",
"startBlock": 1234567
},
"DatasetRegistry": {
"address": "0x...",
"startBlock": 1234567
},
"WorkerpoolRegistry": {
"address": "0x...",
"startBlock": 1234567
}
}
}Changes to this project are tracked in CHANGELOG.md
- Rename the
Corekey toDiamondinnetworks.jsonand update all references accordingly. - Remove support and configuration entries for the
bellecournetwork fromnetworks.json, GHA pipeline, and related documentation.