Examples of cw20 usage, extracted from cw-plus, maintained by the community

Overview

CosmWasm Tokens

CircleCI

This is a collection of cw20-related contracts extracted from cw-plus. These serve as examples of what is possible to build and as starting points for your own CosmWasm token contracts.

None of these have been audited or are considered ready-for-production as is. Contributions may come from many community members. Please do your own due dilligence on them before using on any production site, and please raise Github issues for any bugs you find.

You are more than welcome to create a PR to add any cw20-related contract you have written that you would like to share with the community.

Contracts Download Docs
cw20-atomic-swap Release v0.11.2 Docs
cw20-bonding Release v0.11.2 Docs
cw20-escrow Release v0.11.2 Docs
cw20-staking Release v0.11.2 Docs
cw20-merkle-airdrop Release v0.11.2 Docs

Warning None of these contracts have been audited and no liability is assumed for the use of this code. They are provided to turbo-start your projects.

Contracts

All contracts add functionality around the CW20 Fungible Token standard:

  • cw20-atomic-swap an implementation of atomic swaps for both native and cw20 tokens.
  • cw20-bonding a smart contract implementing arbitrary bonding curves, which can use native and cw20 tokens as reserve tokens.
  • cw20-staking provides staking derivatives, staking native tokens on your behalf and minting cw20 tokens that can be used to claim them. It uses cw20-base for all the cw20 logic and only implements the interactions with the staking module and accounting for prices.
  • cw20-escrow is a basic escrow contract (arbiter can release or refund tokens) that is compatible with all native and cw20 tokens. This is a good example to show how to interact with cw20 tokens.
  • cw20-merkle-airdrop is a contract for efficient cw20 token airdrop distribution.

Compiling

To compile all the contracts, run the following in the repo root:

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.4

This will compile all packages in the contracts directory and output the stripped and optimized wasm code under the artifacts directory as output, along with a checksums.txt file.

If you hit any issues there and want to debug, you can try to run the following in each contract dir: RUSTFLAGS="-C link-arg=-s" cargo build --release --target=wasm32-unknown-unknown --locked

Licenses

All code in this repo will always be licensed under Apache-2.0.

