/protocol-cosmwasm

Webb Protocol Implementation in CosmWasm.

Primary LanguageRustApache License 2.0Apache-2.0

Webb Protocol CosmWasm

🕸️ Webb Protocol CosmWasm! ⧫
⚠️ Beta Software ⚠️


Introduction

This repository contains the Cosmwasm implementation of Webb Protocol, which would be used for Cosmos SDK blockchains.

Contracts layout

contracts/
    |___anchor/                    # Anchor(FixedDepositAnchor) contract
    |___anchor-handler/            # Contract for executing the creation & modification of anchor  
    |___mixer/                     # Mixer contract  
    |___signature-bridge/          # Contract for managing voting, resource, and maintainer composition through signature verification    
    |___tokenwrapper/              # Contract for wrapping pooled assets and minting pool share tokens  
    |___tokenwrapper-handler/      # Contract for executing the creation & modification of token-wrapper  
    |___vanchor/                   # Variable Anchor contract  

Building the contracts(wasm)

Prerequisites

Install Rust & dependency

Install the latest version of Rust by following the instructions here.
Add the compilation target.

rustup default stable  
rustup target add wasm32-unknown-unknown

Building

To build the contract, run the following command.

cargo wasm

You can see the output wasm file in the target/wasm32-unknown-unknown/release directory.

For the optimization, run the following command.
Important: You will need docker installed to run this command.

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

Then, you can see the output wasm file in the artifacts directory.

Testing

Run the following command to run the unit tests.

cargo test --release

License

Licensed under Apache License 2.0.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the GPLV3 license, shall be licensed as above, without any additional terms or conditions.