datavortexrough work
    Updated 2024-10-24
    with cextable as (
    select * from near.core.dim_address_labels
    where label_type ilike 'cex'),

    outflows as (
    select distinct project_name,
    tx_receiver as Outflow_User,
    min (block_timestamp) as outflow_date
    from near.core.fact_transfers t1 join cextable t2 on t1.tx_signer = t2.address
    where status ilike 'true'
    group by 1,2)

    select initcap(t3.label_type) as dApps,
    count (Distinct tx_hash) as TX_Count,
    count (distinct t1.tx_signer) as Users_count
    from near.core.fact_transactions t1 join outflows t2 on t1.tx_signer = t2.outflow_user and t1.block_timestamp > t2.outflow_date
    join near.core.dim_address_labels t3 on t1.tx_receiver = t3.address
    where tx_status ilike 'success'
    group by 1
    order by 2 desc
    QueryRunArchived: QueryRun has been archived