boomer77crypto cosmology
    Updated 2021-11-25
    with raw as (select
    msg_value:execute_msg:initiate_transfer:recipient_chain::string as chain,
    sum(msg_value:execute_msg:initiate_transfer:asset:amount) as amount,
    msg_value:execute_msg:initiate_transfer:asset:info:token:contract_addr::string as assets
    from terra.msgs
    where msg_value:contract::string = 'terra10nmmwe8r3g99a9newtqa7a75xfgs2e8z87r2sf' and msg_value:execute_msg:initiate_transfer:asset:info:token:contract_addr::string is not null
    group by 1,3
    order by 2 desc
    limit 14),

    final as (select chain, case
    when chain = 1 then 'solana'
    when chain = 2 then 'ethereum'
    when chain = 4 then 'BSC'
    when chain = 5 then 'polygon'
    else null end as destination_chain,
    amount, case
    when assets = 'terra1ce06wkrdm4vl6t0hvc0g86rsy27pu8yadg3dva' then amount/1e6
    else amount/1e8 end as token_amount,
    assets, case
    when assets = 'terra1ce06wkrdm4vl6t0hvc0g86rsy27pu8yadg3dva' then 'weUSDT'
    when assets = 'terra1mddcdx0ujx89f38gu7zspk2r2ffdl5enyz2u03' then 'ORION'
    when assets = 'terra1gdapfuda0dxtjc98raemhszntcxty7chyr0wpd' then 'whORION'
    when assets = 'terra127ww0al7uj9vyg7cv2gtcqenhrjzlnq5vaq6dh' then 'whUST'
    when assets = 'terra1yljlrxvkar0c6ujpvf8g57m5rpcwl7r032zyvu' then 'whUSDC'
    when assets = 'terra1tuleqeucunvs9rga3dq5h35ew3ml8uv9a4snzx' then 'whMIR'
    when assets = 'terra1skjr69exm6v8zellgjpaa2emhwutrk5a6dz7dd' then 'whBUSD'
    when assets = 'terra190tqwgqx7s8qrknz6kckct7v607cu068gfujpk' then 'wsSOL'
    when assets = 'terra1fme0uqgjucph3kelyejm6yuj60e4te8647gx6v' then 'whLUNA'
    else null end as tokens
    from raw)

    select destination_chain, token_amount, tokens, concat(tokens,'-',destination_chain) as tokens_chain
    from final
    where tokens is not null
    order by token_amount desc
    Run a query to Download Data