Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OIP1: Asset Feature - MLP2 (Market Liquidity Pool 2) #2

Open
froooze opened this issue Jun 16, 2020 · 2 comments
Open

OIP1: Asset Feature - MLP2 (Market Liquidity Pool 2) #2

froooze opened this issue Jun 16, 2020 · 2 comments

Comments

@froooze
Copy link
Contributor

froooze commented Jun 16, 2020

OIP: 001
Title: Asset Feature - MLP2 (Market Liquidity Pool Version 2)
Author: [bench] <https://github.com/froooze>
Status: Draft
Type: Protocol
Created: 2020-06-11

Abstract

  • MLP2 is an asset lending feature, to provide liquidity for asset exchanges, at the current price level
  • Simplified version of the Bancor Protocol without connector weight
  • Stepless liquidity with no order book for any asset pair
  • Blockchain as borrower and liquidity provider
  • ONS as central node and base currency
  • Market fees are shared to asset lender and blockchain

Motivation

  • User has no easy way to provide liquidity to markets
  • Most order books have low liquidity and high market spread
  • Order books are dependent on certain price levels

Rationale

  • Provide an easy, effective and robust liquidity feature for every user, asset and asset pair on the protocol level
  • Generate demand for ONS and income for Onest Blockchain

Solution

  • Every asset pair can have the MLP2 asset feature
  • The MLP2 asset feature is based on the x * y = k modell
  • x = amount_asset_X, y = amount_asset_Y, k = invariant
  • MLP2 is separated in passive and active liquidity, to allow one asset deposit/withdraw

Exchange

  • The ratio of amount_asset_X/ amount_asset_Y or price_asset defines the asset exchange rate
  • The invariant is not changed during the asset exchange
  • amount_asset_X * sqrt(price_X) = amount_asset_Y * sqrt(price_Y)

Passive liquidity

  • Passive liquidity gets created, when there is an unequal amount of assets, because only one asset was removed/added from/to the MLP2.
  • Passive liquidity needs an equal amount of the corresponding asset, to become active liquidity.
  • Passive liquidity, which was created by removing assets from MLP2, are prioritized for active liquidity over newly added assets.
  • The reduction of passive liquidity is defined by the smaller order of both assets.

Add/remove asset(s) from MLP2

Add an equivalent amount of both assets

  • No passive liquidity
  • No waiting time
  • Highest market fee share

add2-assets

Remove an equivalent amount of both assets

  • Passive liquidity is not changed

remove2-assets

Add only one asset

  • Instantly, when it is the inverse asset of the passive liquidity
  • Waiting time, when it is the asset of the passive liquidity
  • Lower market fee share

add1-assets

Remove only one asset

  • No waiting time
  • Active liquidity gets reduced
  • Passive liquidity can get increased or decreased

remove1-asset

MLP2 start values

MLP2-price1

MLP2 after quadruple ONS price or asset sell for half amount_ONS

MLP2-price2

MLP2 Charts

  • amount_ONS * amount_asset = invariant
  • sqrt(price_ONS) * amount_ONS = constant
  • sqrt(price_asset) * amount_asset = constant
  • price_ONS * price_asset = 1

MLP-price-chart

Fee structure

The asset owner, defines the fee structure for the MLP2
The market fee share to network is defined by the network.

ONS market pairs

  • Only paid in ONS
  • Only for ONS -> asset trading
  • Added partial after the exchange to the MLP2
  • Shared to both assets lenders

Other market pairs

  • Paid in both assets
  • Paid in both directions
  • Added both partial after the exchange to the MLP2
  • Shared to both asset lenders
  • Network cut gets settled by the corresponding ONS market pair

Example fee schedule

0.6% ONS -> asset market fee

  • 75% for the MLP2 asset holder (= 0.45%)
  • 5% for referral system (= 0.03%)
  • 5% for the reserve pool (= 0.03%)
  • 15% for the asset owner (= 0.09%)

0.3% asset -> asset market fee

  • 75% for the MLP2 asset holder (= 0.225%)
  • 5% for referral system (= 0.015%)
  • 5% for the reserve pool (= 0.015%)
  • 15% for the asset owner (= 0.045%)

Price Distribution

MLP2-price-gau

Network Example with different MLP asset features

MLP2-network

Market Dynamics

  • Every asset exchange uses the full inventory of the MLP2 asset feature
  • Every asset is backed by same value of the other asset
  • When ONS price decreases, demand for ONS is increased

MLP2 price changes

ROS = (Relative Order Size) = amount_order/active_mlp
Premium on the exchange rate compared to the current price_asset

ROS Premium delta_price_asset
0.1% 0.1% 0.2%
1% 1% 2%
5% 5% 11%
10% 11% 23%
20% 25% 56%
50% 100% 400%

Orderbook

  • Supported with extra liquidity
  • Reduced market spread
  • Any trading pair can have liquidity with ONS as central node
  • Asymmetric market fee reduces asset/asset market spread

Price feed

The MLP2 asset feature is not only exchange feature, but also a price feed indicator, which oscillates around the market price.

Manipulation

  • Shorting ONS on MLP2 generates market fee and market spread
  • Shorting ONS generates extra demand for ONS
  • Arbitrage pays no market fee and gets an advantage to increase ONS price on DEX

Comparison

Lending options

Case MPLP MLP2 BSIP-70
Motivation interest rate market fee interest rate
Borrower peer blockchain peer
Input debt asset any asset or asset pair any asset
Purpose increase CR & debt increase liquidity lending/trading
Collateral no no yes
Order book no no yes

Implementation

Case MLP2 Uniswap2
Market fee a-/symmetric symmetric
Assets ONS assets ERC-20
Non-core markets yes yes
One asset support yes no
Fee share yes no

