adambalaTop 10 (Destination) Validators With Most ReDelegates To Them (Redelegates Count)
    Updated 2022-12-14
    with redelegatet as (
    select tx_id,
    split(ATTRIBUTE_VALUE,'uatom')[0]::numeric/1e6 as Redelegate_Amount
    from cosmos.core.fact_msg_attributes
    where msg_type = 'redelegate'
    and attribute_key = 'amount'
    and ATTRIBUTE_VALUE ilike '%uatom%'
    and tx_succeeded = 'TRUE'),

    redelegatort as (
    select block_timestamp as Redelegate_Date,
    tx_id,
    attribute_value as Redelegator
    from cosmos.core.fact_msg_attributes
    where msg_type = 'coin_spent'
    and attribute_index = '0'
    and attribute_key = 'spender'
    and msg_index = '0'
    and tx_id in (select tx_id from redelegatet)
    and tx_succeeded = 'TRUE'),

    sourcev as (
    select block_timestamp,
    tx_id,
    attribute_value as Source_Validator_Operator,
    REPLACE(ATTRIBUTE_VALUE, 'valoper', '') as Source_Validator_Address
    from cosmos.core.fact_msg_attributes
    where ATTRIBUTE_KEY= 'source_validator'
    and tx_id in (select tx_id from redelegatet)
    and tx_succeeded = 'TRUE'),

    destv as (
    select block_timestamp,
    tx_id,
    attribute_value as Destination_Validator_Operator,
    REPLACE(ATTRIBUTE_VALUE, 'valoper', '') as Destination_Validator_Address
    Run a query to Download Data