Uniswap
21 min read

Uniswap Review: Decentralised Trading Protocol

By Filippo Bertocchi

Over the course of the last few years, the digital asset space has entirely re-architected the financial ecosystem as we know it and has generated some of the most value-rich, avant-garde economic applications. In fact, with the arrival of Decentralised Finance (DeFi), more and more crypto enthusiasts, private investors and institutional entities have been drawn to experiment with the new financial technologies offered by the space and fascinated by its alternative features.

This is because DeFi is proving to be a rapidly growing trend in the dynamic world of FinTech, taking elements from traditional finance and transforming them into trustless, transparent protocols via smart contracts and token architectures. In December 2019, the DeFi ecosystem had $700 million worth of assets locked in its financial products whereas now, at the time of writing, this number has surpassed $50 billion.

DeF iPulse Total

The Exponential Growth In DeFi’s Total Value Locked (TVL) – Image via DeFiPulse

DeFi is a particularly attractive proposition as it gives participants access to a borderless, open alternative to every financial service imaginable, including saving accounts, loans, insurance, trading and more.

Decentralised applications (dApps), spearheaded by the smart contract giant Ethereum, run on the blockchain’s distributed ledger system and completely eliminate the need for a central authority to act as intermediary like in traditional finance. Essentially, this allows for the creation of a system in which there is not a single point of failure, as identical records are kept across thousands of computers via a peer-to-peer network.

Lending and borrowing, yield farming, arbitrage, high APY staking and decentralised trading protocols are only a few of the alternative services that Decentralised Finance has to offer. Decentralised trading, in particular, has sparked the interest of many investors and crypto users alike, and has led to many projects developing their own trading, decentralised exchange (DEX) and automated market maker (AMM) protocols. One of the most notable projects to do so is Uniswap, with its fully decentralised protocol for automated liquidity provision on Ethereum.

About Uniswap

Uniswap is a leading crypto asset exchange that runs on the Ethereum blockchain and completely differs from traditional exchanges in that it proposes a fully disintermediated, decentralised ecosystem in which no single entity is allowed to own, control or operate its network. Furthermore, Uniswap leverages a fairly new kind of trading model called an automated liquidity protocol, which obviates the need for trusted intermediaries and prioritises decentralisation as well as security.

Uniswap

Uniswap, A Sophisticated Decentralised Trading Protocol

Launched in 2018, Uniswap has become the most popular and most used Decentralised Exchange (DEX) with over $5 billion locked in its smart contracts.

Because it is Ethereum-based, Uniswap is fully-compatible with all ERC-20 tokens and other Ethereum infrastructures such as wallet services like Metamask and MyEtherWallet. In addition to this, the Uniswap platform is completely open-source, which means that anyone can essentially copy its codebase and redeploy it to create a similar DeFi protocol, as is the case for Sushiswap for instance.

Uniswap TVL

A Visual Of Uniswap’s Current TVL – Image via DeFiPulse

As a DEX, Uniswap allows users to swap various ERC-20 tokens from a simple, user-friendly, all-in-one web interface that eliminates the many bottlenecks typical of other traditional and centralised exchanges. In order to do this, Uniswap implements the specific architecture of an Automated Market Maker (AMM) and utilises liquidity pools, as opposed to traditional order books, to determine asset prices, perform transactions and execute trades.

AMM infrastructures indeed constitute one of the most notable developments to come out of the DeFi ecosystem as they offer users incredibly advantageous features, such as the ability to swap ERC-20 tokens without having to find a buyer or seller on the opposite side of the trade.

In fact, Uniswap does not use an order book to determine token prices but utilises a set of formulas based on token ratios in its various liquidity pools. This approach creates a balanced on-chain economy and is meant to produce more reliable prices as well as prevent price manipulation.

Automated Market Maker

Automated Market Makers Facilitate DEX Trading And Do Not Implement Traditional Order Book Systems

