graphops / graph-network-substreams

Graph Network Substreams
Apache License 2.0
1 stars 1 forks source link

refactor: refactored the whole codebase into smaller files #30

Closed sahra-karakoc closed 1 year ago

sahra-karakoc commented 1 year ago

Description

The codebase was getting out of hand with each addition. So, we decided to move modules into smaller files categorized with respect to contracts.

In addition, db.rs, bridge functions from lib.rs to db.rs, graph_out, key generators and finders are all refactored/moved.

I merged all the functions that trigger entityChanges into graph_out. This approach is suggested by SF to be more performant, and it reduces complexity (see substreams graph change for a visualization of the change).

Issue link

For the refactoring of lib.rs, the first approach suggested in the following issue is implemented: https://github.com/graphops/graph-network-substreams/issues/29

sahra-karakoc commented 1 year ago

Are you referring to hardcoding contract addresses, or the inputs of find_key function, or something else?

juanmardefago commented 1 year ago

Mostly all the glue code we need to write when adding new events or new contracts (hardcoding the address, writing the match and decode part to map the event, etc). That seems like something that could be automatically generated, but as I mentioned, I don't think it's worth doing right now, unless we already know how to do it (and I personally don't)