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

feat(cast/selectors): add optional selectors resolving #6864

Merged
merged 1 commit into from
Jan 20, 2024

Conversation

cdump
Copy link
Contributor

@cdump cdump commented Jan 20, 2024

Motivation

4byte selector lookups for cast selectors was requested in comments #6684 (comment)

Solution

Add optional selectors resolving (--resolve, default=false).
After the #6719 has been merged, we don't have a problem with a lot of openchain API calls.

$ cast selectors --resolve $(cast code 0xdAC17F958D2ee523a2206206994597C13D831ec7)

0x06fdde03                              name()
0x0753c30c      address                 deprecate(address)
0x095ea7b3      address,uint256         approve(address,uint256)
0x0e136b19                              deprecated()
0x0ecb93c0      address                 addBlackList(address)
0x23b872dd      address,address,uint256 transferFrom(address,address,uint256)
...

output with | tr ' ' '.' | tr '\t' '|' (spaces replaced with . and tabs replaced with |)

0x06fdde03|.......................|name()
0x0753c30c|address................|deprecate(address)
0x095ea7b3|address,uint256........|approve(address,uint256)
0x0e136b19|.......................|deprecated()
0x23b872dd|address,address,uint256|transferFrom(address,address,uint256)
...

output is readable by humans (columns are aligned) and by shell scripts (no and \t chars in column values)

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm

@mattsse mattsse merged commit eeef40c into foundry-rs:master Jan 20, 2024
19 checks passed
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.

3 participants