Ali3NWeekly Top 5 Worst Terra Validators (By Eclipse Score) & Their $LUNA Delegation Stats Over Time
    Updated 2023-02-05
    with terravalidators as (
    select attribute_value as validator_address,
    REPLACE(ATTRIBUTE_VALUE, 'valoper', '') as validator_address1,
    left(validator_address1, 38) as Account_address1
    from terra.core.fact_msg_attributes
    where ATTRIBUTE_KEY= 'validator'
    and tx_succeeded = 'TRUE'),

    TotalProposalst as (
    select count (distinct proposal_id) as Total_Proposals_Count
    from terra.core.fact_governance_votes
    where tx_succeeded = 'TRUE'),

    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),
    Run a query to Download Data