Skip to main content
Version: 3.x

Contract Template

Change into your working directory and run:

cargo contract new foobar

This will create a new project folder named foobar.

cd foobar/

In the lib.rs file you find initial scaffolded code, which you can use as a starting point.

Quickly check that it compiles and the trivial tests pass with:

cargo +nightly test

Also check that you can build the Wasm file by running:

cargo +nightly contract build

If everything looks good, then we are ready to start programming!