Copied


Uniswap: Everything You Need to Know

Kun Hu   Nov 04, 2020 09:13 4 Min Read


TABLE OF CONTENTS

  1. What is Uniswap?
  2. The core concepts of Uniswap
  3. Uniswap V2
  4. What is Uniswap's token UNI and what's behind it?
  5. How to swap cryptos with Uniswap?
  6. Resources

20201103_Uniswap_everthing_you_need_to_know_feature.jpg

What is Uniswap?

Uniswap is a set of Ethereum smart contracts that implement automated liquidity providers and direct crypto swaps without an intermediary. As a decentralized exchange (DEX), Uniswap inherits the benefits of blockchain and removes the drawbacks inherent in its centralized peers including price manipulation, scam, security, fake transactions, and controversial KYC. Decentralized exchanges are the third generation of the decentralized movement. The decentralized exchange is a typical decentralized finance (DeFi) application. Uniswap is by far the leader in DEXs by volume.

Uniswap was invented by Hayden Adams, in Uniswap's official blog, it recounts the inspiring story of how Uniswap emerged. After he was laid off from his first job since graduation, he worked as a mechanical engineer at Siemens. Karl Floersch, his friend who worked at the Ethereum Foundation convinced Adams to focus on the Ethereum world. Adams spent two months learning about the basics of Ethereum. 

In 2019 Uniswap raised a seed round from Paradigm. In August 2020, Uniswap raised $11 million in a Series A funding led by Andreessen Horowitz.

The core concepts of Uniswap

The decentralized exchanges revolve around three key concepts: pricing, liquidity, incentive. Here's why Uniswap is different compared to most decentralized exchanges.

Automated Market Makers (AMM) 

There are two pricing models: order book and automated market maker (AMM). Uniswap uses automated market makers (AMM) for solving liquidity problems. Behind the model, liquidity providers share revenue as an incentive from cryptocurrency swaps or transactions. Almost all traditional exchanges, including centralized crypto exchanges, use order books. Due to efficiency reasons, there are only a few order book-based decentralized exchanges including IDEX and DDEX. Most decentralized exchanges, including Uniswap, use AMM. Bancor is the first decentralized exchange that implemented AMM.

Constant Product Formula (CPF) pricing mechanism

Uniswap uses a "Constant product formula" pricing mechanism. This is one of the major differences from other decentralized exchanges. For Uniswap, the constant product formula is simply a constant equation:  x * y = k. k is a constant value while x and y are the quantity of Ethereum and the quantity of another token respectively. Although the model is simple yet powerful and had proven to perform well by Uniswap. Alan Lu of Gnosis was the very first person to conceive of x*y=k market makers on Ethereum. Lu explains the concept in more depth in his research paper, “An analysis of Uniswap markets.”

The constant value k is fixed when the first liquidity provider provides x&y trading pairs and sets the initial exchange rate. To add liquidity, you need to deposit an equivalent value of x and y token at the current exchange rate, otherwise, there is an opportunity to being arbitraged.

In Uniswap V1, x must be Ethereum token ETH, In Uniswap V2, you can add an equivalent value of any ERC-20 and ERC-20 token directly.

When one trades x for y, then the quantity of x increases and y decreases, thus the price of x drops in comparison to y.

Fees and incentive

If you swap tokens, the contract will charge you 0.3% for the token you provided as a swapping fee which immediately is deposited into liquidity reserves in form of liquidity tokens. When liquidity providers withdraw liquidity, they will get fees by burning liquidity tokens to remove a proportional share of the underlying reserves. In Uniswap V1, for two ERC20 tokens T1 and T2 to exchange, the process will be T1=>ETH=>T2. There are two steps for exchange and every step charge 0.3, therefore the fee for swapping two ERC20 tokens is 0.5991%. In Uniswap V2, two ERC20 tokens can be swapped directly and the fee is 0.3%.

Uniswap V2

1. In Uniswap V2, it introduces an extra protocol fee to guarantee continuously growing and improving. This will be 0.05% and then the liquidity providers will get a reduced fee of 0.25% of 0.3%. But it does not start yet.

The 0.3% swapping fee paid by the swapper = 0.25% (Swapping fee earned by liquidity provider) + 0.05 (Protocol Fees for management team).

2. Any ERC20 token can be exchanged directly with any other ERC20 token, removing the need for ETH as a bridge as discussed above.

3. Price oracle.

4. Support of non-standard ERC20 tokens.

5. Flash swapping. This feature is for "capital free arbitrage" - if you find an arbitrage opportunity, you can use this feature to earn additional cryptocurrencies. Assume token A and token B swap ratio is 1:10 in Uniswap while in other DeFi projects, the ratio was 1:15. You can use token A in Uniswap to swap token B, then you earn 5 token B. You first need to withdraw the token A from Uniswap,  then you swap another token B with A, then you return 10 token B to Uniswap. As Ethereum transaction is an atomic operation, you need to guarantee to withdraw and return within the same transaction plus fee, otherwise it 

What is Uniswap token UNI and what's behind it?

You may have realized that Uniswap's uniqueness and that Uniswap lacked a token. On Sept. 16, 2020, Uniswap token UNI was launched. Popular crypto exchanges like Coinbase immediately announced the trading support of the UNI token.

There are 1 billion UNI minted at the genesis and would be subsequently allocated in four years. After four years, Uniswap will generate UNI tokens from a perpetual inflation rate of 2% per year. The UNI smart contract address is: 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984.

The 1 billion UNI tokens are distributed as follows, 60% to Uniswap community members and 25% (15% of total supply) were distributed to past users, 21.266% to team members and for future employees, 18.044% to investors, and 0.69% to advisors in a span of4 years.

The addition of the UNI token to Uniswap is actually a result of pressure from SushiSwap, a fork of Uniswap. SushiSwap was an overnight success project. The major difference SushiSwap from Uniswap is that it added its own native token SUSHI as an incentive, especially for liquidity providers (LP). Since the birth of SushiSwap, it has received lots of criticism and interests from communities. Until now, the creator of SushiSwap remains unknown. Uniswap founder Hayden Adams criticized SushiSwap by saying:

"Can't tell who is pretending and who legitimately doesn't understand that the $1B TVL deposited in an incredibly high risk investment on a single days notice is mostly massive whales. Anyone talking about community vs VC here is either delusional or intentionally misleading."

The secret of Uniswap token and other decentralized exchange tokens

Most decentralized exchanges, including Uniswap, now have native tokens. These tokens are in fact extra wealth out of "credit" which bitcoin tried to remove. All involved like founders, LP, and users will get "extra wealth" by receiving these tokens, thus maintain the ecosystem development of the project.

As it is easy to create a new decentralized exchange by forking, many decentralized exchanges have launched their own tokens. On how to build a decentralized exchange step by step in less than an hour, Blockchain.News recently published a detailed guide on building a DEX like Uniswap

How to swap cryptocurrencies with Uniswap

The only thing you need to initiate a swap with Uniswap is an Ethereum address. Go to https://app.Uniswap.org, then click on "Connect to a wallet", and choose how you would like to connect to your wallet.

You are ready to start your journey. For a detailed process of swaps and trades, Blockchain.News previously published a step by step guide on how to use Uniswap.

Official website: https://Uniswap.org

GitHub: https://github.com/Uniswap

Twitter: https://twitter.com/uniswapprotocol?lang=en

 


Read More