Discover more from Economics Design Newsletter
UNISWAP CASE STUDY
Welcome, premium subscribers! Thank you for subscribing. I appreciate you very much.
TLDR below. This is not financial advice.
Uniswap is an Ethereum-based decentralised exchange (DEX), where people can trade between with ERC-20 tokens entirely on-chain using smart contracts. It eliminates order books and is an interesting feature compared to centralised exchanges (DEXs).
Check out how it works here.
The main innovations from the Uniswap protocol are the development of a user-friendly platform on which traders can easily swap tokens. While at the same time, enabling anyone who becomes a provider of liquidity and passively earns transaction fees.
Although only more than 2 years of development, Uniswap has had a certain success. It is a bootstrap for projects further promoted, has strong development potential and at the same time faces many new challenges. In this report, we will analyse in-depth the economic aspect and understand how it works.
What is Uniswap and How Does It Work?
Uniswap is an Automated Market Maker (AMM). It allows users to swap any ERC20 token, using the liquidity pool instead of the order book.
Uniswap is a 100% decentralised and permissionless protocol, operating on the following formula: x*y=k (called “constant product”).
Objectives of Uniswap
Objective 1: Become the best AMM
Objective 2: Reducing risks associated with price movement in trading (i.e. impermanent loss)
Token In Uniswap
$UNI token is a governance token in Uniswap. It allows holders to govern the system while enjoying protocol fees shares from fees accrued. There is a total supply of 1B $UNI in the market.
Uniswap In DeFi
Currently, Uniswap accounts for more than 60% of the market share in trading volume, and not a single Dex has surpassed. Although in recent times, TVL of Sushiswap (Fork of Uniswap) has surpassed Uniswap. It shows that Sushiswap might have higher yields than Uniswap, but when it comes to trader's preference, they prefer Uniswap.
Since the time of writing the report, the number of users across the DEX market has reached 1.7 million. In which, Uniswap contributes more than half of the users, equivalent to more than 1.17m users, equivalent to 69%. This was 56% in early Dec 2020.
From this data, we can see that Uniswap's development contribution in the DeFi space is enormous. Uniswap is providing the service users need, and they are willing to use it as a new solution.
Economics Design of Uniswap
Dexs Are Eating Cexs
According to Coingecko, DEX's total trading volume in 2020 grew by an astounding from $168M to approximately $29B, equivalent to nearly 180times in growth. CEXs increased a modest 285% to reach $505B.
However, the total transaction volume of DEXs is still a small number compared to the volume of CEXs ($29B and $505B). Showcases the growth potential is enormous.
The figure below shows the transaction volumes for 2021 vs 2020. In the first 3 months of 2021, Trading Volume surpassed total trading volume in 2020. This is a very impressive number.
Uniswap protocol is governed and upgraded by $UNI token holders, using three distinct components; the $UNI token, governance module, and Timelock. Together, these contracts allow the community to propose, vote and implement changes to the Uniswap protocol.
There is 1 type of vote available: $UNI Holders participants with their choice, after that, the system will calculate how many % of those who choose yes/no. (1 $UNI = 1 Vote) Holders can choose to self-delegate their votes or to delegate them to someone they believe shares their overall vision. Holder has the right to vote: Operations, upgrades, technical changes, and critical decisions
Uniswap is a decentralised protocol and permissionless, works based on a “constant product”:
x * y = k
x is amount token X;
y is amount token Y;
k is a constant
The pool created is ETH/DAI with 10 $ETH and 1000 $DAI. We have:
x * y = k ⇔ 10 * 1000 = 10,000. And 1 $ETH = 100 $DAI and 1 $DAI = 0.01 $ETH.
Case 1: Swap DAI for ETH.
Trader A enters this pool and swaps 500 $DAI + 0.3% fee to exchange it for $ETH.
⇒ y1 = 500 + 1000 = 1500 $DAI.
k is const ⇒ x1 = k / y1 = 6.66 $ETH.
The trader receives x - x1 = 10 - 6.66 = 3.33 $ETH, which is worth 500 $DAI.
⇒ 1 $ETH = 150.15 $DAI, increase 50.15% from the initial price.
Note: 0.3% fee will be added back to the pool after swapping and changes the value of k.
Case 2: Swap ETH for DAI.
Trader B sells 6 $ETH in exchange for $DAI.
⇒ x1 = 10 + 6 = 16.
⇒ y1 = 10,000 / 16 = 625.
It follows that the trader gets y - y1 = 1000 - 625 = 375 $DAI, which is worth 6 $ETH.
⇒ 1 $ETH = 62.5 $DAI, 37.5% decrease from the initial price.
Note: If the slippage is too large, Uniswap will issue a warning before you swap to display a notification.
New Price For Each Token
The price of the token is determined after a change in reserves. This means the current transaction price is the price of the token which is redetermined at the previous transaction.
The token price computation that the platform performs step by step that I mentioned in the above example. Hence,
New Price of $X Token = ∆y/∆x.
In Case 1: New 1 $ETH = |y1-y| / |x1-x| = 500/3.33 = 150.15 $DAI.
Lack of Liquidity on One Side
If the reserve ratio is 10:90 or 90:10, the price sensitivity is enormous, causing the buyer/seller to buy/sell at a higher / lower price.
Mathematically, let focus on x*y=k ⇔ y=k/x, we derive this function ⇒ y' = 1/x^2. This implies that the change of y is strongly influenced when x is away from 1 unit.
Uniswap uses a “constant product”, which they call the invariant as a substitute for the spot price. The market is making formula sets the invariant as the product of two available liquidity pool reserves.
This invariant is always held in constant, so the “slippage” you get on a large trade increases exponentially as a percentage of the system’s total liquidity pool. So this is great for small traders (low spread) and gets progressively worse for larger traders.
7 Updates in V3
TLDR: V3 update combines both decentralised market maker model with centralised limit order books.
Focused liquidity In Uniswap v2, liquidity is evenly distributed along with the price curve x * y = k, with assets reserved for all prices from 0 to infinity. For most groups, much of this liquidity is never put to use.
Example: DAI/USDC only reserves ~ 0.50% capital to trade between $0.99 and $1.01, the price range with the most volume traded but earning fewer fees.
Therefore, the cost of earning on capital of LP is very small, most likely impossible compared to Impermanent loss. Besides, users also suffer from a high degree of slippage due to thin liquidity across all price ranges.
In Uniswap v3, LP can focus their capital within a custom price range, providing a greater amount of liquidity at the desired price to remedy the situation. Transaction fees earned at a given price range are scaled by LP proportional to the amount of liquidity they've contributed to that range.
Example: LPs in the ETH/DAI pool could choose to allocate $100 to prices between $1.000-$2.000 and add $50 to ranges between $1.500-$1.750
Efficient use of capital By focusing on liquidity as mentioned, LPs can provide the same liquidity depth as v2 in a specific price range with less capital risk.
Imagine, for a certain amount of capital, if spread evenly across price ranges, you would also receive a fee equivalent to less capital, instead of focusing on the price range with the most transactions. As a result, the remaining balance can be used for others.
At launch, capital efficiency gains will be as much as 4,000x for LPs that offer liquidity in a 0.10% price range. Uniswap v3 is technically a 0.02% support, resulting in a 20,000x increase in capital efficiency over v2. However, smaller pools can increase swap costs, so maybe more useful on layer 2.
Active liquidity The above features will lead to the following scenario: If the market price moves outside the specified price range of the LP, then their liquidity will be REMOVED from the pool and no fees collected until the market price returns to LP's specific price range or they decide to update their range to calculate the current price.
In v3, there could theoretically be no liquidity in a given price range. However, the project expects the LPs to continuously update the asset price range to meet the current market price.
Range Orders The V3's LP customisation capabilities open up a feature: Range Orders.
LP can deposit a single token in a custom price range that is higher or lower than the current price: if the market price goes into a specified range, they will sell one asset to another under a curve and get swap charges in the process.
Example: If the current price of $DAI is below 1.001 $USDC, you can add $10M DAI to the range 1.001-1.002 DAI/USDC. When $DAI trades above 1.002 DAI / USDC, the liquidity will be fully converted to $USDC. You have to withdraw your liquidity to avoid automatically converting back to $DAI if the DAI/USDC starts trading below 1.002.
The average execution price of an order in the range is the geometric average of the minimum and maximum prices: In Alice's case, the execution price is equal to 1.001499 DAI/USDC for a total amount of $1,001,499. This execution price does not take into account additional swaps earned during the trading price range 1.001 — 1.002 DAI / USDC.
The broader range of Range Orders can prove especially useful for profit-taking, buy the dip and token issuance: Organisations can liquidate a single asset and specify the exact price range that they want to sell their tokens.
Non-Fungible liquidity As a byproduct of the focused liquidity feature, the liquidity positions are no longer fungible and are not represented as ERC20 tokens. Instead, the LP positions will be represented by the NFTs.
However, shared locations can become ERC20 through external contracts, or other partner protocols. Additionally, transaction fees are no longer automatically re-invested in the pool.
Flexible fee Uniswap v3 offers 3 separate fees per pair: 0.05%, 0.30% and 1.00%. This option ensures that the LPs adjust their returns according to the volatility of the expected liquidity pair: the LP takes more risk in uncorrelated pairs like ETH / DAI and vice versa, accepting dark risk. in correlation pairs like USDC / DAI.
Uniswap v2 introduced a protocol fee switch, allowing administrators to enable a 5 basis point fee (16.66% LP fee). Fees are disabled by default but can be enabled by the admin on a pool-by-pool basis and set between 10% and 25% of the LP fees.
Advanced Oracles V2 oracle works by storing the cumulative sum of the prices of trading pairs on a per-second basis. These totals can be checked once at the beginning of the period and once at the end of the period to calculate the exact TWAP during that period.
Uniswap v3 offers significant improvements to TWA Oracle, making it possible for users to compute any recent TWAP within the past ~ 9 days.
Besides, the Gas Cost on Uniswap for Oracle has been reduced by ~ 50% compared to v2. The cost of calculating TWAP in external smart contracts is also significantly cheaper.
$UNI will be included in the treasury schedule as follows, starting from October 18, 2020:
Year 2: 75%
Year 3: 28.6%
Year 4: 11.11%
The annual inflation rate (2%) will be applied after 4 years to ensure continued participation and contribution of $UNI holders.
Any LP that provides liquidity to the pool gets a 0.3% fee of that pool. In the future, it will be reduced to 0.25%. All $UNI holders will receive a 0.05% fee for the entire platform through the governance.
LPs can receive $UNI tokens when they provide liquidity to pairs requested by the community.
Uniswap allows traders to swap tokens easily and earn passive income by participating as liquidity providers. The user interface is easy to use, and making trades is only a few clicks away.
Uniswap is using “constant product” to swap any pair ERC-20 token, but it has a disadvantage such as a slippage when the market fluctuates strongly and a lack of liquidity on one side occurs. Besides, Uniswap has some risks such as front running, token risk, smart contract risk and impermanent loss.
$UNI token is used for 2 main purposes: governance and reward for providing liquidity. In particular, providing liquidity is very limited, and only pools approved by the community through governance can receive $UNI tokens. At the time of writing the report, providing liquidity programs have ended.
Uniswap may not completely replace traditional exchange or DEX due to its unsuitability for performing large volume trades. In the V3 update, some issues are solved by the core team, in which choosing the range price to provide liquidity can be considered as a big improvement. Besides, the L2 solution is also provided by Uniswap to reduce expensive costs on the Ethereum mainchain.
It seems the enhancements are not designed to increase incentives for UNI except for governance as in previous versions. Do you think this is an omission of Uniswap?