ZSaed1.1 gas total Data
    Updated 2023-03-19
    -- forked from 97570a6a-5b92-4b79-90bb-af6f8e833c7c

    with vote as (select
    BLOCK_TIMESTAMP,
    PROPOSAL_ID,
    VOTING_POWER,
    VOTER,
    TX_HASH
    from ethereum.aave.ez_votes
    where GOVERNANCE_CONTRACT ='0xec568fffba86c094cf06b22134b23074dfe2252c'--only version two

    ),
    only_vote as (
    select TX_HASH
    from ethereum.core.fact_decoded_event_logs
    where tx_hash in (select DISTINCT tx_hash from vote)
    and FULL_DECODED_LOG:name ='VoteEmitted'

    )
    , gas as (
    select BLOCK_TIMESTAMP , TX_HASH , TX_FEE , GAS_USED

    from ethereum.core.fact_transactions
    where tx_hash in (select distinct tx_hash from only_vote )
    and STATUS ='SUCCESS'
    )
    , total_data as (
    select a.* , b.TX_FEE, b.GAS_USED from vote a INNER JOIN gas b using(tx_hash)
    ),
    proposal as (
    select
    proposal_id ,
    count(DISTINCT voter) as num_voter ,
    count(DISTINCT tx_hash) as num_vote,
    sum(tx_fee) as total_fee,
    avg(tx_fee) as avg_fee,
    Run a query to Download Data