What Is Uniswap and How Does It Work?
What is Uniswap?
Uniswap is a decentralized exchange protocol built on Ethereum. To be more precise, it is an automated liquidity protocol. There is no order book or any centralized party required to make trades. Uniswap allows users to trade without intermediaries, with a high degree of decentralization and censorship-resistance.
Ok, but how do trades happen without an order book? Well, Uniswap works with a model that involves liquidity providers creating liquidity pools. This system provides a decentralized pricing mechanism that essentially smooths out order book depth. We’ll get into how it works in more detail. For now, just note that users can seamlessly swap between ERC-20 tokens without the need for an order book.
How does Uniswap work?
Uniswap leaves behind the traditional architecture of digital exchange in that it has no order book. It works with a design called Constant Product Market Maker, which is a variant of a model called Automated Market Maker (AMM).
Automated market makers are smart contracts that hold liquidity reserves (or liquidity pools) that traders can trade against. These reserves are funded by liquidity providers. Anyone can be a liquidity provider who deposits an equivalent value of two tokens in the pool. In return, traders pay a fee to the pool that is then distributed to liquidity providers according to their share of the pool.
Liquidity providers create a market by depositing an equivalent value of two tokens. These can either be ETH and an ERC-20 token or two ERC-20 tokens. These pools are commonly made up of stablecoins such as DAI, USDC, or USDT, but this isn’t a requirement. In return, liquidity providers get “liquidity tokens,” which represent their share of the entire liquidity pool. These liquidity tokens can be redeemed for the share they represent in the pool.
So, let’s consider the ETH/USDT liquidity pool. We’ll call the ETH portion of the pool x and the USDT portion y. Uniswap takes these two quantities and multiplies them to calculate the total liquidity in the pool. Let’s call this k. The core idea behind Uniswap is that kmust remain constant, meaning the total liquidity in the pool is constant. So, the formula for total liquidity in the pool is:
x * y = k
So, what happens when someone wants to make a trade?
Let’s say Alice buys 1 ETH for 300 USDT using the ETH/USDT liquidity pool. By doing that, she increases the USDT portion of the pool and decreases the ETH portion of the pool. This effectively means that the price of ETH goes up. Why? There is less ETH in the pool after the transaction, and we know that the total liquidity (k) must remain constant. This mechanism is what determines the pricing. Ultimately, the price paid for this ETH is based on how much a given trade shifts the ratio between x and y.
Uniswap is a decentralized protocol that doesn’t have a native token. All fees go to liquidity providers, and none of the founders get a cut from the trades that happen through the protocol.
Currently, the transaction fee paid out to liquidity providers is 0.3% per trade. By default, these are added to the liquidity pool, but liquidity providers can redeem them at any time. The fees are distributed according to each liquidity provider’s share of the pool.
A portion of fees may be dedicated to Uniswap development in the future. The Uniswap team has already deployed an improved version of the protocol called Uniswap v2.
How to use Uniswap
Uniswap is an open-source protocol, meaning that anyone could create their own frontend application for it. However, the most commonly used one is
How to use Uniswap
The first step is to make sure you interact with the real ECU/ETH token pair. This link points directly to the ECU/ETH info page:
On the ECU/ETH Uniswap Info page, you will be able to find statistics about the ECU/ETH pair
From the ECU/ETH click “Trade” in the top right-hand corner. This will take you to the trading page and the tokens will automatically be selected for you.
The interface will initially give you the opportunity to swap any ECU you have for ETH. By clicking the arrow between the two text boxes you can switch the direction of the swap in order to change ECU to ETH.
After clicking the link, you will then see a page that looks likeEnter the amount you would like to trade and then click “Connect Wallet”. You will then be asked to select which wallet you want to use. this:
Follow the instructions from your wallet provider to connect your wallet that contains the ECU or ETH that you want to swap. Once you have connected your wallet, click “Swap” and follow the steps provided by your connected wallet.
Once the transaction is confirmed on the blockchain the output tokens will appear in your selected wallet.
As always, it is a good idea to check current Ethereum gas prices to ensure you specify enough gas for your transaction to be processed quickly.
Adding Liquidity To the ECU/ETH Uniswap Pool
Adding Liquidity to a pool is the process of contributing equal value amounts of both of the tokens in a pair, which become part of that pair’s pool for swaps. You should understand the risks associated with contributing liquidity to a Uniswap pool before contributing. To add Liquidity to the ECU/ETH pair’s pool, start by clicking “+ Add Liquidity” in the top right of the info screen:
This will take you to the Liquidity Pooling interface. The tokens from the info page will be the same ones selected on this page.
On the Liquidity Pool interface, you can add liquidity to the pool and see the % of the pool you have.
After entering the amount of ECU and ETH that you want to add to the pool, click “Add Liquidity”, and follow your wallet’s normal process for submitting the transaction. Once the transaction has been confirmed, you will receive a quantity of token called “UNI-V2-LP” that represents your liquidity in the pool. You can think of these “LP tokens” as redemption tickets that you will turn in to pull liquidity tokens out of the pool when you wish to do.