paint-brush
The Uniswap DEX: A Comprehensive Reviewby@Violet
888 reads
888 reads

The Uniswap DEX: A Comprehensive Review

by VioletAugust 23rd, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Uniswap is a DEX (Decentralised Exchange) based on the Ethereum blockchain with a very interesting design philosophy consisting of a lot of pink and unicorns. It has been operating since late 2018 and recently in 2020 moved to the much anticipated V2 bringing many improvements. The idea of DEXs aren’t anything new and many different cryptocurrencies have tried their hand at creating the perfect DEX. However, every DEX implementation has many issues, from centralised gateways to high fees to an excessive number of transactions required to operate or simply lack of volume.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coins Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - The Uniswap DEX: A Comprehensive Review
Violet HackerNoon profile picture

Welcome to my new series “A Comprehensive Guide to” where each time I cover a new topic in-depth while trying to keep things simple.

What is Uniswap and what are its goals?

Uniswap is a DEX (Decentralised Exchange) based on the Ethereum blockchain with a very interesting design philosophy consisting of a lot of pink and unicorns (maybe to show how magical it is to use?). It has been operating since late 2018 and recently in 2020 moved to the much anticipated V2 bringing many improvements. The idea of DEXs aren’t anything new and many different cryptocurrencies have tried their hand at creating the perfect DEX. However, every DEX implementation brought along with it many issues, from centralised gateways that defeat the purpose of a DEX to high fees to an excessive number of transactions required to operate or simply lack of volume.

This is where Uniswap comes in as a new idea of how to operate a DEX. Uniswap supports all erc-20 tokens on Ethereum with unlimited pairs, if a user wishes to create a pair between USDC and any random token they can. Because of this Uniswap already solves one of the issues of older DEX implementations which is any person can trade any token on there and doesn’t need a centralised team to add or list the token on it before trading.

However, Uniswap doesn’t just stop there. It also attempts to solve the issue of large spread between the buy and sell orders on low volume pairs (that is if people wish to buy a token for 1 ETH but sellers want to sell for 10 ETH, that is a large spread). It achieves this by having no traditional order book at all, instead all swaps happen at the price of the currency you are swapping to. Let’s take the ETH/USDC pair as an example. If the current price of ETH is $300, then for each 1 ETH you can purchase 300 USDC instantly without creating orders or anything. This obviously makes Uniswap much more convenient and usable than smaller traditional exchanges.


A deeper dive into Uniswap

Now that you have an overview of what Uniswap is and how it generally works it is time to dive deep into what makes it tick. Each token pair in Uniswap has something called a pool that actually supplies the liquidity for the buyers and sellers. Let’s take ETH/USDC as an example again, currently the Uniswap pool for it holds 18k ETH and 7.2m USDC. When someone makes a transaction on this pool it adds to it the token they are selling and gives them the other token they are buying. If I wanted now to sell 100 of my ETH, I would receive 38000 USDC at current prices. The new pool will have 18.1k ETH and 38k fewer USDC. This effectively lowers the price of the ETH in the pool as the ratio of the tokens is 1:1 in value, so now that there is more ETH and less USDC in the pool the ratio changes from 1:1 so the pool automatically adjusts price to bring it back to 1:1 value. The opposite is true if you were to sell USDC and buy ETH, the price of ETH in USDC would increase in this case. Unfortunately, this approach has a limit in which your order can only be so large at one point. For example, if I was instead to sell 10k ETH I would move the price by almost 35%, so not all my ETH would sell at the 380 price and I would not get 3.8m USDC as expected, instead I would receive only 2.5m USDC. However, the bigger the pool is, the much higher the limit is. The idea is that it is highly unlikely for a person to trade millions of dollars in a single transaction and this becomes possible the bigger the pool is.

What are Uniswap Pools?

