with tinyman as (
select swapper , count(tx_group_id) as transactions ,
min(block_timestamp) as first_time
from algorand.swaps
where swap_program = 'tinyman'
group by 1
),
algofi as (
select swapper ,
min(block_timestamp) as first_time
from algorand.swaps
where swap_program = 'pactfi'
group by 1
)
select
case when o.first_time > t.first_time then 'used tinyman'
else 'not used tinyman'
end as type ,
count (DISTINCT o.swapper ) as users
from algofi o join tinyman t
on o.swapper = t.swapper
group by 1