This monorepository contains the source code for the Money Market smart contracts implementing Anchor 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.
Anchor Token depends on Terraswap and uses its implementation of the CW20 token specification.
| Contract | Reference | Description |
|---|---|---|
airdrop |
doc | Holds ANC tokens which are to be used Luna staker incentives |
collector |
doc | Accumulates protocol fees, converts them to ANC and distributes to ANC stakers |
community |
doc | Manages ANC community grants |
distributor |
doc | Holds ANC tokens which are to be used as borrower incentives |
gov |
doc | Handles Anchor Governance and reward distribution to ANC stakers |
staking |
doc | Handles ANC-UST pair LP token staking |
vesting |
doc | Holds ANC tokens which are to be used ANC token allocation vesting |
- Rust v1.44.1+
wasm32-unknown-unknowntarget- Docker
-
Install
rustupvia https://rustup.rs/ -
Run the following:
rustup default stable
rustup target add wasm32-unknown-unknown- Make sure Docker is installed
Each contract contains Rust unit and integration tests embedded within the contract source directories. You can run:
cargo unit-test
cargo integration-testAfter 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.wasmFor 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 \
cosmwasm/workspace-optimizer:0.11.5This performs several optimizations which can significantly reduce the final size of the contract binaries, which will be available inside the artifacts/ directory.
Copyright 2020 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 http://www.apache.org/licenses/LICENSE-2.0. 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.