Code Monkey home page Code Monkey logo

mango's Introduction

Mango Markets - Decentralized Margin Trading

⚠️ Warning

Any content produced by Blockworks, or developer resources that Blockworks provides, are for educational and inspiration purposes only. Blockworks does not encourage, induce or sanction the deployment of any such applications in violation of applicable laws or regulations.

Contribute

Significant contributions to the source code may be compensated with a grant from the Blockworks Foundation.

Security

Mango is currently unaudited software. Use at your own risk.

You may be eligible for a substantial reward if you find a vulnerability and report it privately to [email protected]

Setup

This setup assumes you're familiar with the basics of Solana development. If you're not, you might find it useful to follow the instructions here: https://github.com/solana-labs/example-helloworld and/or here: https://docs.solana.com/cli to get set up with node and rust as well

get rust

sudo apt-get install -y pkg-config build-essential python3-pip jq
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup override set 1.58
rustup component add rustfmt
rustup component add rust-src

Note that currently rust version at least 1.50 is needed. Check rust version and upgrade if necessary with

rustc --version
rustup update

get mango

VERSION=v1.9.1
sh -c "$(curl -sSfL https://release.solana.com/$VERSION/install)"
sudo apt-get install -y libssl-dev libudev-dev
cargo install spl-token-cli

git clone [email protected]:blockworks-foundation/mango.git
git clone [email protected]:blockworks-foundation/mango-client-ts.git

get devnet coins

  • Go to mango-client-ts/src/ids.json and create a token account in sollet.io for each of the symbols under devnet
  • Go to https://spl-token-ui.netlify.app/#/token-faucets,
  • switch to devnet cluster in top right and Token airdrop tab
  • then copy paste the faucet id for the token you want from ids.json.devnet.faucets
  • paste in your corresponding token account address
  • hit Airdrop tokens and check your sollet.io to see if you've received tokens

deploy devnet

Note: Make sure the IDS_PATH and KEYPAIR are correct in mango/cli/devnet.env

Then set the devnet keys and URL

source cli/devnet.env
solana config set --url $CLUSTER_URL

Then compile program and deploy using devnet_deploy.sh in mango/cli

cd cli
. devnet_deploy.sh

deploy mainnet

Rework devnet_deploy.sh and use cli/mainnet.env to deploy to mainnet

run tests

Regression and integration tests are in progress. To run them

cd program
cargo test  # run non-solana VM tests (none at the moment but would include simple unit tests in the future)
cargo test-bpf  # run tests that use the solana VM (ie the smart contract tests)

mango's People

Contributors

mschneider avatar dafyddd avatar riordanp avatar kevlubkcm avatar nicholasgodfreyclarke avatar lagzda avatar deviantfero avatar tlrjs avatar armaniferrante 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.