with
cex_list as (
select project_name, address_name, address as tx_receiver
from near.core.dim_address_labels
where (
l2_label = 'distributor_cex_satellite' or
l2_label = 'distributor_cex'
)
)
select
date_trunc('day', block_timestamp)::date "Date",
project_name "Project",
iff(address_name is null, project_name, address_name) "Symbol",
count(distinct tx_hash) "Transactions Count",
count(distinct tx_signer) "Users Count"
from near.core.fact_transactions
join cex_list
using (tx_receiver)
where tx_status = 'Success'
group by project_name, address_name, 1
order by "Date", "Transactions Count" desc