Basic instructions
To compile release version of the smart contract you can run:
Note: The above
build
command is setting atarget
flag to create a WebAssembly.wasm
file.
Notice that your project directory now has a few additional items:
#
Build and FlagsWe recommend you to optimize your build artifact with the use of the next flags in your Cargo.toml file. If you are performing a multi-contract build, you should include these settings in the Cargo.toml that is at the root of your project.
The above command is essentially setting special flags and optimizing the resulting .wasm
file. At the end of the day, this allows you to customize the cargo build --release
command.
#
Custom FlagsIf you wish to add custom flags to your build, you can perform this by adding build flags to your ProjectFolder/.cargo/config.toml
as illustrated in this example.
A full set of build options can be accessed at https://doc.rust-lang.org/cargo/reference/config.html.
You can find an example here.