nitsWormhole Personas
    Updated 2022-01-11
    with transactions_on_wormhole as (select *,SUBSTRING(msg_value:execute_msg:initiate_transfer:asset:info:native_token:denom,0,LEN(msg_value:execute_msg:initiate_transfer:asset:info:native_token:denom)) as denominations ,
    (msg_value:execute_msg:initiate_transfer:asset:amount)/pow(10,6) as amount ,
    msg_value:sender as sender_address ,
    msg_value:execute_msg:initiate_transfer:recipient_chain as chain_number ,
    msg_value:execute_msg:initiate_transfer:asset:info:token:contract_addr as contract_address,
    len(denominations) as length_
    from terra.msgs
    where msg_value:contract = 'terra10nmmwe8r3g99a9newtqa7a75xfgs2e8z87r2sf' and amount> '0' and tx_status = 'SUCCEEDED'),
    prices as (select date(block_timestamp) as day,currency, avg(price_usd) as avg_price from terra.oracle_prices
    group by day, currency ),
    distribution_address as
    (select sender_address , distribution from
    (select *, case when val< 1000 and val>=100 then 'b:100-1k'
    when val<100 then 'a<100'
    when val< 10000 and val>=1000 then 'c:1k-10k'
    when val< 100000 and val>=10000 then 'd:10k-100k'
    when val< 1000000 and val>=100000 then 'e:100k-1M'
    when val< 10000000 and val>=1000000 then 'f:1M-10M'
    when val< 100000000 and val>=10000000 then 'g:10M-100M'
    when val>=100000000 then 'h>100M'
    end as distribution
    from
    (select *, amount* avg_price as val from (select * from transactions_on_wormhole)
    inner join prices
    on currency = denominations and date(block_timestamp) = day ))
    group by sender_address, distribution)
    select distribution,total_Interactions, case when contract_address = 'terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s' then 'ANC Market'
    when contract_address = 'terra1snja2twmwx656qp6juq8jpah4h80pxvwsgsvev' then 'Congrats Contract'
    when contract_address = 'terra1tndcaqxkpc5ce9qee5ggqf430mr2z3pefe5wj6' then 'LUNA-UST'
    when contract_address = 'terra1hzh9vpxhsk8253se0vv5jj6etdvxu3nv8z07zu' then 'aUST'
    when contract_address = 'terra1wfz7h3aqf4cjmjcvc6s8lxdhh7k30nkczyf0mj' then 'MIR Mint'
    when contract_address = 'terra1vs9jr7pxuqwct3j29lez3pfetuu8xmq7tk3lzk' then 'Asset Limit Order'
    when contract_address = 'terra14z56l0fp2lsf86zy3hty2z47ezkhnthtr9yq76' then 'ANC Token'
    when contract_address = 'terra10nmmwe8r3g99a9newtqa7a75xfgs2e8z87r2sf' then 'Wormhole Bridge'
    when contract_address = 'terra1jrhxdtwxrsxw3t2al6t3sga89974juhpccuxct' then 'MultiSig Contract'
    Run a query to Download Data