Query editor
WITHbotContracts AS (SELECT address, botVersionFROM query_2683426),protocol_addresses AS (SELECT address, 'Banana Gun' AS protocolFROM botContractsUNION ALLSELECT 0xd17b3c9784510E33cD5B87b490E79253BcD81e2E AS address, 'Integral Relayer 1' AS protocolUNION ALLSELECT 0xEf1c6E67703c7BD7107eed8303Fbe6EC2554BF6B AS address, 'Uniswap Router 3' AS protocol--UNION ALL--SELECT 0x9008D19f58AAbD9eD0D60971565AA8510560ab41 AS address, 'Cowswap' AS protocol--UNION ALL--SELECT 0x1111111254EEB25477B68fb85Ed929f73A960582 AS address, '1inch Router' AS protocol),network_avg AS (SELECT AVG(gas_price / 1e9) as avg_network_gweiFROM ethereum.transactionsWHERE block_time >= CURRENT_DATE - INTERVAL '30' day)SELECTp.protocol,AVG(t.gas_price / 1e9) AS avg_gwei_overall,AVG(t.gas_used) AS avg_gas_overall,COUNT(*) AS total_transactions,AVG(t.gas_price / 1e9) - (SELECT avg_network_gwei FROM network_avg) AS gwei_premium_over_network_avg,AVG(t.gas_price * t.gas_used) / 1e18 AS avg_transaction_cost_ethFROM ethereum.transactions AS tINNER JOIN protocol_addresses AS p ON t."to" = p.addressWHEREt.block_time >= CURRENT_DATE - INTERVAL '30' dayAND success = TRUEGROUP BY p.protocolORDER BY total_transactions DESC;