It is thus clear that in order to better contextualise Uniswap’s DeFi functionalities and automated liquidity provision architecture, a brief AMM and liquidity pool analysis is due. This will help to better understand Uniswap’s role in the DeFi space and shed light on the problems that it looks to solve.

DEXes, AMMs And Liquidity Pools

Automated Market Makers (AMMs) allow digital assets to be traded automatically and without permission by using liquidity pools instead of a traditional market of buyers and sellers. On traditional exchange platforms, buyers and sellers offer up different prices for an asset and when other users find a listed price to be acceptable, they execute the trade and that price becomes the asset’s market price. Real estate, stocks, gold and most other assets rely on this traditional market structure for trading.

Orderbook DEX

Order Books Are Primarily Used In Centralised Exchanges And Traditional Marketplaces – Image via StableTrade Medium

If, for instance, a trader wanted to sell Bitcoin for a price of say $40,000 on a centralised exchange, they would have to wait for a buyer to appear on the other end of the order book who is looking to buy an equal or higher amount of Bitcoin at that price. However, the main issue with this type of economic structure is liquidity, which in this scenario refers to the market depth, or the amount of open orders for the asset, and the number of orders there are on the order book at any given time.

Thus, if liquidity is low, traders might not be able to fill their buy or sell orders, and AMMs attempt to solve this issue by offering a financial tool that is always available for trading and does not rely on traditional interactions between buyers and sellers.

Liquidity Restructured

Liquidity refers to how easily one asset can be converted into another asset without affecting its market price. Before AMMs came into being, liquidity presented Decentralised Exchanges (DEXes) on Ethereum with a hefty challenge. In fact, as a new technology with a complicated interface, the number of buyers and sellers remained pretty small, which essentially meant that it was difficult to find enough users willing to trade on a regular basis.

Market Liquidity

Through Liquidity Pools, Exchanges Gain Access To Greater Trading Activity And Capital Efficiency

AMMs solve this problem of limited liquidity by creating liquidity pools and offering liquidity providers (LPs) an incentive to supply these pools with assets. Consequently, the more assets in a pool and the more liquidity the pool has, the easier trading becomes on Decentralised Exchanges.

On AMMs, instead of trading between buyers and sellers, users trade against a pool of tokens, known as the liquidity pool. Users provide liquidity pools with tokens and the price of the tokens in the pool is determined by a mathematical ratio, as opposed to an order book.

Anyone who holds any type of ERC-20 asset and has access to an internet connection can become a liquidity provider by supplying tokens to an AMM protocol. LPs will usually earn a fee for providing tokens to the pool and this fee is paid by traders who interact with the liquidity pool.

Protocol Architecture

Through being a DEX, Uniswap is more decentralised and flexible than many other digital asset exchanges and it can therefore offer its users a variety of advantageous features, enriching their DeFi experience overall. When viewing Uniswap’s website, it is important to keep in mind that it is much more than just an interface.

In fact, Uniswap standardises how ERC-20 tokens are exchanged with a set of in-house smart contracts and allows anyone to build an interface connecting to these smart contracts in order to immediately start exchanging with everyone else that is using Uniswap.

There are two different types of contracts that make up the Uniswap protocol: Exchange and Factory Contracts.

Exchange Contract Uniswap

A Visual Of Uniswap’s Exchange Contract Mechanism – Image via ProgrammerSought

Exchange contracts contain a pool composed of a specific token and Ethereum, with which users can trade and exchange. The second type of contract is Factory, responsible for creating new exchange contracts and connecting the address of the ERC-20 token to its personal exchange contract.

Adding DAI To Uniswap

When DAI Was Added To Uniswap Via Factory Contract Call – Image via Coinmonks Medium

Because Uniswap charges no fees for listing new tokens on its protocol, anyone can call a function in the Factory contract to register a new token. The figure above displays the process of adding the DAI token to Uniswap and this happened when someone first called the ‘createExchange’ function in a Factory contract with the DAI contract address. The Factory then checks the registry to verify if the Exchange contract for this token was previously created. If it wasn’t created, Factory creates an Exchange contract and writes its address to the registry.

