gitcoinco / grants-stack-indexer

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

reorganize event handlers #527

Open boudra opened 5 months ago

boudra commented 5 months ago

use the following naming convention for event handlers:

{contract name}/{event name}.ts

should make it easier to navigate between event handlers

boudra commented 5 months ago

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.