Home » Gaming Cryptocurrency » Understanding Uniswap, how it works and what is Uniswap V2
Uniswap is an Ethereum-based exchange

Uniswap is an Ethereum-based exchange that is decentralised in the form of two smart contracts hosted on the Ethereum blockchain and a public, open source front-end client. It is a complete on-chain market maker where you could also swap ETH to ERC20 tokens and vice-versa. The system allows one to contribute to liquidity pools for any ERC20 tokens whereby you gain commissions in the form of exchange fees.

Uniswap was created by Hayden Adams who was inspired to create a protocol based on Ethereum’s properties – namely being:

  • It was censorship resistant – no one could stop it.
  • It was decentralised – no one controlled it.
  • It was permissionless – anyone could use it.
  • It was secure – anyone could verify execution.
UNiswap founder Hayden Adams

Hayden Adams in a Uniswap T-shirt or has he calls it: a Unishirt.

UNI, the Unicorn Protocol is a protocol for swapping ERC20 tokens without fees or middlemen. It solves issues that centralised exchanges face, including hacking risks, mismanagement and fee applications.

Why is Uniswap special?

One of Uniswap’s distinctive features is the use of a pricing mechanism called the ‘Constant Product Market Maker Model’, which separates it from other decentralised exchanges.

Instead of connecting buyers and sellers to determine the price of a token, Uniswap uses a constant equation of x*y = k. Meaning, x and y represent how many ETH and ERC20 are available in a liquidity pool and k is a constant value. The x*y = k formula was posted on Ether Research by Ethereum creator Vitalik Buterin describing how it would be utilised with a decentralised exchange. Along with the post, the following graph was posted illustrating the aforementioned formula:

Uniswap's x*y = k formula illustrated

Illustration of the x*y = k formula basis which Uniswap calculates exchange rates for tokens.

Thus the balance between ETH and ERC20 tokens – and supply and demand – determine a particular’s price. So when someone buys a certain token with ETH, the supply of that token goes down while the supply of ETH goes up – the price of the former increases. Ergo, a token’s price on Uniswap only changes if and when trades occur. Essentially, Uniswap is balancing out ETH and ERC20 tokens and their swapping and determining their value in trading.

In an abundance of ETH

In the scenario of someone using the exchange to buy many ERC20 tokens thus causing a shortage of ERC20 and an abundance of ETH tokens. This imbalance changes the exchange rate to a different point on the x*y = k line. The red dot on the graph would move to the upper-left part of the curve thereby increasing the ERC20 value.

In an abundance of ERC20

It may occur, on centralised exchanges, tokens are worth less than $0.01, which is not uncommon with new tokens or tokens with no inherent value to them. Uniswap supports this scenario too, where 1 ETH may be the equivalent of 100,000 ERC20. In such a scenario the red dot would fall to the bottom-right of the curve.

However, it is imperative to note that after a crash of one token’s value, the other cannot crash, thus the curve flattens out. Instead, the token on Uniswap will just bottom out. Henceforth the need to now escape the flattening line and the climb upward may be a little more challenging than a traditional exchange.

Further, you could add any token to Uniswap by funding it with an equivalent value of ETH and ERC20. Each token has its own smart contract and liquidity pool, if not, it is created easily. For example, if you wanted to make an exchange, you would have to launch a new Uniswap smart contract for the token you hold and create a liquidity pool with – for instance – $10 worth of said token and $10 worth of ETH. Once the token has its own exchange smart contract and liquidity pool, anyone can begin trading in the token or contribute to the liquidity pool and earn a fee of 0.3%. All you need is an equal value ETH and ERC20 tokens.

How is a Uniswap token produced?

Whenever a new ETH or ERC20 token is contributed to a liquidity pool, the contributor receives a ‘pool token’, which is also an ERC20 token. Therefore pool tokens are created when funds are deposited into a pool. Being that these are ERC20 tokens, pool tokens can be exchanged, moved and utilised for other decentralised applications freely. The tokens are burned or destroyed when the funds are reclaimed. Each of the pool’s tokens represent a user’s share of the pool’s total assets along with a share of the pool’s trading fee of 0.3%.

Swapping tokens using Uniswap

The Uniswap Protocol can be accessed through its front-end here, additionally, you will also need an Ethereum address. Once it’s ready you can swap or add tokens to a Uniswap liquidity pool; all you need to do is select the token you want to swap in and out of. Post which, you are required to approve the transaction using your wallet confirm the swap.

Being that Uniswap is an open protocol of smart contracts, there are several front-end user interfaces built for it. Some enable you to add funds to Uniswap pools without having to actually access the official Uniswap interface. Others even make for simple-one click solutions to purchase pool tokens in combination with other token strategies.

The launch of Uniswap V2

While Uniswap launched back in November 2018, it was only recently that the protocol started receiving significant traction. Much of it is due to the release of Uniswap V2.

Announced in March, 2020, on the Uniswap blog, Uniswap V2 supports OmiseGo (OMG) and Tether (USDt), both ERC20 tokens that were previously incompatible. In addition to a host of technical improvements, it is an upgrade which enables direct ERC20 to ERC20 swaps and removing Wrapped Ether (WETH) from the equation when it can.

While direct swaps have been enabled, users still do have the option of fo swapping between two tokens with ETH as the intermediary. This helps when there is no pool for the input and output tokens but there is a pool that exists between ETH and the two tokens.

Since pooled liquidity mining saw a drastic uptick in popularity in 2020, this benefited Uniswap too. However, its founder Hayden Adams did admit that it is still “nascent technology” and they have only just “begun to realise its potential”. Hence, they reportedly raised a seed round of over a million dollars, led by crypto hedge fund Paradigm. The money raised will supposedly be used to form a dedicated team to research and develop “Uniswap alongside the broader Ethereum community.”

The re-writing of Uniswap warranted third party audits along with extensive testing on a testnet to ape real-world usage. Consensys Diligence was one of the parties to contribute a comprehensive report on Uniswap V2 source code, their audit could be read here. Thus, it would seem that it was extensively audited and reviewed before its Mainnet release. It also potentially ensures there will be no major bugs in the future too although Uniswap does have a Bug Bounty Program in place in case major flaws are detected.

Uniswap V2, like its predecessor, remains a decentralised, trustless exchange that exists on the Ethereum blockchain that is unlikely to be tampered with unless the fundametal Ethereum protocol is attacked successfully. This has not happened yet and given the amount of miners and validators that currently in operation, it is unlikely to happen.

Relying on Arbitrage Traders

Uniswap has no live order books which results is traders still relying on centralised exchanges to execute trade strategies. Thus, centralised exchanges continue to have a lot of influence in balancing Uniswap exchange rates – which rely on arbitrage trades to stay in sync with the mean market price.

If there is a Uniswap exchange that orchestrates a major unbalance, there needs to be a way to bring back balance to the token values again. Enter arbitrage traders – they will leverage alternative exchange rates from other services to perform the arbitrage. Therefore, Uniswap is not a replacement for traditional exchange models – yet. It is a new model of token swapping and is still in its experimental stage. Ergo, its true benefits and downfalls will only be revealed in time yet to come.

In the end, Uniswap V2 is a good move in the right direction but there is still room for work to be done, evidently, if decentralised exchanges are to totally replace centralised changes. Having said that, the Cryptocurrency community and Ethereum – in particular – is quite positive about it and the DeFi community doesn’t look like they’re slowing down anyway.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments