GithubHelp home page GithubHelp logo

antwuandixon / acala Goto Github PK

View Code? Open in Web Editor NEW

This project forked from acalanetwork/acala

0.0 0.0 0.0 67.01 MB

Acala - cross-chain DeFi hub and stablecoin based on Substrate for Polkadot and Kusama.

Home Page: https://acala.network

License: GNU General Public License v3.0

Makefile 0.21% Rust 96.45% Shell 1.27% Handlebars 0.34% Dockerfile 0.12% Solidity 0.09% TypeScript 1.53%

acala's Introduction

GitHub Workflow Status GitHub tag (latest by date) Substrate version codecov License
Twitter URL Discord Telegram Discourse Medium

1. Introduction

This project is initiated and facilitated by the Acala Foundation. Acala Foundation nurtures applications in the fields of decentralized finance protocols, particularly those that serve as open finance infrastructures such as stable currency and staking liquidity. The Acala Foundation is founded by Laminar and Polkawallet , participants and contributors to the Polkadot ecosystem. The Acala Foundation welcomes more industry participants as it progresses.

2. Overview

The significance of cross-chain communication to the blockchain is like that of the internet to the intranet. Polkadot empowers a network of public, consortium and private blockchains, and enables true interoperability, economic and transactional scalability. A cross-chain stablecoin system will:

  1. create a sound, stable currency for low cost, borderless value transfer for all chains in the network
  2. enable commerical lending with predictable risk
  3. serve as a building block for more open finance services

The Acala Dollar stablecoin (ticker: aUSD) is a multi-collateral-backed cryptocurrency, with value stable against US Dollar (aka. 1:1 aUSD to USD soft peg). It is completely decentralized, that it can be created using assets from blockchains connected to the Polkadot network including Ethereum and Bitcoin as collaterals, and can be used by any chains (or digital jurisdictions) within the Polkadot network and applications on those chains.

By this nature, it is essential that the Acala Network eventually become community-owned with an economic model that can sustain its development and participation in the Polkadot network, as well as ensure its stability and security. The following section will provide a high-level overview of the following topics:

  • aUSD and the Honzon stablecoin protocol
  • the economic model and initial parachain offering

2.1. aUSD and the Honzon stablecoin protocol

Every aUSD is backed in excess by a crypto asset, the mechanism of which is known as an over-collateralized debt position (or CDP). Together with a set of incentives, supply & demand balancing, and risk management mechanisms, as the core components of the Honzon stablecoin protocol on the Acala Network, the stability of the aUSD is ensured. The CDP mechanism design is inspired by the first decentralized stablecoin project MakerDAO, which has become the DeFi building block in the Ethereum ecosystem. Besides, the Honzon protocol enables many unique features - native multi-asset support, cross-chain stablecoin capability, automatic liquidation to increase responsiveness to risk, and pluggable oracle and auction house to improve modularity, just to name a few.

The Honzon protocol contains the following components

  • Multi Collateral Type
  • Collateral Adapter
  • Oracle and Prices
  • Auction and Auction Manager
  • CDP and CDP Engine
  • Emergency shutdown
  • Governance
  • Honzon as an interface to other components

Note: This section is still work in progress, we will update more information as we progress. Refer to the Github Wiki for more details.

2.2. Acala Network Economic Model

The Acala Network Token (ACA) features the following utilities, and the value of ACA token will accrue with the increased usage of the network and revenue from stability fees and liquidation penalties

  1. As Network Utility Token: to pay for network fees and stability fees
  2. As Governance Token: to vote for/against risk parameters and network change proposals
  3. As Economic Capital: in case of liquidation without sufficient collaterals

To enable cross-chain functionality, the Acala Network will connect to the Polkadot in one of the three ways:

  1. as parathread - pay-as-you-go connection to Polkadot
  2. as parachain - permanent connection for a given period
  3. as an independent chain with a bridge back to Polkadot

Becoming a parachain would be an ideal option to bootstrap the Acala Network, and maximize its benefits and reach to other chains and applications on the Polkadot network. To secure a parachain slot, the Acala Network will require supportive DOT holders to lock their DOTs to bid for a slot collectively - a process known as the Initial Parachain Offering (IPO). ACA tokens will be offered as a reward for those who participated in the IPO, as compensation for their opportunity cost of staking the DOTs.

Note: This section is still work in progress, we will update more information as we progress. Refer to the token economy working paper for more details.

3. Building

NOTE

