MCPcopy Index your code
hub / github.com/CosmWasm/cosmwasm

github.com/CosmWasm/cosmwasm @v3.0.9

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.0.9 ↗ · + Follow
4,371 symbols 14,623 edges 326 files 546 documented · 12% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

CosmWasm

component license

WebAssembly Smart Contracts for the Cosmos SDK

Rust crates

The following Rust crates are maintained in this repository:

Crate Usage Download Docs Coverage
cosmwasm‑check Contract development cosmwasm-check docs-cosmwasm-check cov-cosmwasm-check
cosmwasm‑core Internal use only cosmwasm-core docs-cosmwasm-core cov-cosmwasm-core
cosmwasm‑crypto Internal use only cosmwasm-crypto docs-cosmwasm-crypto cov-cosmwasm-crypto
cosmwasm‑derive Internal use only cosmwasm-derive docs-cosmwasm-derive cov-cosmwasm-derive
cosmwasm‑schema Contract development cosmwasm-schema docs-cosmwasm-schema cov-cosmwasm-schema
cosmwasm‑schema‑derive Internal use only cosmwasm-schema-derive docs-cosmwasm-schema-derive cov-cosmwasm-schema-derive
cosmwasm‑std Contract development cosmwasm-std docs-cosmwasm-std cov-cosmwasm-std
cosmwasm‑vm Host environments cosmwasm-vm docs-cosmwasm-vm cov-cosmwasm-vm
cosmwasm‑vm‑derive Internal use only cosmwasm-vm-derive docs-cosmwasm-vm-derive cov-cosmwasm-vm-derive
cw‑schema Contract development cw-schema docs-cw-schema cov-cw-schema
cw‑schema‑derive Internal use only cw-schema-derive docs-cw-schema-derive cov-cw-schema-derive

Dependencies

The following diagram shows the dependencies between the Rust crates in this repository:

---
config:
  theme: 'forest'
---

graph BT
    A("`**cosmwasm-core**
        3.0.6`")

    B("`**cosmwasm-std**
        3.0.6`")

    C("`**cosmwasm-crypto**
        3.0.6`")

    D("`**cosmwasm-vm**
        3.0.6`")

    E("`**cosmwasm-vm-derive**
        3.0.6`")

    F("`**cosmwasm-derive**
        3.0.6`")

    G("`**cosmwasm-schema**
        3.0.6`")

    H("`**cosmwasm-schema-derive**
        3.0.6`")

    I("`**cosmwasm-check**
        3.0.6`")

    J("`**cw-schema**
        3.0.6`")

    K("`**cw-schema-derive**
        3.0.6`")

    A --> B
    A --> C
    A --> D
    C --> B
    C --> D
    B --> D
    E --> D
    F --> B
    H --> G
    B --> I
    D --> I
    G --> B
    J --> B
    J --> G
    K --> J

Overview

To get that contract to interact with a system needs many moving parts. To get oriented, here is a list of the various components of the CosmWasm ecosystem:

Standard library:

This code is compiled into Wasm bytecode as part of the smart contract.

  • cosmwasm-std - A crate in this workspace. Provides the bindings and all imports needed to build a smart contract.
  • cw-storage-plus - A crate which provides convenience helpers for interacting with storage with powerful types supporting composite primary keys, secondary indexes, automatic snapshotting, and more. This is used in most modern contracts.

Building contracts:

  • cosmwasm-template - A starter-pack to get you quickly building your custom contract compatible with the CosmWasm system.
  • cosmwasm-plus - Some sample contracts for use and inspiration. These provide usable primitives and interfaces for many use cases, such as fungible tokens, NFTs, multisigs, governance votes, staking derivatives, and more. Look in packages for docs on the various standard interfaces, and contracts for the implementations. Please submit your contract or interface via PR.
  • rust-optimizer - A docker image and scripts to take your Rust code and produce the smallest possible Wasm output, deterministically. This is designed for preparing contracts for deployment as well as validating that a given deployed contract is based on some given source code, allowing a similar contract verification algorithm as Etherscan.

Building locally instead of using the docker image can leak some information about the directory structure of your system and makes the build non-reproducible.

Executing contracts:

  • cosmwasm-vm - A crate in this workspace. Uses the wasmer engine to execute a given smart contract. Also contains code for gas metering, storing, and caching wasm artifacts.
  • wasmvm - High-level go bindings to all the power inside cosmwasm-vm. Easily allows you to upload, instantiate and execute contracts, making use of all the optimizations and caching available inside cosmwasm-vm.
  • [wasmd](https://github.com/CosmW

Extension points exported contracts — how you extend this code

QueryResponseType (Interface)
This is used to statically ensure all the types have a shared set of traits [15 implementers]
packages/std/src/query/query_response.rs
Schemaifier (Interface)
(no doc) [13 implementers]
packages/cw-schema/src/lib.rs
QueryResponses (Interface)
A trait for tying QueryMsg variants (different contract queries) to their response types. This is mostly useful for the [4 …
packages/schema/src/query_response.rs
ExportInfo (Interface)
A trait that allows accessing shared functionality of `parity_wasm::elements::Module` and `wasmer::Module` in a shared f [2 …
packages/vm/src/static_analysis.rs
Classifier (Interface)
(no doc) [2 implementers]
contracts/floaty/src/floats.rs
Printable (Interface)
(no doc) [1 implementers]
packages/crypto/src/backtrace.rs
SchemaExt (Interface)
(no doc) [1 implementers]
packages/go-gen/src/schema.rs
AllImpl (Interface)
A trait that ensures other traits are implemented for our number types [10 implementers]
packages/std/src/math/mod.rs

Core symbols most depended-on inside this repo

unwrap
called by 1476
packages/std/src/stdack.rs
into
called by 566
packages/std/src/results/response.rs
unwrap
called by 481
contracts/ibc-reflect/src/msg.rs
unwrap
called by 473
packages/std/src/results/submessages.rs
to_string
called by 430
packages/schema/src/idl.rs
mock_env
called by 382
packages/vm/src/testing/mock.rs
clone
called by 275
packages/vm/src/environment.rs
addr_make
called by 179
packages/vm/src/testing/mock.rs

Shape

Function 2,458
Method 1,284
Class 361
Enum 144
Struct 95
Interface 29

Languages

Rust98%
Go2%
Python1%

Modules by API surface

packages/std/src/math/uint256.rs152 symbols
packages/std/src/math/uint128.rs140 symbols
packages/std/src/math/signed_decimal_256.rs137 symbols
packages/std/src/math/signed_decimal.rs135 symbols
packages/std/src/math/uint64.rs131 symbols
packages/std/src/testing/mock.rs127 symbols
packages/vm/src/imports.rs113 symbols
packages/std/src/math/int256.rs101 symbols
packages/std/src/math/uint512.rs98 symbols
packages/std/src/math/int64.rs98 symbols
packages/std/src/math/int128.rs98 symbols
packages/std/src/math/int512.rs95 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add cosmwasm \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact