Afonso_Diaz2023-11-04 06:34 PM copy
    Updated 2023-11-06
    -- forked from 2023-11-04 06:34 PM @ https://flipsidecrypto.xyz/edit/queries/fe4166af-476f-4ed6-b085-7ece2362edd5

    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):amount::float/1e6 as amount,
    amount * price_usd as amount_usd,
    try_parse_json(attribute_value):sender as user,
    try_parse_json(attribute_value):denom as denom
    from cosmos.core.fact_msg_attributes
    join t1 on date = block_timestamp::date
    where msg_type = 'send_packet'
    and try_parse_json(attribute_value):receiver ilike '%stride%'
    and try_parse_json(attribute_value):receiver ilike '%LiquidStake%'
    and tx_id in (
    select distinct tx_id from cosmos.core.fact_msg_attributes
    where msg_type = 'send_packet'
    and attribute_key = 'packet_src_channel'
    and attribute_value = 'channel-391'
    )
    ),

    t3 as (
    select
    Run a query to Download Data