Skip to content

subsquid-labs/squid-evm-examples

Repository files navigation

EVM indexing squids

This repo contains sample squid ETLs for indexing, transforming and presenting EVM on-chain data as GraphQL APIs. Each squid highlights a specific feature of the Subquid SDK.

Overview

  • 1-evm-logs: Index ERC20 transfers by extracting Transfer(address,address,uint256) event logs emitted by a given contract.
  • 2-transaction: Index transactions data.
  • 3-factory: Index token swaps within dynamically created pools. Illustrates network-wide filtering of EVM logs.
  • 4-contract-calls: Enrich the model data by querying historical state of the contract.
  • 5-multicall: Same as the contract example but with state requests batching.
  • 6-ipfs A BAYC NFT indexer. Illustrates batched IPFS gateway calls, external API calls, and contract state queries. Alternative implementation of the BAYC indexer described in the tutorial.
  • 7-multichain A simple multichain squid indexing Transfer events emitted by USDC contracts on Ethereum and BSC.

Prerequisites

  • Node v16.x
  • Docker
  • Squid CLI

To install the Squid CLI, run

npm i -g @subsquid/cli

Running

Navigate to the example folder.

npm ci
sqd build
# start the database
sqd up
# starts a long-running ETL and blocks the terminal
sqd process

# starts the GraphQL API server at localhost:4350/graphql
sqd serve