ETH

Project Insight: Uniswap - A Pioneer in the Decentralized AMM Space

by BSCN

May 17, 2021

chain

The exchange has continued to push the envelope as the crypto sphere evolves. The world's largest decentralised AMM, UniSwap, has made immense contributions to the growth of DeFi. As it announces yet another upgrade, let’s take a look at the platform and how it has evolved over the years.

Introduction

In the early days of crypto trading, exchanges were centralised and used order books to match buyers with sellers. Order-book systems have some limitations - they keep custody of traders' assets and require that investors trust the exchange. Prices of assets in order-book systems need to be manually adjusted whenever market conditions change. Such a process is slow and does not make for the most efficient on-chain trading experience. The poor trading experience is amplified in markets with lower liquidity. With the advent of DeFi, a new approach to trading that fits into DeFi ideology became necessary.

Four years ago, crypto mogul and founder of Ethereum Vitalik Buterin first proposed the concept of an AMM. The ideas put forth by Vitalik were picked up by Hayden Adams, who then developed the world's first decentralised Automated Market Maker, Uniswap. 


An Overview of AMMs

Automated market makers are decentralised trading protocols in which an algorithm determines the exchange rates of assets. Before AMMs were developed, the trading of assets was handled by exchanges with varying levels of centralisation. CEXes often required KYC and held traders' assets in custody. These requirements are against the tenets of decentralisation, adding centralized data storage requirements that eliminate the benefits of DeFi capabilities. 

AMMs brought a new experience to DeFi, making trading fast, cheap, and convenient. Unlike with CEX and other non-AMM DEXes, users don't have to wait for a willing seller to be available before buying an asset. A smart contract controls all the assets in an AMM, and uses an algorithm to determine the price of an asset based on its demand and supply in the AMM's liquidity pool. Once a person confirms their intention to trade, the smart contract executes it almost instantly. 

Users who provide liquidity in AMMs do not need to manually adjust the prices of their assets, which is in contrast with order-book exchanges. The introduction of AMMs made it possible for users to buy or sell their assets on-chain in a decentralised way without giving up their assets to a central authority. 


What Is Uniswap?

Uniswap is an open-source, decentralised crypto exchange. It was built on the Ethereum blockchain and uses the AMM model to facilitate ETH-ERC20, and ERC20-ERC20 token swaps. 

Uniswap was launched in November 2018 and has grown to become the largest decentralised exchange in its category.  The platform consistently records at least $1 billion daily trade volume and a total volume locked (TVL) of more than $6 billion. Much of the progress made in Ethereum-based DeFi expansion is attributable to Uniswap; it provided the much needed AMM utility for dApps to function well in a decentralised environment. 


Features Of Uniswap 

1. Transactions on Uniswap are wholly on-chain. It does not rely on any element external to the Ethereum blockchain to function. In other words, it is fully decentralised. 

2. Uniswap boasts lower gas fees than other DEXes in its category. We can see this in a benchmark of the gas fees of similar DEXes. 

Source: Uniswap

3. In keeping with decentralisation, migration to platform upgrades are optional. The development team is committed to ensuring as much as possible that version upgrades are compatible. 

4. Uniswap DEX is designed to offer equal opportunity to everyone. Anyone can list any token for free. There is also no qualification to be a liquidity provider: anyone can provide any amount of liquidity and earn passive income. Uniswap is a not-for-profit initiative. 



How Does The Uniswap AMM Function?

At the heart of Uniswap are two core components: Liquidity Pools and the AMM mechanism. Let’s take a look at each of them.

1. Liquidity Pools

Liquidity on Uniswap is created via Liquidity Pools (LPs). Anyone can contribute to the pool of any market-pair. The only requirement is to contribute the equivalent worth of the two tokens. If you want to provide liquidity for the A-B market, for example, you can deposit $50 worth of token A and $50 worth of token B. 

It is these liquidity pools that Uniswap uses to match trades rather than an order book. When a trader wants to trade, he or she does not deal directly with a fellow trader. Instead, the transaction is an interaction with the LP's smart contract. 

Each transaction on the platform incurs a 0.3% transaction fee. This fee is shared to LP providers as a reward for supporting the platform. 

2. AMM Mechanism

Uniswap does not use an order book to match traders or set the prices of assets; instead, it uses a smart contract for that purpose. The smart contract uses algorithms to automate market-making. 

Uniswap's AMM mechanism is known as, Constant Product Market Maker (CPMM), represented by the equation: A*B = k. 

The letters A and B represent the tokens that make up the liquidity pair, while the letter 'k' is a factor (that is, the total liquidity) that is always constant.

If a trader, for example, deposits some quantity of A to buy B, the volume of A will increase while that of B will decrease. The value of B will increase to keep the total liquidity 'k' constant. A graph showing the relationship between A, B, and k is seen below.

Source: Medium 

