gitcoinco/grants-stack-indexer

reorganize event handlers

Opened this issue · 1 comments

use the following naming convention for event handlers:

{contract name}/{event name}.ts

should make it easier to navigate between event handlers

at the moment we have two main event handlers, allo v1 and v2, these functions can get big and it can be hard to follow what's going on

I propose we use the contract names and event names as a directory naming convention, for example:

src/indexer/handlers/AlloV1/RoundFactory/V1/RoundCreated.ts
src/indexer/handlers/AlloV2/Registry/V1/ProfileCreated.ts

Each individual file would handle only a single event, repeated code can go into a common directory shared by handlers.
To handle a new event all you'd have to do is create the file, the indexer router would pick up the file with a dynamic import and dispatch events to it.