Setting up a subgraph on Celo with Mobula’s infrastructure is an easy process. This tutorial will guide you through each step to get your subgraph operational on the Celo network.

What you’ll need

  • Basic knowledge of The Graph and subgraphs.
  • Your subgraph project files
  • The Graph CLI installed
  • A Mobula API key (for authentication)

Walkthrough

1

Prepare Your Subgraph

Configure your subgraph for Celo. Adjust your subgraph.yaml file to reference Celo-specific contracts and events. If you don’t have a subgraph yet, you can clone the Uniswap V2 subgraph template and tailor it for Celo:

git clone https://github.com/MobulaFi/univ2-subgraph-celo
2

Install Dependencies

Make sure you have The Graph CLI installed:

npm install -g @graphprotocol/graph-cli
3

Install Mobula CLI

Install our CLI tool using npm:

npm i mobula-cli
4

Setup API Key

Configure your API key with the CLI. You can get your API key from the Dashboard. Please refer to the authentication section for detailed steps on obtaining your API key.

mob apikey set
5

Build Your Subgraph

Compile your subgraph before deployment:

graph codegen && graph build
6

Deploy your subgraph

Deploy your subgraph using the Mobula CLI:

mob deploy -n subgraphName
7

Monitor Deployment

After deployment, you’ll receive a URL to monitor your subgraph’s indexing progress and status.

Best Practices

  • Ensure your subgraph is consistently updated to stay compatible with the latest Celo network changes.
  • Perform thorough testing on a testnet before deploying to the mainnet.
  • Regularly monitor its performance and optimize queries for improved efficiency.

Troubleshooting

If you face issues during deployment:

  • Review your subgraph.yaml file carefully.
  • Ensure the network name and Mobula node URLs are correct.
  • Check that your API key is valid and has the appropriate permissions.

Need help? Our support team is here to assist with any questions or deployment difficulties.