/Acala

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

Primary LanguageRustGNU General Public License v3.0GPL-3.0

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

NOTE

The Acala client node is moved to acala-node. This repo only contains the runtime code. This allow us to decouple the runtime release and client node release.

If you would like to build the client node, please refer to acala-node.

Install Rust:

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

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

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

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

3. Run

You can start a development chain with:

make run

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

5. Bug Bounty 🐛

The Bug Bounty Program includes only on-chain vulnerabilities that can lead to significant economic loss or instability of the network. You check details of the Bug Bounty or Submit a vulnerability here: https://immunefi.com/bounty/acala/

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 module <module_name> i.e.: module_currencies

Bench bot will do the benchmarking, generate weights.rs file and 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 and push changes into your branch.

Bench Acala EVM+

Comment on a PR /bench evm to benchmark Acala EVM+ and bench bot will generate precompile weights and GasToWeight ratio.

7. Migration testing runtime

If modifying the storage, you should test the data migration before upgrading the runtime.

Try testing runtime

try-runtime on karura

# Use a live chain to run the migration test.
# Add `-p module_name` can specify the module.
make try-runtime-karura

# Create a state snapshot to run the migration test.
# Add `--pallet module_name` can specify the module.
cargo run --features with-karura-runtime --features try-runtime -- try-runtime --runtime existing create-snapshot --uri wss://karura.api.onfinality.io:443/public-ws karura-latest.snap

# Use a state snapshot to run the migration test.
./target/release/acala try-runtime --runtime ./target/release/wbuild/karura-runtime/karura_runtime.compact.compressed.wasm --chain=karura-dev on-runtime-upgrade snap -s karura-latest.snap

try-runtime on acala

# Use a live chain to run the migration test.
# Add `--pallet module_name` can specify the module.
make try-runtime-acala

# Create a state snapshot to run the migration test.
# Add `-palet module_name` can specify the module.
cargo run --features with-acala-runtime --features try-runtime -- try-runtime --runtime existing create-snapshot --uri wss://acala.api.onfinality.io:443/public-ws acala-latest.snap

# Use a state snapshot to run the migration test.
./target/release/acala try-runtime --runtime ./target/release/wbuild/acala-runtime/acala_runtime.compact.compressed.wasm --chain=acala-dev on-runtime-upgrade snap -s acala-latest.snap