What Is Uniswap and How Does It Work?
Uniswap is a set of computer programs that are designed to operate on the Ethereum blockchain and allow for decentralized token swaps to take place. In accordance with its logo, the application is based on unicorns.
The Uniswap platform allows users to exchange Ethereum tokens without having to trust anyone else with their funds. In addition, anyone can lend their crypto to a special reserve known as a liquidity pool. Liquidity pools charge fees to users for lending their crypto to them.
How are these unicorns able to convert tokens from one type to another? How do you use Uniswap?
Introduction
The backbone of the cryptocurrency market has been centralized exchanges for many years. The exchanges also offer fast settlement times, high trading volumes, and a continuous improvement of liquidity. Nevertheless, it appears that there is a parallel world being built in the form of trustless protocol. There is no need for middlemen or custodians for decentralized exchanges (DEX) to allow trading.
The inherent limitations of blockchain technology make it incredibly difficult to build DEXes that can effectively compete with their centralized counterparts, mainly due to the inherent limitations of this technology. The user experience and performance of most DEXes could be improved both in terms of performance and usability.
There are a number of developers who have been working on figuring out various ways to create a decentralized exchange. Uniswap is one of the pioneers of this concept. Uniswap is possibly more difficult to comprehend than a traditional DEX. However, we will soon discover that it has some appealing characteristics.
The Uniswap Project has now become one of the most successful and successful projects within the Decentralized Finance (DeFi) movement as a result of this innovation and development.
What is Uniswap?
UniSwap is a decentralized exchange protocol that runs on top of the Ethereum blockchain. It is more precisely referred to as an automated liquidity protocol. The trades are not made on an order book and no centralized party is required to initiate the trades. A unique feature of Uni Swap is the ability to trade without using intermediaries, allowing for a high degree of decentralization and censorship resistance.Uniswap is an open-source application.
Okay, but how does a trade take place without an order book? Uniswap works on a model whereby liquidity providers create liquidity pools, which enable the liquidity providers to trade. It is essentially a decentralized mechanism for determining order book levels, providing a smoothing effect on order book depth. We will discuss how it works in more detail later on. During this time, we only want to make a point about the fact that users can seamlessly swap between ERC-20 tokens without having to sign up for an order book.
A decentralized protocol such as Uniswap does not require a listing process. All ERC-20 tokens will be able to be launched provided there is a liquidity pool that can be accessed by traders. Uniswap, therefore, does not charge any listing fees. The Uniswap protocol makes sense in a certain sense because it's a kind of public good.
Hayden Adams created it in 2018. Vitalik Buterin, the co-founder of Ethereum, was the first person to describe the underlying technology that is the inspiration for the implementation.
How does Uniswap work?
Uniswap breaks away from the traditional architecture of digital exchanges by not having an order book for trading. Constant Product Market Maker is a design modified from a model called Automated Market Maker (AMM) that is based on a design called Constant Product Market Maker .
A market maker that is automated (also referred to as an automated marketplace) is a smart contract that holds liquidity reserves (or liquidity pools) which traders can use to trade. Liquidity providers fund these reserves. Essentially, anyone can be a liquidity provider by simply depositing something equivalent to two tokens in the pool. The traders in the pool pay a fee to the liquidity provider pool which is then distributed to them based on their share of the pool.
Markets are created by liquidity providers by depositing the equivalent value of two tokens into a market. There are either two ERC-20 tokens, or there can be ETH along with two ERC-20 tokens. Usually stablecoins such as DAI, USDC, or USDT are used in these pools, but this is not required. Liquidity providers receive "liquidity tokens" as a reward for providing liquidity. These tokens represent their assigned share of the overall liquidity pool. It is possible to redeem the liquidity tokens for shares of the pool they represent.
Let's examine the ETH/USDT liquidity pool. The ETH portion of the pool will be labelled x, and the USDT portion will be labelled y. In order to calculate the total liquidity in the pool, UniSwap multiplies these two quantities by the number of participants. Let us call this quantity k. According to Uniswap, k must remain constant, which means that the total amount of liquidity in the pool remains constant. The formula for the total liquidity is as follows:
x * y = k
When someone makes a trade, what happens?
We can assume Alex purchases 1 ETH using the ETH/USDT liquidity pool for 300 USDT. This results in an increase in USDT and a decrease in ETH. It is because of this that the price of ETH is able to rise. But why? After the transaction, there's less ETH in the pool and we know the liquidity (k) has to stay constant. That's how the price is determined. In the end, the price paid for this ETH is determined by how much a given trade shifts x and y.
It must be noted that this model does not scale linearly. In effect, the more significant the order, the greater the shift in balance between x and y. Because of this, it means that larger orders are exponentially more expensive than smaller orders, which results in increased amounts of slippage as the order size increases. It also implies that for large orders, the more liquidity pools there are, the more straightforward it is to process them. But, how? Because the difference between x and y is smaller.
Uniswap v3
There have been several iterations of the technology behind Uniswap. Uniswap v2 is more likely to use if you've used it before. Of course, there is always the possibility of new improvements. Take a look at some of the most significant updates to Uniswap 3.
Capital efficiency
Uniswap v3 brings significant improvements in terms of capital efficiency. As a matter of fact, many AMMs are incredibly capital inefficient, which means that most of their funds are sitting in them at any given time not being utilized. As already mentioned, this is due to one of the inherent characteristics of the x*y=k model. It can be stated simply that the greater the liquidity in the pool, the greater the capacity for the system to support larger orders at a wider price range.
In these pools, however, liquidity providers provide liquidity based on a price curve (range) that starts at zero and ends at infinity. This capital is sitting there, waiting for the event when one of the assets in the pool increases in value by 5x, 10x, 100x.
As a result, those idle assets will ensure that there will still be some liquidity left for that portion of the price curve if that were to happen. Therefore, when you look at the liquidity pool, only a small segment of liquidity is located in the areas where most of the trading happens.
For instance, Uniswap currently has about 5 billion dollars in liquidity locked up, yet it does only a volume of about 1 billion dollars every day. Uniswap seems to agree that this isn't an especially elegant way to go about doing things.
As a result, liquidity providers can now provide liquidity based on custom price ranges. This will lead to a concentration of liquidity in the price range where the majority of trading activity takes place.
As such, Uniswap v3 provides a rudimentary way to create an on-chain order book on Ethereum, in which market makers can decide whether to provide liquidity in a prescribed range of prices. There's no denying that this change favors professionals over retail traders. Anyone can participate in AMMs by putting their funds to work and providing liquidity.
Due to this additional level of complexity, "lazy" LPs will operate at a much lower level of trading fees than professionals who have the ability to constantly improve their strategies. Nevertheless, it is not difficult to imagine that aggregators such as yearn.finance might offer retailers a way to compete in this market.
Uniswap LP tokens as NFTs
Uniswap LP now understands that each position is unique due to the fact that each depositor has his or her own price range that can be set. Therefore, it would seem that Uniswap LP positions are no longer fungible. Therefore, all LP positions now have their own non-fungible tokens (NFTs) as a result of the recent blockchain upgrade.
In addition to a fungible token representing a Uniswap LP position, the fungible token provided the advantage of its ability to be used in other parts of DeFi as well. Aave or MakerDAO can accept the Uniswap v2 LP tokens for collateral. however, new types of derivative products which may be able to solve this break in composability.
Uniswap on layer 2
There has been a dramatic increase in the transaction fees on Ethereum in the past year. Due to these reasons, many smaller organizations find that using Uniswap is economically not viable. As part of UniSwap v3, an Optimistic rollup will also be used as a layer 2 scaling solution. This is a very interesting method for scaling smart contracts while retaining security on the Ethereum network. As a result of the deployment, the transaction throughput will rise dramatically and fees for users will decrease significantly.
What is impermanent loss?
Traders can exchange tokens between liquidity providers, which earns fees for providing liquidity. Are there any other concerns liquidity providers need to be aware of? In short, yes. There is an effect known as impermanent loss.
Let us assume Alex deposits 1 Ethereum and 100 USDT into a Uniswap pool. Token pairs must have equivalent value, so ETH is worth 100 USDT. Moreover, the pool contains 10 ETH and 1,000 USDT, with the rest being funded by other liquidity providers. That means Alex has a 10% stake. In this case, we have a total liquidity of 10,000.
What would happen if the price of ETH increased to 400 USDT in the future? Please remember that the total liquidity must remain the same. The ratio between the amount of ETH and the amount of USDT in the pool has changed if ETH is now 400 USDT. Currently, there is a pool of 5 ETH and 2,000 USDT. So why? In an arbitrage trade, USDT is added to the pool and ETH is taken out until the ratio does not reflect the price correctly. This is the reason that k must be understood as a constant.
As a result, alex withdraws her funds and gets 10% of the pool on the basis of her share of the funds. As a result, she will receive 0.5 ETH and 200 USDT, for a total of 400 USDT. In conclusion, she appears to have profited nicely on the transaction. Then what would have happened if she hadn't invested her funds in the pool? She would have 1 ETH and 100 USDT, creating a total of 500 USDT.
Instead of depositing into the Uniswap pool, Alex would have been better off by HODLing. Therefore, the impermanent loss arose from the pooling of a token that appreciated in value. It simply means that Alex may lose out on other opportunities if she deposits money into Uniswap to earn fees.
The effect is relevant regardless of the direction in which the price changes since the deposit was made. But what does it mean? In addition, if ETH prices fall since the deposit, the losses may be amplified.
Nevertheless, why are losses impermanent? The effect will be mitigated if the value of the pooled tokens returns to the price they were at when they were added to the pool. In addition, since liquidity providers earn fees for providing services, over time, the loss may be balanced. Yet liquidity providers need to know this before they put money into a pool.
How does Uniswap make money?
No, it doesn't. Paradigm (a crypto hedge fund) backs UniSwap as a decentralized protocol. In addition, all fees go to the liquidity providers. None of the founders receives a cut from any trades executed through the protocol. There is currently a 0.3% transaction fee paid to liquidity providers.
Liquidity providers can choose to redeem them at any time rather than adding them to the liquidity pool by default. Fees are distributed to liquidity providers based on their share of the pool. It is possible that Uniswap will be developed in the future with a portion of the fees collected. A new version of the protocol named Uniswap v2 has already been deployed by the Uniswap team.
The Uniswap (UNI) token
UNI tokens give holders rights to governance rights on the Uniswap protocol. Basically, holders of UNI get to vote on protocol changes. As we discussed earlier, the protocol has already provided a kind of public good.
One billion UNI tokens were created at genesis. Over the course of four years, 60% of the funds will be distributed to existing Uniswap community members and 40% to investors, advisors, and team members.
Liquidity mining is one method of distributing these funds. It follows that UNI will be distributed to the following Uniswap pools that provide liquidity:
-
ETH/USDT
-
ETH/USDC
-
ETH/DAI
-
ETH/WBTC
But who is a member of the Uniswap community? So it's the address of any Ethereum contract that has been used by the Uniswap contracts. Here's the procedure on how you can get those UNI tokens.