By Chadi EL ADNANI, November 2022
This article was part of a broader report on the following theme: “Challenges and opportunities: The future of DeFi in TradFi”. Crypto Valley Association selected it among the top 5 pieces for its 2022 Call For Papers challenge.
Following the previous article, where we provided a more qualitative analysis of DeFi and DEXs, we dive directly into price discovery mechanisms using the mythical constant function x ∗ y = k formula. We also take inspiration from the paper ”Automated Market-Making for Fiat Currencies” by Mr Alex Lipton and Mr Artur Sepp [LS21] to quantify on-chain/off-chain arbitrage opportunities. Finally, we provide some market adoption charts for selected DEXs native tokens.
1. Price discovery in Uniswap v3
Here is a brief reminder about how the constant function x∗y = k formula works to define prices and liquidity levels in AMMs: let tok1 and tok2 be two fungible tokens, x the liquidity pool reserves of tok1 and y the reserves of tok2, k a constant such as
x ∗ y = k = L2 (1)
where L represents the pool’s liquidity.
Let us consider the case where a user desires to sell ∆x units of tok1 in exchange for ∆y units of tok2.
With a 0% fee assumption, we have:
(x + ∆x) ∗ (y – ∆y) = L2 = x ∗ y (2)
The name constant product market maker comes from the fact that any trade x for y changes reserves such that x ∗ y after the trade remains equal to the constant L2. More precisely, we could face two cases:
- A user would like to sell x units of tok1, and the smart contract needs to compute y.
- A user would like to buy y units of tok2, and the smart contract needs to compute x.
Solving for x and y in each case, we have:
Uniswap v3 takes this approach to avoid having to compute square roots when executing swaps; all formulas in v3 are done on the square root of the price, with the front-end application converting from √p to p and vice versa. As we will see later, using L and √p is convenient because only one change at a time: Price changes when swapping within a tick, whereas liquidity changes when crossing a tick or when minting or burning liquidity.
As mentioned before, one of the main novelties of Uniswap v3 is concentrated liquidity. In earlier versions, liquidity was provided uniformly across the x ∗ y = k reserves curve, meaning that liquidity was provided across the entire price range [0; +∞[. This is simple to implement but meant that as much as 95% of the assets held in a pool were never used in some cases, especially in stablecoin to stablecoin pools. In the wake of these observations, Uniswap v3 introduced the concept of a position, where LPs allocate liquidity to a finite range.
Read full analysis here!
Questions and comments about the rise of DEXs and DAOs can be addressed to firstname.lastname@example.org
- [LS21] Alex Lipton and Artur Sepp. “Automated Market-Making for Fiat Currencies”. In: (2021).
- [tea21] Uniswap team. “Uniswap v3 Core”. In: (2021).
No Investment Advice
The contents of this document about the rise of DEXs and DAOs are for informational purposes only and do not constitute an offer or solicitation to invest in units of a fund. They do not constitute investment advice or a proposal for financial advisory services and are subject to correction and modification. They do not constitute trading advice or any advice about cryptocurrencies or digital assets. SUN ZU Lab does not recommend that any cryptocurrency should be bought, sold, or held by you. You are strongly advised to conduct due diligence and consult your financial advisor before making investment decisions.
Accuracy of Information
SUN ZU Lab will strive to ensure the accuracy of the information in this report, although it will not hold any responsibility for any missing or wrong information. SUN ZU Lab provides all information in this report and on its website. You understand that you are using any information available here at your own risk.
The appearance of third-party advertisements and hyperlinks in this report or on SUN ZU Lab’s website does not constitute an endorsement, guarantee, warranty, or recommendation by SUN ZU Lab. You are advised to conduct your due diligence before using any third-party services.
About SUN ZU Lab
SUN ZU Lab is a leading data solutions provider based in Paris, on a mission to bring transparency to the global crypto ecosystem through independent quantitative analyses. We collect the most granular market data from major liquidity venues, analyze it, and deliver our solutions through real-time dashboard & API stream or customized reporting. SUN ZU Lab provides crypto professionals with actionable data to monitor the market and optimize investment decisions.