Query editor
WITH cash_buyers AS (SELECTl.tx_from AS buyer,min(l.block_time) AS first_cash_buy_time,sum(CAST(varbinary_to_uint256(l.data) AS DOUBLE)/1e6) AS first_week_usdt_spentFROM arbitrum.logs lWHERE l.block_date >= DATE '2025-04-22'AND l.block_date < DATE '2025-04-30'AND l.block_time >= TIMESTAMP '2025-04-22 21:59:34'AND l.block_time < TIMESTAMP '2025-04-29 21:59:34'AND l.contract_address = 0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9AND l.topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efAND l.tx_to = 0xaf7bb1dd1a64a1c391be5c3fa00710c672690828AND varbinary_substring(l.topic1,13,20) = l.tx_fromAND varbinary_substring(l.topic2,13,20) = 0xedf0ef8ea6c13c074babeeaf337775c4fa7ff173GROUP BY 1),first_hop_candidates AS (SELECTb.*,l.block_time AS hop1_time,varbinary_substring(l.topic1,13,20) AS hop1_source,CAST(varbinary_to_uint256(l.data) AS DOUBLE)/1e6 AS hop1_amount,row_number() OVER (PARTITION BY b.buyer ORDER BY l.block_number DESC,l.index DESC) AS rnFROM cash_buyers bLEFT JOIN arbitrum.logs lON l.block_date >= DATE '2025-03-01'AND l.block_date < DATE '2025-04-30'AND l.contract_address = 0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9AND l.topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efAND varbinary_substring(l.topic2,13,20) = b.buyerAND l.block_time < b.first_cash_buy_time),first_hop AS (SELECT * FROM first_hop_candidates WHERE rn=1),second_hop_candidates AS (SELECTh.*,l.block_time AS hop2_time,varbinary_substring(l.topic1,13,20) AS hop2_source,CAST(varbinary_to_uint256(l.data) AS DOUBLE)/1e6 AS hop2_amount,row_number() OVER (PARTITION BY h.buyer ORDER BY l.block_number DESC,l.index DESC) AS rn2FROM first_hop hLEFT JOIN arbitrum.logs lON h.hop1_source IS NOT NULLAND l.block_date >= DATE '2025-03-01'AND l.block_date < DATE '2025-04-30'AND l.contract_address = 0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9AND l.topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efAND varbinary_substring(l.topic2,13,20) = h.hop1_sourceAND l.block_time < h.hop1_time),two_hop AS (SELECT * FROM second_hop_candidates WHERE rn2=1),cex AS (SELECT address,max(cex_name) AS cex_nameFROM cex.addressesWHERE blockchain='arbitrum'