0xHaM-dATOM staking activity copy
    Updated 2023-11-28
    -- forked from ATOM staking activity @ https://flipsidecrypto.xyz/edit/queries/d0994eb8-deb6-4c9c-9dcd-734943168915

    with msg_list as(
    select
    tx_id,
    block_timestamp,
    msg_index,
    msg_type,
    msg_group,
    attribute_value

    from cosmos.core.fact_msg_attributes
    where
    attribute_key = 'amount'
    and (
    msg_type = 'withdraw_rewards'
    or msg_type = 'unbond'
    or msg_type = 'delegate'
    )
    and attribute_value is not null
    and attribute_value like '%uatom%'
    and block_timestamp >= '2021-12-01'
    )

    ,pruning_msg_list as(
    select
    tx_id,
    block_timestamp,
    msg_index,
    msg_type,
    msg_group,
    case
    when (attribute_value like '%ibc%') then substr(right(attribute_value, charindex(',', reverse(attribute_value)) -1), 0, position('uatom', right(attribute_value, charindex(',', reverse(attribute_value)) -1))-1)::integer * pow(10,-6)
    else substr(attribute_value, 0, position('uatom', attribute_value)-1)::integer * pow(10,-6)
    end as amount
    Run a query to Download Data