Basic Contract
Each contract should be in its own crate. In a folder, create two files:
Cargo.toml: The manifest.
lib.rs: The default library file.
Inside the Cargo.toml you will need to specify parameters in the [package]
, [dependencies]
, [lib]
type, and [features]
sections:
In the library file - ink! has a few minimum requirements:
#![cfg_attr(not(feature = "std"), no_std)]
at the beginning of each contract file.a module with
#[ink::contract]
.a (storage) struct - that can be empty - with
#[ink(storage)]
.at least one constructor with
#[ink(constructor)]
.at least one fn with
#[ink(message)]
.
In the lib.rs the minimum implementation is:
The flipper smart contract is most basic example provided by ink! team.
Last updated