Moe10 lqlqlq
    Updated 2022-11-11

    with
    base1 as (
    select
    regexp_substr(sender,'[a-zA-Z]+|\d+') as from_chain, -- thanks to cryptoicicle for this cte
    regexp_substr(receiver,'[a-zA-Z]+|\d+') as to_chain,
    concat(from_chain,' to ',to_chain) as chain_pairs,
    lower(split(currency,'-')[0]) as symbol,
    iff(symbol ilike 'u%', substring(symbol, 2, LEN(symbol)), symbol) as token_name,
    t.*
    from axelar.core.fact_transfers t
    where transfer_type in ('IBC_TRANSFER_IN','IBC_TRANSFER_OUT')),
    base as (select * from base1 where to_chain = 'osmo')

    , raw as (
    select
    'Transfer' as act,
    f.block_timestamp,
    f.tx_id,
    f.sender as user
    from osmosis.core.fact_transfers f
    join base b on f.sender = b.receiver and f.block_timestamp > b.block_timestamp
    where tx_status = 'SUCCEEDED'
    union all --*******************************************
    select
    'Gov dep' as act,
    g.block_timestamp,
    g.tx_id,
    depositor as user
    from osmosis.core.fact_governance_proposal_deposits g
    join base b on g.depositor = b.receiver and g.block_timestamp > b.block_timestamp
    where
    tx_status = 'SUCCEEDED'
    union all --*******************************************
    select
    Run a query to Download Data