Skip to content

subsquid-labs/squid-abi-demo

Repository files navigation

Squid ABI template

An experimental template is used to generate a squid indexing EVM logs and transactions of choice from a contract address. Supports automatic ABI lookups for public contracts using the Etherescan API

Usage

  1. Install the Squid CLI

  2. Init the template and install the dependcies

sqd init my-abi-squid --template https://github.com/subsquid/squid-abi-template
cd my-abi-squid
npm i
  1. Run npx squid-gen-abi with the appropriate flags.
Usage: ts-node generate/run.ts [options]

Options:
  --address <contract>      contract address
  --archive <url>           archive endpoint 
  --abi <path>              (Optional) path or URL to the abi file. If omitted, the Etherscan API is used.
  -e, --event <name...>     one or multiple events to be indexed. '*' will index all events
  -f, --function <name...>. one or multiple contract functions to be indexed. '*' will index all functions
  --from <block>            start indexing from the given block. 
  --etherscan-api <url>     (Optional) an Etherscan-compatible API to fetch contract ABI by a known address. Default: https://api.etherscan.io/
  1. Build and run the squid
npm run build
make up
make migration
make process

The indexing will start.

In a separate window, start the GraphQL API server at localhost:4350/graphql:

make serve
  1. Inspect schema.graphql, src/processor.ts and start hacking!

For more details how to build and deploy a squid, see the docs.

Example

npx squid-gen-abi \
--address 0x2E645469f354BB4F5c8a05B3b30A929361cf77eC \
--archive https://eth.archive.subsquid.io \
--event NewGravatar \
--event UpdatedGravatar \
--function createGravatar \
--from 6000000

Screenshot 2023-01-10 at 13 03 16

About

A demo for a squid generated from an ABI template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published