DEX Specs: A Mean Field Approach to DeFi Currency Exchanges

Erhan Bayraktar,Asaf Cohen,April Nellis
2024-04-14
Abstract:We investigate the behavior of liquidity providers (LPs) by modeling a decentralized cryptocurrency exchange (DEX) based on Uniswap v3. LPs with heterogeneous characteristics choose optimal liquidity positions subject to uncertainty regarding the size of exogenous incoming transactions and the prices of assets in the wider market. They engage in a game among themselves, and the resulting liquidity distribution determines the exchange rate dynamics and potential arbitrage opportunities of the pool. We calibrate the distribution of LP characteristics based on Uniswap data and the equilibrium strategy resulting from this mean-field game produces pool exchange rate dynamics and liquidity evolution consistent with observed pool behavior. We subsequently introduce Maximal Extractable Value (MEV) bots who perform Just-In-Time (JIT) liquidity attacks, and develop a Stackelberg game between LPs and bots. This addition results in more accurate simulated pool exchange rate dynamics and stronger predictive power regarding the evolution of the pool liquidity distribution.
Trading and Market Microstructure
What problem does this paper attempt to address?
The problem this paper attempts to address is how liquidity providers (LPs) in decentralized cryptocurrency exchanges (DEX) choose the optimal liquidity position under uncertain market conditions, and how these choices affect the exchange rate dynamics and potential arbitrage opportunities. Specifically, the authors study the behavior of LPs by establishing a model based on Uniswap v3, where these LPs have heterogeneous characteristics and need to make decisions under the uncertainty of external trade sizes and asset market prices. Additionally, the authors introduce maximum extractable value (MEV) bots for just-in-time (JIT) liquidity attacks, further exploring the game relationship between LPs and these bots. The main contributions of the paper include: 1. **Proposing a mean-field game model with heterogeneous LPs**: This model can better simulate the actual DEX liquidity distribution and exchange rate dynamics. By calibrating the type distribution of LPs, the model's predictions are highly consistent with the observed data. 2. **Introducing semi-strategic traders**: The arrival rate of these traders is related to the arbitrage opportunities of the pool, which is more in line with the behavior of actual "ordinary" users, who are neither completely rational nor completely ignorant. 3. **Extending the research on JIT liquidity attacks**: For the first time, combining mean-field games with JIT liquidity attacks, the interaction between LPs and bots is studied through a Stackelberg game model. It is found that this model can improve prediction accuracy and reduce profit loss caused by bot attacks. Through these studies, the paper provides new perspectives and methods for understanding the liquidity provision mechanism in DEX, the behavior patterns of LPs, and how to respond to potential attacks.