Recommended tools

Don't know Solidity? Don't worry.

  1. Cursor IDE to help you write shadow events

  2. Cursor AI prompt to give GPT context on Shadow and provide ready-to-use code

  3. Contract Code Viewer extension to pull down contract code by pasting in an Etherscan link

  4. Solidity VSCode extension to compile your shadow contracts

This guide shows you how to set each of these tools up and use them effectively.

Cursor IDE

Cursor is a GPT-4 integrated IDE built on top of VSCode. Using this is highly recommended for beginners to Solidity or non-engineers (e.g. data analysts), as it has a number of benefits:

  • It has full codebase context of all files in a smart contract without needing to copy paste

  • It can write code for you directly in the contract

  • You can easily link to a code snippet when asking the AI questions

  • You can one click ask it to resolve compiler errors

Cursor's standard subscription costs the same as ChatGPT Plus ($20/mo). You can also provide a GPT API key and pay no extra costs (hit the gear icon in the top right corner).

Cursor GPT Prompt

This is a GPT prompt that we've iterated on through trial and error. It gives GPT context about what Shadow is, and guidelines for how to answer your questions and write shadow events for you. Paste this into Cursor to give the AI rules on how to answer your questions and write code.

Open the AI Chat in Cursor (right side bar) and click on the "More" tab

Contract Code Viewer Extension

The Contract Code Viewer extension allows you to download contract code into Cursor simply by pasting in an Etherscan link. This will allow you to edit the contract to add shadow events.

How to install within Cursor:

  1. Navigate to the extensions tab within Cursor in the top left corner

  2. Search "Contract Code Viewer" β†’ select the extension by degensean β†’ Install

How to use within Cursor:

  • Click into the top search bar in Cursor and type > to open the command palette, or use the keyboard shortcut cmd + shift + p and type "contract code viewer"

  • Select Enter URL to the contract on explorer

  • Paste in the Etherscan URL of the contract that you want to add shadow events to

  • Open the folder or file that shows up on the dialog

Solidity Compiler Extension

The Solidity VSCode extension by Juan Blanco is what most Solidity developers use. This will allow you to compile your Solidity contracts for testing and prettifies Solidity code for easier reading.

How to install within Cursor:

  1. Navigate to the extensions tab within Cursor in the top left corner

  2. Search "Solidity" β†’ select the Solidity VSCode extension by Juan Blanco β†’ Install

How to use within Cursor:

Compiling contracts means that you are compiling your Solidity code into bytecode, which is the low-level language that the EVM uses. This is a necessary step to ensure that your Solidity code can be processed into valid bytecode that is readable by the EVM (and Shadow).

  • What to do: Within a contract file (.sol), right click anywhere and select Compile contract or use the keyboard shortcut F5

Changing the compiler version is necessary to successfully compile the specific contract that you are modifying. The extension will default to the latest Solidity compiler version, but oftentimes you will be modifying a contract that was deployed using a previous compiler version.

  • What to do:

    • Click into the top search bar in Cursor and type > to open the command palette, or use the keyboard shortcut cmd + shift + p and type "change compiler"

    • Select Change workspace compiler version (Remote)

    • Change version to match what's written in pragma solidity = at the top of the contract

pragma solidity =0.7.6 is shown at the top of the file

Last updated