maybeyonasworm_ust_daily_chain
    Updated 2021-11-24
    with
    outflow as (
    select
    block_timestamp,
    tx_id,
    msg_value:sender::string as user,
    case msg_value:execute_msg:initiate_transfer:recipient_chain::string
    when 1 then 'SOLANA'
    when 2 then 'ETHEREUM'
    when 3 then 'TERRA'
    when 4 then 'BINANCE'
    when 5 then 'POLYGON'
    end
    as recipient_chain,
    msg_value:execute_msg:initiate_transfer:asset:info:native_token:denom::string as token_sent,
    msg_value:execute_msg:initiate_transfer:asset:amount::string/pow(10,6) as amount
    from terra.msgs
    where
    tx_status = 'SUCCEEDED'
    and msg_value:execute_msg:initiate_transfer:asset:info:native_token:denom::string = 'uusd'
    and msg_value:contract::string = 'terra10nmmwe8r3g99a9newtqa7a75xfgs2e8z87r2sf'
    and msg_value:execute_msg:initiate_transfer:recipient_chain::string is not null
    -- and tx_id = '66127E1EAA86C5F9C77584BD189DB5751CC804B4371C499D784F0EF5AF9C6583'
    )

    select
    date(block_timestamp) as date,
    recipient_chain,
    -- token_sent,
    count(tx_id) as txs,
    count(distinct user) as users,
    sum(amount) as tokens
    from outflow
    group by 1,2--,3
    order by tokens desc
    Run a query to Download Data