Coder Social home page Coder Social logo

money-market's Introduction

codecov

Anchor Money Market Contracts

A Rust and CosmWasm implementation of the Anchor Protocol money market on the Terra blockchain.

You can find information about the architecture, usage, and function of the smart contracts in the documentation.

Dependencies

Money Market has dependencies on Anchor Token Contracts and bAsset Contracts.

Contracts

Contract Reference Description
overseer doc Manages money market overalls, stores borrower information
market doc Handles Terra stablecoin deposits and borrows, ANC distribution to borrowers
custody_bluna doc Handles bLuna collateral deposits and withdrawals
interest_model doc Calculates the current borrow interest rate based on the market situation
distribution_model doc Calculates the borrower ANC emission rate based on the previous emission rate
oracle doc Provides a price feed for bAsset collaterals
liquidation doc OTC exchange contract for bAsset collateral liquidations

Development

Environment Setup

  • Rust v1.44.1+
  • wasm32-unknown-unknown target
  • Docker
  1. Install rustup via https://rustup.rs/

  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 and integration tests embedded within the contract source directories. You can run:

cargo unit-test
cargo integration-test

Compiling

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

Production

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 \
  cosmwasm/workspace-optimizer:0.11.5

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

License

This repository is licensed under the Apache 2.0 license. See LICENSE for full disclosure.

© 2021 Anchor Protocol.

money-market's People

Contributors

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