Shade Protocol is an array of connected privacy-preserving dApps built on Secret Network

Overview

Shade Protocol Core Contracts

Contract Reference Description
mint doc Handles asset burning and silk minting
oracle doc Handles asset price queries
treasury doc Handles asset price queries

Development

Development Environment

Install docker for local environment

Source from testnet

docker run -it --rm -p 26657:26657 -p 26656:26656 -p 1337:1337 -v $(pwd):/root/code --name secretdev enigmampc/secret-network-sw-dev

docker exec -it secretdev /bin/bash

Testing the environment

Inside the container:

run python3 contract_tester.py

Environment Setup

  • Rust v1.44.1+
  • wasm32-unknown-unknown target
  • Docker
  • binaryen
  1. Install rustup via https://rustup.rs/

  2. Run the following:

rustup default stable
rustup target add wasm32-unknown-unknown
  1. Make sure Docker is installed

  2. To compile the contracts install binaryen

apt install binaryen

Unit / Integration Tests

Each contract contains Rust unit and integration tests embedded within the contract source directories. You can run:

cargo unit-test
cargo integration-test

Compiling

Run this script to run all of the contract's unit / integration tests and then prepare the contracts for production in /contracts/compiled:

bash ./compile-contracts.sh

Testing

You can optionally run extended tests using the tester

To run a test deployment on a public testnet you can run tester.py --testnet public. For the private testnet you can run tester.py --testnet private.

