apostleoffinanceGas Fee - Revenue Indicator
    Updated 2023-05-10

    WITH def AS (SELECT
    a.tx_hash AS tx_hash,
    a.block_timestamp AS block_timestamp,
    a.tx_fee AS tx_fee,
    a.gas_price AS gas_price,
    b.platform AS platform,
    a.gas_used AS gas_used
    FROM ethereum.core.fact_transactions a
    join ethereum.core.ez_dex_swaps b
    on a.tx_hash = b.tx_hash)

    --We created a separate table called 'def' by joining 'a' + 'b' and extracting the needed columes from the two table a & b.
    --The colunme 'tx_hash' is the colunme that table a has in common with table b, hence we join from 'tx_hash'

    SELECT date_trunc('day', block_timestamp) AS date,
    SUM(gas_used) AS total_gas_used,
    SUM(tx_fee) AS total_gas_fee

    FROM def
    WHERE platform = 'uniswap-v3'
    AND date >= CURRENT_DATE - INTERVAL '2 years'
    GROUP BY 1
    ORDER BY 3 DESC
    Run a query to Download Data