Updated 2023-03-22
    with t as (
    select
    hour::date as date,
    median(price) as price_usd
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'WETH'
    group by 1
    )

    select
    proposal_id,
    count(distinct tx_hash) as votes,
    count(distinct from_address) as voters,
    sum(tx_fee) as fee_eth,
    sum(tx_fee * price_usd) as fee_usd,
    avg(tx_fee) as average_fee_eth,
    avg(tx_fee * price_usd) as average_fee_usd,
    avg(gas_used) as average_gas_used_gwei
    from ethereum.core.fact_transactions
    join ethereum.aave.ez_votes
    using(tx_hash)
    left outer join t
    on block_timestamp::date = date
    where block_timestamp > current_date - interval '{{ months }} months'
    group by 1
    order by fee_eth desc
    limit 10
    Run a query to Download Data