Query editor
WITH custom_labels AS (SELECT 0x27920e8039d2b6E93e36F5D5f53B998e2e631a70 AS address, 'trading_mm_bot_1' AS namespace UNION ALLSELECT 0x3725bD4D175283108156c3F15f86e1c51266155d AS address, 'trading_mm_bot_2' AS namespace UNION ALLSELECT 0xD0a8fc4e0cE78a20d96fDE2e81dDf8dE4b414419 AS address, 'banana_gun' AS namespace UNION ALLSELECT 0xe91CA2EE0566E76C99321435E9dF5817b9C996aF AS address, 'trading_mm_bot_3' AS namespace UNION ALLSELECT 0x5EF2750b1AA98335c44669022c0d9F01C9a9EEAA AS address, 'trading_mm_bot_4' AS namespace UNION ALLSELECT 0x802b65b5d9016621E66003aeD0b16615093f328b AS address, 'trading_mm_bot_5' AS namespace UNION ALLSELECT 0x1Fba6b0BBae2B74586fBA407Fb45Bd4788B7b130 AS address, 'trading_mm_bot_6' AS namespace),protocol_stats AS (SELECTCOALESCE(cl.namespace, COALESCE(c.namespace, 'unknown_likely_mostly_bots')) AS protocol,COUNT(DISTINCT t.hash) AS total_interactions,COALESCE(SUM(t.gas_used * t.gas_price / 1e18), 0) AS total_gas_spent_ethFROM base.transactions AS tLEFT JOIN base.contracts AS cON t."to" = c.addressLEFT JOIN custom_labels AS clON t."to" = cl.addressWHEREt.success = TRUEAND t."to" IS NOT NULLGROUP BY1),overall_stats AS (SELECTSUM(total_interactions) AS total_interactions,SUM(total_gas_spent_eth) AS total_gas_spent_ethFROM protocol_stats)SELECTps.protocol,ps.total_interactions AS number_of_transactions,FORMAT('%.2f%%', ps.total_interactions * 100.0 / NULLIF(os.total_interactions, 0)) AS tx_share,ROUND(ps.total_gas_spent_eth, 4) AS gas_spent_eth,FORMAT('%.2f%%', ps.total_gas_spent_eth * 100.0 / NULLIF(os.total_gas_spent_eth, 0)) AS gas_shareFROM protocol_stats AS psCROSS JOIN overall_stats AS osORDER BYgas_spent_eth DESCLIMIT 5000;