Specifications

Network_parameter

  • fee_share_for_reserve

MLP_parameters

  • asset_id
  • mlp_fee_rate
  • fee_share_asset
  • fee_share_mlp
  • fee_share_referral

MLP_object

  • asset_id
  • delta_asset_balance
  • user_id
  • mlp_function_id

MLP_asset_functions

x = active_amount_asset_X
y = active_amount_asset_Y

x_p = passive_amount_asset_X
y_p = passive_amount_asset_Y

Add both assets

if (y/x == delta_asset_X / delta_asset_Y) {
x += delta_asset_X
y += delta_asset_Y
}

Add one asset

if (delta_asset == passive_asset) {
mlp_passive += delta_asset
}

if (delta_asset_1 != passive_asset) {
mlp_passive -= delta_asset_2
mlp_active += delta_asset_1
}

Remove both assets

x -= delta_asset_X + market_fee_share_X
y -= delta_asset_Y + market_fee_share_Y

market_fee_share = ∫(market_fees * mlp_share)dn

Remove one asset

if (delta_asset_1 == passive_asset) {
mlp_active -= (delta_asset_1 + market_fee_share_1)
mlp_passive += delta_asset_2
}

if (delta_asset_1 != passive_asset) {
mlp_active -= (delta_asset_1 + market_fee_share_1)
mlp_passive -= delta_asset_2
}

market_fee_share = ∫(mlp_fee_rate * fee_share_mlp * mlp_active/(mlp_active + mlp_passive))dn

Exchange ONS to asset

mlp_fee = amount_ONS * fee_rate_mlp * fee_share_mlp // calculate fee cut for MLP2
x += mlp_fee // add fee to MLP2
k = x * y // calculate invariant
x += amount_ONS * (1 - fee_rate_mlp) // amount to exchange
amount_asset = y - k / x // amount to return

Exchange asset to ONS

k = x * y // calculate invariant
y += amount_asset // amount to exchange
amount_ONS = x - k / y // amount to return

Exchange asset_1 to asset_2

mlp_fee = amount_asset_1 * fee_rate_mlp * fee_share_mlp // calculate fee cut for MLP2
x += mlp_fee // add fee to MLP2
k = x * y // calculate invariant
x += amount_asset_1 * (1 - fee_rate_mlp) // amount to exchange
amount_asset_2 = y - k / x // amount to return

Flow Chart

MLP2-flow

Discussion and Summary for Shareholders

  • This is a very important feature, to strengthen our infrastructure, use case and core token value
  • This enables every user to take part in value creation and earning market fees at the same time

Risks

  • Adding only one asset to the liquidity allows to increase rewards or looses.

Copyright

This document is placed in the public domain.

Sources

@froooze
Copy link
Contributor Author

froooze commented Jun 16, 2020

What is new?

  • One asset deposit/withdraw to/from MLP2
  • Non-core token liquidity pairs
  • No orderbook integration

@froooze
Copy link
Contributor Author

froooze commented Jun 16, 2020

Exchange Examples

Fee Schedule

0.5% ONS -> asset market fee

  • 70% for the MLP asset holder (= 0.35%)
  • 20% for referral system (= 0.1%)
  • 10% for the reserve pool (= 0.05%)

ONS -> HONEST.USD Exchange

Pool Inventory

  • x = 25 million ONS
  • y = 1.25 million HONEST.USD
  • k = 31.25 * 10^12 ONS * HONEST.USD
  • ONS pool price = y / x = 0.05 HONEST.USD/ONS

Fee Distribution

  • sell 25k ONS (without fee)
  • fee = 25k ONS * 0.4% = 100 ONS
  • sell 24.9k ONS (with fee)
  • MLP += 70 ONS
  • referral system += 20 ONS
  • reserve pool += 10 ONS

Pool Change

  • x = 25 million ONS + 24.9k ONS = 25,024,900 ONS
  • y = k / x = 1,248,756.2 HONEST.USD
  • Δy = 1243.8 HONEST.USD
  • ONS exchange price = 1243.8 HONEST.USD / 25k ONS = 0.04975 HONEST.USD/ONS
  • market spread = ONS pool price/ONS exchange price = 0.05/0.04975 = 0.5%
  • pool price = y / x = 0.4990 HONEST.USD

Fee Addition

  • x += 70 ONS = 25024970 ONS
  • y = 1248756.2 HONEST.USD
  • k = x * y = 3.125 * 10^13 + 8.6 * 10^7

The market fee does change k after the exchange and makes selling ONS for HONEST.USD less profitable.

HONEST.USD -> ONS Exchange

Pool Inventory

  • x = 25,024,970 ONS
  • y = 1,248,756.2 HONEST.USD
  • k = 3.125 * 10^13 + 8.6 * 10^7
  • pool prize = y / x = 0.4990 HONEST.USD

Pool Change

  • buy ONS with 1250 HONEST.USD
  • y += 1250 HONEST.USD = 1,250,006.2 HONEST.USD
  • x = k / y = 24,999,944.8 ONS
  • Δx= 25025.2 ONS
  • ONS exchange price = 1250 HONEST.USD / 25025.2 ONS = 0.4995
  • market spread = 0.04995/0.04990 = 0.1%

HONEST.USD -> HONEST.CNY Exchange

Every asset can be traded against each other by using ONS as a base currency.

  • HONEST.USD -> ONS
    market spread ∼ order size
  • ONS -> HONEST.USD
    market spread ∼ order size + market fee
  • HONEST.USD -> ONS -> HONEST.CNY
    market spread ∼ 2 * order size + market fee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant