Query editor
WITH price_eth AS (SELECTdate_trunc('month', minute) AS time,AVG(price) AS eth_priceFROM prices.usdWHERE symbol = 'WETH'GROUP BY 1), arb_fees as (SELECTdate_trunc('month', block_time) as time,SUM(gas_used / 1e18) as l2_gas_used,SUM(gas_used_for_l1 * CAST(effective_gas_price AS DOUBLE) / 1e18) as estimated_l1_gas_used,SUM(gas_used * CAST(effective_gas_price AS DOUBLE) / 1e18) as l2_feesFROM arbitrum.transactionsGROUP BY 1), arb_cost as (with l1_batches as (SELECTevt_tx_hash AS tx_hash,evt_block_time AS block_time,evt_block_number AS block_numberFROM arbitrum_ethereum.SequencerInbox_evt_SequencerBatchDeliveredFromOrigin oUNION ALLSELECTcall_tx_hash AS tx_hash,call_block_time AS block_time,call_block_number AS block_numberFROM arbitrum_ethereum.SequencerInbox_call_addSequencerL2BatchFromOrigin oWHERE call_success = trueAND call_tx_hash NOT IN(SELECT evt_tx_hash FROM arbitrum_ethereum.SequencerInbox_evt_SequencerBatchDeliveredFromOrigin o)UNION ALLSELECTcall_tx_hash AS tx_hash,call_block_time AS block_time,call_block_number AS block_numberFROM arbitrum_ethereum.SequencerInbox_call_addSequencerL2Batch oWHERE call_success = trueAND call_tx_hash NOT IN(SELECT evt_tx_hash FROM arbitrum_ethereum.SequencerInbox_evt_SequencerBatchDeliveredFromOrigin o)UNION ALLSELECTcall_tx_hash AS tx_hash,call_block_time AS block_time,call_block_number AS block_numberFROM arbitrum_ethereum.SequencerInbox_call_addSequencerL2BatchFromOriginWithGasRefunder oWHERE call_success = trueAND call_tx_hash NOT IN(SELECT evt_tx_hash FROM arbitrum_ethereum.SequencerInbox_evt_SequencerBatchDeliveredFromOrigin o))