mansaGas Fee Analysis
    Updated 2022-06-21
    with lil as (
    select
    tx_hash as tx_id
    from ethereum.core.fact_event_logs
    where lower(contract_address) = lower('0x5d2C31ce16924C2a71D317e5BbFd5ce387854039')
    and event_name = 'VoteCast'
    ),

    fees as(
    select
    date(block_timestamp) as dates,
    avg(gas_price) as gas,
    sum(gas) over (order by dates) as cum_gas
    from ethereum.core.fact_transactions a
    inner join lil b
    on a.tx_hash = b.tx_id
    group by dates
    ),

    proposal_vote as (
    select
    date(block_timestamp) as vote_day,
    sum(event_inputs:votes) as n_votes,
    sum(n_votes) over (order by vote_day) as cum_votes
    from ethereum.core.fact_event_logs
    where lower(contract_address) = lower('0x5d2C31ce16924C2a71D317e5BbFd5ce387854039')
    and event_name = 'VoteCast'
    group by vote_day
    )

    select
    a.dates,
    a.cum_gas,
    b.n_votes,
    b.cum_votes
    from fees a
    Run a query to Download Data