select
inner_instruction:instructions[1]:parsed:info:source as source,
case
when source = '8vyTqVVPmJfqFexRcMBGDAHoSCyZ52RC5sRVhYzbfU4j' then 'SOL'
when source = '7zJVLbx3DjjwkoD6eUGk4cgoBv2JR3RW67c3ff8URXYh' then 'mSOL'
when source = '9baN3ENgbvDau1Myu5H4Gd5CiujWS6c6WuSu87YWahb7' then 'LUNA'
when source = '377U1dX3mRd96BeoRkpmsJC67wnVDqTpi1u6dALkR9V5' then 'soETH'
when source = '2CD9R7K7AjAswjTJDmdf9HyUZQztfck1B22h9WUJeTeh' then 'BTC'
else 'Others' end as category,
count(*) as frequency
from solana.fact_events
where program_id = '1349iiGjWC7ZTbu6otFmJwztms122jEEnShKgpVnNewy'
--and inner_instruction:instructions[1]:parsed:info:authority = '7wM6TyhDZMJSYojLbZWPcmkMu11xErKu6oeGJoHqtUgV'
and source is not null
group by source, category
order by frequency desc