Query editor
WITH dep_counts AS (SELECT tx_hash, chain, COUNT(*) AS evt_countFROM query_7421848 -- deposits_normalizedGROUP BY 1, 2),wdr_counts AS (SELECT tx_hash, COUNT(*) AS evt_countFROM query_7421953 -- withdrawals_normalizedGROUP BY 1),src_txs AS (SELECT block_time, hash, "from", gas_used, gas_price, value, 'Ethereum' AS chainFROM ethereum.transactionsWHERE hash IN (SELECT tx_hash FROM dep_counts WHERE chain = 'Ethereum')UNION ALLSELECT block_time, hash, "from", gas_used, gas_price, value, 'Base'FROM base.transactionsWHERE hash IN (SELECT tx_hash FROM dep_counts WHERE chain = 'Base')UNION ALLSELECT block_time, hash, "from", gas_used, gas_price, value, 'Arbitrum'FROM arbitrum.transactionsWHERE hash IN (SELECT tx_hash FROM dep_counts WHERE chain = 'Arbitrum')UNION ALLSELECT block_time, hash, "from", gas_used, gas_price, value, 'Rise'FROM rise.transactionsWHERE hash IN (SELECT tx_hash FROM wdr_counts))SELECT'deposit' AS flow,d.chain,d.tx_hash,t.block_time,t."from" AS submitter,d.evt_count,CAST(t.gas_used AS DOUBLE) * CAST(t.gas_price AS DOUBLE) / 1e18 AS tx_gas_native,CAST(t.value AS DOUBLE) / 1e18 AS tx_lz_native_fee,(CAST(t.gas_used AS DOUBLE) * CAST(t.gas_price AS DOUBLE) / 1e18) / d.evt_count AS gas_per_event,(CAST(t.value AS DOUBLE) / 1e18) / d.evt_count AS lz_fee_per_eventFROM dep_counts dJOIN src_txs t ON t.hash = d.tx_hash AND t.chain = d.chainUNION ALLSELECT'withdraw' AS flow,'Rise' AS chain,w.tx_hash,t.block_time,t."from" AS submitter,w.evt_count,CAST(t.gas_used AS DOUBLE) * CAST(t.gas_price AS DOUBLE) / 1e18 AS tx_gas_native,CAST(t.value AS DOUBLE) / 1e18 AS tx_lz_native_fee,(CAST(t.gas_used AS DOUBLE) * CAST(t.gas_price AS DOUBLE) / 1e18) / w.evt_count AS gas_per_event,(CAST(t.value AS DOUBLE) / 1e18) / w.evt_count AS lz_fee_per_eventFROM wdr_counts wJOIN src_txs t ON t.hash = w.tx_hash AND t.chain = 'Rise'ORDER BY block_time DESC