Indexer of Set Protocol v2 events. Built on The Graph.
- Docker >= 20.10
-
Build the Set Protocol Docker subgraph image
task docker-build
-
Deploy a Hardhat node and custom script to the network
task deploy-hardhat [-- HARDHAT_STATE_TARGET_REPO HARDHAT_STATE_TEST_SCRIPT]
Note:
HARDHAT_STATE_TARGET_REPO
andHARDHAT_STATE_TEST_SCRIPT
must be provided as input arguments or defined in the dotenv configuration. Input arguments take precendence over dotenv configurations. For input arguments, you can specify just the target repo, or both the repo and test script, but you cannot provide the test script alone. -
Monitor the Hardhat node until fully deployed and tests are executed
-
In a new terminal, compile the Set Protocol ABIs
task gen-abi
-
Deploy local subgraph
task deploy-local
-
Once deployed, query the subgraph in the browser at http://127.0.0.1:8000/subgraphs/name/GITHUB_REPO/SUBGRAPH_NAME
Be sure to specify the correct
GITHUB_REPO
andSUBGRAPH_NAME
. Example queries to run can be found insamples/sample-query.txt
.
-
Build the Set Protocol Docker subgraph image
task docker-build
-
Deploy hosted subgraph to network specified by the
NETWORK_EXTERNAL
argumenttask deploy-hosted [-- NETWORK_EXTERNAL SUBGRAPH_ACCESS_TOKEN]
Note:
NETWORK_EXTERNAL
andSUBGRAPH_ACCESS_TOKEN
must be provided as input arguments or defined in the dotenv configuration. Input arguments take precendence over dotenv configurations. For input arguments, you can specify just the network, or both the network and the access token, but you cannot provide the access token alone.
IMPORTANT NOTE
Per the documentation on the Hosted Service:
A subgraph is defined as "inactive" if it was deployed to the Hosted Service more than 45 days ago, and if it has received 0 queries in the last 30 days.
-
Build the Set Protocol Docker subgraph image
task docker-build
-
Deploy subgraph to slug identified by the
NETWORK_EXTERNAL
argumenttask deploy-studio [-- NETWORK_EXTERNAL SUBGRAPH_DEPLOY_KEY]
Note:
NETWORK_EXTERNAL
andSUBGRAPH_DEPLOY_KEY
must be provided as input arguments or defined in the dotenv configuration (as per arguments for Hosted Service deployments; see above). -
Complete steps to test and publish following the documentation: https://thegraph.com/docs/en/studio/subgraph-studio/
Available tasks for this project:
COMMAND [OPTS] | DESCRIPTION |
---|---|
clean [-- all|subgraph|hardhat] |
Clean up local subgraph deployment; all arg additionally removes all volumes and the Hardhat node. |
deploy-hardhat [-- HARDHAT_STATE_TARGET_REPO HARDHAT_STATE_TEST_SCRIPT] |
Deploy a local Hardhat node from REPO_URL and run a node state deployment test script. HARDHAT_STATE_TARGET_REPO and HARDHAT_STATE_TEST_SCRIPT must be provided or defined in a private dotenv. |
deploy-hosted [-- NETWORK_EXTERNAL SUBGRAPH_ACCESS_TOKEN] |
Build and deploy subgraph to NETWORK_EXTERNAL on Hosted Service. NETWORK_EXTERNAL and SUBGRAPH_ACCESS_TOKEN must be provided or defined in a private dotenv. |
deploy-local [-- detach] |
Build and deploy graph-node and ipfs services on local network followed by deployment of the subgraph; detach runs containers in detached mode. |
deploy-local-graphnode [-- detach] |
Build and deploy graph-node and ipfs services on local network; detach runs containers in detached mode. |
deploy-local-subgraph [-- refresh] |
Compile and deploy the subgraph onto running graph-node and ipfs services on local network. refresh first deletes all IPFS data and restarts the service. |
deploy-studio [-- NETWORK_EXTERNAL SUBGRAPH_DEPLOY_KEY] |
Build and deploy subgraph to NETWORK_EXTERNAL on Subgraph Studio. NETWORK_EXTERNAL and SUBGRAPH_DEPLOY_KEY must be provided or defined in a private dotenv. |
docker-build |
Build Set Protocol base Docker image on defined node version (default: 16-slim). |
gen-abi |
Pull latest Set Protocol ABIs into the build environment. |
gen-schema [-- hosted] |
Compile the subgraph schema but do not deploy the subgraph; default target subgraph network is local unless hosted argument is provided. |
schema.graphql
- Subgraph schema
templates/subgraph.yaml
- configure watched contracts and events
deployments.json
- configure deployed contract addresses on each chain
src/
- AssemblyScript code for subgraph handlers
src/mappings/
- Event handlers
src/utils/
- Entity mappings functions and other helper utilities