boomer77Wormhole Tx Perc as Bridge
    Updated 2022-01-19
    with tbridge as (select date(block_timestamp) as dt,
    count(distinct msg_value:from_address::string) as users, 'tbridge' as bridges,
    count(distinct tx_id) as tx_count
    from terra.msgs
    where msg_value:to_address::string in ('terra13yxhrk08qvdf5zdc9ss5mwsg5sf7zva9xrgwgc', 'terra1rtn03a9l3qsc0a9verxwj00afs93mlm0yr7chk') and
    tx_status = 'SUCCEEDED'
    group by 1,3),

    whole as (select date(block_timestamp) as dt,
    count(distinct msg_value:sender::string) as users, 'wormhole' as bridges,
    count (distinct tx_id) as tx_count
    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 tx_status = 'SUCCEEDED'
    group by 1,3)

    select a.dt, a.users as tbridge_users, a.tx_count as tbridge_tx, b.users as wormhole_users, b.tx_count as wormhole_tx, (a.tx_count+b.tx_count) as total_tx,
    round(((b.users/total_tx)*100),2) as wormhole_tx_percentage
    from tbridge a
    left outer join whole b on a.dt = b.dt