MLDZMNusers1
    Updated 2023-03-31
    with t1 as (select
    distinct SIGNERS[0] as u_zeta
    from solana.core.fact_events
    where SUCCEEDED='TRUE'
    and BLOCK_TIMESTAMP >='2023-01-01'
    and PROGRAM_ID in ('ZETAxsqBRek56DhiGXrn75yj2NHU3aYUnxvHXpkf3aD')
    ),

    t2 as (select
    distinct SIGNERS[0] as u_drift
    from solana.core.fact_events
    where SUCCEEDED='TRUE'
    and BLOCK_TIMESTAMP >= '2023-01-01'
    and PROGRAM_ID in ('dammHkt7jmytvbS3nHTxQNEcP59aE57nxwV21YdqEDNm','dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH')
    )

    select
    case
    when t.signers[0] in (select u_zeta from t1) then 'Zeta'
    when t.signers[0] in (select u_drift from t2) then 'Drift'
    end as users,
    l.LABEL_TYPE as type,
    count(distinct t.signers[0]) as sender,
    count(distinct tx_id) as no_txn
    from solana.core.fact_transactions t join solana.core.dim_labels l on t.instructions[0]:programId = l.address
    where t.block_timestamp>= '2023-01-01'
    and l.label_subtype != 'token_contract'
    and l.LABEL_TYPE in ('defi','nft','dex')
    and l.label != 'solana'
    and t.succeeded = TRUE
    group by 1,2 having users is not null
    Run a query to Download Data