fbpx

What is Uniswap? A beginner’s crash course

Cryptocurrency

Written by:

Alexander Lee

In this article, you will get a brief understanding of what Uniswap is, its revolutionary solution to a major market issue, and why so many people are excited about it.

How (a lack of) Liquidity can hurt investors

Centralised exchanges such as Coinbase and Kraken have been the major hubs of cryptocurrency trading. These platforms are administered by a single authority (the exchange operator), require users to place funds under their custody, and permit trading using a typical order book system.

The exchanges operate as custodians, holding users’ assets on their behalf. Benefits include efficient settlement time and trading volume. However centralised exchanges use the order book model where the price of an asset listed on the exchange is determined by where the highest price someone is willing to pay and the lowest price someone is willing to sell is matched.

The key issue in the order book model is liquidity.

Imagine you’re opening a new market selling food products. New food sellers would only be attracted to open their stores in your market if there are high numbers of customers they can sell to. On the other hand, customers would only visit the new market if there are an attractive number of sellers to buy from.

Likewise, attracting a larger number of both buyers and sellers onto the platform to trade at agreeable prices is difficult to achieve and maintain. It is a chicken and egg problem – for buyers to come, sellers must already be there, and vice versa.

Decentralised exchanges like Uniswap attempts to solve this problem.

We explore how.

What is Uniswap?

Uniswap is an open-sourced Decentralised Exchange.

Decentralised EXchanges (DEXs) facilitate peer-to-peer trading by relying on automated smart contracts to execute trades without an intermediary.

This means there are no middlemen or custodians. When using DEXs, you have full responsibility and control of your assets.

Think of smart contacts like a plane on autopilot, there is no need for a human to manage the system, the plane automatically reacts and responds to new information (eg. changes in weather) according to pre-designed parameters.

Decentralised exchanges work somewhat like a Whatsapp group chat:

  1. No one owns the group chat; everyone has an equal role in it. (decentralised)
  2. When communicating, instead of text messages, numbers are sent. Everyone gets and stores the same messages. (Distributed ledger)
  3. Now if a person wants to change a message, he cannot simply edit it by himself, he must convince the majority of the group to accept the change. (Immutable list)

Uniswap is built on top of the Ethereum blockchain. It is ERC-20 compliant, which means it is guided by ERC-20 rules that all tokens conform to, in order to be understood and recognized by others in the ecosystem. This allows Uniswap to accept and transact with all other ERC-20 tokens, tools, and infrastructure.

Think of this like cars, where you can have different shapes, models and forms, but they must be within a certain size in order to fit into existing infrastructure such as car parks.

According to DeFi Pulse, Uniswap is the 6th biggest DeFi platform with 5.48 Billion USD of assets locked in its systems.

How did Uniswap begin?

Uniswap was born out of a post made by Vitalik Buterin in 2016 asking for a decentralized exchange (DEX) that would use an on-chain automated market maker (market makers constantly provide buy and sell options to keep the market liquid) that would be an innovative approach to solving illiquid markets.

Uniswap was launched in 2018. In 2020, the now popular Uniswap V2 was launched along with the UNI token. Holding the UNI token gives the holder voting rights and the community plays a role in determining future changes to the protocol.

The protocol is now a critical infrastructure for decentralised finance, creating a secure and booming marketplace for cryptocurrency trading. Constantly innovating, Uniswap V3 was recently launched on 5 May 2021 with community-driven features such as:

  1. Flexibility to provide liquidity at selected price ranges – users can choose at which price they would like to provide their assets for others to borrow.
  2. Risk-adjusted fee tiers; fees earned are proportional to the amount of risk taken
  3. Reduced transaction speed and costs

These updates will be covered in future articles. Today we will be focusing on the core features of Uniswap.

How does Uniswap work?

Any project that is ERC-20 compliant can participate and create an interface that allows trading to happen. There is no listing process nor any listing fees. To participate, one must create 2 different contracts – exchange and factory contracts.

