Anchor-Protocol / anchor-bAsset-contracts

Smart contracts powering Anchor Protocol on Terra

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Anchor bAsset Contracts

This monorepository contains the source code for the smart contracts implementing bAsset Protocol on the Terra blockchain.

You can find information about the architecture, usage, and function of the smart contracts on the official Anchor documentation site.


Contract Reference Description
anchor_basset_hub doc Manages minted bLunas and bonded Lunas
anchor_basset_reward doc Manages the distribution of delegation rewards
anchor_basset_token doc CW20 compliance
anchor_airdrop_registery doc Manages message fabricators for MIR and ANC airdrops


Environment Setup

  • Rust v1.44.1+
  • wasm32-unknown-unknown target
  • Docker
  1. Install rustup via

  2. Run the following:

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

Unit / Integration Tests

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

cargo test unit-test
cargo test integration-test


After making sure tests pass, you can compile each contract with the following:

RUSTFLAGS='-C link-arg=-s' cargo wasm
cp ../../target/wasm32-unknown-unknown/release/cw1_subkeys.wasm .
ls -l cw1_subkeys.wasm
sha256sum cw1_subkeys.wasm


For production builds, run the following:

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 \

This performs several optimizations which can significantly reduce the final size of the contract binaries, which will be available inside the artifacts/ directory.


Copyright 2021 Anchor Protocol

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and limitations under the License.

ezoic increase your site revenue


Smart contracts powering Anchor Protocol on Terra

License:Apache License 2.0


Language:Rust 100.0%