Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reorganize event handlers #527

Open
boudra opened this issue Apr 18, 2024 · 1 comment · May be fixed by #536
Open

reorganize event handlers #527

boudra opened this issue Apr 18, 2024 · 1 comment · May be fixed by #536
Labels
good first issue Good for newcomers

Comments

@boudra
Copy link
Contributor

boudra commented Apr 18, 2024

use the following naming convention for event handlers:

{contract name}/{event name}.ts

should make it easier to navigate between event handlers

@boudra boudra linked a pull request Apr 24, 2024 that will close this issue
@boudra boudra added the good first issue Good for newcomers label Apr 24, 2024
@boudra
Copy link
Contributor Author

boudra commented Apr 24, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant