Behavior of Liquidity Providers in Decentralized Exchanges Ye Wang∗ Lioba Heimbach∗ Roger Wattenhofer [email protected] [email protected] [email protected] ETH Zurich ETH Zurich ETH Zurich Zurich, Switzerland Zurich, Switzerland Zurich, Switzerland ABSTRACT well. So understanding DEXes may be important beyond just Decentralized exchanges (DEXes) have introduced an in- applications. novative trading mechanism, where it is not necessary to DEXes are based on smart contracts running on a . match buy-orders and sell-orders to execute a trade. DEXes In contrast to the limit order book mechanism, traders do execute each trade individually, and the exchange rate is not need to be matched to a trading partner with opposite in- automatically determined by the ratio of assets reserved in tentions. In a DEX, trades are completed immediately when the market. Therefore, apart from trading, financial players the orders are recorded on the blockchain. can also liquidity providers, benefiting from transaction fees is the most popular DEX. As an example, consider from trades executed in DEXes. Although liquidity providers trades between BTC and ETH. The Uniswap platform offers a are essential for the functionality of DEXes, it is not clear (liquidity pool) with locked-in funds for these how liquidity providers behave in such markets. two . When a trader wants to exchange ETH In this paper, we aim to understand how liquidity providers for BTC, the trader just needs to send their ETH to the smart react to market information and how they benefit from pro- contract. The smart contract will then immediately send the viding liquidity in DEXes. We measure the operations of appropriate amount of BTC back to the trader, while the ETH liquidity providers on Uniswap and analyze how they deter- sent by the trader will be locked in the smart contract. The mine their investment strategy based on market changes. We exchange rate is primarily determined by the ratio of BTC also reveal their returns and risks of investments in different to ETH stored in the smart contract. The BTC and ETH in trading pair categories, i.e., stable pairs, normal pairs, and the smart contract are providing the liquidity for the trades exotic pairs. Further, we investigate the movement of liquid- between BTC and ETH on Uniswap. ity between trading pools. To the best of our knowledge, this In a DEX pool, liquidity is provided by liquidity providers. is the first work that systematically studies the behavior of These liquidity providers lock their cryptocurrencies into the liquidity providers in DEXes. corresponding liquidity pools. DEXes generally charge a per- centage transaction fee for each trade executed on the plat- form. This transaction fee is shared by the liquidity providers 1 INTRODUCTION in proportion to their liquidity contributions. Therefore, with Traditionally, trading is executed on centralized exchanges the emergence of DEXes, users have new investment oppor- (CEXes), using the limit order book mechanism. With this tunities in the cryptocurrency ecosystem: they can offer their mechanism, each seller is matched with a buyer for a trade. assets in DEXes as liquidity and benefit from transaction fees. In the cryptospace, when traders for instance want to ex- Many interesting questions emerge: How many differ- change Ether (ETH) with (BTC) through a CEX, they ent pools are liquidity providers invested in? What are the have to transfer their ETH to the account of the centralized expected earnings from transaction fees? How do liquidity arXiv:2105.13822v1 [q-fin.CP] 28 May 2021 operator, submit their sell orders of ETH, wait for matching providers react to market forces? Do liquidity providers redis- corresponding buy orders of ETH, and then withdraw the tribute their assets? As DEXes are an emerging phenomenon incoming BTC from the market operators after the execution that might cross over to other markets beyond cryptocurren- of their orders. This is cumbersome but also risky, since the cies, it is interesting to understand the motives of liquidity funds are temporarily with the CEX. providers. Recently, there is an alternative in the form of decen- In this paper, we quantitatively measure the behavior of tralized exchanges (DEXes). Currently DEXes are popular liquidity providers. We collect data from Uniswap, the most in cryptocurrency markets, but eventually fiat currencies, popular DEX in the cryptocurrency ecosystem, to study liq- stocks or other commodities might be traded on DEXes as uidity provider contributions, returns, and strategies. First, we analyze the distribution of liquidity providers in Uniswap, ∗The first two authors have equal contribution. examining the creation of liquidity pools, the distribution Submission Ye Wang, Lioba Heimbach, and Roger Wattenhofer of liquidity, and the participation of liquidity providers in 2.1 Blockchain and ERC20 these pools. Although Uniswap allows users to create liq- Standard uidity pools between any pair of tokens, more than 80% of Ethereum is a public blockchain platform, which supports liquidity pools include ETH, and six popular tokens domi- Turing complete smart contracts. Compared to earlier blockchain nate the market. Moreover, more than 60% liquidity is locked systems, such as Bitcoin, Ethereum provides a decentralized in the top 24 pools. Cryptocurrency holders act restrained virtual machine, the Ethereum Virtual Machine (EVM), to concerning these new investments: approximately 70% of execute smart contract code. A smart contract is a set of pro- providers reserve their liquidity in a single pool. However, grams written in high-level languages, e.g., Solidity. These these seemingly conservative liquidity providers contribute programs will be compiled into executable byte-code. After more than 50% of the liquidity in the most popular pools. the creation of the smart contract, the executable byte-code This indicates that individual providers, as opposed to pro- will be stored in an independent database of the blockchain. fessional market makers, control the liquidity of DEXes. In Any Ethereum users can invoke functions defined in a smart examining the addition and removal of liquidity day by day, contract. we find that the market change of liquidity is relatively sta- Ethereum supports three kinds of transactions: a simple ble, i.e., the correlation between the number of injections transaction, where the recipient is another address (account) and withdrawals is 0.922. to transfer the native currency, ETH; a smart contract creation To understand the behavior of liquidity providers, we transaction, without recipient is the null to create a new smart study the risks and returns they face across three different contract; a smart contract execution transaction, where the pool Uniswap categories: stable, normal and exotic. We find recipient is a smart contract address to execute a specific that while stable and normal pairs may provide attractive function of that contract. investment opportunities for liquidity providers depending When a transaction is included in a block by a miner, the on the individual risk tolerance and return expectations, the operation corresponding to the message takes effect. The exotic pools investigated are not. Those demonstrated deeply miner who creates the block modifies the state of correspond- negative returns accompanied by high risk. ing accounts based on the messages. Each step of the miner’s Liquidity providers do not frequently move their assets operation consumes a certain amount of gas, and the amount across different pools, seemingly indifferent to price changes of gas consumed in each block is capped. Users need to spec- or other market indicators. However, we observe that many ify a gas price for the operation execution when sending traders redistribute their liquidity given the opportunity to transactions. The fee paid by the initiator of a transaction earn additional benefits of liquidity mining on top of trans- to miners is determined by the amount of gas consumed action fees. This inspires to study what external factors are and the gas price (gas fee = gas price × gas consumption). influencing the behavior of liquidity providers. The miner will include a receipt of the executed transactions This paper makes the following contributions. First, we in Ethereum blocks as well, including the information on conduct a systematic investigation on the liquidity providers whether the transaction has been executed successfully, the in Uniswap to outline the participants of users in such emerg- gas fee, the identity of the transaction and the block, and ing trading activities. Second, we classify three categories of other information generated during the execution. liquidity pools and analyze the investment returns and risks Based on the support of the smart contract, users can of liquidity providers in those pools. We present the variabil- create cryptocurrency other than ETH on Ethereum. These ity of investment strategies for different types of liquidity smart contracts have to follow some standards; the most pools. Finally, we demonstrate the movement of liquidity widely used standard is the ERC20 standard, which requires around the entire DEX and suggests the significant influence an approve function and a transferFrom function. When an of external factors on liquidity providers, such as liquidity address (account) 푎푑푑푟 calls the function approve(푎푑푑푟 , 푣), mining activities. 푎 푏 then the address 푎푑푑푟푏 can transfer at most 푣 tokens in to- tal from 푎푑푑푟푎 to other accounts. After this approval, 푎푑푑푟푏 ′ can transfer 푣 tokens from 푎푑푑푟푎 to another account 푎푑푑푟푐 푎푑푑푟 푎푑푑푟 푣 ′ 2 BACKGROUND AND RELATED WORK by calling the function transferFrom( 푎, 푐 , ), where Í 푣 ′ ≤ 푣. In this section, we introduce the background of DEXes. First, we present the technology basis of the Ethereum blockchain, smart contracts, and the mechanism of DEXes. We also re- 2.2 DEXes view two types of previous work: quantifying user behavior DEXes are smart contracts on Ethereum. Users send mes- on DEXes and analyzing returns of liquidity providers. sages to a DEX address to invoke functions for performing Behavior of Liquidity Providers in Decentralized Exchanges Submission, market operations. DEXes support these operations: cre- Providers can also remove their tokens from the liquidity ate the trading (liquidity) pool between a pair of tokens, pool. The amount of tokens providers can redeem is related to adding/removing liquidity, and exchanging tokens. We take the amount of liquidity tokens they own. Assume a provider Uniswap as an example to present these operations. Uniswap has 훿휆 liquidity tokens of the liquidity pool 퐴 ⇌ 퐵 and is often also called an automated market maker DEX or a the total supply of liquidity tokens is 휆. The provider can constant function market maker DEX. There are currently withdraw 훿푎 of 퐴 and 훿푏 of 퐵 from the 퐴 ⇌ 퐵 pool with 훿′ three Uniswap versions, V1, V2, and V3. Uniswap V2 is the 훿 ′ ≤ 훿 훿푎 = 훿푏 = 휆 훿 ′ 휆 휆 liquidity token, where 푎 푏 휆 . The 휆 of predominated market at the time of this writing. So we liquidity tokens will be burned (destroyed) after they redeem study Uniswap V2 as example in this paper as it provides the money and the total supply of liquidity tokens becomes us with the biggest data set. Furthermore, other DEXes, e.g. Λ = 휆 − 훿 ′ . Sushiswap, have similar mechanisms as Uniswap V2. 휆

2.2.1 Creating Liquidity Pools. In Uniswap, exchanges 2.2.3 Exchanging Assets. In Uniswap, tokens are not ex- between two tokens are conducted through a liquidity pool, changed between two traders but between a trader and the i.e., a smart contract that keeps the pair of tokens. There liquidity pool. The exchange of assets is realized in two steps. are two participants involved in the market: the liquidity First, the traders sends their tokens to the liquidity pool. provider and the trader. Providers reserve their tokens in the Second, the liquidity pool computes the exchange rate and liquidity pool, while traders exchange their tokens with the returns the targeted token to the traders. 훿 퐴 퐵 liquidity pool. Because providers contribute to the market Assume traders wants to exchange 푎 of for token and liquidity, they benefit from the transaction fees incurred with the liquidity of 퐴 and 퐵 are 푎 and 푏. They first need to let transactions in DEXes. the Uniswap address get the approval for transferring his 퐴 Assume we have two tokens 퐴 and 퐵, and we want to token to other accounts. After receiving the exchange order 훿 퐴 create a liquidity pool between 퐴 and 퐵 on Uniswap. We first from the traders, the Uniswap contract transfers 푎 of to 훿 퐵 send a smart contract execution transaction with the ERC20 the liquidity pool address and returns 푏 of back to the smart contract address of 퐴 and 퐵 to the Uniswap to claim traders. the creation of the liquidity pool 퐴 ⇌ 퐵. The smart contract The following equation always holds during the exchange: 퐴 퐵 푎 ·푏 = (푎 +훿 ·푟 )·(푏 − 훿푏 ), where 푟 and 푟 denote the trans- will then check whether the pool between and exists 푎 1 푟2 1 2 according to the addresses of two tokens. If not, Uniswap action fee ratio in asset 퐴 and 퐵 respectively. In Uniswap, smart contract will create a new liquidity pool 퐴 ⇌ 퐵, i.e., a 푟1 = 0.997 and 푟2 = 1, which indicates that the transaction new smart contract reserving these two tokens. fee is equal to 3‰·훿푎. The remaining liquidity in the pool equals to (푎 + 훿 ,푏 − 푟1 ·푟2 ·푏 ·훿푎 ) and the amount of liquidity 푎 푎+푟1 ·훿푎 2.2.2 Adding/Removing Liquidity. After creating the liq- tokens does not change. uidity pool between 퐴 and 퐵, liquidity providers can add a token pair to the liquidity pool. Liquidity providers need to approve the Uniswap address to transfer their 퐴 token and 퐵 2.3 Liquidity in DEXes token from their address to the liquidity pool address. When This paper aims to study liquidity providers in DEXes quan- a Uniswap contract receives a liquidity providers call to add titatively. In this section, we review previous work in two liquidity, it will invoke the transferFrom function in ERC20 aspects: quantitative studies of market behavior in DEXes, contracts to transfer tokens from the provider’s address to and studies on liquidity providers in DEXes. the liquidity pool address. Since all transaction information is broadcast through the If there are no tokens reserved in the liquidity pool, users blockchain network and all transactions in DEXes are pub- 퐴 퐵 can supply any amount of and to the liquidity pool, and lic to all market participants, researchers are able to study the pool will return liquidity tokens as proof of the deposit. If the market behavior of traders in cryptocurrency ecosys- 퐴 퐵 푎 푏 the amounts of and provided by the providers√ are and , tems. Chen et al. [3] provide a basic view of the ERC20 to- respectively, then the provider will get 휆 = 푎 × 푏 liquidity kens on Ethereum. They visualize how cryptocurrencies tokens. Meanwhile,√ the total supply of liquidity tokens of are created, held, and transferred by traders. Other works 퐴 ⇌ 퐵 pool is Λ = 푎 × 푏. explore more detailed behavior of traders in the markets. With 푎 of token 퐴 and 푏 of token 퐵 already in the liquidity Daian et al. [4] measures front-running trades on DEXes. pool, a provider can reserve 훿푎 of its asset 퐴 and 훿푏 of its Because of the transparency and latency of DEXes trans- asset 퐵 in the liquidity pool simultaneously, where 훿푎 = 푎 . actions, traders are able to observe profitable transactions 훿푏 푏 훿푎 before they are executed and place their own orders with Then they will earn 훿휆 = 푙 · liquidity tokens for the 퐴 ⇌ 퐵 푎 higher fees to front-run the target victim. Such behaviors and the total supply of liquidity tokens becomes Λ = 휆 + 훿휆. Submission Ye Wang, Lioba Heimbach, and Roger Wattenhofer result in a high miner-extractable value, which brings sys- 23, 2021)1. We develop and launch a modified version of go- temic consensus-layer vulnerabilities. Torres et al. [10] and ethereum client, which exports all transactions executed on Qin et al. [8] quantify the revenue of traders who conduct Uniswap. a combination of front-running and back-running transac- The addresses of liquidity pool smart contacts are stored tions, i.e., sandwich attacks [13], demonstrating the normal in the UniswapV2Factory contract. We query this contract transactions are vulnerable to arbitrageurs. Wang et al. [12] to get the contract addresses and token pairs of 29,235 avail- study another arbitrage behavior, i.e., cyclic arbitrages (tri- able trading pools until January 23, 2021. Then, we find angular arbitrages) in Uniswap, which profits traders with 21,830,282 transactions interacting with these liquidity pools price differences across different trading pools. They claim as Uniswap trades and filter those containing Mint and Burn that implementing transactions with private smart contracts events, representing adding liquidity, and removing liquidity, is more resilient to front-running attacks than directly call- respectively. ing public functions of DEXes smart contracts. Although In each Mint event, liquidity tokens of the liquidity pool previous studies have provided an in-depth understanding will be generated by the liquidity pool smart contract and of traders in the cryptocurrency ecosystems, they mainly then transferred from the 0 address to the address of liquidity focus on the behavior of normal traders. The novel trading providers. Similarly, in each Burn event, liquidity providers option of providing liquidity on DEXes has not been well transfer their liquidity tokens to the 0 address. Moreover, studied. Therefore, this paper aims to fill the research gap some traders may exchange liquidity tokens in other trans- and inspires more work in this direction. actions, while liquidity pools will generate Transfer events A separate line of work has analyzed the returns of liq- to record such liquidity token movements. With the infor- uidity providers theoretically with microstructure models. mation of Mint, Burn, and Transfer events, we compute the Evans [5] studies the returns of liquidity providers when balance of liquidity tokens of liquidity providers in each pool. there is no transaction fee charged and claims that it is better To further evaluate the behavior of liquidity providers to invest in constant-mix portfolios than providing liquidity. and its dependence on pool characteristics on Uniswap, we Moreover, Evans et al. [6] develop a framework for deter- require the price of each cryptocurrency in a common cur- mining the optimal transaction fees for AMM DEXes and rency – USD in our case. As many cryptocurrencies do not show that providing liquidity to DEXes is preferable to all have a market price, we first compute the price of each cryp- alternative trading strategies as fees approach zero. Aoyagi tocurrency studied in ETH. This data is obtained from the [2] conducts a game-theoretical analysis between liquidity common pool with ETH of the cryptocurrency in question. providers and informed traders to estimate the returns of liq- Such a pool exists for most cryptocurrencies. The ETH price uidity providers in DEXes. These studies have ideal assump- then allows us to calculate the value of each token in USD tions on information delivery and price fluctuations of assets, historical data for the ETH price in USD from coinbase2. which do not coincide with the real scenarios. Moreover, they have not considered how liquidity providers choose between 4 LIQUIDITY DYNAMICS IN DEXES different trading pools. To the best of our knowledge, none In this section, we provide an overview of liquidity pools of the previous studies have empirically analyzed the trad- on Uniswap. Unlike traditional centralized exchanges where ing behavior of liquidity providers in real DEXes. To better only the cryptocurrencies permitted by operators can be understand the new trading option in DEXes, we measure traded on the platforms, DEXes allow any Ethereum users to the real behavior of liquidity providers in Uniswap and study create trading pools between any pair of tokens. As shown how they react to market indicators, which will inspire bet- in Figure 1, the number of liquidity pools increases quickly ter theoretical models for analyzing liquidity providers in with the emergence of Uniswap and continues to rise at a DEXes. rate of over 100 per day until November 2020. After that, the daily growth of liquidity pools has gradually slowed down and keeps at a rate of 50 pools per day by the end of January 2021. In total, we find 29,235 available liquidity pools, which 3 DATA DESCRIPTION involve 25,231 cryptocurrencies, while 22,828 tokens only have a single trading pool. The most popular token is ETH, To measure the behavior of liquidity providers in Uniswap 24,011 tokens share a liquidity pool with ETH. Except for and understand how their trading strategies are influenced ETH, the most popular cryptocurrencies are USDT (1321), by market factors, we collect all transactions recorded on USDC (627), (542), UNI (270), and WBTC (148). These Ethereum from block 10000835 (where Uniswap V2 has been deployed, on May 4, 2020) to block 11709847 (on January 1Block data is available at https://www.ethereum.org/ 2https://www.coinbase.com/ Behavior of Liquidity Providers in Decentralized Exchanges Submission,

Liquidity Pools Liquidity Providers # Pools ·105 1.2 2+ 104 1.9 1 1.8 103 1.7 0.8 1.6 102 0.6 1.5 1.4 1 0.4 10 1.3 1.2 Number of Liquidity Pools 0.2

0 Number of Liquidity Providers 10 1.1 05-04 06-23 08-12 10-01 11-20 01-09 0 1 Date (MM-DD) 05-04 06-23 08-12 10-01 11-20 01-09 Date (MM-DD)

Figure 1: Number of liquidity pools on Uniswap from Figure 3: The number of liquidity providers over time. 4th May 2020 to 23rd January 2021. The orange dotted The gray line demonstrates the number of providers line represents the number of all liquidity pools on that only participate in one pool. The colorful dot- Uniswap, while the black line shows the number of ted line is the number of active liquidity providers in daily emerging pools. Uniswap, and the color indicates the average number of pools that liquidity providers participate.

Figure 2: Distribution of liquidity in Uniswap on Jan- uary 23, 2021. tokens are either stable coins whose value is anchored at 1 USD or tokens with high value. Until 23rd January 2021, Figure 4: Distribution of the number of liquidity pools Uniswap has reserved more than 2.5 billion ETH and more that each liquidity provider participates in. About than 60% of liquidity is located in the top 24 popular pools 10,000 only participate in a single pool (top left), and (Figure 2). some providers participate in many pools (bottom Apart from the distribution of liquidity pools, we also right). measure the participation of liquidity providers in Uniswap. Although some traders may use several addresses to provide liquidity on Uniswap, more than 82% of Ethereum users only pools, as we see the average number of pools providers are control a single account [11]. Therefore, in this paper, we involved in increases to 1.8. consider each address as a single liquidity provider. In total, As shown in Figure 4, the distribution of the number of we find 183,823 addresses add liquidity to liquidity pools on liquidity pools that each liquidity provider participates in Uniswap, while 107,352 of them keep reserving their tokens follows the power law. The largest providers participate in in Uniswap by 23rd January 2021 (Figure 3). Initially, most 120 pools and more than 96.5% of the accounts reserve their liquidity providers reserve their money only in one liquidity money in no more than 5 pools. pool, and the average number of pools they participate in is In general, becoming liquidity provider is not yet a popular less than 1.4 until September 2020. Later on, during October investment strategy in the cryptocurrency ecosystems. Most and November, liquidity providers are interested in more liquidity providers only participate in a single pool. Even Submission Ye Wang, Lioba Heimbach, and Roger Wattenhofer

Figure 5: Number of liquidity providers per pool. The DAI-WETH pool has more than 6,000 individual liq- Figure 6: Total liquidity per pool. The biggest pool is uidity providers. More than 4,000 of them only con- USDC-WETH with more than 200,000 ETH liquidity. tributed to this one (1) pool. The other colors repre- About 125,000 ETH is funded by liquidity providers sent providers which are providing liquidity to more which only contributed to this one (1) pool. The other than one (2,3,...) pool. colors represent providers which are providing liquid- ity to more than one (2,3,...) pool. for those popular liquidity pools on Uniswap, more than 70% of providers reserve their cryptocurrency assets only in one of them. Only few providers spread their assets in more than 10 pools (Figure 5). Liquidity providers reserve their cryptocurrency assets only in one pool have taken a serious role in the DEXes ecosystem, as they provide more than half liquidity in these popular pools (Figure 6). This fact suggests that DEXes are not controlled by oligopoly and professional market makers. Ordinary users contribute the most to the healthy operation of the decentralized market mechanism. During the nine analyzed months, liquidity providers have gradually added and removed liquidity from different pools, while they reserve their tokens 1,011,524 times on Uniswap (Figure 7) and withdraw them for 527,429 times (Figure 8). We find that the day by day correlation between the number of liquidity injections and liquidity withdrawals is very high (0.992), indicating that the market size is growing steadily. Figure 7: Number of mint events per month executed Moreover, in terms of days, the market behaviors of liquidity in different liquidity pools in Uniswap. In September providers are relatively consistent. Almost half of liquidity 2020 there were more then 300,000 mint events in to- operations from August to September take place in the most tal. popular pools. However, these pools become less active from October onwards. On the one hand, we may consider the liquidity in these popular pools to become stable after five we can observe a clear difference between the three types of months of the development. On the other hand, this fact also liquidity pools: normal pools, stable pools, and exotic pools. indicates a rapid change of interests in the liquidity pools of In the normal liquidity pools, both cryptocurrencies traded investors in the cryptocurrency ecosystems. in the pools have a certain value, such as 푈 푆퐷퐶 ⇌ 푊 퐸푇퐻, We have specified 12 pools with the most liquidity injec- 푊 퐵푇퐶 ⇌ 푊 퐸푇퐻, and 퐷퐴퐼 ⇌ 푊 퐸푇퐻. These cryptocur- tions and withdrawals in Figure 7 and Figure 8. As most rencies are recognized in the cryptocurrency ecosystems. liquidity operations occur in these pools, the patterns of To support trades between these cryptocurrencies, the liq- liquidity changes in these pools can represent the trading uidity in the pools is relatively high (Figure 2). Although behavior of liquidity providers in DEXes well. For instance, the price of normal tokens may fluctuate, the price trend Behavior of Liquidity Providers in Decentralized Exchanges Submission,

if the transaction fee is zero. However, in reality, liquidity providers can benefit from their contribution to the liquidity pools through strictly positive transaction fees, which results in different returns and risks compared to the previous the- oretical analysis. To better understand liquidity providers’ motivation in DEXes, we compare the return received by liquidity providers to holding the respective assets according to the given token ratio during the initial liquidity injection. The return between time 푡1 and 푡2 in percent is given as

invest푡2 invest푡1 hold − hold 푡2 푡1 , return푡1→푡2 = 100 · invest푡1 hold푡1

where invest푡 , which is the current value in USD of the liq- Figure 8: Number of burn events per month executed uidity placed in the pool at time 푡 and hold푡 is the value in in different liquidity pools in Uniswap. In September USD of the constant-mix portfolio at time 푡. 2020 there were more then 140,000 burn events. This return is positively influenced by the fees collected from trades performed in the pool and negatively impacted by the impermanent loss, otherwise referred to as divergence is relatively stable and in line with the development of the loss. Consider a liquidity pool 퐴 ⇌ 퐵 between token 퐴 and cryptocurrency ecosystem. 퐵, where the amount of 퐴 in 퐴 ⇌ 퐵 at time 푡 is denoted as In stable pools, both tokens traded in the pool are stable 푎푡 and the amount of 퐵 in 퐴 ⇌ 퐵 at time 푡 is denoted as 푏푡 . 푡 푡 coins, such as 푈 푆퐷퐶 ⇌ 푈 푆퐷푇 and 퐷퐴퐼 ⇌ 푈 푆퐷퐶. The The fees collected between time 1 and 2 as a percentage of price fluctuations of stable coins are negligible. Thus, the the liquidity are given as, market environment has little impact on stable pool liquid- √︁ ! 푘푡 ity providers. Since the price of the stable coins remains fees = 100 · 1 − 1 , 푡1→푡2 √︁푘 largely constant, liquidity providers earn profits by charging 푡2 transaction fees. where 푘 = 푎 · 푏 [1]. The impermanent loss, on the other The remaining pools are referred to as exotic pools. In such 푡 푡 푡 hand, describes the risk for liquidity providers of seeing the pools the price of one trading token is extremely volatile. value of their reserved tokens decrease in comparison to The price of these tokens changed by more than a hundred holding the assets. This occurs with any price change in the times during our measuring period. As we show in Figure 2, pool. More precisely, the impermanent loss between 푡 and although many liquidity operations have been applied on 1 푡 is given as, these pools, they are not part of the high liquidity value by 2

23rd January 2021, as little liquidity remains in the pool – √︃ 푝푡 · 2 2 푝 for example, YAM, MOON, and KIMCHI. For these exotic © 푡1 ª , impermanent loss푡 →푡 = 100 · ­ 푝 − 1® cryptocurrencies, liquidity providers take more risks because 1 2 ­ 1 + 푡2 ® 푝푡1 of their dramatic price fluctuations. When the price of the « ¬ exotic token changes drastically, the other coin they have re- where served in the pool may be emptied instantly by other traders. 푏 푝 푡 , Given the significant differences of these three kinds of 푡 = 푎푡 pools, we infer that the distribution of liquidity providers, is the ratio between tokens in the pool at time 푡 [7]. Due to their trading strategies, and the investment return across the impermanent loss, reserving of tokens runs the risk of these three categories differ. Therefore, we measure the ac- under-performing a buy and hold strategy of a constant-mix tivities of liquidity providers in these pools separately and portfolio. analyze how they react market changes. The returns and the impermanent loss may vary greatly across the different liquidity pool categories, namely nor- 5 RETURNS AND RISKS OF PROVIDING mal pools, stable pools, and exotic pools. Thus, to provide LIQUIDITY a comprehensive understanding of returns and risks of pro- Evans et al. [5] suggest that the returns of providing liquid- viding liquidity in Uniswap, we analyze them separately. ity are lower than investing in the constant-mix portfolios We look at nine pools in detail - three of each kind (stable Submission Ye Wang, Lioba Heimbach, and Roger Wattenhofer

quickly as other trades see an arbitrage opportunity due to the inaccurate price ratio. In Figure 9, 10 and 11, we show the evolution of the return, fees and impermanent loss of stable pools, normal pools, and exotic pools over time, respectively. Each of the three stable coins (USDT, USDC, and DAI) tracks the USD. Thus, the ratio between each pair is close to one at all times, and imperma- nent loss plays a subordinate role in determining the returns (a) 푈 푆퐷퐶 ⇌ 푈 푆퐷푇 and is therefore negligible. Rather, the fees received through trades in the pool dominate the return. This dependency is apparent from the almost overlaying curves for return and fees shown across all three pairs show in Figure 9. Moreover, due to negligible price fluctuations and continuous collection of fees, liquidity providers in stable pools can expect positive returns independent of the time of the liquidity injection. Therefore, providing liquidity in stable pools appears almost risk-free with consistent and stable revenue. (b) 퐷퐴퐼 ⇌ 푈 푆퐷푇 The influence of the impermanent loss on the profits of liquidity providers becomes more apparent for the two other types of pools – normal and exotic. For normal pairs (Fig- ure 10), the cumulative return fluctuates below and above zero, influenced both by the ever-changing impermanent loss and the steadily increasing fees collected. Finally, we observe even starker domination of the impermanent loss for the return rate in Figure 11. Due to the high price volatil- ity characteristic for exotic pairs, we observe impermanent losses of around 70% over a four-month period, which the (c) 퐷퐴퐼 ⇌ 푈 푆퐷퐶 collected fees cannot compensate – leading to deeply red returns. Figure 9: Evolution of the return, fees and imperma- Figure 12 illustrates the fee distribution observed in the nent loss over four months for stable pairs. Stable nine sample pools. While we can detect differences in the pairs do not suffer from impermanent loss. distributions of the fees collected in the various pools, there is no apparent pattern between the different types of pools. pairs: USDC⇌ USDT, DAI⇌USDT, and DAI⇌USDC; nor- The fees collected by liquidity providers appear to depend mal pairs: UNI⇌WETH, LINK⇌WETH, DPI⇌WETH; ex- more on the specific pair than on whether the pair is stable, otic pairs: MOON⇌WETH, KIMCHI⇌SUSHI, KIMCHI⇌ normal, or exotic. WETH)3. We choose pools through a combination of size Turning to the return rate observed in our sample pools, and variety. When analyzing the data, we observe the same Figure 13, we clearly observe patterns between the three dif- four-month period between the end of September 2020 and ferent types of pools. Due to the previously observed negligi- the end of January 2021, i.e., the time during which all nine ble influence of impermanent loss on the profits expected in sample pools were active. Further, when looking at daily stable pairs, the daily returns in stable pools are rarely, if ever, returns, we consider the average daily return as opposed to negative – Figure 13a. Thus, all having positive daily average the closing daily return to mitigate the effects of short-term returns of around 0.03%. For the normal pairs, Figure 13b, we in-balances in pool reserves. Such imbalances occasionally observe significantly higher volatility in the returns, accom- 퐿퐼푁퐾 푊 퐸푇퐻 occur after trades that are large in comparison to the pool panied by both higher (0.04% for ⇌ ) and lower 퐷푃퐼 푊 퐸푇퐻 reserves. Due to the influence of the impermanent loss on (0.00% for ⇌ ) daily returns than previously seen the returns, the inaccurate price ratio causes starkly nega- for the stable pairs. Finally, the exotic pairs seen in Figure 13c tive returns. However, these temporary imbalances recover are characterized by even larger return volatility and very negative daily returns (-0.76% for 퐾퐼푀퐶퐻퐼 ⇌ 푆푈 푆퐻퐼). 3In picking pools, we excluded liquidity mining pools (i.e., WETH⇌USDT, To summarize the risks and returns associated with pro- WETH⇌USDC, WETH⇌DAI and WETH⇌WBTC), as the influence of the viding liquidity, we turn to Figure 14. There we plot the liquidity mining program clearly presents itself in the data. daily mean returns observed in each sample pool against the Behavior of Liquidity Providers in Decentralized Exchanges Submission,

(a) 푈 푁퐼 ⇌ 푊 퐸푇퐻 (a) 푀푂푂푁 ⇌ 푊 퐸푇퐻

(b) 퐿퐼푁퐾 ⇌ 푊 퐸푇퐻 (b) 퐾퐼푀퐶퐻퐼 ⇌ 푆푈 푆퐻퐼

(c) 퐷푃퐼 ⇌ 푊 퐸푇퐻 (c) 퐾퐼푀퐶퐻퐼 ⇌ 푊 퐸푇퐻

Figure 10: Evolution of the return, fees and imperma- Figure 11: Evolution of the return, fees and imperma- nent loss over four months for normal pairs. Some- nent loss over four months for exotic pairs. The fees body funding LINK-WETH in November, and pulling should be much higher considering the risk of imper- out in January would have suffered a loss, since the ac- manent loss. cumulated fees do not make up for the impermanent loss.

푈 푁퐼 ⇌ 푊 퐸푇퐻 exhibit higher returns than at least the ma- daily conditional value at risk (CVaR). CVaR is a coherent jority of stable pairs, but with that also carry higher risks. risk measure that represents the average worst-case scenario. All three stable pairs are very similar in terms of risk and More precisely, CVaR at 5% level is the expected return on return, with 퐷퐴퐼 ⇌ 푈 푆퐷푇 having a slight edge over the an investment in the worst 5% of cases [9]. We use historical others in return. Stable and normal pairs may provide attrac- data to calculate the daily mean and CVaR of the returns. tive opportunities for liquidity providers depending on their Analyzing Figure 14 allows us to extract patterns emerging individual risk tolerance and return expectations. between the three different kinds of pools that in-line with our previous observations. In general, the three exotic pairs 6 MOVEMENT BETWEEN LIQUIDITY have the highest risk, measured through the CVaR, as well as the lowest average return associated with them. Exotic POOLS pairs make an inefficient investment to liquidity providers, As profits and risks associated with providing liquidity vary as all three exotic pairs are dominated, i.e., higher return and widely across different pools, we analyze how users redis- lower risk, by each of the remaining pairs. For the normal tribute their investments across different pools, i.e., how they pairs, on the other hand, the picture is more complex. While move their assets from one pool to another. We investigate the 퐷푃퐼 ⇌ 푊 퐸푇퐻 pair is dominated by all stable pairs, the the movement of liquidity providers with the goal of better remaining two normal pairs are not. 퐿퐼푁퐾 ⇌ 푊 퐸푇퐻 and understanding their motivations. Submission Ye Wang, Lioba Heimbach, and Roger Wattenhofer

(a) stable pairs (a) stable pairs

(b) normal pairs (b) normal pairs

(c) exotic pairs (c) exotic pairs

Figure 12: Daily percentage fees of sample pairs in Figure 13: Daily percentage returns of sample pairs three categories over a four month period. The his- in three categories over a four month period. The tograms are normalized, i.e., the sum of the bar histograms are normalized, i.e., the sum of the bar heights of each data set are equal to one. heights of each data set are equal to one.

In Table 1 we record the correlation between the pool Thus, the correlation between liquidity and trading volume liquidity and other pool characteristics, namely volume, and appears natural. We see that liquidity tracks volume in stable token prices in USD. The correlations are calculated for daily pools in Figure 15a, where the daily volume and liquidity are data. For all stable pairs, Table 1a, volume correlates highly visualized for 푈 푆퐷퐶 ⇌ 푈 푆퐷푇 . with pool liquidity. This strong correlation is expected, as The data shown in Table 1b for normal pairs and Table 1c liquidity provider’s returns in stable pools are directly re- for exotic pairs reveals a less obvious picture. The liquidity lated to the fees accumulated (Figure 9), which are in turn in all but one of the normal and exotic pairs appears largely proportional to the volume. The high correlation between uncorrelated with the volume – 퐿퐼푁퐾 ⇌ 푊 퐸푇퐻 being liquidity and trading volume indicates the dynamic balance the exception. Figure 15b shows that while liquidity and of the liquidity providers in the market. When the trading volume are somewhat correlated for the 퐿퐼푁퐾 ⇌ 푊 퐸푇퐻 volume increases, liquidity providers will earn more fees, pair, the link between them is not as apparent as for the then the high return attracts more liquidity into the pools. stable pairs. In the remaining pools, an example is shown Symmetrically, when the trading volume decreases, liquidity with 퐾퐼푀퐶퐻퐼 ⇌ 푆푈 푆퐻퐼 in Figure 15c, liquidity and volume will withdraw their funds from the pools, allowing the re- are uncorrelated. The lack of correlation might partially be maining liquidity providers to earn sufficient benefits again. due to generally low volume and low liquidity but could also Behavior of Liquidity Providers in Decentralized Exchanges Submission,

USDC⇌ USDT DAI⇌ USDT DAI⇌ USDC Volume 0.82 0.80 0.82 Price token 0 0.09 0.03 0.09 Price token 1 0.09 0.07 0.13 (a) stable pairs

UNI⇌ WETH DPI⇌ WETH LINK⇌ WETH Volume 0.00 0.14 0.48 Price token 0 -0.31 -0.29 0.71 Price token 1 -0.36 -0.16 0.67 (b) normal pairs

MOON⇌ WETH KIMCHI⇌ WETH KIMCHI⇌ SUSHI Volume 0.01 -0.20 -0.05 Price token 0 0.31 -0.50 0.08 Price token 1 -0.11 0.51 -0.05 (c) exotic pairs Table 1: Correlation between the liquidity in the pool and various pool characteristics. The correlations are recorded for daily data.

Figure 14: Risk and return comparison. We plot mean daily returns and the daily 5% CVaR for nine sample pools. Providing liquidity for exotic tokens is beyond just risky.

stem from the less predictable returns in normal and exotic pairs. Thus, liquidity providers might pay less attention to the (a) 푈 푆퐷퐶 ⇌ 푈 푆퐷푇 volume when adding or removing liquidity. In general, the price of the tokens appears uncorrelated with the liquidity. While we do not necessarily expect a strong correlation, the token price influences the liquidity providers’ returns via the impermanent loss. Thus, liquidity providers do not seem to react to price changes, indicating that either they hope for the ratio to recover to previous value or they are insensitive to the effects of the impermanent loss. We further look at the movement of liquidity between (b) 퐿퐼푁퐾 ⇌ 푊 퐸푇퐻 pools. When observing liquidity movements, we consider the entire data set. We record a movement if the same address removes liquidity from one pool and adds liquidity to another pool within 6000 blocks – roughly a day. Further, we restrict our analysis to the pools with the most liquidity movements (mint and burn events) in the following and only consider pools with more than 5000 liquidity movements. In Figure 16 we plot a colormap of the movement be- (c) 퐾퐼푀퐶퐻퐼 ⇌ 푆푈 푆퐻퐼 tween the 72 pools most active pools. We order the pools smallest to largest by their average size, i.e., liquidity in Figure 15: Volume and liquidity in three sample pools. the pool, since their creation. For better visibility, all val- ues are capped at 500. We immediately draw three conclu- sions from Figure 16. First, the movements of liquidity in Submission Ye Wang, Lioba Heimbach, and Roger Wattenhofer

(a) 퐷퐴퐼 ⇌ 푊 퐸푇퐻 → 푊 퐸푇퐻 ⇌ 푆푈 푅퐹

(b) 푈 푆퐷푇 ⇌ 푊 퐸푇퐻 → 푈 푆퐷퐶 ⇌ 푊 퐸푇퐻 Figure 16: The number of directional movements be- tween the 72 most active pools. The pools are ordered smallest to largest by their average size, i.e., liquidity in the pool, since the day of their creation. We cap the number of movements at 500 for better visibility.

Uniswap are rare. Additionally, the matrix appears symmet- ric. In other words, if providers move liquidity from one (c) 푈 푆퐷퐶 ⇌ 푊 퐸푇퐻 → 퐷퐴퐼 ⇌ 푊 퐸푇퐻 pool to another, there also seem to be providers that move liquidity in the opposite direction at similar numbers. Lastly, Figure 17: Directional liquidity movements and vol- the number of movements don’t appear to correlate with ume for a set of ordered pool pairs. the pool size. The ordered pool pair with the most move- ments is 퐷퐴퐼 ⇌ 푊 퐸푇퐻 → 푊 퐸푇퐻 ⇌ 푆푈 푅퐹 with a total of 13389 movements. We count less than 3500 movements for of liquidity does not appear too common among liquidity all remaining ordered pairs. providers unless driven by external motivations, such as When looking at the data of some ordered pool pairs with liquidity mining. many movements in more detail, we observe the emergence of two patterns in Figure 17. While movements between 7 CONCLUSION 퐷퐴퐼 ⇌ 푊 퐸푇퐻 → 푊 퐸푇퐻 ⇌ 푆푈 푅퐹 all occur within a This paper addresses three fundamental problems in under- rather short period and appear to be driven by an individ- standing liquidity providers in DEXes: Who provides liq- ual event, the movements we observe between 푈 푆퐷푇 ⇌ uidity in DEXes? What are the returns and risks of provid- 푊 퐸푇퐻 → 푈 푆퐷퐶 ⇌ 푊 퐸푇퐻 and 푈 푆퐷퐶 ⇌ 푊 퐸푇퐻 → ing liquidity? How do liquidity providers react to market 퐷퐴퐼 ⇌ 푊 퐸푇퐻 happen over a longer period. However, even changes? though we observe different patterns, movements appear Our analysis suggests that users of cryptocurrency ecosys- to relate mostly to liquidity mining. The single spike in be- tems have gradually become interested in providing liquidity tween 퐷퐴퐼 ⇌ 푊 퐸푇퐻 → 푊 퐸푇퐻 ⇌ 푆푈 푅퐹 (Figure 17a) in DEXes. However, users still act with caution – preferring coincides with the time at which liquidity mining for 푆푈 푅퐹 to participate in few liquidity pools. We find that the returns started in the 푊 퐸푇퐻 ⇌ 푆푈 푅퐹 pair4. Further, the move- and losses of providing liquidity in different types of pools ment between the 푈 푆퐷푇 ⇌ 푊 퐸푇퐻 → 푈 푆퐷퐶 ⇌ 푊 퐸푇퐻 vary a lot. Stable pools enable a seemingly risk-free and prof- and 푈 푆퐷퐶 ⇌ 푊 퐸푇퐻 → 퐷퐴퐼 ⇌ 푊 퐸푇퐻 reaches its peaks itable investment opportunity compared to constant-mix around the UNI liquidity mining period, 18th September portfolios. Providing liquidity in exotic pools, on the other 2020 to 17th November 20205. In conclusion, the movement hand, appears to perform much worse than the correspond- 4https://www.reddit.com/r/CryptoMoonShots/comments/jivadf/surf_finance/ ing constant-mix portfolios. Reacting to the unique return 5https://uniswap.org/blog/uni/ opportunities and risks, liquidity providers perform different Behavior of Liquidity Providers in Decentralized Exchanges Submission, trading strategies across pool categories: they respond to trading volume changes in stable pools and pay less atten- tion to market changes of normal and exotic pools. Besides market indicators, liquidity providers are also motivated by external market factors, i.e., liquidity mining activities, to redistribute their liquidity investments. In this paper, we extend the research scope of liquidity provider’s behavior in DEXes from theoretical analysis to empirical studies. By studying the behaviors of liquidity providers on the Uniswap market, our work provides a com- prehensive insight into the new trading options in the cryp- tocurrency ecosystems for users. More, it inspires future work aimed to better understand DEXes market mechanisms. REFERENCES [1] Hayden Adams, Noah Zinsmeister, and Dan Robinson. 2020. Uniswap v2 Core. (2020). [2] Jun Aoyagi and Yuki Ito. 2021. Liquidity Implication of Constant Product Market Makers. Available at SSRN 3808755 (2021). [3] Weili Chen, Tuo Zhang, Zhiguang Chen, Zibin Zheng, and Yutong Lu. 2020. Traveling the token world: A graph analysis of ethereum erc20 token ecosystem. In Proceedings of The Web Conference 2020. 1411–1421. [4] Philip Daian, Steven Goldfeder, Tyler Kell, Yunqi Li, Xueyuan Zhao, Iddo Bentov, Lorenz Breidenbach, and Ari Juels. 2020. Flash boys 2.0: Frontrunning in decentralized exchanges, miner extractable value, and consensus instability. In 2020 IEEE Symposium on Security and Privacy (SP). IEEE, 910–927. [5] Alex Evans. 2020. Liquidity provider returns in geometric mean mar- kets. arXiv preprint arXiv:2006.08806 (2020). [6] Alex Evans, Guillermo Angeris, and Tarun Chitra. 2021. Optimal fees for geometric mean market makers. arXiv preprint arXiv:2104.00446 (2021). [7] Pintail. 2021. Uniswap: A Good Deal for Liquid- ity Providers? (2021). https://pintail.medium.com/ uniswap-a-good-deal-for-liquidity-providers-104c0b6816f2 [Online; accessed 27-May-2021]. [8] Kaihua Qin, Liyi Zhou, and Arthur Gervais. 2021. Quantifying Blockchain Extractable Value: How dark is the forest? arXiv preprint arXiv:2101.05511 (2021). [9] R Tyrrell Rockafellar, Stanislav Uryasev, et al. 2000. Optimization of conditional value-at-risk. Journal of risk 2 (2000), 21–42. [10] Christof Ferreira Torres, Ramiro Camino, and Radu State. 2021. Fron- trunner Jones and the Raiders of the Dark Forest: An Empirical Study of Frontrunning on the Ethereum Blockchain. arXiv preprint arXiv:2102.03347 (2021). [11] Friedhelm Victor. 2020. Address clustering heuristics for Ethereum. In International Conference on Financial Cryptography and Data Security. Springer, 617–633. [12] Ye Wang, Yan Chen, Shuiguang Deng, and Roger Wattenhofer. 2021. Cyclic Arbitrage in Decentralized Exchange Markets. Available at SSRN 3834535 (2021). [13] Liyi Zhou, Kaihua Qin, Christof Ferreira Torres, Duc V Le, and Arthur Gervais. 2020. High-Frequency Trading on Decentralized On-Chain Exchanges. arXiv preprint arXiv:2009.14021 (2020).