Query editor
WITH summary AS (SELECTtx_hash,block_time,bytearray_to_int256(topic1) AS unicorn_id,bytearray_to_int256(topic2) AS slot,substring(topic3 from 13 for 20) AS item_address,bytearray_to_int256(substring(data from 1 for 32)) AS item_type,CAST(bytearray_to_int256(substring(data from 33 for 32)) AS varchar) AS item_tokenid,bytearray_to_int256(substring(data from 65 for 32)) AS amount,substring(data from 109 for 20) AS equipped_byFROMpolygon.logsWHEREtopic0 = 0xf6a6e74325036866564779718221edd966353f7f2bcb2e240dbbc82a00301d53AND contract_address = 0xdC0479CC5BbA033B3e7De9F178607150B3AbCe1fAND block_time > CAST('2024-02-10' AS timestamp)AND bytearray_to_int256(topic2) = 8),ranked_summary AS (SELECT*,ROW_NUMBER() OVER (PARTITION BY unicorn_id ORDER BY block_time DESC) AS rnFROMsummary)SELECTtx_hash,block_time,unicorn_id,slot,item_address,item_type,substring(item_tokenid from 1 for 9) AS tokenid_1,substring(item_tokenid from 10 for 9) AS tokenid_2,amount,equipped_byFROMranked_summaryWHERErn = 1ORDER BYblock_time DESC;