To connect on the "Mandala TC6" network, you will want the version ~0.7.10 code which is in this repo.

Install Rust:

curl https://sh.rustup.rs -sSf | sh

You may need additional dependencies, checkout substrate.dev for more info

sudo apt-get install -y git clang curl libssl-dev llvm libudev-dev

Make sure you have submodule.recurse set to true to make life with submodule easier.

git config --global submodule.recurse true

Install required tools and install git hooks:

make init

Build Mandala TC native code:

make build-full

4. Run

You can start a development chain with:

make run

5. Development

To type check:

make check-all

To purge old chain data:

make purge

To purge old chain data and run

make restart

Update ORML

make update

Note: All build command from Makefile are designed for local development purposes and hence have SKIP_WASM_BUILD enabled to speed up build time and use --execution native to only run use native execution mode.

6. Bench Bot

Bench bot can take care of syncing branch with master and generating WeightInfos for module or runtime.

Generate module weights

Comment on a PR /bench runtime module <module_name> i.e.: module_currencies

Bench bot will do the benchmarking, generate weights.rs file push changes into your branch.

Generate runtime weights

Comment on a PR /bench runtime <runtime> <module_name> i.e.: /bench runtime mandala module_currencies.

To generate weights for all modules just pass * as module_name i.e: /bench runtime mandala *

Bench bot will do the benchmarking, generate weights file push changes into your branch.

7. Migration testing runtime

If modify the storage, should test the data migration before upgrade the runtime.

Try testing runtime

# Use a live chain to run the migration test and save state snapshot to file `snapshot.bin`.
# Add `-m module_name` can specify the module.
cargo run --features with-mandala-runtime --features try-runtime -- try-runtime --wasm-execution=compiled --block-at=0x9def608d5674f6d16574f53849218fe13d80ec1042ef7c2d4de7d4c50abab806 --url="wss://karura.api.onfinality.io/public-ws" on-runtime-upgrade live -s snapshot.bin

 # Use a state snapshot to run the migration test.
cargo run --features with-mandala-runtime --features try-runtime -- try-runtime --wasm-execution=compiled --block-at=0x9def608d5674f6d16574f53849218fe13d80ec1042ef7c2d4de7d4c50abab806 on-runtime-upgrade snap -s snapshot.bin

# Off-Chain worker
# Use a live chain to run the off-chain migration test and save state snapshot to file `snapshot.bin`.
cargo run --features with-mandala-runtime --features try-runtime -- try-runtime --wasm-execution=compiled --block-at=0x9def608d5674f6d16574f53849218fe13d80ec1042ef7c2d4de7d4c50abab806 --url="wss://karura.api.onfinality.io/public-ws" offchain-worker live -s snapshot.bin

 # Use a state snapshot to run the offchain migration test.
cargo run --features with-mandala-runtime --features try-runtime -- try-runtime --wasm-execution=compiled --block-at=0x9def608d5674f6d16574f53849218fe13d80ec1042ef7c2d4de7d4c50abab806 --url="wss://karura.api.onfinality.io/public-ws" offchain-worker snap -s snapshot.bin

8. Run local testnet with RelayChain and Parachain

Build RelayChain and Parachain local testnet to develop.

cd launch

# install dependencies
yarn

# generate docker-compose.yml and genesis
# NOTE: If the docker image is not the latest, need to download it manually.
# e.g.: docker pull acala/karura-node:latest
yarn run start generate

# start relaychain and parachain
cd output
# NOTE: If regenerate the output directory, need to rebuild the images.
docker-compose up -d --build

# list all of the containers.
docker ps -a

# track container logs
docker logs -f [container_id/container_name]

# stop all of the containers.
docker-compose stop

# remove all of the containers.
docker-compose rm

# NOTE: If you want to clear the data and restart, you need to clear the volumes.
# remove volume
docker volume ls
docker volume rm [volume_name]
# prune all volumes
docker volume prune

acala's People

Contributors

0xthreebody avatar afmsavage avatar antonia-chen avatar bette7 avatar brettkolodny avatar dependabot[bot] avatar ermalkaleci avatar ferrell-code avatar gluneau avatar herryho avatar jasl avatar justinphamnz avatar ordian avatar prin-r avatar qwer951123 avatar roynalnaruto avatar shaunxw avatar syan095 avatar ukby1234 avatar wangjj9219 avatar warfollowsme avatar weichweich avatar xlc avatar zjb0807 avatar

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.