Query editor
WITH reg AS (SELECT * FROM query_8051039WHERE blockchain = 'robinhood'),complete_day AS (SELECT LEAST((SELECT MAX(CAST(day AS date)) FROM dune.adam_tehc.dataset_relay_rh_daily WHERE referrer = 'fomo' AND req_class = 'rh_swap'),(SELECT MAX(CAST(day AS date)) FROM dune.adam_tehc.dataset_relay_rh_daily WHERE referrer = 'pumpfun' AND req_class = 'rh_swap'),(SELECT MAX(CAST(day AS date)) FROM dune.adam_tehc.dataset_maestro_daily WHERE blockchain = 'robinhood'),(SELECT MAX(CAST(day AS date)) FROM dune.adam_tehc.dataset_gmgn_daily WHERE blockchain = 'robinhood'),(SELECT MAX(CAST(day AS date)) FROM dune.adam_tehc.dataset_basedbot_daily WHERE blockchain = 'robinhood'),(SELECT MAX(CAST(day AS date)) FROM dune.adam_tehc.dataset_axiom_daily WHERE blockchain = 'robinhood')) AS max_day),deployer_family AS (SELECT r.platform, ct.address AS routerFROM robinhood.creation_traces ctJOIN reg r ON r.anchor_type = 'deployer' AND ct."from" = r.anchor_addressLEFT JOIN reg x ON x.anchor_type = 'deployer_exclude' AND x.platform = r.platform AND x.anchor_address = ct.addressWHERE x.anchor_address IS NULL),bot_txs AS (SELECT t.hash AS tx_hash, f.platform, CAST(NULL AS varbinary) AS walletFROM robinhood.transactions tJOIN deployer_family f ON f.router = t."to"WHERE t.block_date >= CURRENT_DATE - INTERVAL '100' DAYAND t.block_date < CURRENT_DATEUNION ALLSELECT t.hash, r.platform, CAST(NULL AS varbinary)FROM robinhood.transactions tJOIN reg r ON r.anchor_type = 'router' AND t."to" = r.anchor_addressWHERE t.block_date >= CURRENT_DATE - INTERVAL '100' DAYAND t.block_date < CURRENT_DATEUNION ALLSELECT tr.tx_hash, r.platform, CAST(NULL AS varbinary)FROM robinhood.traces trJOIN reg r ON r.anchor_type = 'fee_trace' AND tr."to" = r.anchor_addressWHERE tr.block_date >= CURRENT_DATE - INTERVAL '100' DAYAND tr.block_date < CURRENT_DATEAND tr.value > 0AND tr.successUNION ALLSELECT tr.tx_hash, f.platform, tr."to"FROM robinhood.traces trJOIN (SELECT r.platform, ct.addressFROM robinhood.creation_traces ctJOIN reg r ON r.anchor_type = 'account_factory' AND ct."from" = r.anchor_address) f ON tr."to" = f.addressWHERE tr.block_date >= CURRENT_DATE - INTERVAL '100' DAYAND tr.block_date < CURRENT_DATEAND tr.successUNION ALLSELECT tr.tx_hash, r.platform, CAST(NULL AS varbinary)FROM robinhood.traces trJOIN reg r ON r.anchor_type = 'fee_recipient' AND tr."to" = r.anchor_addressWHERE tr.block_date >= CURRENT_DATE - INTERVAL '100' DAYAND tr.block_date < CURRENT_DATEAND tr.value > 0AND tr.success