The Beginner’s Guide to Uniswap And UNI Tokens

If you’re getting started with Decentralized Finance (DeFi), you would’ve heard about Uniswap. It is one of the most popular projects in the DeFi space – and for a good reason.

And that reason is what we’re going to look into in this guide to Uniswap!

If you’re new to the DeFi space and know nothing of Uniswap, I would recommend you to read the entire article. We’ll explain everything you need to know about Uniswap and UNI Tokens.

But if you’re experienced, here’s everything that you’ll see in the blog. Skip to any section of your choice if you’re short on time.

Uniswap and UNI Token Explained

What is Uniswap? Why is Everyone Talking About it?

Uniswap is an Ethereum-based protocol created by Hayden Adams that provides automated liquidity. Since its launch in November 2018, the protocol has been gaining popularity. As of now, it is the most popular Automated Market Maker (AMM) in the DeFi industry.

The protocol sets a price to all tokens which means you don’t have to put a buy or sell orders. And if you’re a regular trader, you know how the big guys (also called whales) manipulate the prices.

Uniswap ensures a fair market by using smart contracts to set the prices of tokens. This makes it more secure, decentralized, and censorship-resistance.

The fair market ensured by the protocol makes it the prime choice for those trading for the first time. After all, the last thing you want while starting out is a huge loss.

In May 2020, the team released Uniswap V2 contracts on the mainnet, making it even more famous. The new and upgraded system has a host of features to offer. Some of these features are flash swaps (discussed later in the FAQs), price oracles, ERC20/ERC20 token pair, etc.

Before getting into details about Uniswap V2, let’s talk about how V1 works!

How Does Uniswap Work?

Uniswap works on a constant product formula, x*y = k. Here, x and y represent the supplies of two tokens and k is a constant. Let’s take the ETH/DAI token pair to understand how the formula works.

The supply of ETH would then be represented by x and the supply of DAI would be represented by y. The product of the two would be represented by k.

Now, since k is a constant, you would have to adjust the values of x and y for the equation to make sense. So, if there is a surge in the supply of ETH, the supply of DAI would decrease. 

Likewise, if the supply of DAI increases, the supply of ETH would have to come down to keep the equation true. This helps it define a price range for the token pairs according to their available supply.

This also ensures fair play since the only way to change the price of the ETH/DAI token pair is through trading. So, if the price of the pair on Uniswap conflicts with that outside, arbitrage opportunities come up. It ensures that the prices are always similar to the market price.

Being an AMM, Uniswap uses smart contracts to ensure that the system keeps working all the time. Two ERC-20 tokens make up the reserves that make up a liquidity pool managed by smart contracts.

So far so good? Great! Let us now talk about what happens when you become a liquidity provider.

We’re going to explain how you can become a liquidity provider later in the FAQs, so check it out. But for now, let’s talk about what happens once you become a liquidity provider.

When you become a liquidity provider, you receive pool tokens, UNI, against the tokens you’ve provided. These tokens keep a track of the quantity & proportions of tokens in the total reserves. You can redeem these tokens and get the underlying assets whenever you want.

How Does Uniswap Make Money?

As you might have guessed already, the platform makes money with fees.

Uniswap charges a 0.3 % fee from users on every trade. This fee goes straight to the reserves and increases the value of k. Liquidity providers find it in their benefit when the value of k increases. 

The only catch here is that they have to wait until they withdraw their holdings in the total reserves. It is only when they burn the pool tokens they have that they can reap the benefits of the increased value of k.

While this is how it works currently, the fee might drop down to 0.25% in the future. Wondering where the remaining 0.05% would go? It would act as a protocol-wide charge.

Uniswap Tokens

What is the Uniswap (UNI) Token?

The governance token for the Uniswap protocol is UNI. What makes it stand out from most of the other tokens in the market is what happened on 16th September.

Uniswap announced that they would be launching the UNI token. They also said that everyone who had used Uniswap before 1st September (even once) could claim 400 UNI. At that time, the tokens were worth $3 each. So everyone eligible could rake in $1200 because of the announcement.

When the token was actually launched is when the story gets even more interesting. The token price had reached a high of almost $8. So those who claimed their 400 UNI tokens actually had $3200 lying around with them.

If you’re wondering how many lucky people came ahead and claimed their tokens, the answer is a lot. Sent to 50,000 Ethereum addresses, UNI tokens rose to become one of the most distributed tokens.

Liquidity providers got extra UNI tokens for their contribution to the protocol. This way, Uniswap gave away 1 billion UNI tokens in total.

How is the UNI Token Produced?

