0xHaM-dUntitled Query
    Updated 2022-12-14
    with redelegateTb as (
    select
    tx_id,
    split(ATTRIBUTE_VALUE,'uatom')[0]::numeric/1e6 as amount_redelegated
    from cosmos.core.fact_msg_attributes
    where msg_type = 'redelegate'
    and attribute_key = 'amount'
    and ATTRIBUTE_VALUE ilike '%uatom%'
    and tx_succeeded = 'TRUE'
    ),
    spenderTb as (
    select
    block_timestamp,
    tx_id,
    attribute_value as redelegater_wallet
    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 redelegateTb)
    and tx_succeeded = 'TRUE'
    ),
    receiverTb as (
    select
    block_timestamp,
    tx_id,
    attribute_value as receiver
    from cosmos.core.fact_msg_attributes
    where msg_type = 'coin_received'
    and attribute_key = 'receiver'
    and tx_id in (select tx_id from redelegateTb)
    and tx_succeeded = 'TRUE'
    ),
    sourceTB as (
    select
    Run a query to Download Data