logo academy

UniSwap: The Top DeFi Exchange

May 5, 2021
10 min
UniSwap: The Top DeFi Exchange
Beginner
You will learn

    UniSwap is one of the top DEXs by volume and liquidity. So much so that, in October 2020, it surpassed the trading volume of Coinbase.

    UNI is its governance token, launched on the market only in 2020, two years after the release of UniSwap.

    In March 2021, the UNI token climbed up the market-cap rankings, growing by 50% in one week and securing the 8th place in the market. Considering the strength of the project from the outset and the features of Version 3 having been released on the 5th of May 2021, we can say for now that this success is well deserved.

    uni token

    The number one DEX

    UniSwap is primarily a Decentralised Exchange (DEX), i.e. a cryptocurrency exchange platform that is not controlled by any intermediary or company, instead, it relies on smart contracts and algorithms.

    UniSwap is the first project of its kind to achieve real success, thanks to its key features.

    User-friendliness

    Before UniSwap, DEXes were very tricky to use. On the other hand, UniSwap has a very intuitive interface. Especially the section dedicated to token exchanges (Swaps) is very clear.

    uniswap

    Liquidity Availability

    Decentralised exchanges have always had issues of liquidity. In order to allow traders to execute orders at any time, it is necessary to always have a large and active supply and demand for all assets. In other words, you need to have liquidity available at all times.

    UniSwap closed this gap by introducing an Automated Market Maker and an incentive programme for liquidity supply, which we will discuss later.

    Automated Market Makers (AMMs) are a series of smart contracts that determine prices with an algorithm and use pools of liquidity to automatically fill orders.

    The core of DeFi

    The platform allowed for many DeFi tokens to find a market and to emerge. Traders had access to brand new cryptocurrencies that were not available on any other platform.

    Not only did UniSwap provide the decisive breakthrough in the decentralised exchange of cryptocurrencies, but it also stimulated new projects in decentralised finance.

    SushiSwap’s attack and UniSwap’s comeback

    In May 2020 the V2 was released, with substantial improvements, and by the summer of 2020 UniSwap was seeing daily volumes above $1 million. The team grew and raised Series A funding from 4 different Venture Capitals.

    Autumn  of the same year came with the first major hurdle: SushiSwap launched an offer aimed at taking users and liquidity providers away from UniSwap, and it succeeded.

    This ‘vampire attack’ drained UniSwap’s liquidity but, at that point, the team was already working on V3.

    Not only that, but a few days after the attack, the UNI token arrived on the market with a large airdrop for all those who had already used the protocol. The UNI token was immediately listed by the largest international exchanges at an unprecedented speed. In two well-placed moves, UniSwap had taken over the scene.

    Uniswap Version 3

    The long-awaited Version 3 of the UniSwap protocol comes with features that will mark a turning point for DEXes.

    The protocol update was deployed on 5th of May on Ethereum.

    The key word in V3 is “customisation“. The user now has more freedom of choice with regard to 3 main functionalities:

    • Liquidity supply, thanks to concentrated liquidity
    • Token swaps, thanks to range orders
    • Fees, thanks to the addition of flexible fees

    What is Concentrated Liquidity?

    Let’s start with the concept of a Liquidity Provider (LP).

    LPs are users who deposit their tokens in liquidity pools to get a reward.

    Liquidity pools are one of the main instruments of decentralised exchanges. They are “containers” of large quantities of token pairs. The liquidity that the pools contain is used by the exchange to carry out token swaps.

    Supplying Liquidity in V2

    In V2, any liquidity provider (LP) on UniSwap locks its token pairs into a pool to receive periodic rewards in UNI or other tokens.

    The LP deposits an equal amount of both tokens making up the pair concerned. The AMM then takes the number of tokens it needs from the pool to execute an order at a certain price.

    Supplying Liquidity in V3

    In V3, the LP will also decide for which price range to provide liquidity. So you will have a lot of liquidity for a specific price range, hence the term “concentrated liquidity“.

    Let’s give an example by comparing the strategy of an LP using V2 and an LP using V3.

    Supplying Liquidity in V3: Example

    Alice and Bob want to provide liquidity to an ETH/DAI pool on Uniswap v3.
    They have $1 million each.
    The current price of ETH is 1,500 DAI.

    uniswap v3

    Alice decides to distribute her capital over the entire price range (as she would have done in Uniswap V2). She deposits 500,000 DAI and 333.33 ETH (for a total value of $1 million).

    Bob instead creates a concentrated position, depositing only in the price range of 1,000 to 2,250. He deposits 91,751 DAI and 61.17 ETH, for a total value of about $183,500. He keeps the other $816,500, using it as he wishes.

    Even though Alice has deposited 5.44 times more capital than Bob, they earn the same amount of fees as long as the price of ETH/DAI stays within the range of 1,000 to 2,250.

    If the price of ETH falls to $0, both Alice’s and Bob’s liquidity will be fully converted into ETH. However, Bob will only have lost $159,000 compared to Alice’s $1 million.

    Bob can use his additional $816,500 to protect himself against risk or in any other functionality.

    Range Order

    From V3 onwards, there will no longer be only market orders to execute swaps on the exchange, but also range orders.
    Range orders allow you to place a sort of limit order on a certain price range.

    Here’s how it works:

    • The user selects an A-B pair and deposits an amount of token A that they want to convert into token B.
    • They select a price range within which token A will be converted. The price range can be above or below the current price of A.
    • If the market price enters the selected price range, token A is progressively replaced by token B, following a smooth curve.
    • Together with token B, the swap fees are also received.

    Let’s say Alice wanted to use a Range Order:

    range order
    1. Alice deposits 1 million DAI in the DAI-USDC pair when the price of DAI is 1,000 USDC.
    2. She selects the range of 1.001-1.002.
    3. In most cases, the range order is filled at the average price between the two selected extremes.
    4. Thus, according to the curve, when the price of DAI reaches 1.0015, Alice will have already converted half of her DAI to USDC.
    5. Once DAI reaches 1.002, on the other hand, Alice will have about 1 million USDC. Not only that, but she will also have the fees to which she is entitled to for providing liquidity in DAI at a demanded price.

    Memo

    This type of order should not be confused with limit orders. The limit orders in centralised exchanges are not filled on a mathematical price curve, but according to the operation of order books.

    There is one more precaution to be taken once the order is completed: in order not to risk that the USDCs get converted back into DAIs when the price returns to the selected range, Alice must withdraw USDCs from the range order functionality.

    Flexible fees

    The fees on UniSwap are the commissions to be paid to the exchange and at the same time the rewards for LPs.

    Uniswap v3 offers LPs three separate fee levels – 0.05%, 0.30% and 1.00%. This variety of options ensures that LPs tailor their supply according to the expected volatility of the pairs: LPs take more risk with particularly volatile pairs such as ETH/DAI and, conversely, take minimal risk in pairs such as USDC/DAI, as both currencies are pegged to the dollar.

    It is expected that correlated token pairs will use the 0.05% fee level and that pairs such as ETH/DAI will use the 0.30% fee level, while for more recently launched and more complex tokens, 1.00% is more appropriate given the level of risk.

    Conclusion

    Thanks to ‘customisation‘, traders have the opportunity to optimise their operations. The most important improvements resulting from this are as follows:

    • LPs can provide liquidity with up to 4000 times the capital efficiency compared to Uniswap v2, earning higher returns on their liquidity. Just like Bob did!
    • Capital efficiency paves the way for the execution of low price-slippage swaps.
    • Thanks to concentrated liquidity, LPs can significantly increase their exposure to their preferred assets and reduce the percentage of risk of loss.
    • The ability to place not only market orders but also range orders, thus expanding users’ trading strategies.
    Related