Uniswap Liquidity Pools

As previously mentioned, Uniswap does not leverage the order book system to estimate the price of assets. In more traditional crypto exchanges such as Coinbase or Binance, the value of an asset is purely based on supply and demand, where the highest price is the one for which someone is willing to buy and the lowest price is the one for which someone is willing to sell.

Binance Order Book

A Visual Of The Binance Spot Market Order Book For ETH – Image via Binance

The image displayed above shows the highest ETH bid price on Binance is $1985.87 and the lowest bid price is $1985.88. Instead of implementing this system, Uniswap utilises Exchange contracts to pool both ETH and a specific token in one personal pool.

When a user exchanges ETH for another token on Uniswap, ETH is sent to the contract pool and the token is returned directly to the user. Thus, as a result of this, traders are not required to wait for intermediaries to exchange their tokens or determine a price. Furthermore, since any token can be listed on Uniswap, users do not need to worry about matching tokens to any specific individual, avoiding the problem of initial liquidity provision altogether.

Automated Liquidity Protocol

The way Uniswap solves the liquidity problem typical of centralised exchanges using order books is through an automated liquidity protocol. This system works by incentivising users trading on the Uniswap exchange to become liquidity providers (LPs). Uniswap users pool their capital together to create a fund that is used to execute all trades taking placing on the platform.

Each listed token has its own pool that users can supply liquidity to and the price of each token is determined not through an order book system but by using a mathematical algorithm computer. In exchange for supplying pools with their funds, LPs receive a token that represents their staked contribution to the pool.

So, for instance, if an LP contributed $1,000 to a liquidity pool that held $10,000 in total, the LP would receive a staked contribution token for 10% of that pool. This token can be then redeemed for a share of trading fees as, in fact, Uniswap charges users a flat 0.30% fee for every trade that occurs on the platform and automatically sends it to Uniswap’s liquidity reserve.

Uniswap Pooling System

A Representation Of How Uniswap’s Pooling System Works – Image via Uniswap.org

While Uniswap has recently upgraded to Uniswap v.3, its v.2 protocol entailed the introduction of a fee structure that could be turned on and off depending on the community’s vote, through which 0.05% of every 0.30% trading fee was sent to a Uniswap fund to finance infrastructure and future development.

Determining Token Price Through Constant Product Formula

As opposed to using an order book to determine an asset’s price, allocated to the highest buyer and the lowest seller, Uniswap leverages its AMM architecture to mathematically adjust the price of a token based on its supply and demand ratios in a liquidity pool. This essentially works by increasing or decreasing the price of a token depending on the ratio of how many tokens there are in a given liquidity pool.

Constant Formula Uniswap

The Constant Product Formula Was Developed By Vitalik Buterin And Popularised By Uniswap – Image via Finematics

This token ratio is calculated through what is called the Constant Product Formula, an equation that was first proposed by Ethereum founder Vitalik Buterin and then popularised by Uniswap. The Formula presents itself as follows:

tokenA_balance (x) * tokenB_balance (y) = k, or simply x * y = k

The constant, represented by ‘k’, means there is a constant balance of assets that determines the price of tokens in a liquidity pool. For instance, if an AMM holds both ETH and BTC, two highly volatile assets, every time ETH is bought its price will increase as there will be less ETH in the pool than before the purchase. Conversely, the price of BTC will decrease as there is more of it in the pool. It is furthermore important to note that only when new liquidity providers join in will the pool grow in size.

Visually, the price of tokens in the Uniswap AMM follows an exponential curve determined by its Constant Product Formula.

Uniswap Formula Graph

A Visual Application Of Uniswap’s Constant (k) Formula – Image via Paradigm