When you add liquidity to the protocol by providing tokens, you receive pool tokens. The smart contracts generate these tokens.

And that is how the UNI tokens are made. These pool tokens are the governance tokens we talked about a while back. These are the tokens that keep the system going.

Where Can I Buy UNI Tokens?

You can buy UNI tokens on all major exchanges like Binance, Coinbase Pro, and OKEx. While we don’t have any favorites, we’ve seen most newcomers have a good time on Binance.

That said, it is quite a personal choice. So we would recommend you to go ahead and try different exchanges out. And when you finally feel comfortable being on one, stick with it rather than continue experimenting.

What is Uniswap V2?

Uniswap V2 was launched in May 2020 and was well-accepted by the community. And it came with multiple changes enabled by the language Solidity.

Hayden Adams wrote the entire code for smart contracts in V1 on Vyper. But for V2, Solidity became the programming language of choice for smart contracts.

Using Solidity allowed the team to add features that were difficult to write in Vyper. ERC20/ERC20 liquidity pools, flash swaps, and on-chain price feeds were added in V2.

Let’s talk about these features in more detail.

What are ERC20/ERC20 Liquidity Pools?

Understanding ERC20/ERC20 liquidity pools and their importance is only possible by looking at how things were before them. So let’s talk about how things were in Uniswap V1.

Back in Uniswap V1, ETH had to be in every liquidity pool. So a simple trade, say, USDT to DAI had to have an extra step that increased gas fees and slippage.

Firstly, the users had to trade their USDT tokens for an equal value of ETH tokens. Then they had to trade these ETH tokens for an equal value of DAI tokens.

ERC20/ERC20 pools made liquidity providers not wanting to expose themselves to impermanent loss happy. After all, they didn’t have to supply ETH anymore. If you’re wondering what impermanent loss, feel free to check the FAQs out.

For now, just know that it is a temporary loss that becomes permanent only when you withdraw the tokens you’ve given to add liquidity.

What are Flash Swaps?

The addition of flash swaps turned heads—and for a good reason. Let me try to explain what flash swaps are with the help of an example.

Let’s say that you see ETH trading at 350 DAI on some exchange. You remember that ETH was trading at 340 DAI on Uniswap and see an opportunity for arbitrage. So you go ahead and buy a few ETH tokens from Uniswap and sell it on the exchange.

The only problem is not everyone has so much DAI lying around. And because of that, most people miss out on such trades. This is where Uniswap’s flash swaps come in.

Flash swaps allow you to borrow the full reserve of one token in a token pair on Uniswap. You can then deposit an equivalent value of the other token. But between borrowing and depositing, you can use a smart contract to perform an action.

In our example, you can use a smart contract to sell ETH and get DAI on the other exchange. And once you have your DAI, you can deposit the required amount on Uniswap and pocket the profit.

So if you borrowed 2 ETH and sold it on some exchange at 350 DAI each, you can pocket the 10 DAI profit you get per ETH. In essence, you ended up creating 20 DAI out of thin air. Or did you?

While it is true that you didn’t have to spend a penny from your pocket, you still have to pay the gas fees. So you don’t get to pocket the entire 20 DAI.

But have you wondered why people can’t simply walk away with the borrowed ETH in this example? That is due to a callback contract and the atomic transactions on Ethereum.

Upon completion of the callback, there is a check the contract performs. This lets the contract know if you’ve returned the required amount. If it finds any discrepancy, the entire transaction is rolled back.

That is how it ensures that people don’t exploit the system.

What are On-Chain Price Feeds?

If you’ve ever invested in stocks, you must’ve seen a list of stocks and the prices they’re trading at. This is the list that traders use to know if they should buy more stocks or sell theirs.

This list is the price list of the stocks in the market.

Uniswap V2 comes with a similar list that gives you live prices of crypto trading pairs. And it does that in a way that is safe from market manipulators.

Liquidity Pools on Uniswap

When you go to Uniswap and get some other token against your token, your token goes to a liquidity pool. The token you got against yours comes from a liquidity pool as well.

So what are liquidity pools?

Liquidity pools are pools of tokens with an associated smart contract. They provide liquidity for all the trading done on the platform.

Traditional exchanges use the order book model. In this model, buyers and sellers place orders. The buyers try to buy cheap and the sellers try to sell at high prices.

This is quite an issue because there might not be a seller wanting to sell their tokens at the rates buyers look for. Likewise, there might not be a buyer wanting to buy tokens at the high prices sellers quote.

While the buyer could pay a higher price and the seller could quote a lower price for the token, why would they? Since they’re here for getting the best price, none would back down and there would be no trade.

But trades do happen at all exchanges, right? How is that so?

