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

Unpack event logs into map #68

Open
robcxyz opened this issue Feb 12, 2023 · 0 comments
Open

Unpack event logs into map #68

robcxyz opened this issue Feb 12, 2023 · 0 comments

Comments

@robcxyz
Copy link
Contributor

robcxyz commented Feb 12, 2023

Event logs are very difficult to deal with. Should unpack these values into a map and store as json based on the ABI.

  • ABIs
    • Should use internal cache to store ABIs -> github.com/hashicorp/golang-lru/v2
    • This may not work as the ABIs can change over time so we can either
      • Catch the error when unpacking the log -> Could lead to erroneous errors if the ABI changed indexed positions
      • Store an array with block ranges for when the contract was updated -> Would require a detailed history of all the contract updates.
  • Unpacking
    • Take event log, lookup ABI, iterate through indexed / non-indexed data and create a map with keys from ABI and values from event log
    • Store this data as json field in DB

This should be done dry so if we wanted to index this data in elasticsearch that it wouldn't be a pain to do it now. Currently data will go to PG but should be able to be lifted and switched to ES if needed to allow better querying across fields within json.

In PG, not sure if we can support any indexes as the json is not uniform. Will need to look into it. If we can, we should figure out a couple protected methods to index such as Transfer or something like that.

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

No branches or pull requests

1 participant