In this constant state of balance, defined by k, buying one ETH in an ETH-BTC liquidity pool brings the price of ETH slightly higher along the curve, whereas selling one ETH brings its slightly lower. The opposite happens to BTC in the ETH-BTC pool, which allows the pool to deal with high levels of volatility and eventually return to a state of balance.

Further Visual Examples Of (K)

As mentioned previously, Uniswap uses Exchange contracts to pool both ETH and a specific ERC-20 token into one individual pool. When exchanging ETH for a token on Uniswap, ETH is sent to the contract pool and the token is returned to the user. The amount that is returned after the exchange is based on an AMM formula, x * y = k.

Essentially, the amount returned to users depends on the ratio of ETH to token in the pool.

Uniswap K Graph

Image via Uniswap.org

If users supply liquidity pools with only 1 token, these pools maintain a price balance with external markets through oracles and traders who arbitrate between pools. Ideally, taking a DAI-ETH liquidity pool as an example, this could be conceptualised as weighing scale, as illustrated below.

ETH DAI Uniswap Scale

A Visual Of Balanced DAI-ETH Liquidity On A Centralised Exchange – Image via Coinmonks

Let’s assume that the current price of ETH is $150 and the ratio in the Uniswap DAI-ETH pool returns 150 DAI per ETH. In this scenario, the pool is balanced as the price of its assets is coherent with the current market prices. If, however, there is a swift market movement that pushes the price of ETH down to $100 on a centralised exchange, the pool is unbalanced as traders can still exchange ETH for 150 DAI on Uniswap when ETH’s market price is $100.

Unbalanced Liquidity Pool Uniswap

A Visual Of Unbalanced DAI-ETH Liquidity On A Centralised Exchange – Image via Coinmonks

Thus, Uniswap users can put ETH into a pool, withdraw DAI, exchange the DAI for ETH and profit along the way. This can be done until the pool balances out again and reflects the current market price, creating considerable arbitrage opportunities for traders on Uniswap.

Uniswap v.1 and v.2

Uniswap v.1 is the first version of the protocol launched in November 2018 at Devcon 4. Among its key features, Uniswap v.1 offered:

  • Support for any ERC-20 token using Factory contracts.
  • Liquidity pools to collect fees on ETH-ERC-20 pairs.
  • Liquidity-sensitive automated pricing using constant formula (k).
  • ETH trading for any ERC-20 without wrapping.
  • Low gas fees
  • Support for private and custom Uniswap exchanges
  • Open source front-end implementation
  • Funding through an Ethereum Foundation grant
V1 Liquidity Growth

The Exponential Liquidity Growth On Uniswap v.1 – Image via Uniswap.org

In May 2020, Uniswap launched its second iteration and introduced a series of new optimisations and improvements. Among its key features, Uniswap v.2 offered:

  • ERC-20 to ERC-20 trading pairs, as opposed to v.1’s exclusive ETH to ERC-20 and ERC-20 to ETH pairs.
  • Price Oracles
  • Flash Swaps
  • Core/Helper Architecture
  • Technical Architecture
  • Path to Sustainability
  • Testnet and Launch Details

Uniswap v.2’s ERC-20 to ERC-20 pairs constitute perhaps the most notable improvement as they open up an entirely new market for trading digital assets, obviating many of the bottlenecks of centralised exchanges. In Uniswap v.2, any ERC-20 asset can be pooled together with any other ERC-20, with Wrapped ETH instead of native ETH being primarily used in core contracts. While in Uniswap v.1 all liquidity pools are established between ETH and individual ERC-20s, v.2 allows users to swap any ERC-20 with any other ERC-20 by routing through ETH.

ETH Router

The ETH Intermediary When Swapping DAI X USDC In v.1 – Image via Uniswap.org

The implementation of v.2’s ERC-20 to ERC-20 token pools can indeed be advantageous for liquidity providers, who can maintain more diverse ERC-20 token denominated positions. Furthermore, if a user wanted to swap say DAI for USDC in v.1 they would have had to undergo a double transaction fee, namely DAI to ETH and ETH to USDC.

