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
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 I summarizes the cost functions of the AMM given the following information
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
- 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:
- An analysis of Uniswap markets for further discussions on CPMs and CMM
- Issues in Derivative Automated Market Markers for further discussion of AMMs and DeFi.