Scope is a VSCode extension for testing and interacting with smart contracts on the Ethereum blockchain. It is currently in early alpha and under active development. It is built on top of Foundry, ethers-rs and egui; heavy inspiration is drawn from the Remix project.
In many ways, Scope aims to be a GUI wrapper for Foundry. It is intended to be used by developers and security researchers who are already familiar with the command-line tools and want a more visual way to interact with their contracts/tests. Some currently supported features include:
Deploying contracts against a local Anvil node (or a mainnet fork via anvil -f <url>)
Loading existing contracts at an address
Interacting with contracts either via ABI or raw calldata
Easy copying of ABI, AST, calldata, return values, etc.
Setting storage slots and balances
One-button printing storage layout and contract interfaces via cast
Debugging transaction traces via cast call --trace + forge debugger
Running foundry tests
Misc. CLI wrappers:
(see TODO.md for a scratchpad of planned features)
If you run into any issues, DM me on twitter @popular_12345 and I'll help you out. Installation + setup can be a little finnicky currently but I'm aiming to streamline it.
Start a local Anvil instance via the anvil command (take care to not use the terminal window titled "scope"; the extension will use this terminal window for miscellaneous commands). I'd recommend doing this in an external terminal (in case you have to reload VSCode)
You can also use anvil -f <url> to fork mainnet state.
NOTE1 - Scope requires VSCode to be opened in the root directory of a foundry project. It piggybacks on the foundry compiler / command line commands
NOTE2 - The extension requires an Anvil node to be running at localhost:8545 BEFORE the extension is activated (it performs some node setup on load - hardhat_autoImpersonateAccount and hardhat_setBalance). If you start the node after opening VSCode, you will need to reload the extension (Command + Shift + P -> "Developer: Reload Webviews")
Create a new foundry project via foundry init scope-test (or open VSCode at the root of an existing one)
Navigate to the root directory of the new project and open VSCode with code .
Open src/Counter.sol and test/Counter.t.sol in the VSCode editor window
Click the telescope icon to open the extension
Press Compile to compile the contracts (this will run forge build in the background; Scope looks for compiled artifacts in out/)
Alternately, run "forge build" in the terminal and press the "Refresh" button at the top of the extension
Click Deploy to deploy the contract to the local Anvil node
(Separate) Select Counter.t.sol and run some tests (check the options as well)
Most issues can be resolved with some combination of the following:
Ensure you have an anvil node running at localhost:8545 (the default)
Ensure you have VSCode opened at the root of a foundry project
Reload VSCode or the extension webview - Command + Shift + P -> "Developer: Reload Window/Webviews"
Run forge clean && forge build in the terminal -> press the "🔄" button at the top of the extension after successful compilation to refresh the contract list (the Compile button can be error-prone)