Query editor
-- Per-tx fee + MEV breakdown for Euler v2 liquidations on Ethereum.-- gas_fee = gas_used * gas_price-- base_fee = gas_used * block.base_fee_per_gas-- priority = gas_used * (gas_price - block.base_fee_per_gas)-- coinbase = sum of ethereum.traces.value to block.miner inside the tx-- total = gas_fee + coinbaseWITH liq_hashes AS (SELECT DISTINCT from_hex(tx_hash) AS tx_hashFROM dune.pibbles.euler_liquidationsWHERE blockchain = 'ethereum'),tx_with_base AS (SELECTtx.block_time,tx.block_date,tx.block_number,tx.index AS tx_index,tx.hash AS tx_hash,tx.gas_used,tx.gas_price,b.base_fee_per_gas,b.minerFROM ethereum.transactions txJOIN ethereum.blocks bON b.date >= DATE '2024-03-01'AND b.number = tx.block_numberWHERE tx.block_date >= DATE '2024-03-01'AND tx.successAND tx.hash IN (SELECT tx_hash FROM liq_hashes)),coinbase_payments AS (SELECTtr.tx_hash,SUM(CAST(tr.value AS double)) / 1e18 AS coinbase_payment_ethFROM ethereum.traces trJOIN tx_with_base zON z.block_number = tr.block_numberAND z.tx_hash = tr.tx_hashWHERE tr.block_date >= DATE '2024-03-01'AND tr.tx_success AND tr.successAND tr."to" = z.minerAND tr.value > UINT256 '0'GROUP BY 1),eth_price_hr AS (SELECT DATE_TRUNC('hour', minute) AS hr, AVG(price) AS eth_usdFROM prices.usdWHERE blockchain = 'ethereum'AND contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2AND minute >= TIMESTAMP '2024-03-01 00:00'GROUP BY 1)SELECTz.block_time,z.block_date,