But where does this pool money actually come from? It comes from anyone willing to add money to the pool. They are incentivised to do this because any fees generated by trading are given to these pool operators. Uniswap has a flat 0.3% trading fee on all trades, so if a pool has $10k in volume, it will generate $30 in fees which is distributed among the pool operators. For example, in a hypothetical pool where there is $10k in volume and $5k in liquidity then each dollar in liquidity would gain $0.006 per day (effectively a return of 0.6% daily which is quite large). If I held half of the pool (meaning I own $2.5k out of the $5k) I would get $15 daily from fees. As such I am incentivised to keep my tokens in the pool to make a return on them.

However, this isn’t just “free money” as everything comes with a risk to it. So far, we assumed the price of the tokens is constant, however the prices of cryptocurrencies obviously change often.

For example, if I joined the ETH/BAT pool when 1 ETH = 1000 BAT and I wanted to add 1 ETH I would need to add 1 ETH and 1000 BAT to the pool. Next day, BAT gets hacked and 1 ETH now instead equals 2000 BAT, essentially halving the price of BAT in relation to ETH. Now instead I would hold 0.5 ETH and 2000 BAT in the pool. This might not seem like a loss. But now let us instead look at their prices in $, if 1 ETH was 200 USD then 1 BAT would have been 0.2 USD on the first day, meaning you would have 400 USD in the pool on day 1. However, on day 2 I would now own 0.5 ETH and 2000 BAT, now ETH is still at 200 USD but BAT went down 50% so each BAT is 0.1 USD, this means I would now hold 300 USD, so I lost 100 USD in the process. If instead I held both my 1 ETH and 1000 BAT outside of the pool, I would have 350 USD on day 2. This is called impermanent loss, because if next day the price of BAT recovers again, I would have 1 ETH and 1000 BAT again (plus any fees I gained during the 2 days). As such in periods of high volatility such as a big price spike pools come with much extra risk, they benefit from price stability.

Uniswap’s Security

Now there would be no point in discussing ROI or how good an exchange is if all your money could simply be stolen overnight. Luckily for us, Uniswap is fairly secure and has only had one breach in the past that has now been fixed in V2. Your funds never actually leave your personal wallet since you don’t deposit them anywhere, your tokens only leave your wallet for 1 block (roughly 15 seconds) so the transaction can take place then you have your purchased tokens. Because Uniswap is an open source contract on the Ethereum blockchain anyone can go and take a look at the code of it and how it works. Additionally, Uniswap has had 2 professional security audits from dapp.org and Consensys, both finding no major security breaches (and the niche breach that Consensys found was fixed in Uniswap V2).

Using Uniswap

Now that we have looked at what makes Uniswap tick and how it works it is time to see how you can actually use it. First off you will require an Ethereum wallet, myetherwallet works well, however I personally use metamask for ease of use and convenience. When you visit Uniswap (app.uniswap.org) you will be greeted with the main page where you can use the exchange.


As you can see, the interface is quite clean and simple to use you simply press on the ETH icon to change the token you wish to sell, and then on the bottom you press select a token to pick what you wish to buy. You then enter the amount you wish to buy/sell then press on swap.


Here I entered 5 USDC in the bottom box and it automatically told me how much ETH I will need. If I had enough ETH to sell, I would get a “Swap” button under the price there. You will then get a window to confirm the swap, and once you press that it will open your wallet (metamask in my case) so you can send the transaction.


Then you simply confirm the transaction in your wallet and congrats, you just exchanged tokens on Uniswap!


Joining a Pool

To deposit tokens into a pool simply click on “pool” instead of the default “swap”. From that window you can track your current pools or press “add liquidity” in order to join one.


From there all you will need is an equal ratio in value of both tokens and to confirm the transaction just like you did with the swap. Congrats, now you are part of the pool of your choice!

Thanks for reading my first comprehensive guide, I hope it gave you all the information you needed and was fun to read. Stay tuned for more.

I’d appreciate any small tips to help me out:
BTC: bc1qgywzhk5r7fxgke7jk43t9evfdkl4073p6de8l7
LTC: M8rUuFgRuLpgzV8zPVaXmguWv2NjS5ocSc
ETH: 0xFb4ce3d75E8Fd683AC595231f25E0B59973508aD
Dash: XchynuYbt9yCgC1or9hbZbDwqU4aRBvBEV