Comments
  • Automaticaly generate contract schemas in release mode

    Automaticaly generate contract schemas in release mode

    Adds a build script (build.rs) to each contract crate that will generate the CosmWasm schema when the crate is built in release mode.

    If the schemas are already present, it will only re-generate them if any files have changed in packages/shade_protocol/src.

    I wasn't sure whether to ignore the generated schemas in git or not. Other projects seem to track them in git - possibly to make it easier for other projects to integrate without cloning and generating them.

    If we want to track them, I can add them in another commit to this PR.

    opened by chris-ricketts 8
  • doc2book tool

    doc2book tool

    This is a simple tool that scrapes the documentation comments and specified code blocks from a target crate. See tools/doc2book/README.md for more info.

    It was made with the packages/shade_protocol crate in mind. Hopefully this should make it simple to generate the smart contract interface and usage documentation from the source code itself, where it will be easier to keep up to date.

    If anyone can think of a better name (please please please) just let me know and I'll update it.

    opened by chris-ricketts 3
  • Make overhaul

    Make overhaul

    Description

    Replaces the hard to read makefile with an rustified version.

    cargo install --force cargo-make To build the whole project for release cargo make build-all Release just one package cargo make release governance To test a package cargo make test governance Or all packages cargo make test-all

    Notable changes

    • Added rust cargo make support

    Next steps

    • Improve certain setups, like docker support and automating launching a contract withing the makefile
    opened by FloppyDisck 2
  • Bonds audit

    Bonds audit

    Description

    Responding to Certik audit of Bonds contract, as well as adding fix to allow for stkd-SCRT compatibility.

    Notable changes

    • User account created based off of "from", not "sender" when assets are deposited
    • fetch_snip20 now won't error out if token_config DNE
    • HandleResponse from update_config and update_limit_config improved
    opened by wahlbergkyle 2
  • Oracle sienna

    Oracle sienna

    Sienna integration with oracle, all registered pairs for a given symbol will be queried for their current return on a 1SCRT trade, as well as their pool depths. The return amounts will be averaged together weighted by their respective pool CP's. That value is then translated to a USD price based on the SCRT/USD value provided by BAND.

    opened by DrPresident 2
  • add cosmwasm-math-compat crate to get 1.0 maths in 0.10 cosmwasm-std

    add cosmwasm-math-compat crate to get 1.0 maths in 0.10 cosmwasm-std

    Description

    Adds a package called cosmwasm_maths_compat which contains the coswasm_std 1.0 maths types, functions and trait implementations but makes them compatible with cosmwasm_std 0.10.

    This has the following benefits:

    • It will allow a smooth transition to cosmwasm_std 1.0 when it's released by only requiring a simple Search/Replace on the string comwasm_maths_compat to be replaced with cosmwasm_std.
    • Front-end clients can also be build against contract interfaces that use more intuitive types, e.g. Decimal, that are currently too awkward to use in 0.10 due to lack of implementation.
    • Less maths bugs and overflow errors from type conversion as the tried and tested cosmwasm_std 1.0 implementations can be used, as well as 'larger' types such as Decimal256.

    Notable changes

    • Adds cosmwasm_maths_compat crate.
    • Converts all the usages of cosmwasm_std::Uint128 & cosmwasm_std::Decimal to their new counterparts.

    Next steps

    This commit touches a lot of files across the entire code base - in order to reduce merge conflicts for the other contributors, I suggest that this merge is carefully coordinated. It would be less disruptive if any branches off of dev are merged first, so that I can pull in those changes and fix the conflicts before merging this branch.

    opened by chris-ricketts 2
  • Release 0.3 with Airdrop for Shade Protocol

    Release 0.3 with Airdrop for Shade Protocol

    This PR is open to making the Main branch merger with changes made.

    Overhaul changes for Shade Protocol:

    • [x] New Airdrop Contract.
    • [x] New Governance and Staking Contracts.
    • [x] Oracle changes with Index format.
    • [x] Integration Testing Modules,
    • [x] Improved Efficiency with contracts and compilation improvements
    opened by mohammedpatla 2
  • Shd stake | rewards distribution

    Shd stake | rewards distribution

    Added an efficient way to distribute value across stakers by using the staking model found in Cosmos SDK. There are now separate unbonding queues per users so they can query their values efficiently. The old unbonding now exists for when we implement treasury rewards distribution. To allow users to query their stake information, a very simple viewing key system was implemented

    shd-staking 
    opened by FloppyDisck 2
  • Add to documentation

    Add to documentation

    First in a series of commits to update the documentation.

    Please don't merge yet, I will keep adding to this PR and the additions can be reviewed piecemeal.

    oracle 
    opened by chris-ricketts 2
  • Decentralized user maintenance

    Decentralized user maintenance

    Some protocol tasks will require gas and some kind of user interaction

    • Re-staking protocol funds
    • Reward collection
    • Executing proposed governance tasks
    • Executing arbitrage

    These are tasks that can be turned into a "community good" that we will provide incentives for so any user can perform these tasks using a public interface. User's could activate these mechanisms themselves or these tasks can be automated such as executing arbitrage when there is sufficient opportunity.

    opened by DrPresident 2
  • Un-register SecretSwap Pair

    Un-register SecretSwap Pair

    After registering a Pair for say SETH, there is currently no way to undo this and get_price(SETH) will always query secretswap, in the case of a misconfig or an asset we no longer want to support there should be a method to remove/invalidate that secretswap pair with an authorized message.

    oracle 
    opened by DrPresident 2
  • Utility Router

    Utility Router

    Addresses cannot be set that override previously set contracts Address queries will return data stored in contracts if it is present (still just an address is returned) Keys queries is paginated with start (first index to get) & limit (size of page requested)

    opened by DrPresident 0
  • Dao V1.0

    Dao V1.0

    DAO working with V1 feature set, will likely add more tests before launch but audit can likely begin

    • Rebalance working with significant test cases
    • Wrapping L1 tokens
    • Shade Admin
    • Batch Balances
    opened by DrPresident 1
  • Prioritize Storage migration

    Prioritize Storage migration

    Is your feature request related to a problem? Please describe. Many of the old contracts still use the old way to store and load data.

    Describe the solution you'd like These contract's storage must be migrated to the new Item and Map traits that improve readability.

    opened by FloppyDisck 0
  • Basic CI setup (bulds/tests/linters)

    Basic CI setup (bulds/tests/linters)

    Is your feature request related to a problem? Please describe.

    I think it would be useful (especially in the long run) to have continious integration pipelines set up, to check that basic functionality builds, tests unit (and possibly other types of tests in the future) pass, linters are satisfied.

    This should prevent obviously broken code to land into main/dev branches, and improve review process.

    Describe the solution you'd like

    Maybe look into how other Rust projects are doing it and try to come up with someting similar. It doesn't need to be "state of the art", simple working solution would suffice for now (and can be replaced in the future with something else, once more requirements are available for CI).

    Additional context

    Discussed this briefly with @FloppyDisck, and will be looking into it soon.

    opened by LasTshaMAN 1
