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 -d
Install project dependencies
npm ci
Build the project and generate the necessary files:
npm run build
Deploy the subgraph on local node
npm run start-test-stack
Run integration tests
npm run itest
The 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_SLUG
secrets.SUBGRAPH_DEPLOY_KEY
vars.SUBGRAPH_NETWORK_NAME
VERSION_LABEL
is a workfow input
-
Trigger the deployment Action on Github and specify the
version_label
input.
To deploy this subgraph on Thegraph network manually:
-
Set up environment variables in
.env
file: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-deployer
env:
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-deployer
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
Core
key toDiamond
innetworks.json
and update all references accordingly. - Remove support and configuration entries for the
bellecour
network fromnetworks.json
, GHA pipeline, and related documentation.