DEV Community

Cover image for Uniswap explained
Arun Shekhar
Arun Shekhar

Posted on

Uniswap explained

Index

  1. What is Uniswap
  2. How to exchange tokens
  3. How to open position in Liquidity pools (providing liquidity) and earn revenue
  4. Major improvements in Uniswap v3 vs v1 and v2

What is Uniswap

Uniswap is a decentralized exchange (DEX) built on the Ethereum blockchain. It allows users to easily trade Ethereum-based tokens without the need for a centralized authority or intermediaries. This makes it a popular choice for those looking to trade cryptocurrencies in a trustless and secure manner.

Uniswap was created in 2018 by a developer named Hayden Adams. The platform uses a unique liquidity pool model that allows it to function without the need for traditional order books. Instead, users who provide liquidity to the platform earn a portion of the trading fees generated by the DEX.

In brief, Here are some key features of Uniswap

  • Offers users a simple,decentralized and trustless way to trade Ethereum-based tokens.
  • Its unique liquidity pool model and automated trading processes make it a popular choice among those looking to participate in the DeFi ecosystem.
  • This platform is automated and uses smart contracts to automatically execute trades, which ensures that they are completed quickly and without the need for manual intervention.
  • Uniswap is currently one of the largest and most successful DeFi projects, with a total value locked of over $4 billion.

How to exchange tokens

1) Since Uniswap is decentralized platform, you don't have to sign up for an account, just make sure you're on the right platform.
Uniswap
2) You can see the total liquidity and volume of trades going on, on this link Uniswap-info, high volume will result in high gas prices because of high strain on the network

Liquidity
3) Below you can see top tokens and top pools on the platform with their price and other information

You might wonder what is wrapped BTC, Wrapped BTC (or WBTC) is a version of the Bitcoin cryptocurrency that has been converted into a form that is compatible with the Ethereum blockchain. This allows it to be easily exchanged and used in various Ethereum-based decentralized finance (DeFi) applications.

Tokens

4) Getting back to swap page, You will see a simple exchange interface where you click the "Connect Wallet" button. This will prompt you to connect your Web3 wallet to the platform such as Metamask. After connecting your wallet, your current chain will be shown in the UI.

swap

5) By clicking on Select Token button, you can select your desired token or paste the token contract address.

Token

6) After selecting the token, the calculated exchange price will be automatically show, you can alter the values of one token as your liking and new exchange price will be automatically reflected

exchange

7) After clicking swap you'll see this prompt. Here are few things you should know before swapping.

  • Expected output: Amount of token you should get during the exchange disregarding gas price.
  • Price impact: The impact of gas price on expected output, it means this much amount will be deducted.
  • Minimum amount received after slippage: Amount you might receive after deduction and slippage.
  • Liquidity provider fee: Small amount of fees user have to pay while trading to the users who provide liquidity to the pools.

Slippage: It refers to the difference between the expected price of a trade and the actual price at which the trade is executed. It typically occurs when there is a high level of volatility in the market or when there is a large difference between the expected and actual amount of an asset being traded.

swap

8) You can adjust allowed slippage and transaction deadline by clicking on setting icon. (if the transaction is not successful under the deadline, it will be cancelled)

deadline

9) After clicking on confirm swap, your metamask wallet prompt will be opened, click on confirm to start the transaction. You can click on 'View on Etherscan' to view the transaction on chain explorer.

polygon explorer

10) Congratulations, you just learned how to swap tokens on Uniswap.

How to open position in Liquidity pools (providing liquidity) and earn revenue

1) Go to Pools on uniswap and click on 'Add position'.

Add position

2) Select a token and choose your pair, Below you'll see the percentage of revenue you want to generate. It is a good choice to choose stable pairs, because with high reward come high risks too.

pair

3) After that choose your price range in which you want to set stop loss (explained in detail in next section), then choose your amount of tokens you want to add.

tokens

4) After clicking on preview, you'll see this. Most important thing to notice is if the current price of USDC per MATIC went below the min price, all tokens will be converted to MATIC and in other case into the USDC.

add liquidity

5) Click on 'Add', confirm transaction from metamask and you'll now see your position listed on the website as a NFT.

nft

Major improvements in Uniswap v3 vs v1 and v2

Current version of Uniswap works on V3 and it has significant changes about how investor can add and maintain liquidity.

improvements

1) Concentrated liquidity
concentrated liquidity

  • Before V3, while providing liquidity user provided liquidity for the complete price range (Complete red line curve as shown in diagram), which was not very efficient as in stable coins most of the trades happens in a certain limit of price range.
  • So V3 introduced a concept of Concentrated liquidity for liquidity providers where they can select the price range in which they want to provide liquidity and earn profits for all the exchanges happens in that range. This also reduced the risk of impermanent loss

Impermanent loss: It refers to the situation where the value of the assets that a liquidity provider has deposited into the platform decreases relative to the value of the tokens that they receive in return.
For example, if a liquidity provider deposits $100 worth of ETH and $100 worth of a stablecoin into a DEX liquidity pool, they may receive 200 tokens in return. If the value of ETH subsequently decreases relative to the stablecoin, the liquidity provider may experience a loss.

2) NFT Liquidity tokens

  • Uniswap gives a NFT liquidity token when you add the liquidity in the pools and it is redeemable which means you can claim your assets back anytime. NFT will be burned after transfer is complete. It can also be traded with other users.

This just covered the few of the major improvements, you see more in details on Uniswap docs.

Thank you for your time.
Cheers.

Top comments (0)