Releases(v1.2.0)
  • v1.2.0(Aug 18, 2022)

    Fixed a issue where storing contracts on Pulsar-2 gave the following error:

    raw_log: 'failed to execute message; message index: 0: Execution error: Error during
      static Wasm validation: Wasm contract requires unsupported import: "wbindgen_placeholder.__wbindgen_describe".
      Imports supported by VM: ["env.db_read", "env.db_write", "env.db_remove", "env.canonicalize_address",
      "env.humanize_address", "env.query_chain", "env.secp256k1_verify", "env.secp256k1_recover_pubkey",
      "env.secp256k1_sign", "env.ed25519_verify", "env.ed25519_batch_verify", "env.ed25519_sign",
      "env.db_scan", "env.db_next"]. Contract version too new for this VM?: create contract
      failed'
    

    The fix involved:

    • Removing chrono
    • Updating rand package imports in dev-dependencies to be rand = { version = "0.8.5", default-features = false }
    • Cleaning up any stray or unneeded rand dependencies

    These fixes were needed to clean wasm-bindgen and getrandom imports out of the Cargo.lock so that the contracts would be compiled normally without use of wasm-bindgen.

    The tag was made to ensure that future deployment of oracles built using Cosmwam v0.10 are stable and ready in preparation of Bonds being launched.

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Jul 1, 2022)

    What's Changed

    • Adds the testers to dev by @FloppyDisck in https://github.com/securesecrets/shade/pull/190
    • treasury: refactor some handle functions by @chris-ricketts in https://github.com/securesecrets/shade/pull/194
    • Unit testing by @wahlbergkyle in https://github.com/securesecrets/shade/pull/191
    • remove unclaimed by @AustinWoetzel in https://github.com/securesecrets/shade/pull/195
    • Oracle sienna by @DrPresident in https://github.com/securesecrets/shade/pull/193
    • Added feature flags by @FloppyDisck in https://github.com/securesecrets/shade/pull/197
    • Staking | Interface by @FloppyDisck in https://github.com/securesecrets/shade/pull/196
    • Mint fix by @DrPresident in https://github.com/securesecrets/shade/pull/199
    • fixed overflow error by @DrPresident in https://github.com/securesecrets/shade/pull/198
    • add cosmwasm-math-compat crate to get 1.0 maths in 0.10 cosmwasm-std by @chris-ricketts in https://github.com/securesecrets/shade/pull/192
    • Minor package fix by @FloppyDisck in https://github.com/securesecrets/shade/pull/201
    • enable 'cosmwasm-storage/iterator' feature by @chris-ricketts in https://github.com/securesecrets/shade/pull/202
    • added storage plus traits by @FloppyDisck in https://github.com/securesecrets/shade/pull/203
    • Treasury adapters by @DrPresident in https://github.com/securesecrets/shade/pull/204
    • Move staked shd by @FloppyDisck in https://github.com/securesecrets/shade/pull/207
    • now runs tests from root by @DrPresident in https://github.com/securesecrets/shade/pull/209
    • Fadroma ensemble contract harness package by @FloppyDisck in https://github.com/securesecrets/shade/pull/212
    • Snip20 staking math update by @FloppyDisck in https://github.com/securesecrets/shade/pull/211
    • reorganize shade protocol package by @FloppyDisck in https://github.com/securesecrets/shade/pull/210
    • Governance implementation by @FloppyDisck in https://github.com/securesecrets/shade/pull/206
    • Shd sky by @SissonJ in https://github.com/securesecrets/shade/pull/214
    • Shade bonds by @wahlbergkyle in https://github.com/securesecrets/shade/pull/205
    • Improved and scalable Snip20 by @FloppyDisck in https://github.com/securesecrets/shade/pull/217
    • Add Storing Contracts Utility and Verbose Error Message by @xucito in https://github.com/securesecrets/shade/pull/216
    • fixed snip20-reference-impl issues by @FloppyDisck in https://github.com/securesecrets/shade/pull/218
    • Contract harness fix by @FloppyDisck in https://github.com/securesecrets/shade/pull/219
    • Snip20 allowance query fix by @FloppyDisck in https://github.com/securesecrets/shade/pull/220
    • updated to match fadroma's instantiate response by @FloppyDisck in https://github.com/securesecrets/shade/pull/224
    • Lp shade swap by @DrPresident in https://github.com/securesecrets/shade/pull/213
    • Query auth by @FloppyDisck in https://github.com/securesecrets/shade/pull/226
    • transfer bug fix by @FloppyDisck in https://github.com/securesecrets/shade/pull/227
    • refactored fadroma update by @FloppyDisck in https://github.com/securesecrets/shade/pull/228
    • Better assert and fadroma commit lock by @FloppyDisck in https://github.com/securesecrets/shade/pull/229
    • Multisig tooling by @FloppyDisck in https://github.com/securesecrets/shade/pull/230
    • Query auth and bonds code freeze by @wahlbergkyle in https://github.com/securesecrets/shade/pull/223
    • [RC] Shade Bonds + Updates by @mohammedpatla in https://github.com/securesecrets/shade/pull/215

    New Contributors

    • @wahlbergkyle made their first contribution in https://github.com/securesecrets/shade/pull/191
    • @AustinWoetzel made their first contribution in https://github.com/securesecrets/shade/pull/195
    • @SissonJ made their first contribution in https://github.com/securesecrets/shade/pull/214
    • @xucito made their first contribution in https://github.com/securesecrets/shade/pull/216

    Full Changelog: https://github.com/securesecrets/shade/compare/v1.0.0...v1.1.0

    Source code(tar.gz)
    Source code(zip)
  • airdrop(Feb 22, 2022)

    TL;DR

    • Shade Mainnet launch
    • Airdrop Mainnet launch
    • Storage Library
    • Errors Library
    • Contract improvements

    What's Changed

    • fixed test name by @DrPresident in https://github.com/securesecrets/shade/pull/85
    • Contract tester in rust by @FloppyDisck in https://github.com/securesecrets/shade/pull/87
    • minting cap by @FloppyDisck in https://github.com/securesecrets/shade/pull/88
    • Mint | secondary burn by @FloppyDisck in https://github.com/securesecrets/shade/pull/97
    • Mint | start epoch by @FloppyDisck in https://github.com/securesecrets/shade/pull/95
    • Mint | remove supported asset by @FloppyDisck in https://github.com/securesecrets/shade/pull/96
    • Commission renamed to capture by @DrPresident in https://github.com/securesecrets/shade/pull/101
    • Add PR template by @FloppyDisck in https://github.com/securesecrets/shade/pull/106
    • Update issue templates by @FloppyDisck in https://github.com/securesecrets/shade/pull/105
    • Governance | initial contract by @FloppyDisck in https://github.com/securesecrets/shade/pull/103
    • Governance | improved tests by @FloppyDisck in https://github.com/securesecrets/shade/pull/109
    • Fixed issues regarding the capture refactor by @FloppyDisck in https://github.com/securesecrets/shade/pull/111
    • Shade protocol tool by @DrPresident in https://github.com/securesecrets/shade/pull/99
    • Staking | initial contract by @FloppyDisck in https://github.com/securesecrets/shade/pull/115
    • Airdrop | contract by @FloppyDisck in https://github.com/securesecrets/shade/pull/116
    • Governance | voting by @FloppyDisck in https://github.com/securesecrets/shade/pull/119
    • sSCRT staking by @DrPresident in https://github.com/securesecrets/shade/pull/120
    • Shd stake | rewards distribution by @FloppyDisck in https://github.com/securesecrets/shade/pull/125
    • Update README.md by @dylanschultzie in https://github.com/securesecrets/shade/pull/131
    • Add to documentation by @chris-ricketts in https://github.com/securesecrets/shade/pull/117
    • doc2book tool by @chris-ricketts in https://github.com/securesecrets/shade/pull/123
    • Warning cleanup by @DrPresident in https://github.com/securesecrets/shade/pull/134
    • Airdrop | completion flags by @FloppyDisck in https://github.com/securesecrets/shade/pull/127
    • Governance | pre voting by @FloppyDisck in https://github.com/securesecrets/shade/pull/133
    • Airdrop | minor tweaks by @FloppyDisck in https://github.com/securesecrets/shade/pull/138
    • Oracle index by @DrPresident in https://github.com/securesecrets/shade/pull/143
    • Documentation | contract updates by @FloppyDisck in https://github.com/securesecrets/shade/pull/132
    • Airdrop account permits by @FloppyDisck in https://github.com/securesecrets/shade/pull/141
    • [governance] Query proposals by status by @LasTshaMAN in https://github.com/securesecrets/shade/pull/144
    • Airdrop merkle trees by @FloppyDisck in https://github.com/securesecrets/shade/pull/145
    • Airdrop decay by @FloppyDisck in https://github.com/securesecrets/shade/pull/150
    • main doc update by @FloppyDisck in https://github.com/securesecrets/shade/pull/151
    • [oracle] Unregister Secret Swap pair by @LasTshaMAN in https://github.com/securesecrets/shade/pull/149
    • Make format command by @LasTshaMAN in https://github.com/securesecrets/shade/pull/153
    • Airdrop permit fixes by @FloppyDisck in https://github.com/securesecrets/shade/pull/154
    • Permits migration by @FloppyDisck in https://github.com/securesecrets/shade/pull/156
    • Airdrop testnet deploy script by @FloppyDisck in https://github.com/securesecrets/shade/pull/155
    • Airdrop bug fixes by @FloppyDisck in https://github.com/securesecrets/shade/pull/157
    • Airdrop | query protection by @FloppyDisck in https://github.com/securesecrets/shade/pull/158
    • Makefile improvements by @FloppyDisck in https://github.com/securesecrets/shade/pull/160
    • Oracle remove hardcoded by @DrPresident in https://github.com/securesecrets/shade/pull/159
    • Airdrop | improved privacy by @FloppyDisck in https://github.com/securesecrets/shade/pull/164
    • Update dependencies by @DrPresident in https://github.com/securesecrets/shade/pull/166
    • Code cleanup by @FloppyDisck in https://github.com/securesecrets/shade/pull/163
    • Create a Code Of Conduct by @mohammedpatla in https://github.com/securesecrets/shade/pull/162
    • Release 0.3 with Airdrop for Shade Protocol by @mohammedpatla in https://github.com/securesecrets/shade/pull/161

    New Contributors

    • @dylanschultzie made their first contribution in https://github.com/securesecrets/shade/pull/131
    • @chris-ricketts made their first contribution in https://github.com/securesecrets/shade/pull/117
    • @LasTshaMAN made their first contribution in https://github.com/securesecrets/shade/pull/144

    Full Changelog: https://github.com/securesecrets/shade/compare/v0.2.1...airdrop

    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Sep 7, 2021)

  • v0.2.0(Aug 26, 2021)

    This is MVP Release.

    • It has all the four Minting and Burns mechanisms in place.
    • Working Oracle.

    Know Issues :

    • Getting Price of Shade before entry minting is enabled.
    • Secret Swap liquidity.
    Source code(tar.gz)
    Source code(zip)
  • pre-MVP(Aug 16, 2021)

