Skip to content

Commit

Permalink
Support to open files saved from other tools
Browse files Browse the repository at this point in the history
  • Loading branch information
acuarica committed Dec 17, 2024
1 parent 402028c commit b30f0d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,14 @@ garding Yul.

```

You can also use bytecode downloaded with other tools, for example using [Foundry's `cast`](https://book.getfoundry.sh/cast/)

```console
$ cast code --rpc-url https://cloudflare-eth.com 0xD4039ECC40AedA0582036437cf3ec02845DA4C13 >
KrakenETHStaking.bytecode
$ sevm abi KrakenETHStaking.bytecode
```

### `dis`

```console !sevm=bin/sevm.mjs dis --help
Expand Down
4 changes: 2 additions & 2 deletions bin/sevm.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async function getBytecode(pathOrAddress, cache, rpcUrl) {
if (buffer !== '') return Promise.resolve(buffer);
throw new Error('No input from stdin');
}
return await promises.readFile(pathOrAddress, 'utf8');
return (await promises.readFile(pathOrAddress, 'utf8')).trimEnd();
};

/** @param {unknown} field */
Expand Down Expand Up @@ -305,7 +305,7 @@ void yargs(process.argv.slice(2))
.example('$0 abi 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', '')
.example('$0 sol 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', '')
.example('$0 sol --no-patch 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', '')
.example('echo 0x600160020160005500 | sevm yul -', 'Use `-` to read bytecode from stdin')
.example('echo 0x600160020160005500 | $0 yul -', 'Use `-` to read bytecode from stdin')
.epilog(
`[1] See https://docs.soliditylang.org/en/latest/metadata.html for more information regarding Metadata generated by the Solidity compiler.
[2] See https://docs.soliditylang.org/en/latest/abi-spec.html#abi-json for more information regarding the ABI specification.
Expand Down

0 comments on commit b30f0d3

Please sign in to comment.