StateSet Commerce Network Guides
StateSet Contracts Quickstart
Getting started with Contracts on the StateSet Network
Smart contracts can be programmed on the Stateset Network using CosmWasm. Cosmwasm is a smart contract framework that leverages Rust.
To create the smart contract:
- Generate the initial project
- Compile the smart contract
- Run unit tests
- Optimize the wasm contract bytecode to prepare for deployment
- Deploy the smart contract to local Stateset Network
- Instantiate it with contract parameters
The cw20 basic token
Once you have the Stateset Network running on your local machine it should be very easy to create your own token. Here is a quick introduction into creating an interacting with an erc20 like token on Stateset.
Download
We’re going to grab the stateset-contracts repo and compile our chosen contract.
Get the Code
bash
Compile
We can compile our contract like so:
Compile the wasm contract with stable toolchain
bash
However, we want to create an optimized version to limit gas usage, so we’re going to run:
bash
This will result in an artifact called cw_erc20.wasm being created in the artifacts directory.
Upload
bash
Optimize the Contract
bash
Instantiate
bash
Query - Query Balances
bash
Execute - Transfer Tokens
bash