In a nutshell,

  • Factory contracts create and manage exchange contracts while maintaining the address of the token to the exchange address.
  • Exchange contracts execute the trade transaction.

Solving illiquidity – Automated Market Maker (AMMs)

At its core, AMMs are smart contracts that allow cryptocurrencies to be traded seamlessly with the usage of liquidity pools which hold balances of two unique tokens and controls deposits and withdrawals from them.

Liquidity pools can be contributed by anyone who can supply equal values of the paired tokens.

In the traditional order book method, the price a buyer is willing to buy at and the price a seller is willing to sell at is matched for the transaction to happen. In the liquidity pool system, traders do not have to wait for a price match. Instead, liquidity providers deposit assets to pools allowing buyers and sellers to trade against these collective pools that are always buying and selling.

It is like setting up a money changer on a busy street where you and your friends pool together money to support the exchange of SGD and RM. Instead of trying and hoping to find someone on the street to do a currency conversion, people who want can convert SGD to RM can go directly to you, where you already have a pool of willing buyers and sellers of the SGD and RM that are able to service the person at any time!

Source: ethresear.ch

Incentivising liquidity

The incentive to provide liquidity comes from the traders, who get charged a fixed fee of 0.3% for every trade that takes place. Uniswap does not get a cut of the fees unless an additional protocol is activated, therefore all fees that are collected go directly to the liquidity providers.

The fee collected is split in proportion to the amount of liquidity provided – assuming person A contributes $1 million out of a total pool of $10 million, Person A receives a token that records and represents 10% of the total fees collected.

When the liquidity provider decides to exit the pool, they exchange the token and collect their fee for providing liquidity.

How does liquidity pools work?

As shared in my previous article, the secret formula that governs AMMs is actually a simple formula that represents supply and demand:

X * Y = K

X is the amount of token A, Y is the amount of token B and K is a constant number

When providing liquidity into the pool, an equal value of tokens A and B must be added. For example, James wants to trade token A for token B. James adds a big amount of token A, increasing X. This causes Y to decrease as K needs to remain constant. Therefore, as more Token A gets added, the amount of Token B James gets would decrease in proportion.

Source: ethresear.ch

Due to the exponential relationship, how much the prices move depends on the size of the trade in relation to the total value of the pool. The bigger the trade, the more unfavourable the exchange rate becomes. However, it is guaranteed that the trade is always successful.

Hence, larger liquidity pools are extremely attractive as they allow larger trades to happen without changing the exchange ratio too drastically!

How are liquidity pool prices determined?

When a new liquidity pool is created, the first provider must provide the initial liquidity and is incentivised to provide an equal value of both tokens according to the market rate. If the ratio is significantly different from the market, a profitable arbitrage opportunity can be taken by others.

As transactions happen in the pool. The ratio may shift away from the present market rate, if providers believe that the price is wrong, they may add liquidity and arbitrage it back to the desired ratio.

Back to our example – your money changer would not just be the only shop in town, there surely be other competitors. Therefore, if users notice that another money changer has a significantly better exchange rate than you, they can simply buy from your money changer and sell to the other party to earn a quick buck. They will do so until a margin cannot be made and the prices are similar. This keeps the market exchange rates similar across all exchanges. Of course, this is not so easy to do so irl, as they would have to factor in the cost of fees and time involved.

In Summary

More and more users are attracted to Uniswap due to its benefits of:

  1. Flexibility to create unlimited token pairs for trading
  2. Compatible with all ERC-20 compliant third-party protocols
  3. Secure as vetted by a diverse development community

Being one of the leading and most popular decentralised exchanges with a forward-looking team. We can expect more value to come from this unique platform.

If you’re new to crypto, join AK at his upcoming webinar to learn the fundamentals that’ll help you succeed in this new space.

Disclaimer:

This is not financial advice. Any action you take is solely your own responsibility. Cryptocurrencies are extremely volatile, only invest with what you can afford to lose.

Leave a Comment