DatafiResearch on Kraken $ATOM unbond event
    Updated 2023-01-30
    with unbond_tx as
    (select
    block_id,
    block_timestamp,
    tx_id,
    attribute_index,
    case
    when attribute_value like '%uatom%' then replace(attribute_value,'uatom', '')
    else attribute_value
    end as attribute_value
    from cosmos.core.fact_msg_attributes
    where msg_type = 'unbond'
    and tx_succeeded = True
    ),

    unbond_amount AS
    (
    SELECT
    block_id,
    block_timestamp,
    tx_id,
    cast(attribute_value as int) as amount
    FROM unbond_tx
    WHERE attribute_index = 1
    ),

    unbond_time AS
    (
    SELECT
    block_id,
    block_timestamp,
    tx_id,
    cast(attribute_value as timestamp) as completion_time
    FROM unbond_tx
    WHERE attribute_index = 2
    ),
    Run a query to Download Data