Afonso_Diaz2023-11-05 04:29 PM
    Updated 2023-11-05
    with

    t1 as (
    select
    recorded_hour::date as date,
    avg(price) as price_usd
    from osmosis.price.ez_prices
    where symbol = 'ATOM'
    group by 1
    ),


    t2 as (
    select
    tx_id,
    block_timestamp,
    try_parse_json(attribute_value):sender as sender,
    try_parse_json(attribute_value):amount::float/1e6 as amount,
    amount * price_usd as amount_usd,
    try_parse_json(attribute_value):denom as denom
    from cosmos.core.fact_msg_attributes
    join t1 on date = block_timestamp::date
    -- where tx_id in (
    -- select distinct tx_id from cosmos.core.fact_msg_attributes
    -- where attribute_key = 'channel_id'
    -- and attribute_value = 'channel-391'
    -- )
    where msg_type = 'send_packet'
    and attribute_key = 'packet_data'
    and try_parse_json(attribute_value):receiver ilike '%LiquidStake%'
    and try_parse_json(attribute_value):receiver ilike '%stride%%'
    )

    select * from t2 where tx_id = '42504BF45D78B14DFA30B34C404D7350D1CB0C39CBD9570249A24F0D3586E1B8'
    Run a query to Download Data