19 October 2020
Uniswap is a decentralised exchange trading protocol with reference to the automated provision on the Ethereum blockchain platform. It facilitates its service for the developers, liquidity providers and traders while enabling them to participate in a financial marketplace which is open and accessible to everyone. It utilises the ERC20 tokens while any user can swap, add or list tokens with Uniswap.
Uniswap is an open-source automated liquidity protocol that has been written on the Vyper smart contract, it is one of the most known AMM - Automated Market Maker exchanges since the launch of Uniswap’s V1 in November 2018.
Uniswap is powered by a constant product formula and executed in the system of smart contracts on the Ethereum blockchain. It is built on the base of the following factors: censorship-resistance, trusted intermediaries, security, and decentralization.
Uniswap was created by Hayden Adams who was inspired to create and implement protocols because of a post made by the founder of Ethereum - Vitalik Buterin.
Working of Uniswap
The protocol of Uniswap powers a marketplace that is decentralized of the trading pairs wherein the pair consists of reserves including two tokens based on the equal ratio of a 1:1, while the pairs are managed by Uniswap contracts, thus the model mentioned enables any user to be an LP - Liquidity Provider. Meaning each uniswap smart contract or the pair manages a liquidity pool which is made from its reserves of two ERC-20 tokens.
Hence, anyone can participate and be a liquidity provider by depositing the equal value of every token in return of the pool tokens. The liquidity providers on Uniswap are granted for their services through pro-rata >
AMM-based decentralized exchanges - DEXes consists of multiple genres to determine prices, however, Uniswap uses CPMM - “Constant Product Market Maker”.
Its working relies on the equation of x*y=k.
The pairs in the process act as AMM leading to accepting one token for the other while considering and preserving its “constant product” formula. The formula states about the trades not changing the product of the pair’s reserve balances as it must remain unchanged from the reference frame of trade also known to be invariant. This formula attributes to the desirable property considering that larger trades execute at rapid worse rates than the smaller trades.
Uniswap applies a fee to the trades with 0.30%, which is added to the reserves leading to an increase in each trade. This process functions as a payout for the liquidity providers with the realization that the pool token is burnt post the withdrawal of their share of total reserves.
It does not involve an order book, centralized party or any centralized facilitator of trade.
Also Read, Future Of Cryptocurrency Trading Pool
Mathematics of Determining the Price
The prices in Uniswap are determined by the amount of every token in the pool. Its smart contract uses the following constant function: x*y=k
x = token0
y = token1
k = constant
In each trade, a given specific amount of tokens is removed from the pool for the other token’s amount. Hence, to maintain the k, the balances that are implemented by the smart contract are adjusted during the trade execution leading to the change in the price.
Adding Token to Uniswap
Uniswap works on the Ethereum ecosystem and thus it is compatible with any ERC-20 tokens. With Uniswap, anyone can add its project’s token and list it permissionless for trading.
1. Navigate the platform at Uniswap exchange.
2. Click the button that states “Select a token”.
You will arrive at the “Search name or paste address” option wherein you will have to paste the contract address of the ERC-20 token that you need to list.
After the pasting of the contact address, Uniswap will instantly find the tokens on its Uniswap listing.
The user then needs to click on the token selected that leads to a warning screen.
The warning screen occurs as the protocol’s listing process is permissionless; while with the warning screen, uniswap attempts to stress a cautionary step as an initiative to avoid malicious projects and scammers.
The user needs to click on the “I understand” which later directs to Uniswap’s trading interface that consists of buttons named - “Swap” and “Pool”.
The user then needs to click on the “Add Liquidity” button and incase prompted the user will have to paste the token contract address and select the token on the dropdown menu.
The user needs to add liquidity to the pool. However, one should notice that the Uniswap price is dynamic and it is important to consider while gauging the newly listed tokens on the protocol. Also, the project can list only a certain fraction of the token’s supply to Uniswap.
Once the token ratio is set, you would need to approve Uniswap to handle the tokens and send the transaction while pressing the “Confirm” button as prompted.
Post the process, an approval transaction is conducted by the Uniswap and once that is done, Uniswap will activate the “Supply” button on its UI leading to a final pop up prompting confirmation.
The user then needs to click on the “Create Pool & Supply” button, submit its transaction and wait for the process to go through. After it’s processed through, a liquidity pool is created resulting in your token being listed on Uniswap.
You can check or view your Liquidity provider - LP dashboard on Uniswap’s “Pool” tab.
Also Read, The Novice Guide To Yield Farming On DeFi
Adding Liquidity to Uniswap
- The user needs to navigate the pool he/she is interested in.
- You would need to click on the Uniswap “Pool” tab.
- And then click on the “Add Liquidity” button.
- You are then prompted to submit your transaction as per your token allotments.
- Post which, the transaction is confirmed and the liquidity is added to the pool.
Removing Liquidity from Uniswap
- You would need to click on the Uniswap “Pool” tab.
- You will come across a widget at the bottom that states “Remove” button.
- After clicking on the “Remove” button, you’ll be directed to the liquidity removal dashboard.
- The user can choose to remove 25%, 50%, 75%, 100% or any specific amount of liquidity.
- Post the approval of the transaction, you would need to submit the removal request transaction.
- After the confirmation of the transaction, the asset’s are returned to the wallet.
Checking Liquidity for Token on Uniswap
To check in-depth the information dashboard of the Uniswap liquidity pool, the user would need to visit the website and paste the token address of the token that you want to know more about.
The pair dashboard consists of information on metrics such as total liquidity, 24-hour fees, 24-hour volume and all the transactions that are related to the pool.
Uniswap just like any other platform isn’t completely free from risk and attacks, it bears the risk of technical issues which may come with any smart contract-based project. However, Uniswap’s growth and development has been remarkable as the projects are audited and improvised.
In Uniswap V1, an attacker was enabled to hook in the ERC-777 token standard in order to drain the liquidity pool; however, with Uniswap V2, support was added for ERC-777 token to eliminate these kinds of attacks.
Uniswap V2 also launched direct ERC20 to ERC20 swaps in May 2020 and in September 2020 launched its UNI governance token with an airdrop for anyone that had used the protocol before September 1st.
On 10th August 2020, Uniswap powered ~$250 million in its daily trading volume.
The sky's the limit and Uniswap with time has made its all possible effort to reach one.