Research Summary - Automated Market Makers for Decentralized Finance (DeFi)

TLDR:

  • Decentralized Finance (DeFi) applications rely on automated market makers (AMMs) to continuously and accurately price assets users can trade.
  • Current AMMs may be vulnerable to front-running attacks or may not abide by the principles of supply and demand.
  • A constant circle/ellipse, utilizing only the first quadrant of the quadrant plane, is an AMM proposal which is computationally efficient and may provide benefits over existing constant product/mean/sum/etc AMMs.
  • The proposed constant circle/ellipse market maker is more robust against front-running attacks and has a concave cost function allowing for the principle of supply and demand to hold.

Core Research Questions

Are constant circle/ellipse-based cost functions a preferred substitute for automated market makers than currently used cost functions?

Citation

Wang, Yongge. “Automated Market Makers for Decentralized Finance (DeFi).” arXiv preprint arXiv:2009.01676 (2020).

Background

Glossary:

  • Automated market makers (AMM): a decentralized exchange protocol relying on mathematical formulas to accurately and continuously price assets.
  • Path independence: when a market moves from one state to another the payment/cost is independent of the paths it moves in. In other words, anyone making trades in the market must take on some risk when they place transactions, thus, trades are not always guaranteed to be profitable.
  • Translation invariance: the cost of buying payout x always costs x.
  • Liquidity sensitivity: liquid markets are less affected by fixed-size investments than illiquid markets.
  • Logarithmic market scoring rule (LMSR): proposed by Robin Hanson it is the de facto automated market maker for prediction markets. Allows for markets to maintain prices of assets.
  • Liquidy sensitive logarithmic market scoring rule (LS-LMSR): proposed by Othman et al this market scoring rule allows for inclusion of path independence, translation invariance, and liquidity sensitivity to be incorporated into the base LMSR, resulting in a more robust market maker.
  • Front-running attack: when an attacker has prior access to market information and is able to make trades benefiting their position and potentially damaging the position of others.

Summary

  • A basic overview of DeFi applications and implementations is provided.
  • The author provides an overview of prediction markets and various models of automated market makers.
    • Table I summarizes the cost functions of the AMM given the following information
      • a=given constant a
      • b=given constant b
      • C(q) = cost of all outstanding tokens
      • q=number of all outstanding tokens of all token types

Table 1: Automated Market Makers and Their Cost Functions

  • The researcher compares different cost functions in terms of supply and demand, coin liquidity, and price fluctuations.
  • The author gives theoretical examples of the results of a front-running attack on a constant product market and a constant circle market.
  • Finally, the author gives a brief example of how adding tokens to an existing market may adjust the price interval allowing for the continued functionality of an existing LS-LMSR AMM.

Method

  • The researcher uses the underlying mathematical theory and examples of multiple automated market makers to demonstrate potential outcomes given different assumptions.
    • Using theoretical examples the researcher points out potential problems with existing AMMs
  • Using a theoretical coin pairing of USDT and Spade Token, the author compares the pros and cons of different AMMs using an initial market state of 1000 USDT and 1000 Spade Tokens.
    • By utilizing the cost functions of the AMMs, the author is able to demonstrate the potential pros and cons using the theoretical coin pairing.
  • The author models a front-running attack by using the cost functions of constant product and constant circle AMMs.

Results

  • LMSR automated market makers may be subject to manipulation if used as individual price oracles.
    • LMSR based markets are optimal only when outstanding token shares are evenly distributed.
    • The LMSR cost-functions in Figure 1 indicate a purchaser may only need a small amount of one coin type to purchase all outstanding coins of another coin in the market maker. For example, a purchaser may only need 1 coin A purchase all of the outstanding coin B.

  • The cost function of LS-LMSR market is concave.
    • This may be a disadvantage as it does not follow the principle of supply and demand. The concavity of the LS-LMSR implies that if the supply of a token increases, the price of the token may not always decrease.
  • The tangent line of a constant product cost curve can range from negative infinity to zero.
    • This implies the price of tokens utilizing a constant product market may fluctuate sharply.
    • If the total cost of an initial constant product market is relatively small, it may be easy for an attacker to control market prices of certain coins/tokens.
  • Constant circle/ellipse cost curves display a relatively smooth tangent line function.
    • This implies the prices of coins/tokens fluctuate smoothly.
    • The cost function is convex meaning when supply of a token increases the price decreases.
  • LS-LMSR and constant circle/ellipse AMM are more robust against front running attacks.
    • The tangent function of both fluctuates more smoothly than those of constant product/mean cost function, making LS-LMSR and constant circle/ellipse functions more robust.
    • Figure 2 demonstrates the cost function curves of the different AMMs with the given inputs of two tested tokens each with a supply of 1,000. The smoother the curve, the more robust against front-running attacks the AMM is.

