December 4, 2021
December 4, 2021
Is Uniswap safe? How does Uniswap work (v2 & v3)?
Uniswap is a trading protocol running on the Ethereum blockchain, which allows decentralized token swaps. Since Uniswap pools tokens into smart contracts, users can execute an exchange against these liquidity pools trustlessly without the need for central authorization, as opposed to using a traditional order book model. Thus, anyone can trade Ethereum tokens on Uniswap, lend their crypto to liquidity pools to earn a fee, or list a token to Uniswap. Thus, it is an on-chain digital market maker used to swap ERC20 tokens with ETH, and vice-versa. In this article, we will learn about the advantages of Uniswap, its working methodologies and shed light on its prospects.
What is Uniswap?
Definition
More than 6000 (https://e-cryptonews.com/how-many-cryptocurrencies-are-there-in-2020/#:~:text=According%20to%20CoinMarketCap%2C%20the%20total,a%20total%20of%204%2C621%20cryptocurrencies) cryptocurrencies are traded globally. The majority of these tokens are built on Ethereum. Uniswap is a protocol developed to improve the services of tokenized assets running on the Ethereum Network.
Due to the high volume of tokens, it becomes difficult to swap between two ERC-20 tokens, especially when both aren’t listed on the same decentralized exchange. Sometimes, even after being listed on the same decentralized exchange platform, they lack a direct trading pair, thus making the transaction tedious.
Uniswap is a novel technology within the decentralized finance space, facilitating automated liquidity provision on Ethereum. Uniswap is a DeFi protocol with large volumes of ERC20 tokens.
Advantages of Uniswap
Since Uniswap is one of the newest DEX platforms, only time will define its growth. However, below are some of the basic advantages of this decentralized exchange:
+ Since Uniswap is decentralized, it does not depend on intermediaries to facilitate price determination, validation, verification, and other trade related functions.
+ Anyone can connect to a Uniswap smart contract using web3 and build custom decentralized applications on it. Thus, one can seamlessly create a decentralized exchange for any ERC20 token.
+ Since Uniswap is a non-profit protocol, volume traders and whales avoid it due to the market rate equation that Uniswap adopts to calculate exchange rate of tokens, lack of advanced instruments like derivatives, and limitations in manipulating Ethereum price. Thus, the network facilitates small traders as it is cheaper compared to other decentralized exchange platforms.
+ It provides an open liquidity pool where users can contribute to earning stable interest rates.
+ The front-end application built using React can be forked and run on test-nets, like Rinkeby, where users can experiment with online mining, pooling, and alternate finance instruments like derivatives.
Uniswap V2
Uniswap V1 was a proof-of-concept with relatively fewer features but served as a pioneer in the decentralized applications field. Following the success of Uniswap V1 and surge in Ethereum price allowed the team to raise a seed round to fund improvements of their product by releasing Uniswap V2. Uniswap V2 presents several enhancements to the protocol, built upon the liquidity and swapping mechanisms to facilitate ETH and ERC20 token swaps. Some of the key changes include:
+ Addition of “ETH bridging” capability which allowed two ERC20 tokens to be swapped without the need to use ETH as an exchange medium. Thus, tokens can be exchange directly, with relying on ETH. This helps reduce the transaction fee and cuts the transaction count in half.
+ V2 introduced the price oracle functionality which allows time-weighted average pricing contingent on the price of token pairs at each block. It allows developers to compute an average Ethereum price of the token based on the token's price movement over several blocks.
+ Flash swapping is another upgrade added to V2 which allows users to “borrow” tokens from a Uniswap pool, make a transaction, and pay back the borrowed funds at a specific interest rate, all in one transaction. This allows advanced transactions like arbitrage trading to be executed on a DeFi platform using cryptocurrencies.
Uniswap V2 vs V3
In May 2021, the project released a big update Uniswap V3 with concentrated liquidity as a flagship feature. With this hew option, liquidity providers get higher control over price ranges and get fairer compensation for the risks they bear. In the blog post announcing the update, the Uniswap team promises up to 4000x capital efficiency compared to V2.
Another big improvement of the new version is non-fungible liquidity. Each position is now represented in the form of a unique token which adds one more great use-case for this technology.
How does Uniswap Work?
Uniswap comprises smart contracts that store Ethereum based assets and liquidity to provide services. The assets are deposited by liquidity providers. To become a liquidity provider, you simply need to go on the Uniswap website and add liquidity to the pool. This allows you to contribute to the longevity of the protocol and receive a reward as a percentage of trading fees that use the pool.
Now, let’s dive into the three core steps of Uniswap – Swapping Tokens, Validating Tokens, and Liquidity Pools.
Swapping Tokens
Users can access the Uniswap protocol using uniswap.exchange (https://uniswap.exchange/) URL. On the website, users can swap tokens or add tokens to the liquidity pool by simply selecting the appropriate token using a wallet that can hold ETH and other ERC20 tokens. Once a trade is selected, the user can simply approve the transaction to confirm the swap. One must be careful about the transaction fees which is based on the Ethereum price prevalent at the time of swap.
Besides the official Uniswap website, several front-end user interfaces have been created, as Uniswap is an open protocol of smart contracts. Thus, users can also add funds to Uniswap pools without accessing the official interface. Many unique use cases are expected in the coming years, which would use Uniswap’s token swapping system and new decentralized finance (DeFi) products.
Validating Tokens
Since Uniswap serves as a trustless DEX platform on the Ethereum blockchain, it cannot be altered unless the Ethereum protocol is successfully attacked. Given the history of blockchain platforms like Ethereum and Bitcoin, this has not happened to date and is unlikely to happen considering the number of miners and validators currently in operation.
Liquidity Pools at a High Level
Liquidity pools serve as a decentralized liquidity system. Anyone can participate in it and earn rewards. Liquidity can be added and removed freely from an ERC20 Exchange contract. Adding liquidity to the ERC20 Uniswap contract requires ETH – such that Ethereum price is equal to the ERC20 token.
Uniswap charges a 0.3% fee for every swap, which is dispersed among liquidity providers based on each provider’s share of the pool. When a user deposits tokens into a liquidity pool, mining takes place on Uniswap to generate a native token whose value is based on the pool share and helps keep a digital record of the user's share in the pool.
All liquidity tokens adhere to ERC20 protocols and can be traded. The trade serves as a transfer of ownership without removing the liquidity from a pool. Removal of tokens from the pool results in the burning of the liquidity tokens associated with that share.
Risks and Future of Uniswap
Following are some of the key risks associated with Uniswap:
+ Uniswap only supports ECR20 tokens. Thus, if you need to swap bitcoin, you have to change bitcoin into wrapped bitcoin (wBTC).
+ Due to open listing on Uniswap, it presents the risk of scam tokens being listed
+ Uniswap’s flash swap functionality may result in cyber-attacks, as they do not need upfront capital.
Uniswap is the largest exchange on DeFi. The trade volumes on Uniswap are larger than most centralized exchanges. Thus, Uniswap has revolutionized DeFi and brought billions of dollars in trading volume by giving rise to AMM (automated market maker) protocol. Thus, the growth of Uniswap is inevitable.
FAQ
Is Uniswap Safe?
Uniswap is generally considered a safe DEX for trading cryptocurrency assets. Token swaps are highly secure since they do not require funds to be held on the exchange.
Is Uniswap a KYC protocol?
As seen above, Uniswap has several advantages over traditional crypto exchanges. One of them is the elimination of KYC (Know Your Customer verification). On Uniswap, trading is done directly from the user's wallet. Thus, the user’s public wallet address is the only required identifier.
Can I add my logo to Uniswap?
Yes, you can. Uniswap pulls data from the trustwallet asset repository on GitHub: <https://github.com/trustwallet/assets>. Users can add an icon to the repo which will appear on the frontend.
What is an impermanent loss on Uniswap?
Impermanent loss is defined as a temporary loss due to volatility in a trading pair of liquidity provider.