mhmTop 10 contracts that new users intracted with them
    Updated 2022-04-25
    with not_users as (
    select address from terra.labels
    ), all_users_txs as (
    select tx_id, tx_from[0]::string as sender, block_timestamp
    from terra.transactions
    where sender NOT IN (select * from not_users)
    and block_timestamp <= '2022-03-06'
    order by block_timestamp::date desc
    ), old_users as (
    select DISTINCT(sender) as sender
    from all_users_txs
    where block_timestamp::date <= '2021-12-06'
    ), new_users_txs as (
    select * from all_users_txs
    where sender NOT IN (select * from old_users)
    ), new_users as (
    select DISTINCT(sender) as new_user, block_timestamp
    from new_users_txs
    )

    select DISTINCT(label), count(*)
    from terra.msg_events events left join terra.labels as labels on EVENT_ATTRIBUTES:"0_contract_address"::string = labels.address
    where block_timestamp::date >= '2021-03-06'
    and event_type = 'execute_contract'
    and EVENT_ATTRIBUTES:"0_sender" IN (select new_user from new_users)
    and label IS NOT NULL
    group by 1
    order by 2 desc
    limit 10
    Run a query to Download Data