Figure 2: Automated Market Makers and Their Cost Functions

|592x410.00000000000006

  • Figure 2 indicates the order of tested AMMs from most robust to least robust against front running attacks is as follows: LS-LMSR, concave circle, constant sum, convex circle, and finally constant product.

Discussion

  • Constant circle/ellipse markets can limit the amount an attacker can manipulate a token’s price, as the price can only fluctuate within a fixed price amplitude due to the constraints of a constant circle/ellipse cost function. This may allow for the construction of an automated market with a small amount of liquidy. However, it may be argued that the fixed amplitude allows less flexibility in the market.
  • Constant product markets may allow for a small amount of liquidity to be more easily manipulated by bad actors, resulting in an attacker potentially taking advantage of DeFi applications utilizing the constant product market.

Applicability

It is essential for DeFi applications to pick automated market makers that allow for flexibility in trading while providing security to their users. Many AMMs exist, each with their own pros and cons. A DeFi application considering implementing the proposed constant circle/ellipse automated market maker should consider two key aspects of the proposal:

  • To adhere to the principle of supply and demand, the market must utilize the convex part of the constant circle/ellipse cost function as it will ensure that if a token’s supply increases its price decreases.
  • The fixed price amplitude may be less flexible than other AMMs. Users may prefer the potential opportunities offered by more flexible AMMs and choose a different platform.

However, the potential security against front-running attacks the proposed constant circle/ellipse AMM provides may increase user confidence and encourage more users to migrate to the project.

Note: be sure to check out our related posts:

  1. An analysis of Uniswap markets for further discussions on CPMs and CMM
  2. Issues in Derivative Automated Market Markers for further discussion of AMMs and DeFi.
4 Likes

Is there more research on this tradeoff? Are circle/ellipse markets less efficient when there is sufficient liquidity or during periods of fast moving markets?

3 Likes

Unfortunately, I cannot find any other research regarding this tradeoff. The author does make the following two claims regarding situations with LOW liquidity:

“For the constant product cost market, if the patron incorporates the automated market maker by deposing a small amount of liquidity, an attacker with a small budget can manipulate the token price significantly in the automated market maker and take profit from other DeFi applications that use this automated market maker” (pg 13)

and

“For constant circle/ellipse based automated market makers, the patron can use a small amount of liquidity to set up the automated market and the attacker can only manipulate the token price within the fixed price amplitude.” (pg 13)

I’ve been trying to find other research that backs up the specific claim you brought up but it seems as though since this is the first paper (at least that I have found) discussing the potential implications of a constant circle/ellipse AMM that there is a lack of supporting research regarding their claims at the moment.

4 Likes

I’d be really interested to hear about this paper connects to some of the recent news about front-running attacks and Miner Extractible Value. Given what we know now does it still make sense that constant/circle/ellipse-based cost functions are preferred to the cost functions mentioned in the paper?

4 Likes

Interesting article. I was trying to make parallels with web2 market maker issues (CFD platforms need AMM systems to ensure instant execution) and doing so I realised that there are no mention of other type of toxic flow that might interfere with pricing such as fake pending orders and arbitrage.
Additionally, I see no focus on execution time even if in my opinion it can solve some issues and give an edge to the AMM.

1 Like

In this case, why don’t divide the pool in equal cells and each investor has to buy only full cells, like, if the total supply is 1000, each investor has to buy multiple of 1 or 10 thus making sure the amount is evenly distributed. This will have the con of splitting all trades in smaller units thus increasing the amount of calculation( rather than having a 50 USDT transaction, you will have 50 of 1 or 5 of 10) but will help reach the optimal state. Solution will be to optimise the MM so you could have different cell size thus optimising the transfers, like, one AMM will have cells of 1$, one will have cells of 10$ etc., each trade will be allocated accordingly to resources available and trade specifics. You might want to look into functionality of AIF (alternative investment fund) as I remember it being the web2 way of splitting investments in cells for an easier management.

There are solutions for whale protection that can be used here such as limited max holding per wallet or limiting the amount you can sell at once. (can be sorted with the cost of transfer as well, like, if you trade below 1% of all supply you pay 100% of spread/tax, 1%-5% you pay 150%, 5%-9.99% you pay 200% and over 10% you pay 500% of tax/spread)

1 Like