CRE Workflows HubCRE Workflows Hub
  • Workflows
  • Chainlink repo
  • Sign in
CRE Workflows Hub
  • Workflows
  • Docs
  • Contribute workflow
  • Chainlink CRE Templates

A registry for Chainlink Runtime Environment workflows. List and share your CRE workflows without waiting for upstream approval.

Back

Created by Chainlink Labs

Indexer Data Fetch

Workflows for pulling data from The Graph indexer with scheduled cron triggers using the pull pattern.

View on GitHub
TypeScript
Go

Workflows for pulling data from The Graph indexer with scheduled cron triggers. These workflows demonstrate the pull pattern where the workflow initiates and fetches data on a schedule.

Directory Structure

  • indexer-fetch-go/ (Go): workflow.go, main.go, config.staging.json, config.production.json, workflow.yaml
  • indexer-fetch-ts/ (TypeScript): main.ts, config.staging.json, config.production.json, package.json, workflow.yaml

Overview

  • Query The Graph indexer using GraphQL
  • Use cron triggers to schedule periodic data fetching
  • Process and return JSON-formatted indexer data
  • Same functionality in Go and TypeScript

Both workflows query the Uniswap V4 subgraph and fetch: pool manager statistics (pool count, tx count, total volume), ETH price from bundles.

Configuration (config.staging.json): schedule (cron), graphqlEndpoint (The Graph gateway/studio), query, variables.

Go: cd indexer-fetch-go, cre workflow simulate my-workflow --target staging-settings

TypeScript: cd indexer-fetch-ts, cre workflow simulate workflow --target staging-settings

Example use cases: monitoring Uniswap V4 pools, tracking token prices, DeFi protocol metrics.

Reference: CRE docs, The Graph docs.

Install the CRE CLI to use this template

You can use the command below or download the latest CLI release on GitHub.

curl -sSL https://cre.chain.link/install.sh | bash
Author
Chainlink Labs
LicenseMIT

Disclaimer

This template represents an educational example to use a Chainlink system, product, or service and is provided to demonstrate how to interact with Chainlink's systems, products, and services to integrate them into your own. This template is provided "AS IS" and "AS AVAILABLE" without warranties of any kind, it has not been audited, and it may be missing key checks or error handling to make the usage of the system, product or service more clear. Do not use this example in a production environment without completing your own audits and application of best practices. Neither Chainlink Labs, the Chainlink Foundation, nor Chainlink node operators are responsible for unintended outputs that are generated due to errors in code.