header-langage
简体中文
English
Tiếng Việt
Scan to Download the APP
Partnered With:

Viewpoint: A general solution to the existing problems of AMM

Read this article in 18 Minutes
Run away? Slippage? Can't place an order? AMM has a lot of problems now

As AMM (Automated Market Maker) is accepted by more and more traders, the problems it implies are infinitely magnified.

 

As a pure technology contributor and node operator, B-Harvest added a DeFi module to the Cosmos SDK. In this DeFi module, B-Harvest improves the AMM of the existing fixed product model and solves its existing problems.

 

The general solutions proposed in this module can be applied in different environments, for decentralized exchange developers Said to be of great reference value.

 

The Rhythm Research Institute has translated the white paper for readers’ reference:

 

《Liquidity Module of Cosmos Hub》

 

Introduction

 

1. Two innovations in the digital asset market

 

Block Chain: Decentralized Computing Database

 

-Provide trustless infrastructure for automation performance

 

-transparent operating environment

 

-can Expanded blockchain technology

 

AMM: Automated Market Maker

 

-Let market makers participate more freely

 

-Create a digital asset market without middlemen

 

-A minimalist exchange without an order book

 

2. Wanchain Interconnection

 

Use the IBC protocol Interconnecting Wanchain

 

-IBC is ready

 

 

p>

-Many transition bridges are under development

 

-Heterogeneous chains will be available Interconnect

 

The problem with AMM:

 

1 .Unfair transaction execution

 

miners’ absolute control over transaction ordering

 

-miners have 100% order control over all transactions in the block

 

< p line="QZEP">-The order of transactions has a great impact on the execution price

 

Senseless Gas wars and Delay Wars

 

- Traders scramble to prioritize trades

 

-Gas prices are high, miners are monopolized

 

-Unnecessarily low Low Latency

 

-Possible risk of "running away" attack

 

2. The "exchange price" is inconsistent with the "pool price"

 

"Fixed product" problem:

 

Exchange price = (X token reserve + X token transaction volume)/Y token reserve

 

pool price = (X token reserve + 2*X generation currency trading volume)/Y token reserve

 

The disequilibrium between the exchange price and the pool price will amplify the exchanged price of slippage.

 

Side effects of inconsistent prices:

 

< p line="4pYc">Repeated price fluctuations will create unnecessary arbitrage opportunities.

 

Arbitrageurs take profits from the pool, while liquidity providers will suffer losses.

 

3. Limited order mode

 

Buy or fail:

 

-The order can only take effect within one block, otherwise the transaction fails

p>

 

-Orders can only be filled in real time, otherwise the transaction will fail

 < /p>

-Orders cannot be placed, advanced order mode is not provided

 

-Orders cannot be partially Closing

 

These factors will prevent market makers from participating:

 

- Different pending order modes will create more liquidity.

 

Solution:

 

1. Batch execution< /h4>

 

-In each batch period, trading orders will continue to accumulate in the liquidity pool

 

-After each batching period, all transactions accumulated in the pool will be processed together

 

-The duration of the batch period can be one block or multiple blocks

 

< p line="EGs6">Batch execution can effectively reduce unnecessary competition                           &n bsp;         

 

- No order ordering issues: all The executed orders are processed after being batched

 

-There is no delay war: to provide a better

 

-There is no problem of miners manipulating the order of transactions: preventing front-running

 

-There is no problem of gas war

 

-There is no miner monopoly problem

 

Dynamic batching period

 

-The binding period can be extended when the price fluctuates sharply

 

-Longer tranches provide traders with more opportunities for price discovery

 

-Price Discovery The process will be more balanced and smooth

 

2. Exchange price parity model

 

The exchange price equivalence model will redefine the fixed product model so that the exchange price is equal to the price in the pool after exchange:

 

 

Pool price = (X token reserve + X token order volume) / (Y token reserve - X token transaction volume / exchange price) = exchange price

 

