Skip to content

nutsfinance/stable-asset

Repository files navigation

NUTS Stable Asset Pallet

Web3 Grant

Overview

There are vastly emerging assets in the Polkadot ecosystem, including both Polkadot native assets and assets bridged from other blockchains such as Ethereum and EOS. These assets introduce diversity in architecture and business model, but also fragmentizes the ecosystem since applications need to build separate markets for each of these assets. For example, stables coins can be divided into three categories: fiat-backed, crypto-backed and algorithmic stable coins, and on Ethereum each category has more than ten stable coin protocols. DEX benefits from such asset diversification but other protocols such as lending and options find it difficult to accommodate all these various assets.

Asset synthesis is a common approach to unify asset values and hedge asset risks. One approach is to synthesize several mainstream assets or assets belonging to the same niche so that the synthetic assets represents the general trend of the underlying assets. In this approach the synthetic assets acts similiar to an index fund, and how to fairly price and adopt the synthetic assets becomes a new question. The second approach is to synthetize several assets of the same value peg such as BTC, ETH or USD. The synthetic asset has the same value peg, and it could simplifies financial application development since only one synthetic asset needs to be supported for each peg type.

Stable Asset is an asset synthetic protocol of the second approach. It is also built with integrated swap and saving functionalities using the basket of assets.

Installation

Make sure you have done all steps described in Installation page of the Substrate Developer Hub.

To build project run:

cargo build

Tests

To run unit tests type:

cargo test

In case you want run code coverage tool, please follow instructions to install tarpaulin.

To create code coverage report run:

cargo tarpaulin -v

Running the Node

First of all please ensure that your development chain's state is empty:

cargo run --bin node purge-chain --dev

Now you can start the development chain:

cargo run --bin node --dev

Use Docker

You can build the docker image using docker build -t stable-asset .. Then run with docker run -p 9944:9944 stable-asset.

Connecting to the Node

Polkadot.js Explorer

It can be very useful to connect UI to the node you just started.

To do this open https://polkadot.js.org/apps/#/explorer in your browser first.

Follow these steps to register required custom types:

  • In the main menu choose Settings tab;
  • In the Settings submenu choose Developer tab;
  • Copy content of the custom-types.json file into text box on the page;
  • Press Save button.

Example Client

Example client connects to the clean dev node and performs various operations with nutsfinance-stable-asset pallet. See this readme for details.

Using the Pallet

  • See Client API for how to use the pallet from the client perspective.

Development Roadmap

Milestone # Description
1 Implement core Stable Swap algorithm to maintain balance of the basket, e.g.
computeD
computeDy
computeSwapAmount
swap.
Part of the algorithm is implemented in Solidity in acBTC's ACoconutSwap contract
2 Implement core functionalities for Stable Asset, which includes both how Stable Asset is minted/redeemed, e.g.
getMintAmount
mint
getRedeemProportionAmount
redeemProportion
getRedeemSingleAmount
redeemSingle
getRedeemMultiAmount
redeemMulti,
and how the basket assets are managed. The first part is partly implemented in Solidity in acBTC's ACoconutSwap contract

License

NUTS Stable Asset is Apache 2.0 licensed.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published