Skip to content

Unpack event logs into map  #68

Description

@robcxyz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions