CryptoIcicleTerra - 12. The Eclipse Score
    Updated 2023-11-07
    -- Invent an easy-to use "Eclipse Score", based on at least 3 metrics, to rank validators who are not effectively representing their delegators via voting.
    -- (For example: if you participate in only 5% of votes but are in the top 5% of validators by LUNA delegated, you should have a terrible Eclipse Score!)
    -- Provide a table and at least 1 visual that displays validators according to your Eclipse Score, e.g. a bubble chart with LUNA Delegated vs. Votes Attended.
    -- Additionally, analyze the top 5 best and top 5 worst validators according to your Eclipse score.
    -- Basis of Payment:
    -- To be eligible for payment.
    -- The submission must be sent before the deadline indicated on the bounty page.
    -- The submission must score a minimum of 6 points according to the Evaluation Criteria.
    -- 💰 Payout
    -- Rank Based Payout
    -- LUNA Payouts:
    -- First place 400$ in LUNA
    -- Second place 150$ in LUNA
    -- Third place 150$ in LUNA
    -- 4th through 15th place 75$ in LUNA
    -- 16th through 21st place 50$ in LUNA

    with validator_names as (
    select
    message_value:delegator_address as delegator_address,
    message_value:description:moniker as validator_name,
    message_value:validator_address as validator_address
    from terra.core.ez_messages
    where message_type = '/cosmos.staking.v1beta1.MsgCreateValidator'
    ),
    delegate_txns as(
    select
    date_trunc('{{date_range}}',block_timestamp) as date,
    validator_address as validator,
    'delegate' as type,
    count(distinct tx_id) as n_txns,
    count(distinct delegator_address) as n_wallets,
    sum(amount) as amount_luna,
    sum(n_txns) over (partition by validator order by date asc rows between unbounded preceding and current row) as cum_n_txns,
    sum(n_wallets) over (partition by validator order by date asc rows between unbounded preceding and current row) as cum_n_wallets,
    sum(amount_luna) over (partition by validator order by date asc rows between unbounded preceding and current row) as cum_amount_luna
    Run a query to Download Data