Comments
  • Update escrow to feature metadata, recipient can be set after creation

    Update escrow to feature metadata, recipient can be set after creation

    After discussions with @JakeHartnell and @orkunkl we decided to expand functionality for escrow, this new functionality is as follows:

    • Recipient is now optional upon creation, this allows Escrows to be used as bounties e.g. for bug bounties etc.
    • Recipient can be set by the arbiter using the new SetRecipient message
    • Escrows now feature additional meta data, including a title and description. E.g. for a bounty the description may include steps needed to be valid for said bounty.

    Tests are added/updated accordingly.

    Feedback as always is welcome

    opened by Callum-A 5
  • Unable to upload wasm files on terra-station

    Unable to upload wasm files on terra-station

    failed to execute message; message index: 0: Error calling the VM: Error during static Wasm validation: Wasm contract has unknown interface_version_* marker export (see https://github.com/CosmWasm/cosmwasm/blob/main/packages/vm/README.md): store wasm contract failed: invalid request

    What branch version works with terra network?

    opened by 0xdevnet 2
  • add cw-receiver-minimal

    add cw-receiver-minimal

    PR to add a simple example of implementing the cw20 receiver interface (with some added notes) because someone asked about this in Discord the other day

    opened by LeTurt333 1
  • Ledger support for external address airdrops

    Ledger support for external address airdrops

    The current signature verification process for claiming external airdrops requires the claimer to sign an arbitrary message which cannot be performed using a ledger wallet. With the update, claimers of external airdrops will instead be signing a Bank/MsgSend for signature verification purposes, which will enable ledger users to issue airdrop claims.

    opened by MightOfOaks 1
  • EIP-4626 inspired CW20 vault contract

    EIP-4626 inspired CW20 vault contract

    Adds basic implementation of a CW20 token contract to be used for building composable, yield bearing vault. Interface and inspiration taken from EIP-4626 standard.

    This vault contract is designed to allow for modification of two internal, placeholder functions (after_burn & after_mint) to add submessages that can be returned after mint/burn takes place. This allows for messages to/from the vault's ultimate yield sources/protocols that it interacts with.

    There exists the ability for this contract to block deposits and withdraws globally and with address block lists. Future work could add in the option for using an approve list instead (or additionally). The global block settings and the address block lists are only allowed to be updated by the contract's admin. This admin config setting is initially set as the address that instantiates the contract (ie. the info.sender), but it can be modified later on only by existing admin.

    opened by 0xNane 0
  • Create a specification and a base implementation for CW-4626

    Create a specification and a base implementation for CW-4626

    TLDR

    The goal is to adapt the EIP-4626 standard for vaults and interest-bearing tokens to CosmWasm

    Background

    The EIP-4626 (https://eips.ethereum.org/EIPS/eip-4626) is a standard for tokenized vaults, with the goal of increasing composability between DeFi apps, while providing a more secure and standardized interface.

    Motivation

    Vaults are commonly implemented in a wide range of Defi applications such as lending markets, yields aggregators, etc. These vaults are normally implemented as yield-bearing tokens and should conform with the CW20 as well. Given how widespread their use is, it would be very helpful to adopt a shared interface of this "Defi lego", to improve developer experience, forward compatibility, and security.

    Next steps

    If this CW standard is deemed to be useful and we agree on a high-level spec, I can bootstrap the efforts and lead the implementation. It'd be great to do this collaboratively, so any help or contributor is more than welcome :)

    opened by aesmonty 3
  • Merkle airdrop single stage feature

    Merkle airdrop single stage feature

    Currently airdrop contract supports multiple stages, It is possible that an airdrop only wants to do single stage airdrop. Best to enable this feature on instantiate.

    opened by orkunkl 0
  • Error in query curve_info for cw20-bonding

    Error in query curve_info for cw20-bonding

    I tried cw20-bonding and got the following error.

    ❯ CURVEINFO='{"curve_info":{}}'
    ❯ wasmd query wasm contract-state smart $CONTRACT "$CURVEINFO" --output json 
    Error: rpc error: code = InvalidArgument desc = Error calling the VM: Error executing Wasm: Wasmer runtime error: RuntimeError: unreachable: query wasm contract failed: invalid request
    

    Conditions

    • Only query "CurveInfo" will cause an error.
    • Doesn't happen when "CurveType" is "Constant", but happens after "Buy" for "Linear" and "SquareRoot".(Before "Buy", no error occurs.)
    • cw-plus v0.10.0
    • wasmd v0.20.0
    opened by shiki-tak 14
Releases(v0.14.2)
Owner
CosmWasm
Secure Multi-Chain Smart Contracts on the Cosmos SDK
CosmWasm
A cw20 based DAO.

cw20 DAO NOT PRODUCTION READY This builds on cw3-flex-multisig and instead has the voting set maintained by cw20 tokens. This allows for the cw20s to

DAO DAO 114 Dec 28, 2022
Helper library for interacting with Terra assets (SDK coins and CW20 tokens)

terra-asset Helpers for interacting with Terra assets, including native coins and CW20 tokens Usage This crate contains two struct types: AssetInfo st

larry 9 Jan 3, 2022
A collection of Solana-maintained on-chain programs

Solana Program Library The Solana Program Library (SPL) is a collection of on-chain programs targeting the Sealevel parallel runtime. These programs a

Solana Foundation 2.2k Jan 6, 2023
Gum Program Library, a collection of on chain programs maintained by Gum

Gum, at its core, is a decentralized social media protocol on Solana. It unbundles traditional social media into Social Legos similar to how Defi unbu

Gum 4 Feb 22, 2023
An Ethereum compatible Substrate blockchain for bounties and governance for the Devcash community.

Substrate Node Template A fresh FRAME-based Substrate node, ready for hacking ?? Getting Started Follow the steps below to get started with the Node T

null 4 Mar 30, 2022
Bellman zkSNARK library for community with Ethereum's BN256 support

bellman "Community edition" Originally developed for ZCash, with extensions from us to make it a little more pleasant. Uses our "community edition" pa

Matter Labs 113 Dec 29, 2022
The Polkadot Hackathon Global Series North America edition is the second in a series of hackathons that brings the cutting edge of blockchain to a global community.

Polkadot Hackathon Project We are translating Uniswap v2 to Ink. Dependencies Install cargo-contract for building Ink contracts: cargo install dylint-

Kristiyan Dilov 3 Jun 28, 2022
Examples and helpers to build NFT contracts on CosmWasm

CosmWasm NFTS This repo is the official repository to work on all NFT standard and examples in the CosmWasm ecosystem. cw721 and cw721-base were moved

CosmWasm 147 Jan 4, 2023
Examples of Solana on-chain programs

spl-examples List of Solana on-chain programs which demonstrate different aspects of Solana architecture. 01__state It's a counter program. Each user

Max Block 51 Dec 6, 2022
tulipv2 vaults and v1 lending program sdk & examples

tulipv2-sdk Warning Unaudited, possibly untested sdk Tulip Protocol takes no responsibility for any (financial, physical, emotional, etc..) damage tha

Tulip Protocol 16 Oct 26, 2022
CosmWasm-Examples is a collection of example contracts and applications built using the CosmWasm framework

CosmWasm-Examples is a collection of example contracts and applications built using the CosmWasm framework. CosmWasm is a secure and efficient smart contract platform designed specifically for the Cosmos ecosystem.

Vitalii Tsyhulov 20 Jun 9, 2023
Holochain + ZKP usage experiment in the form of battleships

Battleships Circuits Circuits nabbed from https://github.com/kunalmodi/battlesnark/tree/master. Circuits require circom to compile. cd circuits sh bui

null 4 Aug 24, 2023
An automated CLI tool that optimizes gas usage in Solidity smart contracts, focusing on storage and function call efficiency.

Solidity-Gas-Optimizoor An high performance automated CLI tool that optimizes gas usage in Solidity smart contracts, focusing on storage and function

Chia Yong Kang 10 Mar 11, 2024
Community showcase and examples of Actix ecosystem usage.

Actix Examples Curated examples using the Actix ecosystem. Community Showcase Merino: Web service for Firefox Suggest lemmy: A federated alternative t

Actix 2.9k Dec 31, 2022
Winsafe-examples - Examples of native Windows applications written in Rust with WinSafe.

WinSafe examples This repo contains several examples of native Win32 applications written in Rust with WinSafe. All examples follow the same program s

Rodrigo 40 Dec 14, 2022
dua (-> Disk Usage Analyzer) is a tool to conveniently learn about the usage of disk space of a given directory

dua (-> Disk Usage Analyzer) is a tool to conveniently learn about the usage of disk space of a given directory. It's parallel by default and will max

Sebastian Thiel 1.8k Jan 2, 2023
A cw20 based DAO.

cw20 DAO NOT PRODUCTION READY This builds on cw3-flex-multisig and instead has the voting set maintained by cw20 tokens. This allows for the cw20s to

Jake Hartnell 115 Jan 1, 2023
A cw20 based DAO.

cw20 DAO NOT PRODUCTION READY This builds on cw3-flex-multisig and instead has the voting set maintained by cw20 tokens. This allows for the cw20s to

DAO DAO 114 Dec 28, 2022
Helper library for interacting with Terra assets (SDK coins and CW20 tokens)

terra-asset Helpers for interacting with Terra assets, including native coins and CW20 tokens Usage This crate contains two struct types: AssetInfo st

larry 9 Jan 3, 2022
This contract is to provide vesting account feature for the both cw20 and native tokens, which is controlled by a master address

Token Vesting This contract is to provide vesting account feature for the both cw20 and native tokens, which is controlled by a master address. Instan

yys 7 Oct 7, 2022