Fullstack development framework for UTXO-based dapps on Nervos Network

Trampoline-rs The framework for building powerful dApps on the number one UTXO chain, Nervos Network CKB. This is an early-stage, currently very incom

TannrA 2 Mar 25, 2022
Astar Network is an interoperable blockchain based the Substrate framework and the hub for dApps within the Polkadot Ecosystem

Astar Network is an interoperable blockchain based the Substrate framework and the hub for dApps within the Polkadot Ecosystem. With Astar Network and

Astar Network (Plasm) 43 Dec 14, 2022
The Graph is a protocol for building decentralized applications (dApps) quickly on Ethereum and IPFS using GraphQL.

Graph Node The Graph is a protocol for building decentralized applications (dApps) quickly on Ethereum and IPFS using GraphQL. Graph Node is an open s

Mindy.wang 2 Jun 18, 2022
MASQ Network 121 Dec 20, 2022
A Curve-like AMM for Secret Network

A Curve-like AMM for Secret Network. Supports a varibale number of tokens with the same underlying value.

Enigma 16 Dec 11, 2022
An End-to-End Privacy Computing Protocol on Layer 2

Eigen Network Eigen Network is an end-to-end privacy computation network for a better digital economy based on hybrid privacy computation protocols an

Eigen Lab 24 Oct 13, 2022
Docker containers on a synthetic network. Run applications in a context that lets you manipulate their network conditions.

