Yousefi_1994Aave Delegates - Total Gas Used
    Updated 2023-03-22
    with fix_parameter as (
    select
    case
    when try_cast('{{Days}}' as int) = 90 then 90
    when try_cast('{{Days}}' as int) = 180 then 180
    else 90
    end as time_frame
    ),
    eth_price_usd as (
    select
    hour::date as days,
    avg(price) as price_usd
    from ethereum.core.fact_hourly_token_prices
    where token_address is null
    and hour::date >= current_date - (select time_frame from fix_parameter)
    group by days
    ),
    aave_vote_log as (
    select
    block_timestamp,
    tx_hash,
    decoded_log:id as proposal_id,
    decoded_log:support as vote_option,
    decoded_log:voter as voter
    from ethereum.core.ez_decoded_event_logs
    where contract_address = '0xec568fffba86c094cf06b22134b23074dfe2252c'
    and event_name = 'VoteEmitted'
    and topics[0] = '0x0c611e7b6ae0de26f4772260e1bbdb5f58cbb7c275fe2de14671968d29add8d6'
    and tx_status = 'SUCCESS'
    and block_timestamp >= current_date - (select time_frame from fix_parameter)
    ),
    aave_vote_log_with_fee as (
    select
    log.*,
    transactions.tx_fee as fee_in_eth
    from aave_vote_log log
    Run a query to Download Data