This is a lab to test indexing UniswapV3 swaps data using Subsquid. This project serves as a starter template of a squid indexer for EVM networks (Ethereum, Polygon, BSC, etc.). See Squid SDK docs for a complete reference.
For a step-by-step migration guide from TheGraph, see the dedicated docs page.
Prerequisites: Node.js, Docker.
-
Install Node.js from the official website.
-
On Windows, resolve script execution policy issues by running the following PowerShell commands:
Get-ExecutionPolicy Set-ExecutionPolicy RemoteSigned Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
-
Clone the repository:
git clone https://github.com/subsquid-labs/uniswapv3-swaps-example.git cd uniswapv3-swaps-example
-
Install @subsquid/cli globally:
npm i -g @subsquid/cli
-
Install dependencies:
npm ci
-
Start a Postgres database container and detach:
sqd up
-
Build and start the processor:
sqd process
-
The command above will block the terminal, being busy with fetching the chain data, transforming and storing it in the target database.
-
To start the GraphQL server, open a separate terminal and run:
sqd serve
A GraphiQL playground will be available at localhost:4350/graphql to query the indexed data.