{"id":13400830,"url":"https://github.com/CosmWasm/cw-plus","last_synced_at":"2025-03-14T06:31:57.915Z","repository":{"id":36970766,"uuid":"272626471","full_name":"CosmWasm/cw-plus","owner":"CosmWasm","description":"Production Quality contracts under open source licenses","archived":false,"fork":false,"pushed_at":"2024-10-13T15:56:16.000Z","size":24989,"stargazers_count":510,"open_issues_count":17,"forks_count":352,"subscribers_count":20,"default_branch":"main","last_synced_at":"2024-10-30T09:48:37.016Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CosmWasm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-16T06:22:16.000Z","updated_at":"2024-10-28T02:04:06.000Z","dependencies_parsed_at":"2023-11-13T11:31:56.218Z","dependency_job_id":"708555d0-4451-4c63-aab6-f9a51e950b3c","html_url":"https://github.com/CosmWasm/cw-plus","commit_stats":{"total_commits":2588,"total_committers":56,"mean_commits":"46.214285714285715","dds":0.6031684698608965,"last_synced_commit":"a959518fc04c47cb3db10e95117cc89a21868337"},"previous_names":["cosmwasm/cosmwasm-plus"],"tags_count":78,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CosmWasm%2Fcw-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CosmWasm%2Fcw-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CosmWasm%2Fcw-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CosmWasm%2Fcw-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CosmWasm","download_url":"https://codeload.github.com/CosmWasm/cw-plus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243537938,"owners_count":20307098,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T19:00:55.954Z","updated_at":"2025-03-14T06:31:57.907Z","avatar_url":"https://github.com/CosmWasm.png","language":"Rust","funding_links":[],"categories":["Rust","Smart Contracts","Development Tools","Contracts","Cryptocurrencies"],"sub_categories":["Smart Contract Templates","Smart Contracts"],"readme":"# CosmWasm Plus\n\n[![CircleCI](https://circleci.com/gh/CosmWasm/cw-plus/tree/main.svg?style=shield)](https://circleci.com/gh/CosmWasm/cw-plus/tree/main)\n\n| Specification | Crates.io                                                                                       | Docs                                                            | Coverage                                                                                                                                  |\n| ------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |\n| cw1           | [![cw1 on crates.io](https://img.shields.io/crates/v/cw1.svg)](https://crates.io/crates/cw1)    | [![Docs](https://docs.rs/cw1/badge.svg)](https://docs.rs/cw1)   | [![codecov](https://codecov.io/gh/CosmWasm/cw-plus/branch/main/graph/badge.svg?token=IYY72ZVS3X)](https://codecov.io/gh/CosmWasm/cw-plus) |\n| cw3           | [![cw3 on crates.io](https://img.shields.io/crates/v/cw3.svg)](https://crates.io/crates/cw3)    | [![Docs](https://docs.rs/cw3/badge.svg)](https://docs.rs/cw3)   | [![codecov](https://codecov.io/gh/CosmWasm/cw-plus/branch/main/graph/badge.svg?token=IYY72ZVS3X)](https://codecov.io/gh/CosmWasm/cw-plus) |\n| cw4           | [![cw4 on crates.io](https://img.shields.io/crates/v/cw4.svg)](https://crates.io/crates/cw4)    | [![Docs](https://docs.rs/cw4/badge.svg)](https://docs.rs/cw4)   | [![codecov](https://codecov.io/gh/CosmWasm/cw-plus/branch/main/graph/badge.svg?token=IYY72ZVS3X)](https://codecov.io/gh/CosmWasm/cw-plus) |\n| cw20          | [![cw20 on crates.io](https://img.shields.io/crates/v/cw20.svg)](https://crates.io/crates/cw20) | [![Docs](https://docs.rs/cw20/badge.svg)](https://docs.rs/cw20) | [![codecov](https://codecov.io/gh/CosmWasm/cw-plus/branch/main/graph/badge.svg?token=IYY72ZVS3X)](https://codecov.io/gh/CosmWasm/cw-plus) |\n\n| Contracts          | Download                                                                                                 | Docs                                                                                        | Coverage                                                                                                                                  |\n| ------------------ | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |\n| cw1-subkeys        | [Release v0.13.4](https://github.com/CosmWasm/cw-plus/releases/download/v0.13.4/cw1_subkeys.wasm)        | [![Docs](https://docs.rs/cw1-subkeys/badge.svg)](https://docs.rs/cw1-subkeys)               | [![codecov](https://codecov.io/gh/CosmWasm/cw-plus/branch/main/graph/badge.svg?token=IYY72ZVS3X)](https://codecov.io/gh/CosmWasm/cw-plus) |\n| cw1-whitelist      | [Release v0.13.4](https://github.com/CosmWasm/cw-plus/releases/download/v0.13.4/cw1_whitelist.wasm)      | [![Docs](https://docs.rs/cw1-whitelist/badge.svg)](https://docs.rs/cw1-whitelist)           | [![codecov](https://codecov.io/gh/CosmWasm/cw-plus/branch/main/graph/badge.svg?token=IYY72ZVS3X)](https://codecov.io/gh/CosmWasm/cw-plus) |\n| cw3-fixed-multisig | [Release v0.13.4](https://github.com/CosmWasm/cw-plus/releases/download/v0.13.4/cw3_fixed_multisig.wasm) | [![Docs](https://docs.rs/cw3-fixed-multisig/badge.svg)](https://docs.rs/cw3-fixed-multisig) | [![codecov](https://codecov.io/gh/CosmWasm/cw-plus/branch/main/graph/badge.svg?token=IYY72ZVS3X)](https://codecov.io/gh/CosmWasm/cw-plus) |\n| cw3-flex-multisig  | [Release v0.13.4](https://github.com/CosmWasm/cw-plus/releases/download/v0.13.4/cw3_flex_multisig.wasm)  | [![Docs](https://docs.rs/cw3-flex-multisig/badge.svg)](https://docs.rs/cw3-flex-multisig)   | [![codecov](https://codecov.io/gh/CosmWasm/cw-plus/branch/main/graph/badge.svg?token=IYY72ZVS3X)](https://codecov.io/gh/CosmWasm/cw-plus) |\n| cw4-group          | [Release v0.13.4](https://github.com/CosmWasm/cw-plus/releases/download/v0.13.4/cw4_group.wasm)          | [![Docs](https://docs.rs/cw4-group/badge.svg)](https://docs.rs/cw4-group)                   | [![codecov](https://codecov.io/gh/CosmWasm/cw-plus/branch/main/graph/badge.svg?token=IYY72ZVS3X)](https://codecov.io/gh/CosmWasm/cw-plus) |\n| cw4-stake          | [Release v0.13.4](https://github.com/CosmWasm/cw-plus/releases/download/v0.13.4/cw4_stake.wasm)          | [![Docs](https://docs.rs/cw4-stake/badge.svg)](https://docs.rs/cw4-stake)                   | [![codecov](https://codecov.io/gh/CosmWasm/cw-plus/branch/main/graph/badge.svg?token=IYY72ZVS3X)](https://codecov.io/gh/CosmWasm/cw-plus) |\n| cw20-base          | [Release v0.13.4](https://github.com/CosmWasm/cw-plus/releases/download/v0.13.4/cw20_base.wasm)          | [![Docs](https://docs.rs/cw20-base/badge.svg)](https://docs.rs/cw20-base)                   | [![codecov](https://codecov.io/gh/CosmWasm/cw-plus/branch/main/graph/badge.svg?token=IYY72ZVS3X)](https://codecov.io/gh/CosmWasm/cw-plus) |\n| cw20-ics20         | [Release v0.13.4](https://github.com/CosmWasm/cw-plus/releases/download/v0.13.4/cw20_ics20.wasm)         | [![Docs](https://docs.rs/cw20-ics20/badge.svg)](https://docs.rs/cw20-ics20)                 | [![codecov](https://codecov.io/gh/CosmWasm/cw-plus/branch/main/graph/badge.svg?token=IYY72ZVS3X)](https://codecov.io/gh/CosmWasm/cw-plus) |\n\nNote: `cw2` and `controllers` have been moved to the [`cw-minus` repo](https://github.com/CosmWasm/cw-minus) and can be\nfollowed there.\n\nNote: `cw721` and `cw721-base` have moved to the new [`cw-nfts` repo](https://github.com/CosmWasm/cw-nfts) and can be\nfollowed there.\n\nNote: most of the `cw20-*` contracts besides `cw20-base` have moved to the new\n[`cw-tokens` repo](https://github.com/CosmWasm/cw-tokens) and can be followed there.\n\nThis is a collection of specification and contracts designed for use on real networks. They are designed not just as\nexamples, but to solve real-world use cases, and to provide a reusable basis to build many custom contracts.\n\nIf you don't know what CosmWasm is, please check out [our homepage](https://cosmwasm.com) and\n[our documentation](https://docs.cosmwasm.com) to get more background. We are running\n[public testnets](https://github.com/CosmWasm/testnets#running) you can use to test out any contracts.\n\n**Warning** None of these contracts have been audited and no liability is assumed for the use of this code. They are\nprovided to turbo-start your projects.\n\n## Specifications\n\nThe most reusable components are the various cwXYZ specifications under `packages`. Each one defines a standard\ninterface for different domains, e.g. [cw20](./packages/cw20/README.md) for fungible tokens,\n[cw721](https://github.com/CosmWasm/cw-nfts/blob/main/packages/cw721/README.md) for non-fungible tokens,\n[cw1](./packages/cw1/README.md) for \"proxy contracts\", etc. The interface comes with a human description in the READMEs,\nas well as Rust types that can be imported.\n\nThey contain no logic, but specify an interface. It shows what you need to implement to create a compatible contracts,\nas well as what interface we guarantee to any consumer of such contracts. This is the real bonus of specifications, we\ncan create an escrow contract that can handle many different fungible tokens, as long as they all adhere to the cw20\nspecification.\n\nIf you have ideas for new specifications , please [raise an issue](https://github.com/CosmWasm/cw-plus/issues) or\n[create a pull request](https://github.com/CosmWasm/cw-plus/pulls) on this repo.\n\n## Contracts\n\nWe provide sample contracts that either implement or consume these specifications to both provide examples, and provide\na basis for code you can extend for more custom contacts, without worrying about reinventing the wheel each time. For\nexample [`cw20-base`](./contracts/cw20-base) is a basic implementation of a `cw20` compatible contract that can be\nimported in any custom contract you want to build on it.\n\nCW1 Proxy Contracts:\n\n- [`cw1-whitelist`](./contracts/cw1-whitelist) a minimal implementation of `cw1` mainly designed for reference.\n- [`cw1-subkeys`](./contracts/cw1-subkeys) a simple, but useful implementation, which lets us use a proxy contract to\n  provide \"allowances\" for native tokens without modifying the `bank` module.\n\nCW3 Multisig:\n\n- [`cw3-fixed-multisig`](./contracts/cw3-fixed-multisig) a simple implementation of the\n  [cw3 spec](./packages/cw3/README.md). It is a multisig with a fixed set of addresses, created upon initialization.\n  Each address may have the same weight (K of N), or some may have extra voting power. This works much like the native\n  Cosmos SDK multisig, except that rather than aggregating the signatures off chain and submitting the final result, we\n  aggregate the approvals on-chain.\n- [`cw3-flex-multisig`](./contracts/cw3-flex-multisig) builds on cw3-fixed-multisig, with a more powerful implementation\n  of the cw3 spec. It's a multisig contract backed by a cw4 (group) contract, which independently maintains the voter\n  set.\n\nCW4 Group:\n\n- [`cw4-group`](./contracts/cw4-group) a basic implementation of the [cw4 spec](./packages/cw4/README.md). It handles\n  elected membership, by admin or multisig. It fulfills all elements of the spec, including raw query lookups, and is\n  designed to be used as a backing storage for [cw3 compliant contracts](./packages/cw3/README.md).\n- [`cw4-stake`](./contracts/cw4-stake) a second implementation of the [cw4 spec](./packages/cw4/README.md). It fulfills\n  all elements of the spec, including raw query lookups, and is designed to be used as a backing storage for\n  [cw3 compliant contracts](./packages/cw3/README.md). It provides a similar API to [`cw4-group`], but rather than\n  appointing members, their membership and weight are based on the number of staked tokens they have.\n\nCW20 Fungible Tokens:\n\n- [`cw20-base`](./contracts/cw20-base) a straightforward, but complete implementation of the cw20 spec along with all\n  extensions. Can be deployed as-is, or imported by other contracts.\n\n## Compiling\n\nTo compile all the contracts, run the following in the repo root:\n\n```\ndocker run --rm -v \"$(pwd)\":/code \\\n  --mount type=volume,source=\"$(basename \"$(pwd)\")_cache\",target=/target \\\n  --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \\\n  cosmwasm/optimizer:0.16.0\n```\n\nThis will compile all packages in the `contracts` directory and output the stripped and optimized wasm code under the\n`artifacts` directory as output, along with a `checksums.txt` file.\n\nIf you hit any issues there and want to debug, you can try to run the following in each contract dir:\n`RUSTFLAGS=\"-C link-arg=-s\" cargo build --release --target=wasm32-unknown-unknown --locked`\n\n## Quality Control\n\nOne of the basic metrics of assurance over code quality is how much is covered by unit tests. There are several tools\navailable for Rust to do such analysis and we will describe one below. This should be used as a baseline metric to give\nsome confidence in the code.\n\nBeyond code coverage metrics, just having a robust PR review process with a few more trained eyes looking for bugs is\nvery helpful in detecting paths the original coder was not aware of. This is more subjective, but looking at the\nrelevant PRs and depth of discussion can give an idea how much review was present.\n\nAfter that, fuzzing it (ideally with an intelligent fuzzer that understands the domain) can be valuable. And beyond that\nformal verification can provide even more assurance (but is very time-consuming and expensive).\n\n### Code Coverage\n\nI recommend the use of [tarpaulin](https://github.com/xd009642/tarpaulin): `cargo install cargo-tarpaulin`\n\nTo get some nice interactive charts, you can go to the root directory and run:\n\n`cargo tarpaulin -o html` and then `xdg-open tarpaulin-report.html` (or just `open` on MacOS).\n\nOnce you find a package that you want to improve, you can do the following to just analyze this package, which gives\nmuch faster turn-around:\n\n`cargo tarpaulin -o html --packages cw3-fixed-multisig`\n\nNote that it will produce a code coverage report for the entire project, but only the coverage in that package is the\nreal value. If does give quick feedback for you if you unit test writing was successful.\n\n## Contributing\n\nSee our [Contributing Guidelines](CONTRIBUTING.md).\n\n## Generating changelog\n\nTo generate a changelog we decided to use\n[github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator).\n\nTo install tool you need Ruby's `gem` package manager.\n\n    $ gem --user install github_changelog_generator\n\nAnd put `$HOME/.gem/ruby/*/bin/` into your PATH.\n\nGenerating changelog file first time:\n\n    $ github_changelog_generator -u CosmWasm -p cw-plus\n\nAppending next releases could be done adding `--base` flag:\n\n    $ github_changelog_generator -u CosmWasm -p cw-plus --base CHANGELOG.md\n\nIf you hit GitHub's 50 requests/hour limit, please follow\n[this](https://github.com/github-changelog-generator/github-changelog-generator#github-token) guide to create a token\nkey which you can pass using `--token` flag.\n\nThere's also a convenience `scripts/update_changelog.sh`, which can take a --since-tag parameter (to avoid processing\nthe entire history). It can also auto-detect the latest version tag for you, with --latest-tag.\n\n## License\n\nThis repo is licensed under [Apache 2.0](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCosmWasm%2Fcw-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCosmWasm%2Fcw-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCosmWasm%2Fcw-plus/lists"}