Updated 3 days ago
    WITH usd_conversion AS (
    SELECT
    avg(price) AS eth_price_usd
    FROM
    ethereum.price.ez_prices_hourly
    WHERE
    symbol = 'ETH'
    AND hour >= '2025-01-01'
    AND hour <= '2025-12-31'
    ),
    swaps_with_gas AS (
    SELECT
    s.tx_hash,
    t.tx_fee,
    s.block_timestamp
    FROM
    ethereum.defi.ez_dex_swaps s
    JOIN ethereum.core.fact_transactions t ON s.tx_hash = t.tx_hash
    WHERE
    t.block_timestamp >= '2025-01-01'
    AND t.block_timestamp <= '2025-12-31'
    AND t.tx_succeeded = True
    ),
    swaps_with_price AS (
    SELECT
    s.tx_hash,
    s.tx_fee,
    s.block_timestamp,
    u.eth_price_usd
    FROM
    swaps_with_gas s
    CROSS JOIN usd_conversion u
    )
    SELECT
    COUNT(DISTINCT s.tx_hash) AS total_swaps,
    SUM(s.tx_fee) AS total_swap_fee_eth,
    Last run: 3 days ago
    TOTAL_SWAPS
    TOTAL_SWAP_FEE_ETH
    Average Swap Fee (USD)
    Average Swap Fee (ETH)
    1
    31016242153713.8649819894.5945157080.004955915194
    1
    56B
    110s