Create a new project
Make sure you have installed the tooling and that you are in the working directory, and then run:
- cargo-contract
- Pop
cargo contract new flipper
pop new contract
This command will create a new project folder named flipper
with:
flipper
└─ lib.rs <-- Contract Source Code
└─ Cargo.toml <-- Rust Dependencies and ink! Configuration
└─ .gitignore
tip
The Pop CLI has many templates to offer!
Contract Source Code
For the lib.rs
file, cargo-contract
automatically generates the source code for the "Flipper" contract, which is about the simplest "smart" contract you can build. You can take a sneak peak as to what will come by looking at the source code here:
Flipper Example Source Code.
The Flipper contract is nothing more than a bool
which gets flipped from true
to false
through the flip()
function.
Now that we are feeling confident things are working, we can actually compile the contract in the next step.