TL;DR

Uniswap is a set of computer programs that run on the Ethereum blockchain and allow decentralized token swaps. It works with the help of unicorns (as illustrated by the logo).

Traders can exchange Ethereum tokens on Uniswap without the need to trust their funds to anyone else. Furthermore, anyone can lend their cryptocurrencies to special reserves called liquidity pools. Users who provide liquidity to these pools receive fee payments as a reward.

And how do these magical unicorns do token conversions? What do you need to use Uniswap? This is what we will see in this article.


Introduction

Centralized exchanges have been the core of cryptocurrency markets for many years. They offer fast settlements, high trading volume and constantly growing liquidity. However, there is a parallel world being built in the form of trustless protocols. Decentralized exchanges (DEX) do not require intermediaries or custodians to facilitate the trading process.

Due to the inherent limitations of blockchain technology, developing DEXes capable of competing with centralized platforms has been challenging. Most DEXs have room for improvement, both in terms of performance and user experience.

Many developers have been working to develop new ways to build a decentralized exchange. Uniswap is one of the pioneering projects in this proposal. The way Uniswap works can be a little harder to understand when compared to more traditional DEXes. However, we will soon see that this model provides some attractive benefits.

As a result of this innovation, Uniswap has become one of the most successful projects that is part of the Decentralized Finance (DeFi) movement.

Let's see how Uniswap works and how you can exchange tokens (swap) simply by using an Ethereum wallet.


What is Uniswap?

Uniswap is a decentralized exchange protocol built on Ethereum. More specifically, it is an automated liquidity protocol. To place trades, there is no order book and a centralized participant is also not necessary. Uniswap allows users to trade without intermediaries, with a high level of decentralization and censorship-resistance.

Uniswap is open-source software. You can check the details of the software yourself on Uniswap's GitHub.

Ok, but how do trades occur without an order book? Well, Uniswap works on a model that involves the creation of liquidity pools by users known as “liquidity providers”. The system provides a decentralized pricing mechanism that essentially smooths out the depth of the order book. We will soon discuss how this system works in more detail. For now, keep in mind that users can swap ERC-20 tokens without difficulty and without the need for an order book.

As the Uniswap protocol is decentralized, there is no listing process. Essentially, any ERC-20 token can be launched on the platform, as long as there is a pool of liquidity available to traders. Therefore, Uniswap also does not charge any listing fees. In a way, Uniswap acts as a type of public good.

The Uniswap protocol was created by Hayden Adams in 2018. But the technology that inspired its implementation was created by Ethereum co-founder Vitalik Buterin.


How does Uniswap work?

Uniswap leaves behind the traditional digital exchange architecture as it does not have an order book. It works with a design called Constant Product Market Maker, which is a variant of the Automated Market Maker (AMM) model.

Automated Market Makers (AMM) are smart contracts that maintain liquidity pools where traders can place their trades. These liquidity reserves are financed by liquidity providers (LP - Liquidity Providers). Anyone can be a liquidity provider who deposits an amount equivalent to two different tokens into the pool. In return, traders pay a fee to the pool. The fee amount is then distributed to liquidity providers according to their pool shares. Let’s check out how this system works in more detail.

Liquidity providers “form” the market (market makers) by depositing an amount corresponding to two tokens. This value can be a combination of ETH and ERC-20 tokens or two ERC-20 tokens. These pools are typically made up of stablecoins like DAI, USDC or USDT but this is not a requirement. In return, liquidity providers receive “liquidity tokens”, which represent their stake value in the entire liquidity pool. The user can redeem the corresponding value of these tokens, according to the participation they represent in the pool.

So let's consider the ETH/USDT liquidity pool. We can call the ETH portion of the pool x and the USDT portion y. Uniswap takes these two quantities and multiplies them to calculate the total liquidity in the pool. Let's call this value k. The core idea of ​​Uniswap is that the value of k must remain constant. In other words, the total amount of liquidity in the pool is constant. Therefore, the formula for total liquidity in the pool will be:

x * y = k

And what happens when someone places a trade?

Let's say Alice buys 1 ETH for 300 USDT using the ETH/USDT liquidity pool. In doing so, it increases the USDT portion and decreases the ETH portion of the pool. Effectively, this means that the price of ETH will rise. Why? After the transaction, there will be less ETH in the pool, but we know that the total liquidity value (k) remains constant. This is the mechanism responsible for determining the price. Ultimately, the price paid for this ETH is based on how much a given trade operation changes the relationship between x and y.

It is important to note that this model does not scale linearly. Effectively, the higher the order, the greater the variation in the proportion between x and y. This means that larger value orders become exponentially more expensive compared to smaller orders, which generates increasingly larger amounts of slippage. This also means that the larger a liquidity pool is, the easier it is to process large-value orders. Why? In this case, the variation in the relationship between x and y will be smaller.


Uniswap v3

