Afonso_DiazTotal Deposit and Withdrawn of wAVAX
    Updated 2023-02-07
    with

    t as (
    select
    tx_id,
    iff(msg_type ='pool_joined', 'deposit', 'withdraw') as type,
    iff(attribute_value ilike '%uosmo%', 'uOSMO', 'wAVAX') as currency,
    block_timestamp,
    iff(currency = 'uOSMO', 1e6, 1e18) * split_part(trim(regexp_replace(attribute_value,'[^[:digit:]]',' ')), ' ', 0) as amount
    from osmosis.core.fact_msg_attributes
    where
    right(
    attribute_value, length(attribute_value) -
    length(split_part(trim(regexp_replace(attribute_value, '[^[:digit:]]', ' ')), ' ', 0))
    )
    in ('uosmo', 'ibc/6F62F01D913E3FFE472A38C78235B8F021B511BC6596ADFF02615C8F83D3B373')
    and msg_type in ('burn', 'pool_joined')
    ),

    t1 as (
    select
    count(distinct tx_id) as deposit_txns_count
    from t
    where type = 'deposit'
    and block_timestamp >= '2023-01-22'
    ),

    t2 as (
    select
    count(distinct tx_id) as withdrawn_txns_count
    from t
    where type = 'withdraw'
    and block_timestamp >= '2023-01-22'
    )

    select
    Run a query to Download Data