Query editor
withcollection as (SELECT'0x' || lower(to_hex(varbinary_substring(topic1, 13, 20))) AS diamond_address,'0x' || lower(to_hex(varbinary_substring(topic2, 13, 20))) AS owner_address,-- '0x' || lower(to_hex(varbinary_substring(topic3, 13, 20))) AS creator,block_number,block_time,tx_hashFROM arbitrum.logs-- WHERE contract_address = 0x4adbb0432a1924004cbfdcc3baea3b9e64894cf8 #older contractWHERE contract_address = 0x4ec0bd1b372a7bfd099f30ae389f5a8d58ce0acb-- AND topic0 = 0xdac8d7ac7572e04074c3481cf92a231efb2e6a2f1142399e90b5b656f86978c4AND topic0 = 0x2e59d7380a1f9235952a09f122ae824be48dd2be63499cb8a4c431fdc122a871ORDER BY block_number DESC),creator as (SELECTcontract_address as collection,'0x' || lower(substring(cast(data as varchar), 8227, 40)) as creatorFROM arbitrum.logsWHERE lower(cast(contract_address as VARCHAR)) in (SELECT diamond_address from collection)AND topic0 = 0x8faa70878671ccd212d20771b795c50af8fd3ff6cf27f4bde57e5d4de0aeb673AND length(cast(data as varchar)) = 8386 -- there are 2 events with the same topic0 so we need add another clause)SELECTb.creator,a.*,rank() over (ORDER BY block_time ASC) as collection_countFROM collection aLEFT JOIN creator b on diamond_address = CAST(b.collection as VARCHAR)ORDER BY block_time desc