gitcoinco / grants-stack-indexer

Grants Stack Indexer
https://grants-stack-indexer-v2.gitcoin.co/graphiql
29 stars 23 forks source link

refactor: implemented base for new indexer event handling approach #590

Open hussedev opened 1 month ago

hussedev commented 1 month ago

In this PR we are setting a base for a new approach on how we handle events in the indexer, starting with ProjectCreated event of alloV1.

With this new approach we will have separated contract folders that will include the abi and the event handlers. To retrieve the handler of an specific event we will use getEventHandler function that receives the contract and event names as arguments.

For now we are relying in this function to delegate event handling to the old approach if the function returns undefined, this allows us to migrate event by event or contract by contract seamlessly, while in the future we will throw an error if it returns undefined.

indexer/abis/index.ts will be moved to indexer/contracts/abis.ts, in that way once the migration is done, when we want to include a new strategy, we will just include the folder with its abi and its handlers, and import the abi to indexer/contracts/abis.ts.

Closes BLU-119