This squid captures Transfer(address,address,uint256) events emitted by the contract at env.CONTRACT_ADDRESS (USDC token contract by default). It keeps up with network updates in real time. Balances of individual accounts are computed and kept up to date.
The handler function for batches of Transfers lives in a separate module and has a test. The test can run locally or as a GitHub Action.
Dependencies: Node.js v20 or newer, Docker.
git clone https://github.com/subsquid-labs/squid-with-tests
cd squid-with-tests
docker compose up -d
npm run build
npx squid-typeorm-migration apply
node -r dotenv/config lib/main.jsthen in a separate terminal
npx squid-graphql-serverA GraphiQL playground will be available at localhost:4350/graphql.
Enter the project folder and make sure that the database is up:
docker compose up -dthen run
npm test