CryptoPotato
CryptoPotato
  • Crypto News
  • Margin Trading
  • Guides
    • Bitcoin & Crypto Guides 101
    • Bitcoin For Beginners
    • Editorials
  • DeFi & NFT
  • Buy
  • Language
    • Español
  • Crypto News
  • Bitcoin For Beginners
  • Cryptocurrency Guides 101
  • Editorials
  • Bitcoin & Crypto Margin Trading
  • DeFi & NFT News
  • Bitcoin Price Analysis
  • CryptoPotato Crypto Fund
  • Ethereum (ETH) Price Analysis
  • Ripple (XRP) Price Analysis
  • Market Updates
  • Interviews
  • Buy Bitcoin with Card
  • Español
  • bitcoin
    BTC$29,395.00
  • ethereum
    ETH$1,846.96
    • Market Updates
    • BTC Analysis
    • ETH Analysis
    • XRP Analysis
    • Interviews
    • Opinions
    CryptoPotato
    CryptoPotato
    • Crypto News
    • Margin Trading
    • Guides
      • Bitcoin & Crypto Guides 101
      • Bitcoin For Beginners
      • Editorials
    • DeFi & NFT
    • Buy
    • Language
      • Español
    • Crypto News
    • Bitcoin For Beginners
    • Cryptocurrency Guides 101
    • Editorials
    • Bitcoin & Crypto Margin Trading
    • DeFi & NFT News
    • Bitcoin Price Analysis
    • CryptoPotato Crypto Fund
    • Ethereum (ETH) Price Analysis
    • Ripple (XRP) Price Analysis
    • Market Updates
    • Interviews
    • Buy Bitcoin with Card
    • Español
    Home » Guides » What is Uniswap In Simple Words?

    What is Uniswap In Simple Words?

    Author: Michiel Mulders

    Last Updated Apr 19, 2021 @ 17:02

    Uniswap guide to explain what is it and how it works. The Uniswap protocol allows buyers and sellers to swap ERC20 tokens without the use of an exchange or order book.

    You may have heard of Uniswap has been a frequently debated topic among the DeFi space. Originally, Hayden Adams created the Uniswap protocol as he was inspired by Vitalik Buterin’s post about the market maker equation X * Y = K.

    Hayden took a practical approach to the equation and created Uniswap, a protocol for automated liquidity provisioning.

    This guide will help you understand the following concepts:

    • What is Uniswap?
    • How does automated liquidity provisioning work using X * Y = K equation?
    • What’s the difference between Uniswap V1 and V2?
    • How can you profit from liquidity provisioning on Uniswap?
    • What are the dangers of flash swaps (flash loans)?

    Let’s dive right into the details of Uniswap!

    What is Uniswap?

    Let’s start with a basic introduction that answers the question, what is Uniswap?

    Uniswap is a protocol that allows buyers and sellers to swap ERC20 tokens without the use of an exchange or order book. Uniswap uses an algorithmic equation that automatically determines the swap rate based on the balances of both tokens and the actual demand for this swapping pair.

    Now you may wonder why Uniswap is so revolutionary? Traditional markets require buyers and sellers to provide liquidity, which is not always easy to deliver. Even decentralized exchanges (DEX) suffer this problem as they heavily rely on liquidity for its success.

    Uniswap tackles this problem in a different way through automated liquidity provisioning. Uniswap allows a DEX to swap ERC20 tokens without having to rely on the mechanic of buyers and sellers creating liquidity.

    But how does automated liquidity provisioning work?

    How Does Uniswap’s Automated Liquidity Provisioning Work?

    The “X * Y = K” Equation Explained

    In the “X * Y = K” equation, the X and Y represent respectively the number of available ETH and ERC20 tokens. Whereas K represents a constant that can be set by the creators of the exchange contract on Uniswap. K might look like some random constant, however, it matters most. When you multiply X by Y, the value must always be equal to the value of K.

    uniswap1-min

    Now, let’s take a look at the above graph. The graph represents the constant K, which is a function. The Y-axis represents token B (ETH) while the X-axis represents token A (ERC20) token.

    The first red dot (old position) represents the current price for swapping this ETH-ERC20 pair based on the current balance of ETH tokens against ERC20 tokens.

    However, Alice decides to swap her ERC20 tokens for ETH.

    Therefore, the balance of ETH tokens decreases, and the balance of ERC20 tokens increases. This means the red dot moves to the new position as we have more ERC20 tokens and fewer ETH tokens in the liquidity pool. In other words, it’s a very simple pricing algorithm where the price rate moves along a graph.

    Next, it’s important to know that since March 23rd, 2020, Uniswap V2 was introduced.

    V2 comes with a lot of new functionality and updates to existing features. Let’s learn about the differences.

    Understanding the Difference between Uniswap V1 and V2

    Many new features have been introduced with Uniswap V2, such as price oracles, flash swaps, and a swapping router. This last element is most important to understand how to get a better sense of the way Uniswap routes tokens between liquidity pools.

    Uniswap V1 Swaps

    From the Uniswap V2 blog post, we can read how Uniswap V1 works:

    “In Uniswap V1, all liquidity pools are between ETH and a single ERC20 token. Having a constant numeraire provides a nice UX advantage — users can swap any ERC20 for any other ERC20 by routing through ETH.

    Since ETH is the most liquid Ethereum-based asset and does not introduce any new platform risk, it was the best choice for Uniswap V1.”

    What this means is that Uniswap V1 always executes two trades. A first trade to swap your ERC20 token for ETH, and a second trade to convert your ETH back to the wished ERC20 token. In other words, the end-user pays fees twice.

    uniswap2-min

    This posed a couple of limitations on the use of Uniswap:

    1. Higher fees
    2. Uniswap strongly tied to the use of ETH
    3. Not possible to swap ERC20 tokens directly with other ERC20 tokens.

    For the above reasons, Uniswap V2 has been created.

    Uniswap V2 Swaps

    Uniswap V2 provides end-users with three different options to swap their tokens, using the “Router Contract.”

    The Router Contract is nothing more than a contract that contains routing logic to send your tokens to the right swapping contract. In other words, the router contract is aware of every swapping contract that implements the Uniswap V2 protocol.

    Here are the three swapping possibilities:

    1. A direct swap between two ERC20 pairs. For example, two stablecoins such as DAI/USDC may prove very useful for traders.
    2. Traditional swap through ETH, where you pay fees twice.
    3. Custom path swaps where you can build a more complex swapping path such as DAI/ETH, ETH/BAT, BAT/USDT, and USDT/USDC to convert your DAI to USDC. Often, this provides traders with interesting arbitrage opportunities.

    uniswap3-min

    Next, let’s learn why users provide liquidity to Uniswap’s liquidity pools and how you can profit from this opportunity.

    Providing Liquidity on Uniswap: How to Profit?

    How do users profit form liquidity provisioning on Uniswap? The answer is simple – trading fees. You can participate in those liquidity pools by providing an equal amount of ETH and ERC20 tokens to a Uniswap exchange contract.

    In return, whenever someone makes a swap, the swapper has to pay a 0.3% fee per swap. This fee is subsequently added to the liquidity pool. Next, liquidity providers receive part of the transaction fee proportional to their weight in the liquidity pool.

    Uniswap Flash Swaps: Useful or Dangerous?

    Lastly, let’s discuss the new Flash Swaps functionality provided by Uniswap V2. From the same blog post, Uniswap explains Flash Swaps as:

    “Uniswap V2 flash swaps allow you to withdraw as much as you want of any ERC20 token on Uniswap at no upfront cost and do anything you want with them (execute arbitrary code), provided that by the end of the transaction execution, you either:

    Pay for all ERC20 tokens withdrawn, pay for a percentage of ERC20 tokens and return the rest, or return all ERC20 tokens withdrawn.”

    This all sounds super exciting as it opens up a lot of new possibilities. Flash swaps, also referred to as flash loans, have been coined by Marble Protocol in 2018 by Max Wolff. Back then, he coined his invention a “smart contract bank,” that allows for zero-risk loans.

    However, lately, we’ve seen many flash loan attacks happening across different protocols such as bZx where an attacker runs off with thousands worth of tokens, which he got for free through flash loans.

    A flash loan attacker takes advantage of imbalances between different marketplaces and then pays back the initial loan while they keep the surplus they gained by trading those market imbalances.

    Some industry leaders argue this is a serious risk for the DeFi space; however, others attribute the occurrence of flash loan attacks to the weak security of the bZx protocol.

    Either way, Uniswap has decided to implement its so-called flash swaps. This allows anyone to withdraw as many ERC20 tokens from a liquidity pool as possible. But, the user has to return the tokens within the same block. Or, return their ETH equivalent to the ETH liquidity pool.

    In Conclusion

    It’s undeniable that automated liquidity provisioning has given a big boost to the DeFi space, creating many new and more sophisticated trading opportunities. However, time will tell if swaps were the right thing for the crypto space. Here’s a short recap list with the pros and cons of using Uniswap.

    Uniswap – The Pros

    • Decentralized
    • Any new token can directly access liquidity through adding their token for an exchange to the Uniswap V2 router contract.
    • Low-cost trades compared to a DEX or centralized exchange.
    • Liquidity providers can benefit from contributing liquidity to liquidity pools.

    Uniswap – The Cons

    • Possibility for flash swap attacks
    • It still relies on arbitrage trading to remove market imbalances. However, any natural market sees arbitrage trading occur to remove imbalances quickly.
    • Fake token listings.
    • Currently, high gas prices because of the high volume of trades make trading using Uniswap still a more expensive activity.
    SPECIAL OFFER (Sponsored)
    Binance Free $100 (Exclusive): Use this link to register and receive $100 free and 10% off fees on Binance Futures first month (terms).

    PrimeXBT Special Offer: Use this link to register & enter CRYPTOPOTATO50 code to receive up to $7,000 on your deposits.

    Tags: Decentralized exchange DeFi Uniswap
    Enjoy reading? Share with your friends
    Facebook Twitter LinkedIn Telegram

    About The Author

    Michiel Mulders
    More posts by this author

    Developer advocate and tech writer with a passion for blockchain, marketing, user experience, and endurance sports. A software engineer who likes Node.js and Go. If I'm not writing, I'm drinking a Belgian beer!. Contact Michiel: LinkedIn

  • bitcoin
    BTC$29,395.00
  • ethereum
    ETH$1,846.96
  • Join Our Community

    FacebookTwitter YouTubeTelegram


    Editorials
    Wall Street Traders Are Using DeFi: Interview With dYdX Foundation’s VP of Strategy, David Gogel

    Wall Street Traders Are Using DeFi: Interview With dYdX Foundation’s VP of Strategy, David Gogel

    This Will Trigger Crypto’s Mass Adoption Next Years: Animoca Brands’ Yat Siu

    This Will Trigger Crypto’s Mass Adoption Next Years: Animoca Brands’ Yat Siu

    Facebook’s Answer to Twitter: A Complete Guide on Threads

    Facebook’s Answer to Twitter: A Complete Guide on Threads

    What is a Meme Coin? The Biggest Meme Coins You Must Know About

    What is a Meme Coin? The Biggest Meme Coins You Must Know About

    The Weaknesses of Ethereum VS Modern Blockchains: Interview With Radix

    The Weaknesses of Ethereum VS Modern Blockchains: Interview With Radix

    Institutions Intend to Buy Bitcoin in Late 2023: Interview With CryptoQuant

    Institutions Intend to Buy Bitcoin in Late 2023: Interview With CryptoQuant

    Why Didn’t ETH Dump After Shanghai? Interview With Nansen

    Why Didn’t ETH Dump After Shanghai? Interview With Nansen

    Join Our Newsletter
    Become a CryptoPotato VIP
    One Weekly Email Can Change Your Crypto Life.
    Sign-up FREE to receive our extended weekly market update and coin analysis report
    We NEVER send spam. You can unsubscribe at any time.
    Invalid email address
    Thanks for subscribing!
    Footer Logo
    About
    Advertise on CryptoPotato
    About Us | Contact Us | Careers
    Editorial Policy
    Terms of service | Privacy Policy | GDPR
    More Sections
    IEO List | Evaluations
    Airdrops
    Scholarship
    Disclaimer
    Disclaimer: Information found on CryptoPotato is those of writers quoted. It does not represent the opinions of CryptoPotato on whether to buy, sell, or hold any investments. You are advised to conduct your own research before making any investment decisions. Use provided information at your own risk. Full disclaimer
    © Copyright CryptoPotato 2016 - 2021
    Scroll to top
    One Weekly Email Can Change Your Crypto Life.

    Sign-up FREE to receive our extended weekly market update and coin analysis report

    We never send SPAM. You can unsubscribe at any moment
    Invalid email address
    Thanks for subscribing!