From 11e3f1153144352b80751997533febbfe3285c66 Mon Sep 17 00:00:00 2001 From: Luis Mastrangelo Date: Thu, 30 Nov 2023 21:29:43 +0100 Subject: [PATCH] :memo: Update & validate docs' `README` --- .github/workflows/pages.yaml | 3 +- docs/README.md | 72 +++++++++++++++++++++++++++++++++--- package.json | 2 +- 3 files changed, 70 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml index ce4d274e..ffb2393c 100644 --- a/.github/workflows/pages.yaml +++ b/.github/workflows/pages.yaml @@ -31,7 +31,8 @@ jobs: - name: Setup Pages uses: actions/configure-pages@v3 - run: yarn install --frozen-lockfile - - run: yarn tsdoc + - run: yarn make:docs + - run: git --no-pager diff --exit-code docs/README.md - name: Upload artifact uses: actions/upload-pages-artifact@v1 with: diff --git a/docs/README.md b/docs/README.md index 93cc9333..2bc58ed8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,10 +4,10 @@ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/acuarica/evm/main.yaml?style=flat-square)](https://github.com/acuarica/evm/actions/workflows/main.yaml) ![nycrc config on GitHub](https://img.shields.io/nycrc/acuarica/evm?style=flat-square) -[![npm (scoped)](https://img.shields.io/npm/v/@acuarica/evm?style=flat-square)](https://www.npmjs.com/package/@acuarica/evm) -![npm](https://img.shields.io/npm/dt/@acuarica/evm) +[![npm](https://img.shields.io/npm/v/sevm?style=flat-square)](https://www.npmjs.com/package/sevm) +![npm](https://img.shields.io/npm/dt/sevm?style=flat-square) [![GitHub](https://img.shields.io/github/license/acuarica/evm?style=flat-square)](https://github.com/acuarica/evm/blob/main/LICENSE) -[![install size](https://packagephobia.com/badge?p=@acuarica/evm)](https://packagephobia.com/result?p=@acuarica/evm) +[![install size](https://packagephobia.com/badge?p=sevm)](https://packagephobia.com/result?p=sevm) [![Demo](https://img.shields.io/badge/demo-acuarica.github.io%2Fevm-informational?style=flat-square)](https://acuarica.github.io/evm) A Symbolic [Ethereum Virtual Machine (EVM)](https://medium.com/mycrypto/the-ethereum-virtual-machine-how-does-it-work-9abac2b7c9e) interpreter and decompiler, along with several other utils for programmatically extracting information from bytecode. @@ -35,13 +35,19 @@ Install using your package manager or Browser's `script` tag ### **yarn** ```sh -yarn add @acuarica/evm +yarn add sevm ``` ### **npm** ```sh -npm install @acuarica/evm +npm install sevm +``` + +or to install globally in your system + +```sh +npm install --global sevm ``` ### **Browser WIP** @@ -182,6 +188,62 @@ web3.eth.getTransaction( +## `--help` + + + + +```console +$ sevm --help +sevm + +Commands: + sevm metadata Shows the Metadata of the contract[1] + sevm abi Shows the ABI of the contract[2] + sevm dis Disassemble the bytecode into Opcodes + sevm cfg Writes the cfg of the selected function in `dot` for + mat into standard output + sevm sol Decompile the contract's bytecode into Solidity-like + source code + sevm yul Decompile the contract's bytecode into Yul-like sour + ce code[3] + sevm config Shows cache path used to store downloaded bytecode + +Options: + --version Show version number [boolean] + --color Display with colors, use `--no-color` to deactivate colors + [boolean] [default: true] + -s, --selector Function signature, e.g., `balanceOf(address)` or selector has + h to choose a specific function [string] + --help Show help [boolean] + +Examples: + sevm abi 0x00000000000C2E074eC69A0dFb299 shows the ABI of the ENS registry co + 7BA6C7d2e1e ntract + sevm decompile 0x00000000000C2E074eC69A0 decompiles the ENS registry contract + dFb2997BA6C7d2e1e + +[1] See https://docs.soliditylang.org/en/latest/metadata.html for more informati +on 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. +[3] See https://docs.soliditylang.org/en/latest/yul.html for more information re +garding Yul. + +At least one command must be specified + +``` + + + +## EVM Bytecode Decompiler Signature & Topics Hashes _4byte_ + +Collection of Ethereum `function` and `event` signatures. +It looks up in the signature and events database for matching hashes. + +When a matching `function` or `event` is found in a `Contract`, +it patches the `function` or `event` with the corresponding signature. + ## Detached Fork This GitHub repo was originally a fork of . diff --git a/package.json b/package.json index 5a312232..8951cd01 100644 --- a/package.json +++ b/package.json @@ -92,10 +92,10 @@ "make:ercs": "scripts/ercs.mjs > src/ercs.ts", "make:4byte": "node scripts/4byte.mjs", "make:help": "bin/sevm.mjs 2>&1 | MARKER='sevm --help' scripts/help.mjs README.md", + "make:docs": "cp README.md docs && typedoc --out docs/tsdoc src/index.ts src/ast/index.ts", "prettier": "prettier --write .", "prettier:staged": "pretty-quick --staged", "docs": "http-server docs", - "tsdoc": "typedoc --out docs/tsdoc src/index.ts src/ast/index.ts", "clean": "rm -r .solc/" }, "engines": {