Welcome to all our new subscribers! Please forward today's note to a friend, neighbour, colleague, frenemy, or in-law to spread the word. And for those who missed last week's episode, you can find it here.
TLDR below. This is not financial advice.
Catch the episode on YouTube
Economics of tokenisation and ecosystem is free weekly in your inbox. Please share it with anyone that can benefit from this knowledge.
General Conclusion
Uniswap is an Ethereum-based decentralised exchange (DEX), where people can trade between with ERC-20 tokens entirely onchain using smart contracts. It eliminates order books and is an interesting feature compared to centralised exchanges (CEXs).
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 to be a provider of liquidity and earn passive income through transaction fees.
How does Uniswap Work?
The Uniswap protocol does things differently to CEX. It allows users to trade ERC-20 tokens without the need for a middleman. As well as helping to reduce fees, this can iron out some thorny issues concerning censorship.
Source: Uniswap.org
Uniswap is a 100% decentralised and permissionless protocol, operating on the following formula: xy=k (called “constant product”)
In which:
x is amount token X;
y is amount token Y;
k is a constant
Uniswap provides an environment for the parties (Liquidity provider, trader, arbitrageurs and developer) to trade and develop.
Liquidity Providers (LPs) provide liquidity by depositing Erc-20 tokens into the pool and they receive LP token back as a certificate of ownership of a portion of this pool. After a while, they will be paid with the pool's transaction fees.
Traders participating in trading must pay a fee for each transaction. This fee is stored in the pool and paid to the LP.
Arbitrageurs align the price difference between the internal market and external markets.
For example
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 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 in re-calculated. Hence,
New Price of $X Token = ∆y/∆x.
In Case 1: New 1 $ETH = |y1-y| / |x1-x| = 500/3.33 = 150.15 $DAI.
What Else Did You Miss?
K for Constant
Trading in terms of quantity
Price
Constant
But it's no perfect! What's The Problem?
Uniswap V3: Decentralised Market Maker + CLOB
7 Changes in Uniswap V3
1. Focused Liquidity
Benefits
2. Capital Efficiency
3. Price Discovery
4. Range Orders
5. Non-Fungible Liquidity
6. Flexible Fees
7. Advanced oracle
Get premium access to unlock more content
TLDR:
Uniswap V3 combines the benefits of a standard AMM with those of an asset-stable AMM, plus other functions that make using capital more efficient. This makes V3 a super flexible protocol that can accommodate a wide variety of assets.
Uniswap V3 can change the game on AMM. It also poses many problems for related projects. Of course when the problem is solved, it is the opportunity!
Ps: Order the textbook "Economics and Math of Token Engineering and DeFi" today!