Instadapp Guides
  • Instadapp Pro Help Docs
  • Getting Started
    • Managing Assets on Instadapp
    • Simulation Mode
    • Debt Collateral Ratio
    • Custom Tokens
    • Authority
      • How to add an Authority to your Account
      • How to remove an Authority
      • Using Gnosis Safe as an Authority
    • FAQs
  • Smart Wallets
    • DeFi Smart Account (DSA)
      • Not able to see your wallet balance?
      • Depositing from your Connected Wallet into DSA
      • Migrating DeFi assets into your DSA
      • Withdrawing to your Connected Wallet
      • Advanced Withdrawals
      • Advanced Deposits
    • Avocado Wallet
      • 🥑Avocado Guides
  • Features
    • Cross Chain Bridge
    • Protocol Refinancing
    • Sweep Swap
    • Protection Automation
    • Private Transactions
      • How to enable ETH_Sign on Metamask
    • Quick Menu
    • Global Settings
  • Protocols
    • MakerDAO
      • Maker Protocol Explained
      • Liquidations on MakerDAO
      • More Maker Info
    • Compound
      • Compound Explained
      • Liquidations on Compound v2
      • Compound v3 Explained
      • Using Compound v3
    • AAVE
      • AAVE Protocol Explained
      • How to activate E-Mode
      • Migrate from v2 to v3
      • Get more E-Mode Accounts
    • Uniswap
      • Uniswap Protocol Explained
      • Managing Uniswap on Instadapp
      • Creating a Uniswap LP
      • Import / Export
      • Rebalancing your LP
      • How to Create Uniswap Rewards
      • Staking Uniswap LPs for Staking Rewards
    • Liquity
      • Liquity Protocol Explained
      • How to open a Trove and borrow LUSD
      • How to close a Trove
      • Liquidations on Liquity
      • Supply to the Stability Pool
      • Staking LQTY
    • Euler
      • Euler Protocol Explained
      • Using Euler
      • Debt and Collateral Transfer
    • Morpho Optimizer
      • Morpho Explained
      • Using Morpho
    • Morpho Blue
      • Morpho Blue Explained
      • Using Morpho Blue Borrow
      • Using Metamorpho
  • Strategies
    • Using Strategies
    • Compound Strategies
    • Leverage / Max Mining
    • Save / Unwind Mining
    • Collateral Swap
    • Debt Swap
    • Alternative Strategies
  • Governance
    • Voting and Governance
    • Snapshot
    • Atlas
  • Walkthroughs
    • Refinancing to Morpho
    • Migrate iTokens to AAVE DSA
    • Quick Start Primer
    • Metamask Tx Creation Issues
    • How to hard reset on Metamask
  • Dive Deeper
    • DeFi Smart Accounts
    • URLs by Network
Powered by GitBook
On this page

Was this helpful?

  1. Protocols
  2. Uniswap

Uniswap Protocol Explained

Description of the Uniswap Protocol

PreviousUniswapNextManaging Uniswap on Instadapp

Last updated 2 years ago

Was this helpful?

To begin, let’s recall what DEX is. Decentralized exchanges (DEX) are a sort of cryptocurrency exchange that enables secure online peer-to-peer cryptocurrency transactions between two exchanging user wallets without the involvement of a middleman. Decentralized exchanges take a unique approach to buying and selling digital assets by relying on self-executing smart contracts allowing for quicker trades at a lesser cost than centralized crypto exchanges. The 'Constant Product Market Maker Model' distinguishes Uniswap from other decentralized exchanges. Because of this pricing method, any ERC20 token can be exchanged on the exchange as long as it is funded with the same amount of ETH.

Liquidity Pools

The liquidity pools are the next key aspect to understanding how Uniswap works.

Liquidity refers to the availability of assets in a market and is essential for any decentralized exchange to function properly. There is no way to discover an asset's price without significant liquidity and this could affect the trading of tokens. In essence, Uniswap allows users to create a dedicated exchange for any ERC20 token by constructing an exchange contract that contains both ETH and the token's liquidity pool. Users must fund a pool with an ERC-20 token and an equivalent amount of ETH to become a liquidity provider (LP). Let’s walk through the inception of the ETH/DAI market. So, if the price of ETH is $1000 and the price of DAI is $5, a user would have to contribute 1 ETH and 5000 DAI to the ETH-DAI pool.

How does this work exactly?

Whenever it is time for a trade, Uniswap essentially balances the tokens in a pool based on the desire to purchase and sell them from users. As a result, any ERC-20 token with the CPMMM equation x * y = k can be posted and exchanged on Uniswap. "x" and "y" denote the number of ETH and ERC-20 tokens in a pool, respectively, while "k" is a constant. An important detail to note is that the price depends on the size of the order relative to the size of the DAI/ETH reserve. Uniswap’s market-making model will always provide liquidity, meaning reserves will never be depleted.

Concentrated Liquidity

Liquidity on Uniswap v3 is set to price ranges

Uniswap V3 introduces concentrated liquidity which allows LPs to concentrate liquidity in the target price ranges, achieving much higher capital efficiency. Uniswap V3 allows focused liquidity rather than requiring liquidity providers (LPs) to supply liquidity throughout the entire price range (as seen in V2). In a nutshell, it allows limited partners (LPs) preferences on a price band in which their liquidity is employed.

Using the stable coin swap (USDC/USDT) as an example, LPs could deploy capital just inside the two-cent price range (US$0.99–1.01), resulting in more liquidity in the middle price range and higher overall trading fees. Their preferred amount of risk determines their position for that pair. To meet the same amount of risk in the case of very volatile tokens, the range would have to be vast, which in some cases would be almost impossible.

LPs don't only deposit their assets in liquidity pools and spread them uniformly throughout the price curve in Uniswap v3. Instead, they get to choose the price range to which they want to assign their assets, and they earn fees when the price falls within that range.

Active Liquidity

If market prices shift outside of an LP's price range, their liquidity is effectively removed from the pool and no longer earns fees. Until the market price swings back into their chosen price range or they opt to alter their range to account for current values, an LP's liquidity is made up completely of the less valuable of the two assets. It is theoretically feasible in v3 for there to be no liquidity in a certain price range. However, we expect rational LPs to revise their pricing ranges on a regular basis to reflect actual market prices.

The Uniswap protocol is complex and has many parts use the above as a summary of the protocol. Please refer to their official documentation for more information:

Uniswap Official Documentation