MLDZMNADG5
    Updated 2023-03-19
    with tb1 as (select
    HOUR::date as day,
    avg(PRICE) as price_token
    from ethereum.core.fact_hourly_token_prices where SYMBOL='WETH'
    group by 1)

    select
    distinct voter,
    count(distinct s.tx_hash) as no_votes,
    sum(TX_FEE) as total_fee,
    sum(TX_FEE*price_token) as amount_usd,
    avg(TX_FEE*price_token) as avg_usd,
    median(TX_FEE*price_token) as median_usd,
    min(TX_FEE*price_token) as min_usd,
    max(TX_FEE*price_token) as max_usd


    from ethereum.aave.ez_votes s
    left join ethereum.core.fact_transactions a on s.tx_hash=a.tx_hash
    left join tb1 b on s.BLOCK_TIMESTAMP::date=b.day
    where s.BLOCK_TIMESTAMP >= CURRENT_DATE-180
    group by 1
    order by 4 desc limit 10
    Run a query to Download Data