SELECT * FROM (
SELECT
trunc(BLOCK_TIMESTAMP, 'month') as time,
COUNT(DISTINCT TX_HASH) as transactions,
row_number() OVER (PARTITION BY time ORDER BY transactions DESC) as contract_rank,
CONTRACT_ADDRESS
FROM
arbitrum.core.fact_event_logs
GROUP BY
CONTRACT_ADDRESS,
time
ORDER BY
time DESC)
WHERE
contract_rank <= 10