with
main as (
select
tx_hash,
block_timestamp,
from_address as user,
to_address as contract_address,
label as project_name,
label_type,
tx_fee
from
ink.core.fact_transactions
left join
ink.core.dim_labels on address = to_address
where
tx_succeeded
and label_subtype not in ('token_contract')
and label_type != 'token'
)
select
project_name,
count(distinct tx_hash) as transactions,
count(distinct user) as users
from
main
group by 1
order by 2 desc
limit 10