For example, when a trade swings the price of 'A' upward, the price may go higher than what is obtainable in other exchanges. When this happens, arbitrage traders try to cash in on the price difference. Eventually, the price stabilises back to what is comparable in other exchanges.


How To Trade On Uniswap

Trading on Uniswap is extremely easy, following the instructions listed below: 

1. Get either a PC (personal computer) wallet such as Metamask, WalletConnect, Coinbase Wallet, or a mobile wallet such as Trust Wallet that supports ERC-20 tokens. 

2. Have some ETH in your wallet (purchased from an exchange like Binance or via peer-to-peer), which you will use in paying for the Ethereum network's transaction fees.

3. Either from a PC or using the dApp browser of your mobile wallet, go to the platform's homepage and click on 'Use Uniswap'.

4. Click 'Connect Wallet', choose your wallet from the list, and connect. Some mobile wallets like Trust Wallet will automatically connect once you click 'Connect Wallet'. 

5. The 'Swap' button is selected by default. On the page, you will see two dropdown menus. Use the first one on top to specify the token you have which you want to swap; enter the amount of the token you want to swap into the space for it on the right-hand side. 

6. Use the second dropdown menu below to select the token you want to have after the swap.

7. At the base, click 'Swap'. A new window will pop up with the details of the transaction. If everything is okay, click 'Confirm Swap'. 

8. In a few moments, the transaction will be processed on the Ethereum blockchain, after which you will receive your desired tokens in your wallet.

Uniswap's Tokenomics

Uniswap Tokenomics Pie Chart

In September 2020, the platform launched its native token, UNI. In one of the most elaborate airdrop schemes in the history of Cryptocurrency, Uniswap gave 400 UNI (worth about $1,000 then but more than $12,000 at the time of writing!) to everyone who tried to use the platform before September 1, 2020. 

Holding UNI gives one the right to contribute via voting to the governance of the platform.

The maximum supply of UNI is 1,000,000,000, to be distributed as follows,

1. Users: 60%

2. Project Team: 21.51% 

3. Investors: 17.8%

4. Advisors: 0.69%.

The distribution will happen over a four-year vesting period (image)


Platform Upgrade: Uniswap V2

The first version of Uniswap set out the initial concept behind the project. A few months after the original concept went live, work began to enhance it and fix some rough edges.

After some previews of the new version, on 18th May 2020, the team formally announced the release of Uniswap V2.

Some of the improvements of Uniswap V2 over V1 include, 

1. ERC20 - ERC20 Pools

Uniswap V1 only supported ETH - ERC20 liquidity pools. It meant that to swap directly between two ERC20 tokens meant that more than one transaction would be involved, which made users incur higher transaction fees. Version 2 now supports ERC20 - ERC20 Pools, making direct swap between two ERC20 tokens more efficient and cheaper than before.

2. Flash Swaps

Similar to flash loans, flash swaps make it possible for a user to withdraw any amount of ERC20 without first making any financial commitment. The withdrawn assets can be used in another external transaction and then paid for or returned unused at the end of the original Uniswap transaction. This feature can be applied to arbitrage and margin trading.

Here are some other features and technical improvements found in Uniswap V2!

Latest Upgrade: Uniswap V3

About one year after Uniswap V2, when everyone seemed to be settling down to it, Version 3 rolled out freshly baked from the oven!

Uniswap Version 3 was announced on May 5, 2020. It is a testament to the team's commitment to continuous effort to improve the platform and stay ahead of the competition. In a blog post, the team described Version 3 as the most powerful version of the protocol". 

Several improvements were implemented in Version 3. They include, 

1. Concentrated Liquidity: this helps liquidity providers to optimise their earnings by efficiently allocating their LP assets. 

2. Flexible Fees: V3 added additional fee tiers for each liquidity pair. This feature enables liquidity providers to tailor their margins according to how much risk they are willing to take.

Source: Uniswap


3. Non-fungible Liquidity

Some of the enhancements introduced by V3 means that liquidity provided by two persons may no longer have the same parameters. Liquidity will no longer be fungible as it was in previous versions of Uniswap. To make room for these changes, Liquidity Pool provision will now be represented by ERC721 NFTs.

Notably, each version of Uniswap will continue to exist and be functional despite the upgrades. More information about the features of Version 3 can be seen in the team's preview post. 


Concluding Thoughts

Uniswap provided a crucial platform to jump-start the DeFi revolution, and now is a critical part of the DeFi framework for both Ethereum and other chains. The platform empowers developers, liquidity providers and other DeFi stakeholders to take part in the decentralised market securely and optimally.

The regular updates to the Uniswap platform reveals the energy of a team that strives to deliver the best DeFi experience. Expect more innovation from the Uniswap team as they continuously improve in order to maintain their market leadership while staying ahead of increasingly stiff competition. 

To keep up with the latest on Uniswap, check out these links! 

Uniswap Website | Documentation | Twitter | GitHub | Reddit | Discord

;