Ali3NDistribution of Voting Power Among Terra Validators
    Updated 2023-02-22
    with DelegateTable2 as (
    select validator_address,
    sum (amount) as delegate_amount
    from terra.core.ez_staking
    where action ilike 'delegate'
    and tx_succeeded = 'TRUE'
    group by 1),

    UndelegateTable2 as (
    select validator_address,
    sum (amount) as undelegate_amount
    from terra.core.ez_staking
    where action ilike 'undelegate'
    and tx_succeeded = 'TRUE'
    group by 1),

    RedelegateTable2 as (
    select validator_address,
    sum (amount) as redelegate_amount
    from terra.core.ez_staking
    where action ilike 'redelegate'
    and tx_succeeded = 'TRUE'
    group by 1),

    RedelegateTable22 as (
    select validator_src_address,
    sum (amount) as redelegate_amount1
    from terra.core.ez_staking
    where action ilike 'redelegate'
    and tx_succeeded = 'TRUE'
    group by 1),

    maintable as (
    select t1.validator_address,
    case when t1.validator_address = 'terravaloper120ppepaj2lh5vreadx42wnjjznh55vvktp78wk' then 'Allnodes.com'
    when t1.validator_address = 'terravaloper18vnm040mwk0d6plc60v5m9h2376gkcphknuwzs' then 'Prism Protocol'
    Run a query to Download Data