Summary
Safrochain ships with CosmWasm enabled (see wasmbindings/ and the x/cw-hooks module), but the repository contains no runnable CosmWasm contract examples or a walkthrough that takes a new developer from cargo new to a deployed contract on a local Safrochain node. New builders coming from the broader CosmWasm ecosystem currently have to piece this together themselves.
Goal
Add an examples/cosmwasm/ directory with at least three small, self-contained reference contracts and a step-by-step guide that uses safrochaind to compile, upload, instantiate, and execute them against a local node.
Suggested example contracts
counter/ — the classic Hello-World: Increment, Reset, GetCount. Demonstrates state, messages, queries, and unit testing with cw-multi-test.
cw20-mintable/ — a minimal mintable CW20 token. Demonstrates the standard token interface and how to mint/transfer/query balances.
clock-counter/ — a contract registered with x/clock that auto-increments on every block. Shows how to use Safrochain's custom clock module — this is one of the chain's differentiators and currently has no public example.
Optional bonus:
cw-hooks-listener/ — subscribes to events via x/cw-hooks. Same rationale as above: it's a Safrochain-specific feature with no published example.
Suggested walkthrough (examples/cosmwasm/README.md)
- Prerequisites (
rustup, wasm32-unknown-unknown target, cargo-generate, safrochaind)
- Build with
cargo wasm + optional cosmwasm/optimizer Docker image
safrochaind tx wasm store … to upload the bytecode (with gas/fee guidance using usaf)
safrochaind tx wasm instantiate …
safrochaind tx wasm execute … and safrochaind query wasm contract-state smart …
- How to register the contract with
x/clock or x/cw-hooks where applicable
- Troubleshooting (gas estimation, wasm size limit, query vs execute)
Why this matters
- Lowers the barrier to entry. New CosmWasm developers can clone the repo and have a working contract on a Safrochain devnet in under 30 minutes.
- Documents Safrochain-specific features.
x/clock and x/cw-hooks are real differentiators but invisible to anyone who hasn't read the Go code. Examples are the most credible form of documentation for them.
- Drives adoption. Most chains compete for contract developers on tooling and examples. A complete
examples/ directory is one of the highest-leverage docs investments.
- Stress-tests the chain. Maintaining runnable examples surfaces breakage from SDK / wasmd / wasmvm bumps before integrators hit it.
Acceptance criteria
Why this is a good first issue
Each contract can be tackked independently — a newcomer can pick "counter" or "cw20-mintable" without needing deep chain knowledge, and the Rust side is well-trodden territory in the CosmWasm community. Comment to claim one.
Summary
Safrochain ships with CosmWasm enabled (see
wasmbindings/and thex/cw-hooksmodule), but the repository contains no runnable CosmWasm contract examples or a walkthrough that takes a new developer fromcargo newto a deployed contract on a local Safrochain node. New builders coming from the broader CosmWasm ecosystem currently have to piece this together themselves.Goal
Add an
examples/cosmwasm/directory with at least three small, self-contained reference contracts and a step-by-step guide that usessafrochaindto compile, upload, instantiate, and execute them against a local node.Suggested example contracts
counter/— the classic Hello-World:Increment,Reset,GetCount. Demonstrates state, messages, queries, and unit testing withcw-multi-test.cw20-mintable/— a minimal mintable CW20 token. Demonstrates the standard token interface and how to mint/transfer/query balances.clock-counter/— a contract registered with x/clock that auto-increments on every block. Shows how to use Safrochain's customclockmodule — this is one of the chain's differentiators and currently has no public example.Optional bonus:
cw-hooks-listener/— subscribes to events via x/cw-hooks. Same rationale as above: it's a Safrochain-specific feature with no published example.Suggested walkthrough (
examples/cosmwasm/README.md)rustup,wasm32-unknown-unknowntarget,cargo-generate,safrochaind)cargo wasm+ optionalcosmwasm/optimizerDocker imagesafrochaind tx wasm store …to upload the bytecode (with gas/fee guidance usingusaf)safrochaind tx wasm instantiate …safrochaind tx wasm execute …andsafrochaind query wasm contract-state smart …x/clockorx/cw-hookswhere applicableWhy this matters
x/clockandx/cw-hooksare real differentiators but invisible to anyone who hasn't read the Go code. Examples are the most credible form of documentation for them.examples/directory is one of the highest-leverage docs investments.Acceptance criteria
examples/cosmwasm/<name>/directory per contract, each independently buildablecargo testMakefileorjustfilewithbuild,optimize,store,instantiate,executetargetsexamples/cosmwasm/README.mdwalks through the full local-node flow with copy-pasteable commandsusaffor fees andsafro-testnet-1as the chain ID, matching the main READMEWhy this is a good first issue
Each contract can be tackked independently — a newcomer can pick "counter" or "cw20-mintable" without needing deep chain knowledge, and the Rust side is well-trodden territory in the CosmWasm community. Comment to claim one.