boomer77terra-bsc wormhole daily
    Updated 2021-12-06
    with raw as (select
    date_trunc('week', block_timestamp) as dt,
    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,
    count(distinct tx_id) as tx_count,
    case
    when assets in ('terra1e6mq63y64zcxz8xyu5van4tgkhemj3r86yvgu4',
    'terra19t8cxscre0jss7nejqy29c97fkg7els3v8zujg',
    'terra1hd9n65snaluvf7en0p4hqzse9eqecejz2k8rl5',
    'terra1j5xfzqqznn77jm4d7pwcxcqzfv55dnrw5fak08',
    'terra1kkyyh7vganlpkj0gkc2rfmhy858ma4rtwywe3x',
    'terra14z56l0fp2lsf86zy3hty2z47ezkhnthtr9yq76',
    'terra193c42lfwmlkasvcw22l9qqzc5q2dx208tkd7wl',
    'terra15gwkyepfc6xgca5t5zefzwy42uts8l2m4g40k6',
    'terra1xu3nyee55dfe5vxqtg9m4rkex8u2t6n2etl08h') then 1000000
    else 100000000 end as power, (amount/power) as token_volume
    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 and chain = 4
    group by 1,2,4
    order by 2 desc
    limit 100),

    final as (select dt, amount, assets, token_volume, tx_count, case
    when assets = 'terra1mddcdx0ujx89f38gu7zspk2r2ffdl5enyz2u03' then 'ORION'
    when assets = 'terra1gdapfuda0dxtjc98raemhszntcxty7chyr0wpd' then 'ORION'
    when assets = 'terra127ww0al7uj9vyg7cv2gtcqenhrjzlnq5vaq6dh' then 'whUST'
    when assets = 'terra1yljlrxvkar0c6ujpvf8g57m5rpcwl7r032zyvu' then 'whUSDC'
    when assets = 'terra1tuleqeucunvs9rga3dq5h35ew3ml8uv9a4snzx' then 'MIR'
    when assets = 'terra1skjr69exm6v8zellgjpaa2emhwutrk5a6dz7dd' then 'whBUSD'
    when assets = 'terra1vlqeghv5mt5udh96kt5zxlh2wkh8q4kewkr0dd' then 'whUSDT'
    when assets = 'terra193c42lfwmlkasvcw22l9qqzc5q2dx208tkd7wl' then 'BTL'
    when assets = 'terra14z56l0fp2lsf86zy3hty2z47ezkhnthtr9yq76' then 'ANC'
    when assets = 'terra1fme0uqgjucph3kelyejm6yuj60e4te8647gx6v' then 'LUNA'
    when assets = 'terra1kkyyh7vganlpkj0gkc2rfmhy858ma4rtwywe3x' then 'whUSDC'
    when assets = 'terra1xu3nyee55dfe5vxqtg9m4rkex8u2t6n2etl08h' then 'whUSDT'
    Run a query to Download Data