Uniswap is the leading Decentralized Crypto Exchange (DEX) that runs on the Ethereum Blockchain. Uniswap, with the use of an Automated Market Maker (AMM), allows you to trade any ERC20 token in a decentralized environment without any intermediary. Uniswap is also the 5th largest DeFi application running on Ethereum Network with 7.3 Billion dollars in Total Value Locked. If you wish to learn more about Uniswap, visit my previous article here. This is a comprehensive step-by-step guide on how to use Uniswap Exchange.
In addition to Ethereum, someone can find Uniswap also on Polygon, Arbitrum, and Optimism Layer 2 networks. By the time you read this article, you might be able to use Uniswap on other blockchain networks. Due to the high fees on Ethereum Network, I will use Polygon Network in this guide. However, the same steps apply to all networks.
To use Uniswap, you will need to have your Metamask wallet set up on Ethereum, Polygon, or the corresponding network you intend to use Uniswap. In addition, you will require to have some tokens of the native currency used on the network. These tokens are needed to pay gas fees for each transaction. For example, you must have ETH in your wallet for Ethereum and Arbitrum, MATIC for Polygon, etc.
Metamask is not the only non-custodial wallet you can use. Other non-custodial wallets you can use include Coinbase Wallet, Trust Wallet, and any other wallet that supports WalletConnect. However, for this guide, we use Metamask.
To set up Metamask, you can follow the guides below:
|Network||Native Token||Network Profile||Metamask Guide|
|Ethereum||$ETH||Ethereum Network||How to set up Metamask on Ethereum|
|Polygon||$MATIC||Polygon Network||How to add Polygon to Metamask|
Finally, the other pre-requisite is to have the tokens you want to swap in your wallet. If you’re going to exchange BTC for MATIC, USDC or any other ERC20 token, you need to have BTC in your wallet.
How to trade on Uniswap
Step 1: Select Network
Use the following link to navigate to Uniswap Exchange: https://app.uniswap.org/#/swap. Click on the upper right of the screen and select the network you want to use.
Step 2: Connect your Wallet
Once you select the network, your Metamask wallet will connect automatically (if you used the exchange before) or have to do it manually. If it’s the first time you are using Uniswap, click on the connect wallet button on the upper right of your screen.
Step 3: (Optional) Configure your trade settings
Once you click on the Settings button as visualized in the screen above, Uniswap’s setting pop-up will come up.
On the setting pop-up, you will find the following four configurations you can change:
- Slippage Tolerance: Slippage allows you to specify the difference in the price you are willing to accept. On the screen above, I specify that I am willing to accept a 0.1% change in price. Therefore, in worst case scenario, I will receive 0.1% less tokens, compared to the one showed on Uniswap’s screen. This is required, since the price can change by the time your transaction is executed, due to trading activity on the exchange. Your transaction will revert if price changes unfavorably by more than this percentage.
- Transaction Deadline: Since Uniswap operates on a Decentralized Environment, your transaction is not executed immediately. When you send your transaction to the network, it goes into what is called a “Transaction Pool”, and remains pending until a validator executes it. Based on transaction activity, gas fees, etc, your transaction can remain pending for a long time. Here you can specify, how long you are willing to wait for the network to execute your transaction. Your transaction will revert if it’s pending for more than the specified amount.
- Auto Router API: It is used for you convinience. Sometimes, you might get a better result from swapping ETH/DAI DAI/BTC compared to ETH/BTC directly. When this configuration is on, Uniswap’s router tries to find the most optimal trade for you.
- Expert Mode: By default, Uniswap will alert you when you are trying to execute a risky transaction (i.e. on low liquidity). If you turn it off, then Uniswap will stop alerting you for this kind of transactions.
Overall, the default settings are the most appropriate for general use. Change these settings if and only if you know what you are doing. Make sure that you switch the settings back to the default once you finish with risky transactions. Otherwise, you might end-up executing wrong transaction and accepting slippage that you shouldn’t be accepting.
Step 4: Specify the tokens and amount you want to trade
In the middle of the screen, you will find four sections associated with your trade that you need to fill up.
- From the first drop down, select the token you want to sell.
- From the second drop down, select the token you want to buy.
- On the first text box, specify the amount of tokens you want to sell.
- On the second text box, specify the amount of tokens you want to buy.
Regarding steps 3 and 4 from above, you need to perform only one of them. If you specify the number of tokens you want to sell, Uniswap will calculate and show you the number of tokens you will buy. This calculation is done based on the Automated Market Maker algorithm built in the exchange. On the other hand, Uniswap will calculate and show you the number of tokens you have to sell if you specify the number of tokens you wish to buy.
Step 5: Execute your swap (or trade)
To execute your swap, click “Swap.” Metamask will prompt you to sign the transaction. If it’s the first time trading on this pair, you might need to execute two transactions:
- Approve: Authorize the protocol to use the tokens from your wallet
- Swap: Perform the actual trade / transaction
Once the transaction is completed, Metamask and Uniswap will notify you.
How to provide liquidity on Uniswap
Step 1: Find a Liquidity Pool
To find the various liquidity pools already deployed on Uniswap, click on the “Charts” from the main page or navigate directly to the analytics page. There you see all the pairs and liquidity pools listed on the exchange. You can also select different networks and see the same data associated with other networks.
From the pools section below or the pools page, you can click on the various pools and see the analytics’ page of each pool. This page will look like the screenshot above. You see the MATIC/USDC pool’s analytics page in the screenshot above. This page has four main sections indicated with numbers 1-4 in the screenshot above:
- It shows you the pairs associated with this liquidity pool, the percentage fee on the pool as well as the icon of the pool’s network. The percentage fee, is the fee the traders pay on each transaction (swap). Higher percentage does not necessarily mean more profit for liquidity providers, since the are other factors associated with the liquidity providers’ rewards. Other factors include, the size of the pool and trading activity.
- Prices of the two tokens, based on the current reserves in the pool.
- Section 3 shows the amount of reserves of each tokens on the top, followed by the total value locked, 24h trading volume, 24h collected fees in dollar value. Total Value Locked (TVL) is the amount of funds deposited in the pool.
- A graph where you can see different measures associated with this pool over time. These measures include Volume, TVL, Liquidity and fees.
Overall, finding the liquidity pool that will maximize your earnings is not a trivial task and is beyond the scope of this article. However, looking on the analytics page is a good starting point; it will help you understand the activity on each liquidity pool.
Step 2: Select pairs and amount to be deposited
The next step is to select the pairs. This can be done from your screen’s two drop-down menus (indicated with number 1 on the screenshot above). Once you select the pair, Uniswap will show you the fee associated with this pool. Below you need to specify the amount of tokens you wish to deposit. You determine one of the two, and the protocol (AMM) will calculate the other based on the current price of the assets.
Step 3: Specify Price Range
On the right side of the screen, you also see the range. This is the range on which your assets will be active for trading. If you allow your funds to be active for the full range, the impact of impermanent loss and your risk are higher. Hence, it is always better to specify a smaller range. If you want to understand how price ranges work fully, Uniswap provides a very detailed article on the topic with an illustrative example you can find below:
Alice and Bob both want to provide liquidity in an ETH/DAI pool on Uniswap v3. They each have \$1m. The current price of ETH is 1,500 DAI.
Alice decides to deploy her capital across the entire price range (as she would have in Uniswap v2). She deposits 500,000 DAI and 333.33 ETH (worth a total of \$1m).
Bob instead creates a concentrated position, depositing only within the price range from 1,000 to 2,250. He deposits 91,751 DAI and 61.17 ETH, worth a total of about $183,500. He keeps the other $816,500 himself, investing it however he prefers.
While Alice has put down 5.44x as much capital as Bob, they earn the same amount of fees, as long as the ETH/DAI price stays within the 1,000 to 2,250 range.
Step 4: Add liquidity
In the final step, click approve to let the protocol access your funds. Then, click preview, and on the pop-up click “Add”. The pop-up shows you the final details of your transaction. Once you click “Add”, Metamask will prompt you to sign the transaction, and when the transaction is completed, Uniswap and/or Metamask will notify you. The information associated with your position or the share you have in the liquidity pool will appear on the pools’ page.
How to withdraw your liquidity from Uniswap
To withdraw your tokens from the pool is fairly easy. Navigate to the pools section and select the liquidity pool you want to withdraw your funds from. A page like the one shown above will show up. Then just click “Remove Liquidity”.
Uniswap user interface is very simple and elegant which makes it extremely easy to use the platform. Learning how to use Uniswap is important if you are planning to use any of the networks where Uniswap is deployed, especially Ethereum. The majority of the projects launching on Ethereum Network are first listed on Uniswap, before getting listed on other Centralized or Decentralized exchanges.