Tutorial
How to use wasm CLI
First of all, install ununifid
to use wasm CLI and Rust. To learn how to install ununifid
, see here
There are two ways of using wasm CLI.
ununifid tx wasm --help
ununifid query wasm --help
Compiling and Testing a Contract
Quoted from CosmWasm Documentation
# Download the repository
git clone https://github.com/CosmWasm/cw-plus
cd cw-plus
git checkout main
cd contracts/cw20-ics20
# compile the wasm contract with stable toolchain
rustup default stable
cargo wasm
Unit Tests
Quoted from CosmWasm Documentation
RUST_BACKTRACE=1 cargo unit-test
Build with Optimizer
Quoted from CosmWasm Documentation
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.11
Deployment and Interaction
Quoted from CosmWasm Documentation
To deploy your wasm smart contract that you built, use ununifid tx wasm store
commands.
ununifid tx wasm store --help
Converse to Solidity smart contracts, CosmWasm has two stages to activate smart contracts. That are deploy and instantiate. So after you deployed your wasm smart contract, use ununifid tx wasm instantiate
commands.
ununifid tx wasm instantiate --help
最終更新