The technology behind Uniswap has had several iterations to date. If you've ever used Uniswap, it was probably Uniswap v2. However, new improvements to the system are always emerging. Let's evaluate the most impactful updates provided by Uniswap v3.


Capital Efficiency

One of the most significant changes offered by Uniswap v3 is related to capital efficiency. Note that most AMMs are very capital inefficient – ​​that is, at certain times, most of the funds deposited in them are not being used. This is due to an inherent feature of this x * y = k model discussed earlier. Simply put, the more liquidity there is in the pool, the larger the orders the system can support, with a wider price range.

However, the liquidity providers (LPs) in these pools essentially provide liquidity for a price curve (range) between 0 and infinity. All this capital is reserved for when one of the assets in the pool is 5x-s, 10x-s, 100x-s.

If this happens, these idle assets ensure that there is still liquidity remaining in that part of the price curve. In other words, only a small part of the pool's liquidity is responsible for the majority of trades.

As an example, Uniswap currently has around 5 billion dollars of liquidity locked, while only 1 billion in volume per day. You may be thinking that this is not a very interesting way for the system to work. Apparently, the Uniswap team agrees. Uniswap v3 solves this problem.

Liquidity providers can now set custom price ranges for which they want to provide liquidity. This should generate more concentrated liquidity in the price range where most trading activity occurs.

In a way, Uniswap v3 is a rudimentary way to create an on-chain order book on Ethereum, where Market Makers can choose to provide liquidity at the price ranges they have established. It's important to note that this change favors professional Market Makers over retail users. The difference with AMMs is that anyone can provide liquidity and ensure that their funds are used for a purpose.

However, with this added layer of complexity, “lazy” LPs will earn much less in trading fees than professionals who can constantly optimize their strategy. At the same time, it's not hard to imagine aggregators like yearn.finance offering retail LPs a way to stay competitive in this environment.


Uniswap LP Tokens as NFTs

We now understand that each Uniswap LP position is unique as each depositor can set their own price range. This means that Uniswap LP positions are no longer fungible. Therefore, each LP position is now represented by a non-fungible token (NFT).

One of the advantages of representing a Uniswap LP position with a fungible token was that it could be used for other functions in the DeFi sector. Uniswap v2 LP tokens could be deposited into Aave or MakerDAO as collateral value (collateral). This is no longer the case with the v3 version as each position is unique. However, this composability problem can be solved with new types of derivative products.


Uniswap for layer 2

Transaction fees on Ethereum have skyrocketed over the past year. This makes using Uniswap economically unviable for many users.

Uniswap v3 will also be implemented in a layer 2 scalability solution called “Optimistic Rollup”. It is a good way to provide scalability of smart contracts and at the same time achieve security of the Ethereum network. This implementation should cause a large increase in transaction throughput, in addition to providing much lower fees for users.


What is impermanent loss?

As we mentioned, liquidity providers receive fees for providing liquidity to traders who swap between different tokens. Is there anything else liquidity providers should be aware of? Yes. There is an effect called impermanent loss.

Let's assume Alice deposited 1 ETH and 100 USDT into a Uniswap pool. Since the token pair needs to have an equivalent value, this means the price of ETH is 100 USDT. At the same time, there is a total of 10 ETH and 1,000 USDT in the pool – funded by other liquidity providers such as Alice. This means that Alice has a 10% stake in the pool. In this case, our total liquidity (k) is 10,000.

What happens if the price of ETH rises to 400 USDT? Remember, the total liquidity value of the pool remains constant. If ETH reached 400 USDT, it means that the relationship between the amounts of ETH and USDT in the pool has changed. In reality, there are now 5 ETH and 2,000 USDT in the pool. Why? Arbitrage traders will add USDT and remove ETH from the pool until the ratio accurately reflects the price. This is why it is essential to understand that k is constant.

Then, Alice decides to withdraw her funds and receives 10% of the pool according to her holdings. That is, she receives 0.5 ETH and 200 USDT, totaling 400 USDT. It looks like she made a good profit. But wait a minute, what would have happened if she didn't add her funds to the pool? It would have 1 ETH and 100 USDT, totaling 500 USDT.

In other words, Alice would have better results when HODLing instead of depositing her ETH and USDT in the Uniswap pool. In this case, impermanent loss is essentially the opportunity cost of adding a token to the pool that could appreciate in value. This just means that by depositing funds into Uniswap in the hope of earning from fees, Alice may miss out on other opportunities.

Note that this effect works regardless of the direction in which the price changes, starting from the moment of deposit. What does that mean? If the price of ETH decreases relative to the time of deposit, losses may also be magnified. If you want a more technical explanation, check out Pintail's article on this subject.

But why is loss impermanent? If the price of tokens returns to the price when they were added to the pool, the effect will be mitigated. Additionally, as liquidity providers earn fees, the loss may balance out over time. Still, liquidity providers should be aware of this before adding funds to a pool.


How does Uniswap make money?

