Ali3NVote Changing Behavior of Voter Validators (Cosmos Osmosis Terra)
    Updated 2023-02-22
    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'),

    firstvotes1 as (
    select voter,
    block_timestamp,
    tx_id,
    vote_option,
    case when t1.vote_option = '3' then 'NO'
    when t1.vote_option = '4' then 'NO WITH VETO'
    when t1.vote_option = '2' then 'ABSTAIN'
    when t1.vote_option = '1' then 'YES' end as vote_description,
    proposal_id
    from cosmos.core.fact_governance_votes t1),

    secondvotes1 as (
    select distinct t1.voter,
    t1.block_timestamp,
    t1.tx_id,
    t1.vote_option,
    case when t1.vote_option = '3' then 'NO'
    when t1.vote_option = '4' then 'NO WITH VETO'
    when t1.vote_option = '2' then 'ABSTAIN'
    when t1.vote_option = '1' then 'YES' end as vote_description,
    t1.proposal_id
    from cosmos.core.fact_governance_votes t1 join firstvotes1 t3 on t1.voter = t3.voter and t1.block_timestamp > t3.block_timestamp and t1.vote_option != t3.vote_option and t1.proposal_id = t3.proposal_id),

    firstvotes2 as (
    select voter,
    block_timestamp,
    tx_id,
    vote_option,
    Run a query to Download Data