grants-stack-indexer icon indicating copy to clipboard operation
grants-stack-indexer copied to clipboard

reorganize event handlers

Open boudra opened this issue 1 year ago • 1 comments

use the following naming convention for event handlers:

{contract name}/{event name}.ts

should make it easier to navigate between event handlers

boudra avatar Apr 18 '24 08:04 boudra

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.

boudra avatar Apr 24 '24 14:04 boudra