Don't win. Uniswap is a decentralized protocol supported by Paradigm (cryptocurrency hedge fund). All fees go to the liquidity providers. Founders receive nothing for trades made through the protocol.

Currently, the fee paid to liquidity providers is 0.3% per trade. By default, fee amounts are added to the liquidity pool, but liquidity providers can redeem them at any time. Fees are distributed according to each liquidity provider's share of the pool.

There is a possibility that a portion of the fees will be dedicated to the development of Uniswap in the future. The Uniswap team has already developed and implemented an improved version of the protocol called Uniswap v2.


➟ Thinking about investing in cryptocurrencies? Buy Bitcoin on Binance!


How to use Uniswap

Uniswap is an open source protocol, meaning anyone can create their own frontend application for it. However, the most used are https://app.uniswap.org and https://uniswap.exchange.

  1. Access the Uniswap interface.

  2. Connect your wallet. You can use MetaMask, Trust Wallet, or any other Ethereum-compatible wallet.

  3. Select the token you want to exchange.

  4. Select the token you want to receive.

  5. Click Swap.

  6. Preview the transaction in the window (pop-up).

  7. Confirm the transaction request in your wallet.

  8. Wait for the transaction to be confirmed on the Ethereum blockchain. You can monitor the status at https://etherscan.io/.


O token Uniswap (UNI)

UNI is the native token of the Uniswap protocol and grants its holders governance rights. This just means that UNI holders can vote on changes to the protocol. We discussed how the protocol already acts as a kind of public good. The UNI token consolidates this idea.

1 billion UNI tokens were issued at the birth of the project. 60% of these are distributed to members of the Uniswap community, while 40% will be made available to team members, investors and advisors over four years.

Part of community distribution happens through liquidity mining. This means that UNI will be distributed to users who provide liquidity to the following Uniswap pools:

  • ETH/USDT

  • ETH/USDC

  • ETH/DAI

  • ETH/WBTC

And who are the members of the Uniswap community? Well, any Ethereum address that has interacted with Uniswap contracts. Let's see how to redeem UNI tokens.


How to redeem Uniswap (UNI) tokens

If you have previously used Uniswap, you are probably entitled to a redemption of 400 UNI tokens for each address used on Uniswap. To redeem your tokens:

  1. Visit https://app.uniswap.org/.

  2. Connect the previously used wallet to Uniswap.

  3. Click on “Redeem UNI tokens”.

como-resgatar-uni-tokens-uniswap

  1. Confirm the transaction in your wallet (you can check Gas prices on the Ethscan Gas Tracker).

  2. Congratulations! You are now a UNI holder!

Want to trade your UNI tokens? Binance has everything you need.


➟ Click here to trade UNI tokens on Binance!


How to buy UNI on Binance

To buy UNI, you must swap fiat currencies or cryptocurrencies using the Binance Exchange platform. It is not possible to purchase UNI directly with a credit/debit card. Below are the available pairs. You can choose between BNB, BTC, BUSD, USDT or EUR.


If you want to buy UNI using cryptocurrencies, you can transfer coins to your Spot wallet or buy some. BUSD is recommended due to its price stability. You can buy BUSD with your card by going to the [Buy Crypto] page. Enter the amount you wish to purchase and click [Continue] to enter your card details.


After purchasing your cryptocurrencies, go to the exchange and select the UNI pair you want to trade. You can change the pair by clicking on the current market pair in the top left corner.


In the search bar, type your selected pair. For example, we want to use UNI/BUSD.


You can create an order to purchase UNI. The quickest way is through a market order with the current spot price. You can also set a limit order or stop-limit order if you want to buy at a specific price.

To create your market order, click on [Spot Wallet] on the right part of the exchange's trading page. Make sure to select [Market Order] as your order type in the [Buy] tab and enter the amount of BUSD you wish to trade. Finally, click [Buy UNI] to create your order.


How to sell UNI on Binance

The UNI selling process is similar to the purchasing process. First, make sure your UNI balance is in your Binance Spot wallet. If you haven't deposited your tokens yet, go to the [Fiat and Spot] page and look for the UNI token. Click [Deposit] and see instructions for UNI transfer. You can also check our How to Deposit on Binance guide for more information.


After depositing your UNI, open the exchange page and select the desired UNI trading pair. In the example, we will use UNI/BTC.


Use the search bar to find the pair you want. In this case, we select the [UNI/BTC] pair.


On the right side of the screen, you can sell your UNI at the current market price. In the [Sell] tab, click [Spot Wallet] and select [Market Order] as the order type. Enter the amount of UNI you want to sell and click [Sell UNI].


Final considerations

Uniswap is an innovative decentralized exchange protocol built on Ethereum. It allows any user with an Ethereum wallet to trade tokens, without the need for an intermediary or third party.

Although it has its limitations, this technology could have interesting implications for the future of trustless token swap operations. It is very likely that the launch of Ethereum 2.0 scaling solutions on the network will also benefit Uniswap.