To compile release version of the smart contract you can run:
Note: The above
buildcommand is setting a
targetflag to create a WebAssembly
Notice that your project directory now has a few additional items:
We 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.
If 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.