glxyresearchBase Fees Burned From Uniswap Traders
    Updated 2024-10-14
    WITH dex_swaps AS (
    SELECT DISTINCT
    block_number,
    block_timestamp,
    tx_hash
    FROM
    ethereum.defi.ez_dex_swaps
    WHERE
    platform IN ('uniswap-v2', 'uniswap-v3')
    ),
    transactions AS (
    SELECT
    tx_hash,
    gas_used / POWER(10,9) AS gas_used_gwei
    FROM
    ethereum.core.fact_transactions
    ),
    blocks AS (
    SELECT
    block_number,
    (GET(block_header_json, 'baseFeePerGas')::FLOAT / POWER(10,9)) AS base_fee_per_gas_gwei
    FROM
    ethereum.core.fact_blocks
    )
    SELECT
    DATE_TRUNC('day', d.block_timestamp) AS day,
    SUM(t.gas_used_gwei * b.base_fee_per_gas_gwei) AS total_base_fees
    FROM
    dex_swaps d
    JOIN
    transactions t ON d.tx_hash = t.tx_hash
    JOIN
    blocks b ON d.block_number = b.block_number
    GROUP BY
    DATE_TRUNC('day', d.block_timestamp)
    ORDER BY
    Last run: 3 months ago
    DAY
    TOTAL_BASE_FEES
    1
    2020-05-05 00:00:00.000
    2
    2020-05-06 00:00:00.000
    3
    2020-05-11 00:00:00.000
    4
    2020-05-12 00:00:00.000
    5
    2020-05-13 00:00:00.000
    6
    2020-05-14 00:00:00.000
    7
    2020-05-15 00:00:00.000
    8
    2020-05-16 00:00:00.000
    9
    2020-05-17 00:00:00.000
    10
    2020-05-18 00:00:00.000
    11
    2020-05-19 00:00:00.000
    12
    2020-05-20 00:00:00.000
    13
    2020-05-21 00:00:00.000
    14
    2020-05-22 00:00:00.000
    15
    2020-05-23 00:00:00.000
    16
    2020-05-24 00:00:00.000
    17
    2020-05-25 00:00:00.000
    18
    2020-05-26 00:00:00.000
    19
    2020-05-27 00:00:00.000
    20
    2020-05-28 00:00:00.000
    ...
    1620
    63KB
    321s