The CosmWasm team provided several production quality smart contracts in the CosmWasm/cw-plus repo. This directory simply contains the compiled .wasm
output from each of these contracts.
cw1-whitelist
a minimal implementation ofcw1
mainly designed for reference.cw1-subkeys
a simple, but useful implementation, which lets us use a proxy contract to provide "allowances" for native tokens without modifying thebank
module.
cw3-fixed-multisig
a simple implementation of the cw3 spec. It is a multisig with a fixed set of addresses, created upon initialization. Each address may have the same weight (K of N), or some may have extra voting power. This works much like the native Cosmos SDK multisig, except that rather than aggregating the signatures off chain and submitting the final result, we aggregate the approvals on-chain.cw3-flex-multisig
builds on cw3-fixed-multisig, with a more powerful implementation of the cw3 spec. It's a multisig contract backed by a cw4 (group) contract, which independently maintains the voter set.
cw4-group
a basic implementation of the cw4 spec. It handles elected membership, by admin or multisig. It fulfills all elements of the spec, including raw query lookups, and is designed to be used as a backing storage for cw3 compliant contracts.cw4-stake
a second implementation of the cw4 spec. It fulfills all elements of the spec, including raw query lookups, and is designed to be used as a backing storage for cw3 compliant contracts. It provides a similar API to [cw4-group
], but rather than appointing members, their membership and weight are based on the number of staked tokens they have.
cw20-base
a straightforward, but complete implementation of the cw20 spec along with all extensions. Can be deployed as-is, or imported by other contracts.
-
Clone the CosmWasm/cw-plus repository.
git clone [email protected]:CosmWasm/cw-plus.git cd cw-plus # path to the repo.
-
Start the Docker daemon, and run the following to compile all the contracts:
docker run --rm -v "$(pwd)":/code \ --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ cosmwasm/workspace-optimizer:0.12.11
This will compile all packages in the
contracts
directory and output the stripped and optimized wasm code under theartifacts
directory as output, along with achecksums.txt
file. -
If that (↑) worked, you're done.
-
If you encounter any issues and want to debug, you can try to run the following in each contract directory:
RUSTFLAGS="-C link-arg=-s" cargo build --release --target=wasm32-unknown-unknown --locked