Gate.io Blog: From V1, V2 to V3, Why Is Uniswap Leading the DEX Market?
The Trading of Cryptocurrencies and the Beginning of Centralized Exchanges
Apart from direct transfers through cryptocurrency wallets, centralized exchanges (CEX) like Gate.io are currently the most used for cryptocurrency trading. It is often a requirement to sign up, complete personal identification verification (KYC) and deposit cryptocurrency to be able trade on a centralized exchange.
Centralized exchanges have multiple advantages. For instance, transaction speed is fast, users don’t need to manage private keys, a variety of coins can be traded, and the threshold of trading can be lowered. However, there have been incidents of exchanges such as Turkey’s Thodex, Vebitcoin, HB Top, and GGBTC scamming their users.These incidents cast shadows over the centralized exchange industry.
Decentralized Exchange (DEX)
With the advancement and development of blockchain technology, decentralized exchanges are gradually becoming popular. There are currently two forms of decentralized exchanges in the cryptocurrency market:
1) The order book type: The exchange directly encourages orders between buyers and sellers. Trading takes place on the blockchain network, which spares users the effort of registering. However, for this type of trading, there are liquidity problems, i.e., it may take a long time for transactions to complete.
2) Algorithmic exchanges that operate on a liquidity pool or a swap pool: These exchanges are designed to solve the issue of liquidity. A liquidity pool is essentially a pool of money. A typical representative of this is Uniswap.
¥ Image from: Uniswap.org
The Development of Uniswap
Uniswap V1 was created and released by former Siemens mechanical engineer Hayden Adams on November 2nd, 2018. An upgraded V2 was launched in 2020. Less than a year later, Uniswap saw another upgrade, with V3 in 2021. In February 2021, Uniswap became the first decentralized exchange in the world to surpass $100 billion in trading volume, asserting itself as the leader among decentralized exchanges.
How Uniswap Works
Uniswap is essentially an Ethereum-based protocol designed to facilitate automated exchange trading between Ethereum (ETH) and other ERC20 tokens. For this reason, all transactions on Uniswap take place on the Ethereum chain.
In order book-based decentralized exchanges, the entire trading process is on-chain, resulting in drawbacks such as slow speed, long transaction time, and occasional failed transactions due to chain congestion. In contrast, decentralized exchanges based on liquidity pools, such as Uniswap, introduce Automated Market Maker (AMM) to mimic the behavior of market makers. All trades are executed automatically by smart contracts.
In general, there are two participants on the Uniswap platform: Liquidity Providers and Traders. Liquidity Providers are like depositors in a traditional bank, providing liquidity by locking in a certain amount of tokens and earning a fee from trades that take place on the platform. Traders are the actual buyers and sellers on the platform.
Image from: bancor.network
The Core of Uniswap’s Operation — The Market Maker System
In the traditional financial market, a market maker is a legal entity. It acts as a licensed trader, constantly quoting prices for specific securities to investors and accepting their requests to buy or sell at a given price. Under such a system, the buyer does not have to wait for a seller, but can deal directly with the market maker, greatly increasing trading efficiency.
In the cryptocurrency market, everyone can be a market maker. Suppose you want to provide 100 ETH and 100 GT tokens to Uniswap’s liquidity pool, and the ratio of the two values is 1:1. Uniswap will multiply the two values according to the algorithm (k=x*y) to get a 10000. This product is constant. The platform will use this to determine the price of ETH and GT. By adding the liquidity here,you will also become a market maker in Uniswap.
When a trader buys 10 GT from this pool, there are 100 ETH and 90 GT left in the pool. Since the pool of 10000 is constant, divide it by 90 GT and you get 111.11 ETH, while the pool itself only has 100 ETH. Therefore, when I need to buy 10 GT, I need to pay 11.11 ETH. The price ratio between ETH and GT becomes 1:1.11, and the price of GT goes up from 1 ETH to 1.11 ETH.
Image from: CoinMarketCap
As more and more traders participate in market making, the tokens in the liquidity pool increases. The cost of trading will also decrease as the magnitude of price changes generated from trades becomes smaller. With automated market makers, the trading of cryptocurrencies is more efficient. This model is becoming increasingly popular amongst decentralized exchanges.
Problems of the Market Maker System
However, the market maker system is not perfect. One of the common drawbacks is Impermanent Loss. Price changes in the market maker system are based on a function curve that does not necessarily match those of other market exchanges. In such a case, the price of a digital asset can change before and after the deposit. The greater the change, the greater the likelihood of impermanent losses occurring. As a consequence, the value of the funds at the time of withdrawal will be lower than the value at the time of deposit.
Suppose we now deposit 1ETH and 100GT tokens worth $100 into Uniswap’s liquidity pool at a value ratio of 1:100 for a total value of $200 and a constant product of 10,000. If we have other 9 liquidity providers, we can have a 10% share in a pool of 10 ETH and 1,000GT tokens.
Soon after, the price of ETH in the external market rises to $400 and the price of GT remains unchanged with a price ratio of 1:400. At the same time, the price in the internal pool has not yet changed, at which point the third party takes the ETH by continuously adding GT to the pool and taking it proportionally until the price ratio in the pool is the same as the market price, i.e. 1:400. Since the curve function 10000 is constant, ETH and GT in the pool would become 5 and 2000 respectively.
When we decide to withdraw the funds, according to the previous share ratio and the current ETH to GT ratio, a total of 0.5 ETH and 200 GT can be retrieved, with a total value of $400. But if we don’t add to liquidity, the total value we hold is $500 due to the price increase of ETH, with $100 of this as an impermanent loss. The third party is also known as an arbitrageur.
Spreads can be taken advantage of through arbitrage in both the market maker system and the external market. The liquidity provider also receives a fee from the arbitrageur’s transactions, but the arbitrageur’s profit from the spread can also create a potential loss for the liquidity provider.
Uniswap’s First Update to Facilitate Trading and Prevent Price Manipulation
Much as Uniswap offers a faster trading experience through the market maker system and ensures low cost of operation through simple smart contracts and algorithms, it still has some drawbacks. There are high costs when traders need to swap token A for token B. It’s costly as they need to buy and sell ETH and pay two transaction fees and gas fees.
In March 2020, Uniswap received its first upgrade, Uniswap V2. Compared to V1, V2 added three main improvements. Firstly, it added ERC20-to-ERC20 token trading pairs. Therefore, there is no need to buy ETH as the intermediate exchange coin in trading these two tokens. The trading fee can also be cut by half.
Secondly, it provides the Flash Swap feature. This facilitates borrowing, trading and repayment from the liquidity pool that can be completed through a single transaction. When one part of the process goes wrong, all status changes will be directly reversed and the tokens will be returned to the liquidity pool. This feature helps save Gas fees on transactions, but is also used to arbitrage transactions.
Thirdly, it’s positive for the price. Since Uniswap’s token price is determined by a function curve, deviations from the market price can occur from time to time. For each trading pair, the market price before each block mined will be measured. The price of the last trade will also be recorded after the last block being mined is finished. The cumulative price at the end of the block is then calculated with the help of the time-weighted average price (TWAP). If someone wants to use arbitrage through price manipulation, they need to make many consecutive trades that deviate from the market price. It is way too costly.
After Uniswap V2 was released, its usage and trading volume experienced massive growth and it quickly became the most popular application on the ethereum network. a year after the release of V2, Uniswap was officially upgraded to V3 in May 2021.
The Much-Anticipated Uniswap V3 Hit the Market and Once Again Sparked Buzz Amongst the Cryptocurrency Community
Compared to its predecessor, Uniswap V3 focuses on improving liquidity and makes the most use of it.
The main feature of the new version is the introduction of Concentrated Liquidity. In the previous two generations of the system, liquidity was evenly distributed along the entire price curve, but in reality most assets were traded within a small price range, resulting in capital inefficiencies. Take the ETH/USDC trading pair as an example, if the majority of transactions are in the $1-$1.50 range, then most of the ETH and USDC will be placed in this range, greatly increasing the frequency of use, i.e. improving capital efficiency.
In addition to this, Uniswap V3 adds features such as range orders (similar to limit orders on centralized exchanges), flexible rates, and an oracle that reads more historical data to meet the needs of traders and liquidity providers.
However, this time Uniswap V3 has also made changes in its software licensing to protect its development, with its core launched under Business Source License 1.1. This license will restrict commercial or any other applications from directly using Uniswap V3’s code for two years. The code can only be used by the aforementioned applications. After two years when the license is converted to a GPL license the code is set to become open-source.
Will Uniswap Stay a Leader of Decentralized Exchanges?
Compared to traditional centralized exchanges, decentralized exchanges have their advantages. For instance, the traders can keep their assets in their own wallet, and the trading data is more transparent(all users can access all transactions on-chain). Apart from Uniswap, there are other decentralized exchanges such as SushiSwap, MDEX, and PancakeSwap. At the time of writing this article, Uniswap V2 and V3 ranked first and second respectively in the DEX ranking, with a total market share of nearly 30%. This is further proof of its current leading position.
Image from: CoinMarketCap
Undeniably, Uniswap V3 has set a lot of precedents for decentralized exchanges, but it was not all smooth sailing. In 2020, Uniswap’s basic core design was still adopted. SushiSwap adopted a swap pool and a mode of automatic market maker. It provided the Sushi token as a bonus for liquidity providers and gained many assets and users from Uniswap. At one point, it threatened Uniswap’s position. Uniswap countered by releasing UNI, a protocol governance token, to compete for volume share and retain its leadership position.
According to CoinGecko’s data, total trading volume on decentralized exchanges still only accounts for 5% of centralized trading volume. As DeFi continues to expand, decentralized exchanges are likely to become increasingly popular in the future. Insiders are excited to see what new moves Uniswap will make to maintain its position in the market.
Gate.io has opened UNI token trading. Users can trade UNI tokens with USDT and ETH.
UNI/USDT trading pair: https://www.gate.io/en/trade/UNI_USDT
UNI/ETH trading pair: https://www.gate.io/en/trade/UNI_ETH
*This article represents the views of the researcher and does not constitute any investment advice.