Query editor
with raw as (select 'ethereum' as blockchain, contract_address, tx_hash, block_time, topic0, topic1, topic2, data from ethereum.logs where block_date >= date '2026-04-01' and topic0 in (0xd1cf3d156d5f8f0d50f6c122ed609cec09d35c9b9fb3fff6ea0959134dae424e,0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb,0xfa56f7b24f17183d81894d3ac2ee654e3c26388d17a28dbd9549b8114304e1f4,0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef) and (topic0 <> 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef or topic1 = 0x0000000000000000000000000000000000000000000000000000000000000000 or topic2 = 0x0000000000000000000000000000000000000000000000000000000000000000)union allselect 'base', contract_address, tx_hash, block_time, topic0, topic1, topic2, data from base.logs where block_date >= date '2026-04-01' and topic0 in (0xd1cf3d156d5f8f0d50f6c122ed609cec09d35c9b9fb3fff6ea0959134dae424e,0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb,0xfa56f7b24f17183d81894d3ac2ee654e3c26388d17a28dbd9549b8114304e1f4,0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef) and (topic0 <> 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef or topic1 = 0x0000000000000000000000000000000000000000000000000000000000000000 or topic2 = 0x0000000000000000000000000000000000000000000000000000000000000000)union allselect 'arbitrum', contract_address, tx_hash, block_time, topic0, topic1, topic2, data from arbitrum.logs where block_date >= date '2026-04-01' and topic0 in (0xd1cf3d156d5f8f0d50f6c122ed609cec09d35c9b9fb3fff6ea0959134dae424e,0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb,0xfa56f7b24f17183d81894d3ac2ee654e3c26388d17a28dbd9549b8114304e1f4,0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef) and (topic0 <> 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef or topic1 = 0x0000000000000000000000000000000000000000000000000000000000000000 or topic2 = 0x0000000000000000000000000000000000000000000000000000000000000000)union allselect 'optimism', contract_address, tx_hash, block_time, topic0, topic1, topic2, data from optimism.logs where block_date >= date '2026-04-01' and topic0 in (0xd1cf3d156d5f8f0d50f6c122ed609cec09d35c9b9fb3fff6ea0959134dae424e,0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb,0xfa56f7b24f17183d81894d3ac2ee654e3c26388d17a28dbd9549b8114304e1f4,0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef) and (topic0 <> 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef or topic1 = 0x0000000000000000000000000000000000000000000000000000000000000000 or topic2 = 0x0000000000000000000000000000000000000000000000000000000000000000)union allselect 'polygon', contract_address, tx_hash, block_time, topic0, topic1, topic2, data from polygon.logs where block_date >= date '2026-04-01' and topic0 in (0xd1cf3d156d5f8f0d50f6c122ed609cec09d35c9b9fb3fff6ea0959134dae424e,0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb,0xfa56f7b24f17183d81894d3ac2ee654e3c26388d17a28dbd9549b8114304e1f4,0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef) and (topic0 <> 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef or topic1 = 0x0000000000000000000000000000000000000000000000000000000000000000 or topic2 = 0x0000000000000000000000000000000000000000000000000000000000000000)union allselect 'scroll', contract_address, tx_hash, block_time, topic0, topic1, topic2, data from scroll.logs where block_date >= date '2026-04-01' and topic0 in (0xd1cf3d156d5f8f0d50f6c122ed609cec09d35c9b9fb3fff6ea0959134dae424e,0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb,0xfa56f7b24f17183d81894d3ac2ee654e3c26388d17a28dbd9549b8114304e1f4,0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef) and (topic0 <> 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef or topic1 = 0x0000000000000000000000000000000000000000000000000000000000000000 or topic2 = 0x0000000000000000000000000000000000000000000000000000000000000000)union allselect 'mantle', contract_address, tx_hash, block_time, topic0, topic1, topic2, data from mantle.logs where block_date >= date '2026-04-01' and topic0 in (0xd1cf3d156d5f8f0d50f6c122ed609cec09d35c9b9fb3fff6ea0959134dae424e,0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb,0xfa56f7b24f17183d81894d3ac2ee654e3c26388d17a28dbd9549b8114304e1f4,0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef) and (topic0 <> 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef or topic1 = 0x0000000000000000000000000000000000000000000000000000000000000000 or topic2 = 0x0000000000000000000000000000000000000000000000000000000000000000)union allselect 'linea', contract_address, tx_hash, block_time, topic0, topic1, topic2, data from linea.logs where block_date >= date '2026-04-01' and topic0 in (0xd1cf3d156d5f8f0d50f6c122ed609cec09d35c9b9fb3fff6ea0959134dae424e,0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb,0xfa56f7b24f17183d81894d3ac2ee654e3c26388d17a28dbd9549b8114304e1f4,0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef) and (topic0 <> 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef or topic1 = 0x0000000000000000000000000000000000000000000000000000000000000000 or topic2 = 0x0000000000000000000000000000000000000000000000000000000000000000)union allselect 'unichain', contract_address, tx_hash, block_time, topic0, topic1, topic2, data from unichain.logs where block_date >= date '2026-04-01' and topic0 in (0xd1cf3d156d5f8f0d50f6c122ed609cec09d35c9b9fb3fff6ea0959134dae424e,0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb,0xfa56f7b24f17183d81894d3ac2ee654e3c26388d17a28dbd9549b8114304e1f4,0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef) and (topic0 <> 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef or topic1 = 0x0000000000000000000000000000000000000000000000000000000000000000 or topic2 = 0x0000000000000000000000000000000000000000000000000000000000000000)),comets as (select distinct blockchain, contract_address as cometfrom raw where topic0 = 0xfa56f7b24f17183d81894d3ac2ee654e3c26388d17a28dbd9549b8114304e1f4),ev as (select r.* from raw r join comets c on r.blockchain = c.blockchain and r.contract_address = c.comet),mints as (select blockchain, contract_address as comet, tx_hash, block_time, varbinary_substring(topic2, 13, 20) as acct, varbinary_to_uint256(data) as amtfrom ev where topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef and topic1 = 0x0000000000000000000000000000000000000000000000000000000000000000),burns as (select blockchain, contract_address as comet, tx_hash, block_time, varbinary_substring(topic1, 13, 20) as acct, varbinary_to_uint256(data) as amtfrom ev where topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef and topic2 = 0x0000000000000000000000000000000000000000000000000000000000000000),supplies as (select distinct blockchain, contract_address as comet, tx_hash, varbinary_substring(topic2, 13, 20) as acctfrom ev where topic0 = 0xd1cf3d156d5f8f0d50f6c122ed609cec09d35c9b9fb3fff6ea0959134dae424e),withdraws as (select distinct blockchain, contract_address as comet, tx_hash, varbinary_substring(topic1, 13, 20) as acctfrom ev where topic0 = 0x9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb),lender as (select m.blockchain, m.comet, m.block_time, 'deposit' as side, m.amtfrom mints m join supplies s on m.blockchain = s.blockchain and m.comet = s.comet and m.tx_hash = s.tx_hash and m.acct = s.acctunion allselect b.blockchain, b.comet, b.block_time, 'withdraw', b.amtfrom burns b join withdraws w on b.blockchain = w.blockchain and b.comet = w.comet and b.tx_hash = w.tx_hash and b.acct = w.acct),-- base token per comet: ERC20 token most often sent out of the comet in Withdraw txsbasemap as (select blockchain, comet, base_token from (select t.blockchain, w.comet, t.contract_address as base_token,row_number() over (partition by t.blockchain, w.comet order by count(*) desc) as rnfrom withdraws wjoin tokens.transfers t on t.blockchain = w.blockchain and t.tx_hash = w.tx_hash and t."from" = w.cometwhere t.block_date >= date '2026-09-01'group by 1, 2, 3) where rn = 1)