DAI To USDC Swap

DAI To USDC Swap With Router On Uniswap v.2 – Image via Uniswap.org

With Uniswap v.2, however, users can transact directly between two ERC-20s through an ETH Router.

Uniswap v.3: A New Era Of AMMs

It is by now clear that Uniswap serves as critical infrastructure for decentralised finance and incentivises developers, traders and liquidity providers to participate in a robust and secure digital asset marketplace.

Uniswap Version 3

Uniswap v.3 Introduces A New Layer To Decentralised Exchange Trading

On May 5th 2021, the Uniswap team announced the launch of Uniswap v.3, its most powerful version yet, on the Ethereum mainnet.

Uniswap Tweet V3

On May 5th, Uniswap v.3 Went Live On The ETH Mainnet – Image via Uniswap Twitter

Uniswap v.3 introduces:

  • Concentrated Liquidity, giving LPs granular control over what price ranges their capital is allocated to.
  • Multiple Fee Tiers, allowing LPs to be appropriately compensated for taking on varying degrees of risk.
  • Liquidity Provision with up to 4000x capital efficiency compared to v.2, meaning higher return for LPs.
  • Lower Slippage.
  • Fast and Cheap Price Oracles. Uniswap v.3 Oracles are capable of providing time-weighted average prices on demand for any period within the last 9days of execution.
  • Significantly Cheaper Gas Fees! v.3 swap transactions will occur on Optimism’s Layer-2 solution.

v.3 Capital Efficiency

One of the most significant changes coming with Uniswap v.3 relates to capital efficiency. This is because most AMMs have proven to be rather capital inefficient, as the majority of their funds at any given time are not used. For instance, Uniswap currently has $5 billion locked in its contracts, however, it does only $1 billion in volume per day.

Uniswap v.3 seeks to solve this issue by allowing LPs to set custom prices for which they want to provide liquidity for. This will, in turn, lead to more concentrated liquidity in the price range that most trading activity happens in.

Uniswap On Layer-2

Transaction fees on the Ethereum network have been at an all-time-high in the last year and this has, at times, made Uniswap unaffordable for many smaller investors out there. Thus, to counter this, Uniswap v.3 will be deployed on a Layer-2 scaling solution called Optimism.

Optimism

Optimism Will Allow Uniswap To Reach Greater Scalability And Perform Transactions More Efficiently – Image via Uniswap.org

By implementing a Layer-2 Optimistic rollup, Uniswap will benefit from the security of the Ethereum blockchain and enjoy greater transactional throughput as well as scalability.

How To Use Uniswap

Uniswap offers a user-friendly interface that allows users to connect their Metamask, Portis, WalletConnect, Coinbase Wallet or Fortmatic wallets and begin trading right away. Below is a step-by-step guide on how to get started using the Uniswap platform:

  • Once a wallet is fully set up, users can go to the official Uniswap website, click ‘Launch App’ and then ‘Connect Wallet’.
Connect Wallet Uniswap

Image via app.uniswap.org

  • Users can then select their preferred wallet and begin using the platform.
  • A pop-up will subsequently appear showing the user’s account, and they should click ‘next’ and ‘connect’.
  • Now that the selected wallet is connected to Uniswap, users can begin swapping.
  • On the swap tab, users can choose the token amount they wish to swap, and if a token is not listed they will have to manually enter the official contract address of the desired token.
Token Amount

Image via TheCryptoBasic

  • Uniswap will then provide users with an estimate of the amount of tokens they will receive after the swap.
  • Users can confirm the swap simply by clicking ‘Confirm Swap’.
  • After having confirmed the swap, a window will show up with the gas fee required to execute the transaction.
  • Once the transaction is completed, Uniswap provides users with a link to their transaction on Etherscan.

UNI Token

