Coder Social home page Coder Social logo

perpetual's Introduction

Margined Protocol Perpertuals

Continuous Integration codecov

This repo contains a the Margined Protocol a decentralized perpetual contract protocol on the Terra Blockchain.

Contracts

Contract Reference Description
Margin Engine doc Margin engine that manages users positions and the collateral management
vAMM doc Virtual AMM enabling users to take perpetual positions
Price Feed doc Integration contract for the data oracles and other data related logic
Governance doc TODO
Factory doc TODO

Get started

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

Build

Clone this repository and build the source code:

git clone [email protected]:margined-protocol/mrgnd-perpetuals.git
cd mrgnd-perpetuals
cargo build

To Do List

  • vAMM
    • Initialise
      • Owner, assets, etc
    • Execute
      • Init vAMM (define constant product func k)
        • define the state of the new vAMM
      • Long / Short
      • SettleFunding
    • Query
      • Latest Price
  • Margin Engine
    • Initialise
      • owner, vAMM, etc
    • Execute
      • New position / Close position
      • New eligible collateral (maybe? potentially we only allow a single type? would make x-margin easier)
      • Update vAmms, i.e. append, remove etc
      • Update vAmms, i.e. append, remove etc
    • Query
  • Oracle
    • PriceFeed contract that integrates against TeFi hub
    • Wrapper for TeFi oracles which do calcs listed below
    • TWAP
    • ???
  • Decimal Library
    • General decimal calculation library for use around with my fixed point decimals
  • Factory
  • Governance
  • General
    • Testing framework improvements
      • Wrapper for smart contract functions
      • Setup files
      • Better organisation
    • Code comment documentation
    • Code Coverage - cargo-tarpaulin
    • Code linting

Reading / Docs

Perpetual

perpetual's People

Contributors

yuki-dev-226 avatar

Watchers

 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.