Decentralized Exchanges (DEX) with Automated Market Maker (AMM) Protocols
Total Page:16
File Type:pdf, Size:1020Kb
SoK: Decentralized Exchanges (DEX) with Automated Market Maker (AMM) protocols Jiahua Xu Nazariy Vavryk Krzysztof Paruch Simon Cousaert UCL CBT reNFT Vienna University of Economics and Business UCL CBT Abstract—As an integral part of the Decentralized Finance liquidity providers benefit from asset supply with exchange (DeFi) ecosystem, Automated Market Maker (AMM) based fees from pool users. Furthermore, maintaining the state of Decentralized Exchanges (DEXs) have gained massive traction an order book is computationally expensive, which is costly with the revived interest in blockchain and distributed ledger technology in general. Most prominently, the top six AMMs— given the native price mechanism on the Ethereum blockchain. Uniswap, Balancer, Curve, DODO, Bancor and Sushiswap— While this problem is minimized by keeping the order books hold in aggregate 15 billion USD worth of crypto-assets as off-chain, DEX with AMMs allows for more accessible liq- of March 2021. Instead of matching the buy and sell sides, uidity provision, especially for low-liquid assets. AMMs employ a peer-to-pool method and determine asset Despite apparent advantages such as decentralization, au- price algorithmically through a so-called conservation function. Compared to centralized exchanges, AMMs exhibit the appar- tomation and continuous liquidity, AMMs are often charac- ent advantage of decentralization, automation and continuous terized by high slippage with asset exchange and divergence liquidity. Nonetheless, AMMs typically feature drawbacks such loss with liquidity provision. Throughout the last three years, as high slippage for traders and divergence loss for liquidity new protocols have been introduced to the market one after providers. This work establishes a general AMM framework another with incremental improvements and the attempt to describing the economics and formalizing the system’s state-space representation. We employ our framework to systematically com- tackle different issues which were identified as weak spots pare the top AMM protocols’ mechanics, deriving their slippage in a previous version. and divergence loss functions. We further discuss security and While innovative on certain aspects, the various AMM privacy concerns associated with AMM DEXs, and conduct a protocols generally consist of the same set of composed comprehensive literature review on related work covering both mechanisms to allow for multiple functionalities of the system. DeFi and conventional market microstructure. Index Terms—Decentralized Finance, decentralized exchange, Therefore these systems are structurally similar, and their automated market maker, blockchain, Ethereum main differences lie in parameter choices and/or mechanism adaptations. Describing a class of mechanisms that defines I. INTRODUCTION the characteristics of an AMM allows assessing the differences A. Background of design choices and their impacts on the system to conse- With the revived interest in blockchain and cryptocurrency quently discuss the structural composition of AMMs and make among both the general populace and institutional actors, the statements about their stability for different market conditions. past year has witnessed a surge in crypto trading activity and B. Contributions increasing competition and accelerated development in the Decentralized Finance (DeFi) space. This work establishes a taxonomy of the major components Among all the prominent DeFi applications, Automated of an AMM focusing on stakeholder roles, asset types, mech- Market Makers (AMM) based Decentralized Exchanges anisms, metrics and attack vectors. This framework is used (DEXs) are on the ascendancy, with an aggregate value locked for a comparative analysis of selected projects by comparing exceeding 15 billion USD at the time of writing.1 Different slippage and divergent loss functions of example protocols. arXiv:2103.12732v3 [q-fin.TR] 19 Apr 2021 from order-book based exchanges where the market price This work represents the first systematization of knowledge of an asset is determined by the last matched buy and sell in AMM-based DEXs with deployed protocol examples to the orders, each AMM uses a so-called conservation function that best of our knowledge. determines asset price algorithmically by only allowing the II. AMM PRELIMINARIES exchange rates to move along predefined trajectories which are conditioned upon the quantities of available assets. AMMs This section presents a taxonomy of the main components implement a peer-to-pool method, where liquidity providers across major decentralized exchanges [1]. To guide the fol- contribute assets to liquidity pools while individual users lowing formal definitions, Uniswap can be used as an intuitive exchange assets with a pool containing both the input and example. This protocol allows exchanging two tokens via the the output assets. Exchange users obtain immediate liquidity use of one liquidity pool containing both assets. A constant without having to find an exchange counterparty first, whereas product function is parametrized at the time of pool inception, defining a number that has to hold true as the product of both 1https://defipulse.com/ asset quantities for all future states of the system. This property determines the swap prices as any trade must uphold the B. Assets constant product under updated asset amounts in the pool. The Several distinct sorts of assets are used in AMM protocols liquidity is provided to the pool by liquidity providers, which for operations and governance. One or more assets can fulfil receive a pool share representing their relative contribution to several functionalities; one asset may assume multiple roles. the pool. The trading fee for token swaps is accumulated in a) Risk assets: This is the primary type of asset for which the pool and therefore acts as a reward for liquidity providers. the protocol was designed: to provide liquidity in these assets, Other protocols extend this basic functioning, and their specific to facilitate exchange between them and to allow liquidity components are discussed later in this paper. providers to earn rewards in return for their contribution. Typ- ically many different risk assets are involved in one protocol - A. Actors they have to be whitelisted, compatible with the protocol and fulfil the technical requirements (e.g. ERC202 for most AMMs a) Liquidity provider (LP): A liquidity pool creator is on Ethereum). the first liquidity provider (LP) when deploying a new smart b) Base assets: For some protocols, a trading pair always contract that acts as a liquidity pool with some initial supply of consists of a risk asset and a designated base asset. In the case crypto assets. Other LPs can subsequently increase the pool’s of Bancor, every risk asset is paired with BNT, the protocol’s reserve by adding more of the assets that are contained in the native token with an elastic supply [4]. In their early version, pool. In turn, they receive pool shares proportionate to their Uniswap required every pool to be initiated with ETH as one liquidity contribution as a fraction of the entire pool [2]. LPs of the risk assets making it an obligatory base asset. Many earn transaction fees paid by exchange users. While sometimes protocols, such as Balancer and Curve are managed without a subject to a withdrawal penalty, LPs can freely remove funds designated base asset as they connect two or more risk assets from the pool [3] by surrendering a corresponding amount of directly in the composition of their portfolios. pool shares [2]. c) Pool shares: Also known as “liquidity shares” and The liquidity pool must be initialized with two or more “liquidity provider shares”, pool shares represent ownership different assets for the smart contract to parametrize the in the portfolio of assets within a pool, and are distributed conservation function and set the initial relative prices. Pool to liquidity providers. Shares qualify for the reception of fees creators initialize the pool with quantities that reflect the that are earned in the portfolio whenever a trade occurs. Shares market prices to avoid unnecessary divergence loss. The act can be redeemed at any time to withdraw back the liquidity of liquidity provision or removal updates the value of the initially provided. conservation function invariant(s) (see Section III). Liquidity d) Protocol tokens: Protocol tokens are used to represent providers are also called liquidity miners due to new protocol voting rights in a decision formation process defined in the tokens minted and distributed to them as a reward in addition protocol and are thus also termed “governance tokens”. Pro- to pool shares when they supply funds. Like centralized tocol tokens are typically valuable assets that are sometimes exchanges, an AMM-based DEX can facilitate an initial ex- tradeable even outside of the AMM and can incentivize change offering to supply a new asset through liquidity pool participation. For example, they might be rewarded to liquidity creation. providers in proportion to their liquidity supply. b) Exchange user (Trader): A trader submits an ex- C. Fundamental AMM economics change order to a liquidity pool by specifying the input and output asset and one associated quantity - the smart contract 1) Rewards: AMM protocols often run several reward will automatically calculate the exchange rate based on the schemes, including liquidity reward, staking reward, gover- conservation function and execute the exchange order accord- nance rights, and security reward, distributed to