Since 2020, Decentralized finance has become quite popular for peer-to-peer transactions for trading cryptocurrencies and earning passive income from providing liquidity to them. Among many such platforms, Uniswap V2 is one of the emerging decentralized cryptocurrency exchanges that can create a market between any two ERC-20 tokens.
If you are curious to know about decentralized exchanges such as Uniswap V2, then you are at the right place. In this blog, we will discuss some of its amazing features and its working mechanisms.
What is Uniswap V2?
There are centralized exchanges and decentralized exchanges. Every decentralized exchange like Uniswap V2 has two main actors, liquidity providers, and traders. The Liquidity Providers are the users who come together and create a pool consisting of two different tokens that can be exchanged, For example, Ethereum and Matic. As a reward for providing liquidity, they receive another token that represents their shares in the liquidity pool and this token is known as the liquidity token.
Whereas talking the traders, the traders are people, who buy tokens from the pool in exchange for the other token provided by the liquidity providers. The exchange rate of Token and Token0 is determined based on the relative numbers of both tokens. Along with that, the pool takes a small percentage of the fee also known as a reward from the traders.
How Does it Work?
Every liquidity pool on Uniswap such as ETH/USDT takes the quantities of both and multiplies them to calculate the total liquidity of the pool. This is also known as k. The core logic behind Uniswap is that the total liquidity k should always remain the same. So the formula of total liquidity is
x*y = k
Let’s take an example to understand in a better way, let’s suppose you buy an ETH for 300 USDT using ETH/USDT pool. After this transaction, the amount of ETH will decrease and USDT will increase, and the effective price of Eth will go up to maintain the value of k as constant. Based on this formula, the pricing of the token is determined.
How does it differ from Uniswap V1?
Uniswap V1 is one of the earliest proof-of-concepts for any new type of decentralized cryptocurrency exchange. It featured automated liquidity provision of Blockchain like Ethereum. Further, the Uniswap protocol functions provided an unstoppable platform for the users to convert their ERC20 tokens from one type to Another. Uniswap is still serving on the Ethereum blockchain as long as it exists and offers a lot of use cases.
However, with the ongoing revolution in technology, Uniswap has developed a second iteration called Uniswap V2. This version includes various new features and enhancements. Some of the main features are as follows.
In Uniswap V2, any ERC20 tokens can easily be pooled with any other ERC20 tokens. Wrapped Ether is the token used in the core contract whereas users can still use Ethereum by using third-party contracts. With the introduction of the ERC20/ERC20 token pair, users can maintain diversified ERC20 token denominations without using Ether ( the native token on the Ethereum chain).
Another Implementation is the on-chain price feeds, which are manipulation resistant and highly decentralized. Uniswap has leveraged the historical data to build expensive to manipulate price feeds. Any external smart contract can create gas-efficient time weight Averages for Different assets on Uniswap.
If we talk about the most critical part of Defi, then it is the On-chain price feeds. Despite Uniswap V1 tracking the price of all assets, it is not a secure solution yet, because the price of assets is highly volatile and can be changed in a short period of time.
Uniswap V2 has numerous improvements built for efficient price feed. For every token pair, the market price at the beginning of every block before the trade occurs is stored and measured. This price is difficult to manipulate as it is set by the last transaction in the previous block.
Uniswap V2 Flash Swaps give users a facility to withdraw as many tokens from the pool without any upfront cost and conduct any activity them and by the end of transaction confirmation, users can either return all the ERC20 tokens or pay for the percentage of ERC20 tokens and buy all the tokens.
With the help of flash swaps, users can easily perform margin trading and borrow from lending Pools.
Technical Improvements in Uniswap V2
Uniswap V2 has a lot of technical improvements on top of its previous version.
- All the smart contracts are written in the Solidity programming language rather than Vyper.
- It uses the CREAT2 feature of Ethereum to create the liquidity pool of ERC20 token pairs.
- Uniswap V2 handles all the “missing return” ERC20 tokens which do not work on Uniswap V1.
- It also offers gasless transactions for the approval to withdraw tokens from your wallet.
- Utilizes advanced security best practices to prevent any hacks or security attacks.
- Fixed bugs of Uniswap V1 Version.
- In case of any revert or error, the messages are now quite descriptive.
Path to More Sustainable Product
In recent times decentralization has increased and demolished the central point of failure. Uniswap V1 is one of the earliest protocols that offered decentralization, censorship-resistant and trustless. And Uniswap V2 is the much more advanced and enhanced version of it. In order to open a path of self-sustainability, Uniswap V2 also charges a small 5 unlike before.
The Uniswap UNi TOken.
The Native token of the Uniswap Protocol is the UNI token, it gives governance rights to its holders. This basically means that all the UNI holders can vote on proposals for any changes in the protocol. The total Supply of UNI tokens is 1 Billion and 60 percent of the total tokens have been distributed among the existing Uniswa COmmunity, whereas 40 percent of tokens are reserved for the team members, advisors, and investors and distributed periodically.
In a nutshell, the core smart contracts are already developed and being used by a lot of users. All the Uniswap V2 smart contracts have undergone a complete security audit check. The interface, analytics service, and API are all updated to newer versions with an improvised user experience.
If you are looking to build your own cryptocurrency exchange on blockchain, then Uniswap V2 would be an ideal choice. And after the launch of the Ethereum 2.0 Scalable solution, Uniswap V2 is performing quite efficiently with comparatively less gas cost on Ethereum.