Skip to content

Commit

Permalink
Add 'cast selectors' docs (#1094)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdump authored Jan 20, 2024
1 parent 832034c commit 8f3974d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
- [cast calldata](./reference/cast/cast-calldata.md)
- [cast calldata-decode](./reference/cast/cast-calldata-decode.md)
- [cast pretty-calldata](./reference/cast/cast-pretty-calldata.md)
- [cast selectors](./reference/cast/cast-selectors.md)
- [cast upload-signature](./reference/cast/cast-upload-signature.md)
- [Conversion Commands](./reference/cast/conversion-commands.md)
- [cast format-bytes32-string](./reference/cast/cast-format-bytes32-string.md)
Expand Down
3 changes: 2 additions & 1 deletion src/reference/cast/abi-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
- [cast calldata](./cast-calldata.md)
- [cast calldata-decode](./cast-calldata-decode.md)
- [cast pretty-calldata](./cast-pretty-calldata.md)
- [cast upload-signature](./cast-upload-signature.md)
- [cast selectors](./cast-selectors.md)
- [cast upload-signature](./cast-upload-signature.md)
2 changes: 1 addition & 1 deletion src/reference/cast/cast-4byte.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ Get the function signatures for the given selector from <https://sig.eth.samczsu

### SEE ALSO

[cast](./cast.md), [cast 4byte-decode](./cast-4byte-decode.md), [cast 4byte-event](./cast-4byte-event.md)
[cast](./cast.md), [cast 4byte-decode](./cast-4byte-decode.md), [cast 4byte-event](./cast-4byte-event.md), [cast selectors](./cast-selectors.md)
32 changes: 32 additions & 0 deletions src/reference/cast/cast-selectors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## cast selectors

### NAME

cast-selectors - Extracts function selectors and arguments from bytecode

### SYNOPSIS

``cast selectors`` [*options*] *bytecode*

### DESCRIPTION

Extracts function selectors and arguments from bytecode using the [EVMole library](https://github.com/cdump/evmole)

### OPTIONS

`-r`
`--resolve`
&nbsp;&nbsp;&nbsp;&nbsp;Resolve the function signatures for the extracted selectors using https://openchain.xyz

{{#include common-options.md}}

### EXAMPLES

1. Get WETH's contract function signatures & arguments:
```sh
cast selectors $(cast code 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)
```

### SEE ALSO

[cast](./cast.md), [cast 4byte](./cast-4byte.md)
3 changes: 3 additions & 0 deletions src/reference/cast/cast.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ This program is a set of tools to interact with Ethereum and perform conversions
[cast pretty-calldata](./cast-pretty-calldata.md)
&nbsp;&nbsp;&nbsp;&nbsp;Pretty print calldata.

[cast selectors](./cast-selectors.md)
&nbsp;&nbsp;&nbsp;&nbsp;Extracts function selectors and arguments from bytecode

[cast upload-signature](./cast-upload-signature.md)
&nbsp;&nbsp;&nbsp;&nbsp;Upload the given signatures to https://sig.eth.samczsun.com.

Expand Down

0 comments on commit 8f3974d

Please sign in to comment.