Let’s take a look at the Uniswap project with enough detail to make it clear what functionality there is and how to use it.
Before UniSwap launched in 2018, the cryptocurrency trading ecosystem was dominated by centralized exchanges (CEX), which are a type of cryptocurrency exchange managed by a third party (bank or service provider) to help conduct transactions for certain fees. Centralized and decentralized exchanges (DEX) have been operating in parallel for years.
Unlike CEX, DEX allows direct peer-to-peer cryptocurrency transactions without the use of an intermediary.
Uniswap, one of the world’s most popular DEXs, is one of the leaders in the race to surpass centralized exchanges.
According to DeFi Llama, UniSwap accounts for 64% of all DEX volumes. The UniSwap token has a market capitalization of about $4.5 billion. During the peak of the bull cycle in 2021, Uni’s market capitalization exceeded $22.5 billion.
Having achieved one of the highest TVLs* of any DeFi project, the Uniswap team launched a new version, Uniswap V3, in 2021.
Uniswap’s current TVL is about $4.5 billion (4th in the rankings).
DefiLlama. TVL Rankings
* TVL (Total Value Locked) is the total locked value of assets and represents the amount of assets that are currently placed in a particular protocol.
About Uniswap
Uniswap is a decentralized exchange (DEX) based on external liquidity providers that can add tokens to smart contract pools and users can trade them directly.
UniSwap allows exchanging Ethereum ERC20 tokens without using an order book. The exchange rate is based on the demand for both tokens and the balance of the exchanged pair.
Each token has its own smart contract and liquidity pool. Uniswap, being fully decentralized, has no restrictions on adding tokens.
If contracts for a pair of tokens do not already exist, anyone can create them and anyone can provide liquidity to the pool. As an incentive, these liquidity providers are given a commission of 0.05-1% per transaction.
Investment in Uniswap
Only $176 million has been invested in Uniswap. Investment rounds:
Aug 7, 2020 Series A – Uniswap $11M
Lead investor: Andreessen Horowitz (a16z)
Oct 13, 2022 Series B – Uniswap $165M
Lead investor: Polychain Capital
Polychain Capital was joined in the Series B funding round by a16z crypto, Paradigm, SV Angel and Variant. Uniswap Labs is valued at $1.66 billion.
How the Uniswap protocol works
Uniswap is an automated market maker (AMM). In practice, it is a set of smart contracts that define a standard way to create liquidity pools, provide liquidity and exchange assets.
Each liquidity pool contains two assets. The pools track aggregate liquidity reserves and predefined pricing strategies set by liquidity providers. Reserves and prices are updated automatically every time someone trades. There is no centralized order book, third-party storage, or order matching mechanism.
Because reserves are automatically rebalanced after each trade, the Uniswap pool can always be used to buy or sell a token – unlike traditional exchanges, traders do not need to check with individual counterparties to complete a trade.
Three types of users
The Uniswap ecosystem includes three types of users:
- Liquidity providers: people who provide their crypto-assets to help them trade.
- traders: people who exchange one token for another.
- Developers: people who work with Uniswap smart contracts to create new features.
- Liquidity Providers.
Liquidity providers provide ERC-20 tokens to Uniswap liquidity pools. Larger pools generate larger transaction volumes with better prices than smaller pools.
Consequently, liquidity providers play a very important role in providing liquidity to traders. In turn, liquidity providers receive a commission for each transaction in the pool, which is distributed proportionally among the liquidity providers of that pool.
Different types of liquidity providers:
- Passive liquidity providers: token holders who want to invest their assets to accumulate trading commissions. This can generate passive income.
- Professional liquidity providers: focus on market making as their primary strategy. They develop tools and ways to track their liquidity positions in various projects.
- DeFi pioneers: explore sophisticated liquidity interactions.
Examples include incentivized liquidity, liquidity as collateral, and other experimental strategies. The Uniswap protocol is ideal for projects to experiment with such ideas.
Project tokens: sometimes decide to become liquidity providers to create a liquid market for their tokens. This allows users to easily buy and sell tokens.
- Traders.
There are several categories of traders in the protocol ecosystem:
- Speculators: individuals who use various community tools and products to exchange tokens.
- Arbitrage Bots: these are Uniswap bots for profit! They compare prices on different platforms to find some competitive advantage. These bots actually help keep prices fair and equal.
- Dapp users: individuals who buy tokens through the Uniswap protocol. They later trade these tokens in other applications on the Ethereum network.
- Smart contracts: transactions are performed over the protocol, implementing the exchange function. These products include DEX aggregators for custom Solidity scenarios.
In all cases, transactions are subject to the same fixed commission for trading over the protocol. Each is important for improving price accuracy and encouraging liquidity.
- Developers
Developers create applications and services on top of the Uniswap protocol. There are too many in the Ethereum ecosystem to count.
Uniswap is completely open. Countless developers have launched their own interfaces to interact with the Uniswap protocol. Wallets can integrate exchange and liquidity features as a core offering.
DEX aggregators extract liquidity from multiple liquidity protocols. This allows them to offer traders the best prices available. The Uniswap protocol is the largest single decentralized liquidity source for these projects.
Smart contract developers can invent new tools and experiment with other ideas. Examples include projects like Unisocks or Zora, but the possibilities are endless!
Many members of the Uniswap ecosystem fill more than one of these roles. You can be a liquidity provider, a trader and a developer at the same time!
Using Uniswap
The key functionality of UniSwap consists of three blocks:
- Token exchange
- Work with token list
- Liquidity pools
0. Connecting a wallet
- Token exchange
Uniswap has a separate exchange contract for each ERC20 token. Instead of waiting for a match in the order book, users can trade at any time.
A fee is charged for each trade. Pricing is automatic – the price is adjusted based on the size of reserves combined with the size of the incoming trade.
Token exchange page interface
In token exchange transactions, price slippage must be taken into account.
What is price slippage?
Price slippage is a change in the price of a token caused by general market movement. Price slippage is reflected as the difference between the price you expect to receive after the exchange and the price you actually receive after the exchange is complete.
The minimum amount you receive from a trade is determined by the market price and the slippage limit you set.
When you use the Uniswap web application, you will receive the market price that is offered based on the slippage limits. The Uniswap web application sets the default slippage to 0.50%
Price slippage is affected by two factors.
- Liquidity: some tokens and token pairs are not traded that often (very new, not popular, etc.) and have low liquidity. Because of the low demand for these tokens, when an exchange is initiated, the price can change dramatically because the difference between the lowest requested price and the highest bid is very large.
- Price volatility: when the price of a token is volatile, it means that it can change quickly or unexpectedly. This can cause a dramatic change in price, which will affect the market for that token price.
Let’s break down the example of how Uniswap informs about price slippage:
The expected amount of DAI you are going to get is 9.16624.
The minimum you can get is 9.12064, which is 0.50% less than the expected price.
Your transaction will not occur if the price changes more than this (in the example, 0.50%) percentage.
Price slippage
The percentage of price slippage can be adjusted manually by clicking on the “gear” in the upper right corner. It is worth changing the slippage percentage if you have a good understanding of why you need it.
- Token List
The token page allows you to find and evaluate ERC-20 tokens to make informed decisions when buying or selling tokens on Ethereum and supported L2 networks.
Page with the list of tokens
On the token page, you can view:
- token name and icon;
- Token price with real-time data;
- % token price change;
- total locked value (TVL);
- volume of tokens on Uniswap.
Supported networks: Ethereum, Polygon, Arbitrum, Optimism, Celo.
- Liquidity Pools
In traditional finance, liquidity is organized using a central limit order book, where buyers and sellers create trade orders organized by price and demand.
The Uniswap protocol takes a different approach: an automated market maker (AMM) replaces the traditional order book method with a liquidity pool of two assets, where the price is determined by the AMM.
A liquidity pool is a group of tokens that are locked into a smart contract and used to trade between assets on a decentralized exchange (DEX) such as Uniswap. Usually two tokens are used to create or provide liquidity.
Liquidity providers provide different tokens for which they receive an LP token in exchange for providing liquidity.
Before exchanging, it is important to assess the available liquidity in the pool. A pool with low liquidity will not give you an optimal price and could potentially lead to losses.
Providing liquidity in Uniswap V3
Uniswap V3 introduces the concept of concentrated liquidity – liquidity providers have the ability to deliver their assets within a certain price range.
Rises and falls in asset prices can go beyond the limits set by liquidity providers. When this happens, the liquidity of the position is no longer active and is no longer charged. This offers traders higher liquidity and allows liquidity providers to earn more with less capital investment.
Concentrated liquidity allows the market to determine a reasonable distribution of liquidity, allowing liquidity providers to create as many positions as they see fit in their price range.
Whereas Uniswap V2 required all users to provide liquidity across the entire price curve from 0 to infinity, Uniswap V3 allows liquidity providers to concentrate capital at will in the price range that they believe will yield the greatest returns.
To better understand this, let’s look at an example.
Uniswap Liquidity Capital Efficiency Example
Alice and Bob decide to provide liquidity in the ETH/DAI pool on Uniswap V3. They each have $10,000 and the current price of ETH is $1,750.
Alice splits all of her capital between ETH and DAI and spreads it across the price range (similar to V2). She contributes 5,000 DAI and 2.85 ETH.
Bob, instead of using all of his capital, decides to concentrate his liquidity and provides capital in the 1500 to 2500 price range. He contributes 600 DAI and 0.37 ETH, a total of $1,200, and leaves the remaining $8,800 for other purposes.
What’s interesting is that as long as the ETH/DAI price stays in the 1500 to 2500 range, they both get the same trading commission. This means that Bob can only provide 12% of Alice’s capital and still make the same profit, making his capital 8.34 times more efficient than Alice’s.
In addition, Bob puts a smaller portion of his total capital at risk. In the unlikely scenario that ETH falls to $0, all of Bob’s and Alice’s liquidity would move into ETH. While they would both lose all of their capital, Bob would risk a much smaller amount.
Non-constant losses
Non-permanent losses are the potential losses to which funds are exposed when they are in the liquidity pool.
This occurs when a mathematical formula adjusts the ratio of assets in the pool to ensure that they remain at 50:50 in terms of value. The pool can become unequal due to large transactions that deplete one asset on one side of the pool, causing a significant rebalancing of the pool. The number of tokens deposited in the pool varies with trading activity.
On exit, the user is given tokens equivalent to their “share” in the pool. The loss is not realized until the user withdraws from the liquidity pool.
What factors contribute to Uniswap V3’s volatile losses?
- Price Divergence – when the prices of the two assets in the pool diverge from each other, the volatility loss increases.
- Extreme volatility increases the impact of non-permanent losses.
- Concentration of liquidity at V3 increases the impact of volatile losses in narrow position ranges.
- Narrow position ranges generate higher commissions, but also increase the impact of volatile losses.
- Non-permanent losses can be 4 times higher when using a liquidity range to compensate for doubling or halving the price compared to using the entire range.
The last point explains why Uniswap V2 (liquidity across the entire price range) is still more popular compared to V3 (concentrated liquidity in a specific price range).
One of the problems with Uniswap V3 is that providing liquidity can become a bit more difficult, especially for less experienced users.
Choosing the wrong price range can increase the chances of suffering intermittent losses, and it will be interesting to see the development of third-party services that could help with optimal liquidity allocation strategies.
Limit Orders
Range Limit Orders are available on Uniswap V3 – they allow liquidity providers to provide one token as liquidity at an arbitrary price range above or below the current market price. When the market price moves out of the specified range, one asset is traded for another on a smooth curve, while still receiving a commission for the exchange.
For example, suppose the DAI/USDC trades below 1.001. The liquidity provider may decide to put its DAIs into a narrow range between 1.001 and 1.002. Once the DAI trades above 1.002 DAI/USDC, all of the liquidity provider’s liquidity is converted to USDC. At this point, the liquidity provider must withdraw its liquidity to avoid automatic conversion back to DAI once the DAI/USDC returns to trading below 1.002.
Such range orders, unlike traditional limit orders, will not be executed if price crosses the specified range and then reverses to go in the opposite direction before the target asset is withdrawn. Although you will receive a liquidity provider commission during this time, if the goal is to fully exit into the desired target asset, you will need to monitor the order and either manually remove your liquidity when the order is executed or use a third-party service to withdraw funds on your behalf.
Bottom line, liquidity providers can sell one asset for another, adding liquidity to a price range above or below the market price, approaching a limit order with a commission that executes on a smooth curve.
This is essentially something similar to limit orders, but with a lot of caveats (see link above) and no support for automatic limit order execution.
Conclusion
Uniswap has been a leading DEX and one of the world’s most popular DeFi platforms since its inception.
In its latest funding round (October 2022), led by Polychain Capital, Uniswap Labs raised $165 million. They plan to spend that money to add “several new products.”
The new products are rumored to allow users to trade NFT on Uniswap with a number of trading platforms and will develop their own wallet.