Closed sahra-karakoc closed 1 year ago
Ideally I'd love to have a single .rs file per contract supported, so that multiple contracts can be worked on in parallel without any conflicts arising from that work being done, but I'm not 100% sure if that has any impact on performance or it's less optimal in rust.
One part of the lib.rs file that makes the 1 file per contract approach slightly cumbersome is the map_events (If I recall correctly), which handles the checks agains all the contract addresses supported and wraps the output messages to the event list, but if that can be abstracted away in some way without hurting performance, I think it would be the cleanest solution, and probably easier for expanding the substream afterwards.
I think I managed to implement what you suggested. Please lmk if you want any further improvements.
With the recent additions, lib.rs file is almost 800 lines. It contains all the modules related to all the contracts (staking, curation, rewardsManager). It also contains functions that bridge between modules in lib.rs and entityChanges in db.rs, and graph_out. I think it becomes harder and harder to update lib.rs on each change.
I am thinking of either
For the first approach, we either write an initial module for each contract, or have a separate file for the initial modules and then branch after that.