UNI is an ERC-20 token and Uniswap’s native asset. The UNI token acts as a governance token for the Uniswap platform and gives holders the right to vote on new changes and developments to the platform, including how minted tokens should be distributed to the community and developers, as well as any changes to the fee structure.

UNI was created in September 2020 in an effort to prevent Uniswap users from migrating to SushiSwap, which had offered Uniswap users SUSHI tokens in return for their migration. Thus, Uniswap minted 1 billion UNI tokens and decided to distribute them to anyone who had previously used the platform. On September 1st, each user received 400 UNI tokens, equating to approximately $1,400 at the time.

Uni Token Price

Since The Beginning Of 2021, Uniswap Has Enjoyed A Progressive Upward Trend But Has Retraced From Its Highs Of May 2021 – Image via CoinMarketCap

Uniswap is currently trading at around $16 and peaked at an all-time-high of $44.97 on May 3rd 2021. Uniswap received backing and investments from heavyweight venture capital firms in the blockchain space such as Andreessen Horowitz, Paradigm Venture Capital, Union Square Ventures and Parafi. Due to its backing, historical performance and the launch of v.3, Uniswap is likely set to continue growing in the medium to long term outlook and carry on delivering on its promises of becoming the ultimate DeFi DEX.

Uniswap Team

Uniswap was founded on November 2nd 2018 by Hayden Adams, a former mechanical engineer for Siemens. Hayden graduated from Stony Brook University with a bachelor in engineering in 2016 and was deeply inspired by Vitalik Buterin’s 2016 proposal for a Decentralised Exchange that would employ an on-chain automated market maker with certain unique characteristics. Just two years later, Hayden Adams began working on his own AMM-DEX and has since then become the founder and leading catalyst of Uniswap.

After receiving several funding rounds as well as a $100,000 grant from the Ethereum Foundation, Hayden began expanding his employee base for the Uniswap platform.

The Team at Uniswap Labs is composed of:

Conclusion

Uniswap has taken the DeFi space by storm as it offers its users a variety of exciting and advantageous functionalities, ultimately re-architecting the concept of liquidity via its AMM infrastructure.

As a DEX, Uniswap allows users to swap various ERC-20 tokens from a simple, user-friendly, all-in-one web interface that eliminates the many bottlenecks typical of other traditional, centralised exchanges and it furthermore incentivises traders and developers to provide liquidity to its pools and receive attractive trading fees.

Uniswap has created an innovative DeFi architecture that is truly reshaping the process of decentralised on-chain trading and, for this very reason, it is essentially destined to achieve long term success.

Disclaimer: These are the writer’s opinions and should not be considered investment advice. Readers should do their own research.
Filippo is an all-round digital asset enthusiast, DeFi-NFT lover and Cambridge University linguist looking to deliver only the most up-to-date information on the dynamic world of cryptocurrency and the most exciting developments in the space. View all posts by Filippo Bertocchi ->

Related Posts

AMP Token Review
AMP Token Review

Amp Token Review: Paving the Way for Digital Payments?

October 28, 2021 19 min read
Ellipal Hardware Wallet Review
Ellipal Hardware Wallet Review

Ellipal Titan Wallet Review- Next Generation of Hardware Wallet?

October 27, 2021 15 min read
Crypto Friendly Banks
Crypto Friendly Banks

Top 6 Crypto-Friendly Banks: Complete List

October 21, 2021 15 min read
Exodus Wallet Review
Exodus Wallet Review

Exodus Wallet Review: Everything You Need to Know

October 14, 2021 16 min read
Beginners Guide to Crypto Trading Bots
Beginners Guide to Crypto Trading Bots

Crypto Trading Bots : Automated Money Machines?

September 28, 2021 18 min read
Holochain Review
Holochain Review

Holochain RSM: NEW and IMPROVED Blockchain!

September 28, 2021 19 min read
Top Privacy Coins
Top Privacy Coins

The Top 5 Privacy Coins for 2022

September 27, 2021 18 min read