Before diving into any Sway code, ensure you have installed the following dependencies.
Start by installing the Fuel toolchain .
Install the beta-4 toolchain distribution and set it as your default with:
$ fuelup toolchain install beta-4
$ fuelup default beta-4
You can check to see the current toolchain version installed by running the following:
$ fuelup show
Next, add the Sway extension to your VS Code.
If you want to be able to run tests in Rust, install the Rust toolchain as well.
This example uses the
beta-4
toolchain, which is version0.46.0
offorc
Within your terminal start by creating a new folder called sway-store
, and making a new contract called sway-store-contract
.
$ forc new sway-store
$ cd sway-store
Open up the contract
folder in VSCode, and inside the src
folder you should see a file called main.sw
. This is where you will write your Sway contract.
Since we're creating a brand new contract you can delete everything in this file.
Was this page helpful?