KARTODTotal UST transactions volume in USD in 2022 across the terra bridge
    Updated 2022-04-16
    with
    sent_across_the_bridge as (
    select
    date(block_timestamp) as block_date,
    'Sent to Ethereum' as transaction_type,
    msg_value:amount[0]:denom as original_denom,
    substring(msg_value:amount[0]:denom, 2, 6) as dervied_denom,
    concat(dervied_denom, ' sent to Ethereum') as derived_transaction_type,
    sum(msg_value:amount[0]:amount / POW(10, 6)) as derived_value_usd,
    count(DISTINCT TX_ID) as transactions
    from terra.msgs m
    where msg_value:to_address::string = 'terra13yxhrk08qvdf5zdc9ss5mwsg5sf7zva9xrgwgc'
    and block_date >= date('2022-01-01')
    and tx_status = 'SUCCEEDED'
    and original_denom in ('uusd')
    group by 1, 2, 3, 4, 5
    ),
    received_from_bridge as (
    select
    date(block_timestamp) as block_date,
    'Received from Ethereum' as transaction_type,
    msg_value:amount[0]:denom as original_denom,
    substring(msg_value:amount[0]:denom, 2, 6) as dervied_denom,
    concat(dervied_denom, ' received from Ethereum') as derived_transaction_type,
    sum(msg_value:amount[0]:amount / POW(10, 6)) as derived_valued_usd,
    count(DISTINCT TX_ID) as transactions
    from terra.msgs m
    where msg_value:from_address::string = 'terra13yxhrk08qvdf5zdc9ss5mwsg5sf7zva9xrgwgc'
    and block_date >= date('2022-01-01')
    and tx_status = 'SUCCEEDED'
    and original_denom in ('uusd')
    group by 1, 2, 3, 4, 5
    ),
    joined_bridge_transactions as (
    select
    *
    Run a query to Download Data