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

Add utilities to parse log events #120

Merged
merged 2 commits into from
Dec 22, 2023
Merged

Add utilities to parse log events #120

merged 2 commits into from
Dec 22, 2023

Conversation

ferranbt
Copy link
Collaborator

@ferranbt ferranbt commented Dec 5, 2023

📝 Summary

This PR introduces a utility to parse event logs. An event in Ethereum has the form:

struct Event(
   uint64 num,
   uint64 indexed num2,
   uint256 num3
)

When serialized into JSON, indexed fields (e.g. num2) are included in an array of 32 bytes each called topics. Un-indexed fields are ABI encoded in a single []byte field called Data.

Currently, there are only helper methods to separately parse the indexed/unindexed fields. This PR creates a new method ParseLog that combines both methods.

📚 References


  • I have seen and agree to CONTRIBUTING.md

Copy link
Member

@dmarzzz dmarzzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love it

@ferranbt ferranbt merged commit fe570fb into main Dec 22, 2023
3 checks passed
@ferranbt ferranbt deleted the feature/parse-event branch December 22, 2023 16:58
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

Successfully merging this pull request may close these issues.

2 participants