DEV Community

mawutor
mawutor

Posted on

Top 10 Uniswap Pools By Swap Volume

Introduction

The central idea around the invention of cryptocurrencies is that traditional fiat currencies are failing to serve a fast-advancing society. Since bitcoin's invention, the idea of money has changed from being an asset controlled by a single entity to a decentralized system that is trustless, permissionless, and accessible to anyone with an internet connection.

Blockchain technology, the backbone of this innovation, has spurred off countless cryptocurrencies, with different approaches, solutions, and ideologies coming together to create a new paradigm. The realization now is that there is no one currency to rule them all, however, an ecosystem is emerging where different types of cryptocurrencies serve different purposes.

Decentralized Exchanges

A crypto ecosystem that will promote adoption and utility should provide the means of seamless exchange of currencies (tokens). Decentralized exchanges (DEXs) enable the exchange of tokens by allowing token holders to provide tokens in a pool to facilitate trades. Mechanisms of DEXs vary by design however, the leaders in this space happen to be automated market makers (AMM) that allow tokens to be traded automatically and without permission using liquidity pools.

Uniswap

Uniswap is an AMM designed for exchanging tokens on the Ethereum blockchain. As a pioneer in the space of AMMs, Uniswap is the largest decentralized exchange with total value locked (TTVL) over $5 billion. In this piece, we seek to investigate the liquidity pools available on Uniswap and rank the pools with the most swap volumes. We define swap volumes as the number of tokens exchanged within a particular pool over time.

On-chain data

Our investigation requires access to on-chain data. FlipsideCrypto is a data analytics firm that provides free access to crypto on-chain data via an SQL interface and a REST application programming interface (API). For simplicity’s sake, we shall use the SQL interface to make the search query. The purpose of the query is to get the top 10 Uniswap pools by swap volume.

Method

According to FlipsideCrypto documentation, to get Uniswap swap data, we have to call the Uniswapv3.swap table. Uniswap v3 is chosen over v2 and v1 because it is the latest iteration of the Uniswap protocol at the time of writing. Next, we identify the amount0_usd and amount1_usd columns which hold the swap amount for every trade made on the protocol. To get the top 10 pools, we sum up the swap amounts for every transaction associated with a particular pool. The result is ordered in descending order and limited to 10 entries representing the top 10 pools. Here’s how the query looks like:

WITH swap_raw AS (
    SELECT
        pool_address,
        pool_name,
        CASE WHEN amount0_usd < 0 THEN amount0_usd ELSE amount1_usd END AS swap_usd_amount_out,
        CASE WHEN amount0_usd >= 0 THEN amount0_usd ELSE amount1_usd END AS swap_usd_amount_in
    FROM uniswapv3.swaps
    WHERE amount0_usd IS NOT NULL AND amount1_usd IS NOT NULL
)
-- // Only amount in
SELECT
    pool_address,
    pool_name,
    SUM(ABS(swap_usd_amount_in)) AS swap_volume_usd 
FROM swap_raw
GROUP BY 1,2
ORDER BY 3 DESC
LIMIT 10
Enter fullscreen mode Exit fullscreen mode

Note: Conditions are applied to only add one of amount0_usd or amount1_usd to the summation depending on the direction of the trade.

The chart below presents the bar graph visualization of the top 10 Uniswap pools by swap volume.
Top 10 Uniswap Pools By Swap Volume

Findings & Conclusion

The top 10 Uniswap pools have a combined swap volume of $66,082,676,649 out of the total all-time swap volume of $87,614,231,061. This represent a share of ~75%, which means that about 75 percent of swaps made on Uniswap happen within the top 10 liquidity pools.

Top comments (0)