Query editor
with cm as (select id,from_hex(substr(json_extract_scalar(marketParams, '$.loanToken'), 3)) loan,from_hex(substr(json_extract_scalar(marketParams, '$.collateralToken'), 3)) collfrom morpho_blue_ethereum.morphoblue_evt_createmarket),liq as (select 'aave' proto, contract_address mkt, evt_block_number bn, evt_tx_index txi, evt_index ei, evt_tx_hash h, evt_block_time t, evt_tx_from tx_from, evt_tx_to tx_to, liquidator, collateralAsset coll, debtAsset debt, cast(debtToCover as double) debt_amt, cast(liquidatedCollateralAmount as double) coll_amtfrom aave_v3_ethereum.pool_evt_liquidationcall where evt_block_date >= date '2026-10-01' and evt_block_date < date '2026-12-04'union allselect 'aave', contract_address, evt_block_number, evt_tx_index, evt_index, evt_tx_hash, evt_block_time, evt_tx_from, evt_tx_to, liquidator, collateralAsset, debtAsset, cast(debtToCover as double), cast(liquidatedCollateralAmount as double)from aave_v3_ethereum.lidopool_evt_liquidationcall where evt_block_date >= date '2026-10-01' and evt_block_date < date '2026-12-04'union allselect 'spark', contract_address, evt_block_number, evt_tx_index, evt_index, evt_tx_hash, evt_block_time, evt_tx_from, evt_tx_to, liquidator, collateralAsset, debtAsset, cast(debtToCover as double), cast(liquidatedCollateralAmount as double)from spark_protocol_ethereum.pool_evt_liquidationcall where evt_block_date >= date '2026-10-01' and evt_block_date < date '2026-12-04'union allselect 'morpho', l.id, evt_block_number, evt_tx_index, evt_index, evt_tx_hash, evt_block_time, evt_tx_from, evt_tx_to, caller, cm.coll, cm.loan, cast(repaidAssets as double), cast(seizedAssets as double)from morpho_blue_ethereum.morphoblue_evt_liquidate l join cm on cm.id = l.idwhere evt_block_date >= date '2026-10-01' and evt_block_date < date '2026-12-04'),p as (select contract_address, timestamp ts, price, decimalsfrom prices.hourwhere blockchain = 'ethereum' and timestamp >= timestamp '2026-10-01' and timestamp < timestamp '2026-12-04 01:00'and contract_address in (select coll from liq union select debt from liq union select 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2)),tx as (select hash, index, gas_used, gas_price, priority_fee_per_gas, successfrom ethereum.transactionswhere block_date >= date '2026-10-01' and block_date < date '2026-12-04'and hash in (select h from liq)),blk as (select number, miner, base_fee_per_gas from ethereum.blockswhere date >= date '2026-10-01' and date < date '2026-12-04' and number in (select bn from liq)),cb as (select tr.tx_hash, sum(cast(tr.value as double)) / 1e18 cb_ethfrom ethereum.traces tr join blk on blk.number = tr.block_number and tr.to = blk.minerwhere tr.block_date >= date '2026-10-01' and tr.block_date < date '2026-12-04'and tr.block_number in (select bn from liq)and tr.value > uint256 '0' and tr.success and (tr.call_type is null or tr.call_type = 'call')group by 1),svr as (select block_number, tx_index, contract_address feedfrom ethereum.logswhere block_date >= date '2026-10-01' and block_date < date '2026-12-04'and topic0 = 0x8d530b9ddc4b318d28fdd4c3a21fcfecece54c1a72a824f262985b99afef009b),rf as (select block_number, min(index) rf_idx, sum(cast(value as double)) / 1e18 rf_ethfrom ethereum.transactionswhere block_date >= date '2026-10-01' and block_date < date '2026-12-04'and to = 0x149B41b1e4c00b5F9aA34B14Fd9f84cfD2f014e5group by 1),svrj as (select l.h, l.ei, max(s.tx_index) svr_idx, max_by(s.feed, s.tx_index) svr_feedfrom liq l join svr s on s.block_number = l.bn and s.tx_index < l.txi