Skip to content

defi-wonderland/grants-stack-indexer-v2

Repository files navigation

Grants Stack Indexer v2

Grants Stack Indexer v2 is a tool designed to index blockchain events generated by Allo contracts, making the data accessible over HTTP in JSON format. The data is organized in a structure that enables efficient querying and easy access to key components of the protocol.

📖 Overview

This repository is a monorepo that contains 8 packages and 3 applications:

Applications

  • @grants-stack-indexer/indexer: An Envio indexer service that collects relevant events from Allo contracts. It is designed to run on the Envio hosted platform and includes a Dockerfile for deployment.

  • @grants-stack-indexer/processing: This service runs the core processing pipeline, coordinating components from various packages to process blockchain events. It manages an Orchestrator per chain.

  • @grants-stack-indexer/scripts: Contains scripts for managing the database schema and migrations. It includes scripts for running migrations and resetting the database schema.

Packages/libs

  • @grants-stack-indexer/chain-providers: Provides wrappers of the Viem library to interact with EVM-based blockchains. It includes utilities for reading contracts and making batch requests.

  • @grants-stack-indexer/data-flow: Manages the flow of data between different components of the indexer. It includes core components for the processing pipeline.

  • @grants-stack-indexer/indexer-client: A client library for interacting with blockchain event indexing services. It provides methods to fetch events by block number and log index.

  • @grants-stack-indexer/metadata: Handles metadata related to the indexed events. It provides a metadata provider to retrieve metadata from IPFS.

  • @grants-stack-indexer/pricing: Manages pricing data and calculations. It includes providers to get the price of a token at a specific timestamp using chainId and token address.

  • @grants-stack-indexer/processors: Contains various data processors used in the indexing pipeline. It includes processors for handling Allo, Strategy, and Registry events.

  • @grants-stack-indexer/repository: Manages the storage and retrieval of indexed data. It implements the Repository pattern to abstract database operations.

  • @grants-stack-indexer/shared: Provides shared utilities, types, constants, and logger. It is designed to be used across the packages of the monorepo to ensure consistency and reusability.

🚀 Local Deployment (Development)

Prerequisites

Ensure you have the following installed on your machine:

Setup

  1. Copy the Example Environment File and edit the .env file
cp .env.example .env
  1. Build and start the services in detached mode:
docker-compose up -d --build
  1. Copy the Example Environment File on apps/migration-scripts and edit the .env file
cp apps/migration-scripts/.env.example apps/migration-scripts/.env
  1. After starting Docker Compose, run the following command to apply the database migrations:
pnpm script:db:migrate
  1. Navigate to the processing service directory and start it with:
cd apps/processing && pnpm dev

Once the setup is completed you can access Hasura by navigating to:

http://localhost:8080/

Use the default password: testing.

Contributing

Wonderland is a team of top Web3 researchers, developers, and operators who believe that the future needs to be open-source, permissionless, and decentralized.

DeFi sucks, but Wonderland is here to make it better.

📝 Conventional Commits

We follow the Conventional Commits specification.

📜 License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages