VSCode Solidity Inspector •
An extension for VSCode editor to inspect the Solidity smartcontracts and generate yul/asm outputs to inspect what's happening under-the-hood. Read 0age's tweet, it is the inspiration for this extension.
Note: This extension is not tested across multiple platforms yet.Only the contracts under foundry project are supported for now.
0age 👑 dropped the optimization alpha in his tweet and when I tried it out for the first time I thought it was really a cool trick. The tweet has the configuration only for hardhat projects. But forge helps to do the same thing in a single command. So I thought instead of typing out the command for each contract in the CLI, it would be handy for the buildoors if there's an extension to inspect solidity contracts and generate low-level code for the contracts. The o/p generated is very useful for gas optimizations.
TL;DR, this is my first VSCode extension, so feel free to provide feedback as I know that there's a plenty of room for improvements, as always^^
Features at a glances:
- Forge ir-optimized o/p generation for the current file.
- Forge ir-optimized o/p generation for the multiple files option via the context menu.
- Forge asm-optimized o/p generation for the current file.
- Forge asm-optimized o/p generation for the multiple files option via the context menu.
The following will need to be installed in order to use this template. Please follow the links and instructions.
- Foundry / Foundryup
- This will install
- You can test you've installed them right by running
forge --version and get an output like:
forge 0.2.0 (f016135 2022-07-04T00:15:02.930499Z)
- To get the latest of each, just run
The usage of this extension is straightforward. You can inspect the solidity contracts that are under the foundry project in two ways:
1.) Select file(s) -> Right click ->
SolidityOptimizer: ir-inspect selected file(s)
Cmd + Shift + P -> Search
Solidity Optimizer - ir-optimizer
Contributions are welcomed. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature)
- Commit your Changes (
git commit -m 'Add some AmazingFeature')
- Push to the Branch (
git push origin feature/AmazingFeature)
- Open a Pull Request
The outputs generated are not always safe for production usage. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of the result. They have not been audited and as such there can be no assurance they will work as intended, and users may experience delays, failures, errors, omissions, loss of transmitted information or loss of funds. The creators are not liable for any of the foregoing. Users should proceed with caution and use at their own risk.