Through the above formula, we can get:

 

Exchange price=(X token reserve + 2*X token transaction volume)/Y token reserve

Note: The fixed product formula is in this model Invalid

 

Prevent price fluctuation after exchange

 

 

p>

-After the exchange is completed, the pool price remains the same as the exchange price

 

-There is no price fluctuation amplification caused by fixed product in this model




From the above figure, we can see that the fixed product model will amplify price fluctuations, while the exchange price equivalence model can effectively prevent the amplification of fluctuations.

 

3. Hybrid exchange



Note: Figure 1 is the order book model, Figure 2 is the liquidity pool model, and Figure 3 is the hybrid model


AMM+order book

 

-Allow limit pending orders

 

- Every time a batch is executed, the order book will use the traditional matching mechanism

 

-in this process, the liquidity pool will use The quantity of limit orders calculated by the exchange price peer-to-peer model participates in order matching

 

Matching mechanism in batch processing

 

- Limit orders in each liquidity pool will be accumulated in the order book

  ;

-Every time a batch transaction is processed, the order book performs order matching through the traditional matching mechanism

 

-During this process, the liquidity pool will participate in order matching and provide limit orders based on the order volume calculated by the exchange price peer-to-peer model

 

Advantages of Hybrid Exchange

 

-AMM model for traders Provides very stable liquidity support

 

-However, the liquidity in the pool has a delay for real-time trading volume

 

-Limit orders can provide sufficient liquidity support for immediate liquidity needs

 

Analysis of the liquidity module:




Traditional

 

Batch transactions

 

-Different from centralized exchanges and ordinary AMMs, the transaction exchange of batch transactions is discontinuous

 

- Orders are accumulated in the order book and then batches are matched

 

- Each batch Unmatched transactions in the order book will be kept in the order book and will be matched with transactions in other batches in the future

 

Unified exchange price for each batch

 

-There is a unified exchange price for each batch

 

-The transactions in a batch will be executed according to the uniform exchange price, regardless of the order status

 

Partial Execution (Close)

 

- Unlike other AMM models, Hybrid Exchange The model will allow partial execution based on order book and liquidity pool conditions

 

-partial execution will only occur when the order price When it is the same as the exchange price

 

Joining the liquidity pool

 

< p line="ODBP">-Different from traditional algorithms, the liquidity pool will affect the order matching results

 

- The liquidity pool performs order matching under the condition of following the exchange price peer-to-peer model

 

When the order book and the exchange price are known Order Matching Rules

 

X Exchange Y

 

-If the order price>When exchanging the price, all orders must be matched and executed

 

-If the order price ==When the price is exchanged, the order will be fully/partially executed

 

-If the order price is <when the price is exchanged, The order will not be executed

 

Y for X

 

-If the order price < exchange price, all orders must be matched and executed

 

- If the order price == the exchange price, the order will be fully/partially executed

 

-if the order price>exchange

 

Exchange Price Equivalent Model

 < /p>

This model determines the total amount of orders that the liquidity pool will provide at a certain exchange price

 

-Situation 1) When the exchange price == the middle price of the current pool

 

In this case, the liquidity pool Orders will not be provided

 

-Case 2) when the exchange price>

 

The total amount of Y token orders in the pool = (exchange price Y reserve - X reserve) / (2 times the exchange price)

 

-Case 3) When the exchange price < the middle price of the current pool, the liquidity pool provides X Tokens

 

The total amount of X token orders in the pool = (X reserve amount - exchange price * Y reserve amount) / 2

 

Flowchart:




White Paper Link
< p>


Welcome to join the official BlockBeats community:

Telegram Subscription Group: https://t.me/theblockbeats

Telegram Discussion Group: https://t.me/BlockBeats_App

Official Twitter Account: https://twitter.com/BlockBeatsAsia

举报 Correction/Report
Choose Library
Add Library
Cancel
Finish
Add Library
Visible to myself only
Public
Save
Correction/Report
Submit