Market makers enable trades in such situations. These are traders who buy or sell certain assets at whatever price is offered.

The drawback to that is the fact that it becomes very expensive when you take it to the blockchain. This creates the need for an optimal alternative.

And that is where liquidity pools come in. They hold two tokens that make a token pair. This creates a market for that token pair. So a liquidity pool for the ETH/DAI token pair would hold an equal value of ETH and DAI. Whoever provides the first set of tokens sets the initial price for them.

What are Liquidity Providers on Uniswap?

A liquidity provider is anyone who provides tokens to a liquidity pool. The reason why they’re called so is they enable trades to happen. This makes the tokens easy to sell—which increases the liquidity of the tokens.

Remember the ones who provided the first set of tokens in the liquidity pool and got to set the initial price? They’re the first liquidity providers for that pool.

How to Become a Liquidity Provider on Uniswap?

To become a liquidity provider, you have to add an equal value of two tokens to the liquidity pool of that token pair. So if you add 1 ETH and an equivalent value of DAI to Uniswap, you become a liquidity provider for the ETH/DAI token pair.

And you’ll be rewarded for it with a chunk of the Uniswap pool’s fees. Ka-ching!

The Risks: Is Uniswap Safe?

Uniswap has been designed in such a way that there isn’t much that the attackers can play with. It is simple and self-contained.

The only way an attacker can do harm is by attacking or obstructing contracts. And that isn’t easy to do on any platform in the DeFi space.

Uniswap has been audited multiple times and the platform has proven itself secure. But that doesn’t mean that it is attack-proof. So tread at your own risk.

The Future of Uniswap

Uniswap raised $11 million in series A from Andreessen Horowitz, Paradigm, Version One, and a few other notable VCs back in August 2020. The team used the funds to grow the team and is working on building Uniswap V3.

It is expected that V3 would increase the capital efficiency and flexibility of the protocol by a long shot. And the community is eagerly waiting for it to be rolled out.

With major improvements from V1 to V2, it looks like the team is serious about making the protocol better. With V3 and the versions they release after that, the protocol is bound to have a great future.

FAQs on Uniswap and UNI Tokens

What do you mean by Impermanent Loss?

An impermanent loss is a loss of funds liquidity providers may face when they provide liquidity. The concept can be pretty confusing so I’ll try to put it in as simple words as possible.

Let’s say that you’re a liquidity provider for the ETH/DAI liquidity pool on Uniswap. You provide equal values of ETH and DAI tokens to the pool.

So far so good. But what happens when one of the tokens goes up in value?

What happens when ETH rises in value? People would try to arbitrage until the pool price is the same as the market price. And that’s great but your ETH is locked in. So, you are at a temporary loss until the pool price equals the market price.

But guess what? If you pull your ETH out while the pool price is lower than the market price, you make the loss permanent.

What are Automated Market Makers?

Automated market makers (AMMs) are decentralized exchanges that use smart contracts to set the price of the tokens on the platform.

When you trade your tokens on these DEXes, you’re trading with smart contracts and not people. So you don’t have to place buy or sell orders to trade. The smart contracts act as the maker and facilitate exchange on AMMs.

How are Automated Market Makers different from Order book DEXes?

Order book DEXes (Decentralized Exchanges) need the buyers and the sellers to agree at a fair market price for the tokens.

But the buyers want to spend as low as possible to buy the tokens. And the sellers want to get as much as possible for their tokens.

This creates a stalemate where neither the sellers nor the buyers budge. And so the trade can’t go on.

So the only way to facilitate trade is by bringing in someone willing to buy and sell specific tokens at any price. These people are aptly called market makers.

Automated market makers use smart contracts and liquidity pools to get the job done. This makes the process decentralized and permissionless.

Anyone can set up liquidity pools for the tokens of their choice. And they don’t have to pay any listing fees or meet any admission criteria for that.

Since providing liquidity is something anyone can do with AMMs, fans, and holders of new tokens can create a liquid market for it. And that goes a long way in helping new projects grow.

What do you mean by Constant Product Market Maker?

Much like an automated market maker, a constant product market maker uses smart contracts and liquidity pools to enable trade. The difference lies in the way it is done.

Constant product market makers like Uniswap are built around the constant product formula x*y=k. This formula ensures that even if one of the tokens in a token pair sees an increase in value, the other drops to keep the product of the two constant.

Before You Go…

Uniswap is one of the most exciting projects in the DeFi space. It would be amazing to see what else the team manages to bring to the table in the future and we’re excited about it.

That said, invest in Uniswap only once you understand how it works and the risks involved properly.