Synthetic Network Docker containers on a synthetic network. Run applications in a context that lets you manipulate their network conditions. Dependenc

Daily 58 Dec 15, 2022
A multi-protocol network relay

A multi-protocol network relay

zephyr 43 Dec 13, 2022
A Rust library for parsing the SOME/IP network protocol (without payload interpretation).

someip_parse A Rust library for parsing the SOME/IP network protocol (without payload interpretation). Usage Add the following to your Cargo.toml: [de

Julian Schmid 18 Oct 31, 2022
Cloud Native high performance security and privacy SQL proxy.

Fern proxy With the advent of Cloud Native applications, architecture patterns evolved and emerged to take advantage of cloud computing, and build mor

Fern 12 Nov 7, 2022
A minimalistic encryption protocol for rust async streams/packets, based on noise protocol and snow.

Snowstorm A minimalistic encryption protocol for rust async streams / packets, based on noise protocol and snow. Quickstart Snowstorm allows you to se

Black Binary 19 Nov 22, 2022
Network simulation in Rust

netsim - A Rust library for network simulation and testing (currently linux-only). netsim is a crate for simulating networks for the sake of testing n

Andrew Cann 115 Dec 15, 2022
A private network system that uses WireGuard under the hood.

innernet A private network system that uses WireGuard under the hood. See the announcement blog post for a longer-winded explanation. innernet is simi

Tonari, Inc 4.1k Dec 29, 2022
Computational Component of Polkadot Network

Gear is a new Polkadot/Kusama parachain and most advanced L2 smart-contract engine allowing anyone to launch any dApp for networks with untrusted code.

null 145 Dec 19, 2022
Official Implementation of Findora Network.

Findora Platform Wiki Contribution Guide Licensing The primary license for Platform is the Business Source License 1.1 (BUSL-1.1), see LICENSE. Except

Findora Foundation 61 Dec 9, 2022
Simple in-network file transfer with barely any overhead.

fftp fftp is the "Fast File Transport Protocol". It transfers files quickly between computers on a network with low overhead. Motivation FTP uses two

leo 4 May 12, 2022
netavark: A container network stack

netavark: A container network stack Netavark is a rust based network stack for containers. It is being designed to work with Podman but is also applic

Containers 230 Jan 2, 2023
A cross-platform, user-space WireGuard port-forwarder that requires no system network configurations.

Cross-platform, user-space WireGuard port-forwarder that requires no system network configurations.

Aram Peres 629 Jan 4, 2023
An implementation of the CESS network supported by CESS LAB.

--------- ?? ---------An infrastructure of decentralized cloud data network built with Substrate-------- ?? -------- ---------------- ?? -------------

Cess Project 249 Dec 26, 2022