Skip to content

docs(examples): add CosmWasm contract examples and deploy walkthrough#56

Open
Karry2019web wants to merge 21 commits into
Safrochain-Org:mainfrom
Karry2019web:feat/cosmwasm-examples
Open

docs(examples): add CosmWasm contract examples and deploy walkthrough#56
Karry2019web wants to merge 21 commits into
Safrochain-Org:mainfrom
Karry2019web:feat/cosmwasm-examples

Conversation

@Karry2019web

Copy link
Copy Markdown
Contributor

Summary

This PR adds a complete examples/cosmwasm/ directory with four self-contained CosmWasm smart contract examples and a step-by-step walkthrough README, as described in issue #38.

Contracts included

1. counter/ — Classic Hello-World

  • Increment, Decrement, Reset messages
  • GetCount query
  • Full unit tests with cw-multi-test
  • Demonstrates: state management, messages, queries, testing

2. cw20-mintable/ — Minimal mintable CW20 token

  • Wraps cw20-base with mint capability
  • Full test coverage: initialization, mint, transfer, balance queries
  • Demonstrates: CW20 standard, cw20-base integration

3. clock-counter/ — x/clock integration

  • Implements SudoMsg::ClockEndBlock for EndBlock execution
  • Manual increment for testing
  • Demonstrates: x/clock registration, sudo entry point, chain-specific feature

4. cw-hooks-listener/ — x/cw-hooks integration (bonus)

  • Listens for staking events (AfterValidatorCreated, AfterValidatorBonded, etc.)
  • Stores events on-chain for querying
  • Demonstrates: x/cw-hooks sudo messages, staking event handling

Walkthrough documentation

The top-level examples/cosmwasm/README.md includes:

  • Prerequisites and setup instructions
  • Quick-start guide with copy-pasteable safrochaind commands
  • Step-by-step deploy walkthrough for the counter contract
  • Troubleshooting guide

Acceptance criteria

  • examples/cosmwasm/<name>/ directory per contract, each independently buildable
  • Each contract has unit tests passing under cargo test
  • Top-level examples/cosmwasm/README.md walks through the full local-node flow
  • Examples reference usaf for fees and safro-testnet-1 as the chain ID
  • Bonus: cw-hooks-listener demonstrates Safrochain-specific x/cw-hooks integration

Closes #38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(examples): add CosmWasm contract examples and end-to-end deploy walkthrough

1 participant