Soheil_MKUntitled Query
    Updated 2022-12-11
    with redel as (
    select
    distinct tx_id
    from cosmos.core.fact_msg_attributes
    where MSG_TYPE ='redelegate'
    ),

    source_valid as (
    select
    BLOCK_TIMESTAMP,
    tx_id,
    ATTRIBUTE_VALUE as voter
    from cosmos.core.fact_msg_attributes
    where tx_id in (select tx_id from redel)
    and MSG_TYPE='redelegate'
    and ATTRIBUTE_KEY ='source_validator'
    and BLOCK_TIMESTAMP>='2022-11-14 03:03:04'
    ),

    destination_valid as (
    select
    BLOCK_TIMESTAMP,
    tx_id,
    ATTRIBUTE_VALUE as voter
    from cosmos.core.fact_msg_attributes
    where tx_id in (select tx_id from redel)
    and MSG_TYPE='redelegate'
    and ATTRIBUTE_KEY ='destination_validator'
    and BLOCK_TIMESTAMP>='2022-11-14 03:03:04'
    )

    select
    --BLOCK_TIMESTAMP::date as date,
    CASE
    when a.voter ='cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0' then '1-stake.fish'
    when a.voter ='cosmosvaloper1c4k24jzduc365kywrsvf5ujz4ya6mwympnc4en' then '2-Coinbase Custody'
    Run a query to Download Data