Query editor
WITH settokenissued AS (SELECTtx_hash, index,(bytearray_substring(topic1, 13, 20)) AS set_token,(bytearray_substring(topic2, 13, 20)) AS issuer,(bytearray_substring(topic3, 13, 20)) AS recipient,bytearray_to_uint256(bytearray_substring(data, 33, 32)) / 1e18 AS quantityFROM arbitrum.logsWHERE topic0 = 0xc07f1e2fe31c4d90eae81f76d263d7995aac043a99d6ee6de9c0506047f541c2AND topic1 = 0x000000000000000000000000c0e8d7a022cffff1ee9d9351fe9bfc917004d9f8),settokenredeemed AS (SELECTtx_hash, index,(bytearray_substring(topic1, 13, 20)) AS set_token,(bytearray_substring(topic2, 13, 20)) AS redeemer,(bytearray_substring(topic3, 13, 20)) AS to_address,bytearray_to_uint256(bytearray_substring(data, 1, 32)) / 1e18 AS quantityFROM arbitrum.logsWHERE topic0 = 0x05f8aaada00823525432114f0e904c6f7c0198a5b8f113ee635ff81aaf9566adAND topic1 = 0x000000000000000000000000c0e8d7a022cffff1ee9d9351fe9bfc917004d9f8),-- transfers AS (-- SELECT-- tx_hash, index,-- (bytearray_substring(topic1, 13, 20)) AS from_address,-- (bytearray_substring(topic2, 13, 20)) AS to_address,-- bytearray_to_uint256(bytearray_substring(data, 1, 32)) / 1e18 AS value-- FROM arbitrum.logs-- WHERE topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef-- AND contract_address = 0xc0e8d7a022cffff1ee9d9351fe9bfc917004d9f8-- ),final_joined AS (SELECTi.tx_hash,i.index,i.set_token,i.recipient AS to_address,i.quantity AS issued_quantity,i.issuer,i.recipient,NULL AS redeemer,NULL AS redeemed_quantity,NULL AS transfer_value,li.block_time,li.block_numberFROM settokenissued iJOIN arbitrum.logs li ON i.tx_hash = li.tx_hash AND i.index = li.indexUNION ALLSELECTr.tx_hash,r.index,r.set_token,r.to_address,NULL AS issuer,