You may have heard of Uniswap, which has been a controversial topic in the DeFi community. Hayden Adams originally developed the Uniswap protocol after being inspired by Vitalik Buterin’s post about the market maker equation X * Y = K. Hayden took a rational approach to the problem, developing Uniswap, a protocol for automated liquidity provisioning. Let’s find out more details about Uniswap to understand how it works and what are the risks of it!
What is Uniswap?
Uniswap is a completely different form of exchange that is completely decentralized – that is, it is not owned and run by a single company – and employs a very new trading methodology known as an automatic liquidity protocol.
The Uniswap platform was established in 2018 on the Ethereum blockchain, the world’s second-largest cryptocurrency project by market capitalization, making it interoperable with all ERC-20 tokens and infrastructure such as wallet services such as MetaMask and MyEtherWallet.
Uniswap is also totally open source, which means that anyone may copy the code and use it to build their own decentralized exchanges. It even allows users to list tokens for free on the market. Normal centralized exchanges are profit-driven and demand exorbitant fees to list new coins, thus this is a significant distinction. Because Uniswap is a decentralized exchange (DEX), users have complete control over their funds at all times, as opposed to a centralized exchange, which requires traders to hand over control of their private keys so that orders can be logged on an internal database rather than executed on a blockchain, which is more time consuming and expensive.
How Uniswap works?
Uniswap is powered by two smart contracts: “Exchange” and “Factory.” These are computer programs that are programmed to conduct specific tasks when certain criteria are satisfied. The factory smart contract is used in this case to add new tokens to the platform, while the exchange contract handles all token swaps, or “trades.” On the improved Uniswap v.2 platforms, any ERC20-based token can be swapped for another.
Automated liquidity protocol
An automated liquidity protocol is used by Uniswap to tackle the liquidity problem (mentioned in the introduction) of centralized exchanges. This operates by incentivizing exchange traders to become liquidity providers (LPs): Users on Uniswap pool their funds to form a fund that is used to perform all deals on the platform. Each token listed has its own pool to which users can contribute, and the values for each token are calculated using a mathematical algorithm operated by a computer
A buyer or seller does not have to wait for the opposing party to emerge in order to conclude a transaction with this approach. Instead, they can execute any deal quickly at a known price as long as there is enough liquidity in the pool to make it possible.
Each LP receives a token that symbolizes their staked commitment to the pool in exchange for putting up their funds. For example, if you contributed $10,000 to a liquidity pool with a total value of $100,000, you would receive a token representing 10% of that pool. This token can be exchanged for a portion of the trading costs. Uniswap charges consumers a fixed 0.3% fee for each trade executed on the platform, which is instantly transferred to a liquidity reserve.
When a liquidity provider decides to withdraw, they receive a percentage of the total fees from the reserve based on the amount they staked in that pool. The token they received, which keeps track of how much money they owe, is then destroyed.
Following the Uniswap v.2 upgrade, a new protocol fee was implemented, which can be switched on or off by a community vote and essentially transfers 0.05 percent of every 0.30% trading charge to a Uniswap fund to fund future development. This charge option is currently disabled; however, if it is enabled, LPs will begin receiving 0.25% of pool trading fees.
How Does Uniswap’s Automated Liquidity Provisioning Work?
The X and Y in the “X * Y = K” equation reflect the number of available ETH and ERC20 tokens, respectively. Whereas K is a constant that can be set by the designers of the Uniswap exchange contract. K may appear to be a random constant, but it is the most important. When you multiply X by Y, the result must always be equal to K.
The graph below illustrates the function K, which is a constant. Token B (ETH) is represented on the Y-axis, whereas token A (ERC20) is represented on the X-axis. The first red dot (old position) reflects the current price for swapping this ETH-ERC20 pair based on the current ETH token balance versus ERC20 tokens.
As a result, the balance of ETH tokens falls while the balance of ERC20 tokens rises. This means that the red dot will migrate to the new location as the liquidity pool contains more ERC20 tokens and fewer ETH tokens. To put it another way, it’s a very simple pricing algorithm in which the price rate advances along with a graph.