select count(distinct origin_address) as n_long_purchaser, sum(n_long_opt_bought) as tot_long_contract_bought
from (select origin_address, count(tx_id) as n_long_opt_bought from ethereum.udm_events
where --x_id='0x7cb81dc0fb135d3eefdfac0afdbf397206af74950a6cea6951bd06e1d01eea08' and
event_name='Swap' and contract_address='0x82c427adfdf2d245ec51d8046b41c4ee87f0d29c'
group by 1 order by 2 desc)
order by 1
limit 10000