A template for creating CW20-compliant token contracts on Cosmos blockchains. This template provides a basic implementation of the CW20 token standard with common functionality like minting, burning, and transferring tokens.
- CW20 standard compliance
- Token minting with optional supply cap
- Token burning
- Token transfers
- Balance and token info queries
- Configurable token parameters (name, symbol, decimals)
- Rust 1.65.0 or later
- wasm32-unknown-unknown target
- wasm-opt (optional, for optimizing wasm)
# Build the contract
cargo build --target wasm32-unknown-unknown --release
# Generate schemas
cargo xtask generate_schemas
# Run tests
cargo test
let msg = InstantiateMsg {
name: "My Token".to_string(),
symbol: "MTK".to_string(),
decimals: 6,
initial_supply: Uint128::new(1000000),
minter: Some(minter_address),
};
Transfer
: Transfer tokens to another addressMint
: Mint new tokens (minter only)Burn
: Burn tokens from sender's balance
Balance
: Query token balance of an addressTokenInfo
: Query token information (name, symbol, decimals, total supply)Minter
: Query minter information
# Run all tests
cargo test
# Run specific test
cargo test test_cw20_operations
cargo xtask generate_schemas
This will generate JSON schema files in the schema
directory, which can be used for contract interaction and documentation.
This project is licensed under the Mozilla Public License 2.0.
Contributions are welcome! Please feel free to submit a Pull Request.
This contract has not been audited and is provided as-is. Use at your own risk.