Project Scaffolding
Thexyz init command creates a complete CosmWasm contract project with all the necessary files and configurations.
Usage
Options
Create a Project
Output
Output
Project Structure
File Contents
Cargo.toml
src/lib.rs
src/msg.rs
src/state.rs
src/error.rs
src/contract.rs
Templates
CW20 Template (Default)
Token contract template based on CW20 standard:- Token minting
- Transfers
- Balance queries
- Allowances
Overwrite Existing
To overwrite an existing directory:Next Steps
After scaffolding:Customizing the Contract
Add New Execute Messages
- Add variant to
ExecuteMsginsrc/msg.rs:
- Handle in
src/contract.rs:
Add New Queries
- Add variant to
QueryMsginsrc/msg.rs:
- Handle in
src/contract.rs:
Add State
- Define in
src/state.rs:
- Use in contract:
Troubleshooting
Directory already exists
Directory already exists
Use
--force to overwrite:Permission denied
Permission denied
Check write permissions for the current directory.