Ali3NComparison of Validators' Participation on Recent 5 Proposals vs Other Terra Proposals
    Updated 2023-01-21
    with terravalidators as (
    select REPLACE(ATTRIBUTE_VALUE, 'valoper', '') as validator_address1,
    left(validator_address1, 38) as Account_address
    from terra.core.fact_msg_attributes
    where ATTRIBUTE_KEY= 'source_validator'
    and tx_succeeded = 'TRUE'),

    maintable as (
    select 'Recent 5 Proposals' as type,
    proposal_id,
    case when left(t1.voter, 38) in (select Account_address from terravalidators) then 'Validator'
    else 'Non-Validator' end as voter_type,
    count (distinct tx_id) as Votes_Count,
    count (distinct voter) as Voters_count
    from terra.core.fact_governance_votes t1
    where proposal_id in ('3796','3795','3794','3665','3619')
    and tx_succeeded = 'TRUE'
    group by 1,2,3

    union ALL

    select 'Other Proposals' as type,
    proposal_id,
    case when left(t1.voter, 38) in (select Account_address from terravalidators) then 'Validator'
    else 'Non-Validator' end as voter_type,
    count (distinct tx_id) as Votes_Count,
    count (distinct voter) as Voters_count
    from terra.core.fact_governance_votes t1
    where proposal_id not in ('3796','3795','3794','3665','3619')
    and tx_succeeded = 'TRUE'
    group by 1,2,3)

    select type,
    voter_type,
    avg (voters_count) as Average_Voters_Count
    from maintable
    Run a query to Download Data