select
case
when project_name ilike '%astroport%' then 'Astroport'
when project_name ilike '%valkyrie%' then 'valkyrie'
else project_name
end as Contract_Name,
count(distinct tx_id) as tx_count,
count(distinct TX_SENDER) as uniqe_wallet
from terra.core.fact_transactions ft join terra.core.dim_address_labels al on ft.tx:body:messages[0]:contract = al.address
where tx_succeeded = 'TRUE'
and block_timestamp <= '2023-01-03'
group by 1
order by 2 desc
limit 10