Afonso_Diaz2023-06-11 06:47 PM
    Updated 2023-06-16
    with t as (
    select
    date_trunc('month', block_timestamp)::date as month,
    'Near' as chain,
    count(distinct tx_hash) as votes,
    count(distinct signer_id) as voters,
    sum(votes) over (order by month) as cumulative_votes
    from near.core.fact_actions_events_function_call
    left outer join near.core.dim_address_labels
    on address = receiver_id
    where method_name = 'act_proposal'
    and label_type = 'dao'
    and creator = 'Near Foundation'
    group by 1, 2

    union all

    select
    date_trunc('month', block_timestamp)::date as month,
    'Cosmos' as chain,
    count(distinct tx_id) as votes,
    count(distinct voter) as voters,
    sum(votes) over (order by month) as cumulative_votes
    from cosmos.core.fact_governance_votes
    where tx_succeeded = 1
    group by 1, 2

    union all

    select
    date_trunc('month', block_timestamp)::date as month,
    'Osmosis' as chain,
    count(distinct tx_id) as votes,
    count(distinct voter) as voters,
    sum(votes) over (order by month) as cumulative_votes
    from osmosis.core.fact_governance_votes
    Run a query to Download Data