with t1 as
(
select a.TX_RECEIVER,a.BLOCK_TIMESTAMP
from near.core.fact_transactions as a
inner join near.core.fact_actions_events as b
on a.tx_hash=b.tx_hash
where b.action_name ilike 'DeployContract'
)
select count(*) as contracts_number,
TX_RECEIVER as contracts
from near.core.fact_transactions
where TX_RECEIVER in (select TX_RECEIVER from t1)
group by 2
order by 1 desc
LIMIT 5