Uniswap and how it works


To benefit from the services of a centralized crypto exchange, you must first submit your KYC (Know Your Customer) form along with some prerequisite documents. By doing so, you reveal several details about yourself to the third-party exchange. Moreover, these exchanges act like a bank; they monitor transactions and can hinder or stop any user’s business activities.

This can be counterproductive for those who have turned to crypto specifically to avoid the shadows of traditional finance. For this very reason, decentralized finance projects like Uniswap have sprung up. They circumvent the longstanding problems of centralized exchanges by using smart contracts and algorithms that create a permissionless cryptocurrency trading system.

What is Uniswap?

Uniswap is a decentralized crypto token exchange protocol. It was built on top of Ethereum and allows seamless trading of ERC-20 tokens without the need for order books.

Uniswap, in addition to being decentralized, is also an open source platform. This means anyone can copy the source code of Uniswap to build their decentralized exchange. It is also completely devoid of benefits. The founders and developers of the platform do not get any share of the transactions made on Uniswap. For all intents and purposes, it is a public transaction facilitation service. New decentralized projects can even list their coins on the platform without paying listing fees.

But what makes Uniswap unique is how it handles the task of market makers. It uses the Automated Market Maker (AMM) smart contract instead of relying on intermediaries to match traders’ buy and sell prices. It does this by setting up liquidity pools for multiple asset pairs. Uniswap also uses the “constant product formula” which keeps the ratio of assets in the liquidity pool balanced and ensures that larger trades are facilitated without any hitches.

In case it’s a little too hard to understand, we’ve explained the concepts below.

Understanding market makers, AMMs and how Uniswap works:

The basis of traditional trading is based on the concept of Market Makers. In financial trading, market makers provide liquidity for trading pairs. Let’s take an example to further clarify the concept. If trader A wants to buy bitcoin, an exchange will find a seller, trader B, selling bitcoin at the rate indicated by trader A. In this scenario, the exchange acts as a middleman.

Some financial institutions add liquidity by creating multiple buy/sell orders to match retail investor orders. Entities that provide liquidity become market makers.

The goal of an automated market maker in a decentralized exchange (DEX) is to remove middlemen from the crypto trading process. You can think of AMM as a computer program that automates the process of providing liquidity. These protocols are built using smart contracts – computer codes that execute themselves – to set the price of a digital asset and provide liquidity. In the AMM protocol, users do not negotiate with a financial institution. Instead, they trade with a pool of liquidity defined by a smart contract that dictates trading rules and prices for buyers and sellers.

Anyone can become a liquidity provider by contributing two tokens, either 2 ERC-20 tokens, or 1 ERC-20 token and 1 ether. Traders must pay a commission to liquidity providers. This incentivizes providers to lend their tokens to the pool.

Let’s take an example to better understand the concept of MA.

If you want to trade a particular asset for another, like ether (ETH) for tether (USDT), you need to find an individual ETH/USDT liquidity pool. In AMM, any entity can be a liquidity provider if it meets the requirements stipulated in the smart contract. Thus, a liquidity provider can deposit their Ether and Tether tokens to contribute to the ETH/USDT liquidity pool.

To ensure that the asset ratio remains balanced, MAs use predefined mathematical formulas. Most DEXs like Uniswap use the constant product formula, X*Y=K.

X represents the price of the first asset in the pool and Y represents the price of the second asset, while K is constant to ensure that the ratio between the two assets does not change.

Due to the constant addition and removal of assets in the pool, the price of assets fluctuates. This helps maintain the same ratio between the two assets in the pool. If ether is taken from the ETH/USDT liquidity pool, the price of ether within the pool will rise and the price of tether will fall.

This discrepancy in pool asset prices is resolved by arbitrage traders who find differences between the price of an asset across multiple exchanges. They buy on one platform where the price of the asset is lower and sell it on another where it is higher.

What’s so special about Uniswap’s constant product marketplace builder?

AMM is present in most decentralized exchanges as it is the foundation for providing liquidity. It is responsible for attaching a price to a token in a liquidity pool. But there are also problems with AMMs. One of the biggest issues is that the processing of larger orders is proportional to the size of the liquidity pool. However, Uniswap’s Constant Product Market Maker can provide liquidity regardless of pool size or order size. This is one of the major factors that sets it apart from other decentralized exchanges.

(Edited by : Abhishek Jha)

First post: STI


Comments are closed.