Giter Club home page Giter Club logo

cw-contracts's Introduction

CosmWasm Examples

CircleCI

This repo is a collection of simple contracts built with the cosmwasm framework. Smart contracts here are for only demonstration purposes, not production ready. Production grade smart contracts are collected under cw-plus.

This repo's organization is relatively simple. The top-level directory is just a placeholder and has no real code. And we use workspaces to add multiple contracts below. This allows us to compile all contracts with one command.

Usage:

The following contracts are available for use. For each of the contracts in contracts, you can view the source code under src and a precompiled wasm ready for deployment called contract.wasm.

Take a look here:

  • escrow - A basic escrow with timeout and partial release
  • erc20 - Basic implementation the erc20 interface for CosmWasm, as a base for token designers
  • nameservice - Simple name service application to buy names and map values to those names
  • voting - An example voting contract to create, manage, vote and deposit on polls
  • simple-option - A contract that replicates options in finance
  • cw20-pot - Basic smart contract using cw20 contact

You can get more info from README.md file in each of the contacts.

Development

Starting a contract

If you want to add a contract, first fork this repo and create a branch for your PR. I suggest setting it up via cw-template:

cargo generate --git https://github.com/CosmWasm/cw-template.git --name FOO

Then update the README.md to reflect your actual contract (just read the README.md in the autogenerated template - it explains a lot).

Preparing for merge

Before you merge the code, make sure it builds and passes all tests:

./devtools/build_test_all.sh

Once you pass these checks, please open a PR on this repo.

Release builds

On every tag release builds are automatically created and deployed to GitHub Releases.

You can build release artifacts manually like this, which creates a reproducible optimized build for each contract and saves them to the ./artifacts directory:

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/rust-optimizer:0.12.3 ./contracts/*/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.