misaghlbAave Delegates' Gas Usage - comparison
    Updated 2023-03-22
    with eth_price as (
    SELECT date(hour) as pdate, avg(price) as avg_price
    from ethereum.core.fact_hourly_token_prices
    where date(hour) >= CURRENT_DATE - 180
    AND symbol = 'WETH'
    GROUP BY pdate
    )
    SELECT
    case when date(a.block_timestamp) > CURRENT_DATE - 90 then '90 - 180 Days Ago' else '90 Days Ago' end splitter,
    sum(tx_fee) as "Total Fee",
    sum(tx_fee * avg_price) as "Total Fee(USD)",
    avg(tx_fee) as "Average Fee",
    sum(gas_used / 1e9) as "Total Gas",
    avg(gas_used / 1e9) as "Average Gas"
    FROM ethereum.aave.ez_votes a
    JOIN ethereum.core.fact_transactions b ON a.tx_hash = b.tx_hash
    JOIN eth_price on date(a.block_timestamp) = pdate
    where date(a.block_timestamp) >= CURRENT_DATE - 180
    GROUP BY splitter
    Run a query to Download Data