Code Monkey home page Code Monkey logo

nax's Introduction

NAX - Neo Assets Exchange

Demo video NAX

TestNet Smart contract v0.2: KT1UFrBkUqxd2jxsCfxQnKapqRmCSSkdQ8LG

TestNet Smart contract v0.1: KT1MpgKoT5L32ngsPJgjE9fptVgBE9XAUc6X

Neo Assets Exchange (NAX) is a decentralised exchange for trading perpetual contracts on crypto and NFT like assets. NAX is an experimental exchange for trading perps on new/exotic assets with Tezos as settlement currency. Due to its novel mCFMM price discovery mechanism, it doesn't require any liquidity pools or external liquidity. The main aim of the exchange is to provide exposure to exotic assets to the Tezos Hodlers without having to convert to other cryptocurrencies or trade-in new exchange.

Why Perpetual contracts (PERPs)?

With explosion of NFT markets and traders chasing the high quality NFT, it has become difficult to buy NFT during the intial drop. As most of the high value NFTs ( ex Beeple) are minted on Ethereum and its side chains, it has become very hard for the traders to trade as eth transaction fees eat much of their profits.

So NAX decided to introduce the Perpetual contracts on Tezos for traders to get maximum advantage of their trading. Perpetual contracts are leveraged derivative products that enable users to take exposure ( buy or sell) in an asset without actually holding the asset. Perps are leverage product and its price is expected to correlate closely with the spot price. So traders can take more postions than on the spot market for given amount of money.

Components

NAX smart contract actually consists of three main components:

  1. Vault
  2. Ledger
  3. Market Maker

NAX

Vault

Vault stores all the tezos of all users deposits in the single place. Vault will act as a multi-sig contract for high value transactions. Vault will play more important role once the staking and stable coins are introduced.

Ledger

Ledger smartcontract deals with following

  1. Record all the trade related transctions
  2. Calculate the MTM positions and re-calcaulate the balances of each account
  3. If any account doesnt meet the maintainence margin, it will perform the liquidation
  4. It also performs the "Funding" operations to align the Mark price and market price

Ledger receives the Market prices from the oracle and it can use either mark price or market price for the MTM and Margin calculation. Mark price is provide by mCFMM

mCFMM

NAX Prepetual(nPreps) uses modified Constant Function Market Maker (mCFMM) as a price discovery mechanism. Additional info on Constant Function Market Maker can be found here

nPreps use the constant product function X * Y = K ( same as Uniswap). However for nPerps, there will be no swap of assets.

Below is the example on how the mCFMM functions.

Let us assume a Floor price of Beeple NFT is a 700Tez and 100 nPrep are introduced for trading.

X = number of contracts = 100

Y = equivalent amount of tez = 700 * 100 = 70,000

Z = 100 * 70,000 = 7,000,000

Mark price for the contract = Y / X

image

Alice sends a buy order for 1000 tez.

Y adds 1000 tez => 71,000 so X becomes 98.5915 to maintain Z at a constant 7,000,000 This results in Alice buying 1.4085 ( 100 - 98.5915) contracts for 1000 tez and the Mark Price moves to 720

image

Another user Bob sends a buy order for 1000 tez.

Y adds 1000 tez => 72,000 so X becomes 97.22222 to maintain Z at a constant 7,000,000 This results in Bob buying 1.3693 contracts for 1000 tez and the Mark Price moves to 740

image

Now Alice decides to close her long position of 1.4085 contracts and sends the order to NAX This results in following changes in CFMM X adds 1.4085 to become 98.6307 so Y becomes 70972 to maintain Z at a constant 7,000,000 Alice receives 1028 tez (change in Y => 72000 - 70972) and the Mark Price moves to 720. ALice made a profit of 28 tez

image

Bob follows the suit to close his long position of 1.3693 contracts and sends the order to NAX This results in following changes in CFMM X adds 1.3693 to become 100 so Y becomes 7000 to maintain Z at a constant 7,000,000 Bob receives 972 tez (change in Y => 70972 - 70000) and the Mark Price moves to 700. Bob made a loss of 28 tez.

image

As we can see from example, Alice's profit was compensated by Bob's loss which means for the exchange to run , there is no need for additional liquidity or liquidity providers. Traders compensate each other profits and loss and the Mark price is determined by the algorithm.

Future Plan:

  1. NAX will continue to innovate the new DEFI products and has plans to introduce Futures and Options on crypto prices and NFT floor prices.
  2. NAX will also work to towards enabling private markets.
  3. NAX will also introduce support for stable coins settlement.

Current Status of the project:

image

UI

image

image

image

Test Case Snapshot - Smartpy explorer

image

image

image

image

nax's People

Contributors

karthi1908 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

ironcrypto

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.