Query editor
with ev as (select *,case when debt_usd is not null and coll_usd is not null and debt_usd < 1e9 and coll_usd < 2*debt_usd + 1000 then greatest(coll_usd - debt_usd, 0) end bonusfrom dune.fadz2323.result_eth_liq_oct_dec_2026),t as (select h, min(proto) pgrp, min(mkt) mkt, min(t) t, min(txi) txi, min(liquidator) liq, max_by(coll, coalesce(bonus, 0)) coll, max_by(debt, coalesce(bonus, 0)) debt,count(*) n_ev, count(bonus) n_priced, sum(bonus) bonus,max(eth_usd) eth_usd, coalesce(max(gas_used * priority_fee_per_gas), 0) / 1e18 prio_eth, coalesce(max(cb_eth), 0) cb_eth, max(svr_idx) svr_idxfrom ev group by h),tx as (select *, (prio_eth + cb_eth) * eth_usd builder, case when svr_idx is not null and txi - svr_idx = 1 then 1 else 0 end is_svr, cast(date_trunc('day', t) as date) dfrom t where n_ev = n_priced and eth_usd is not null),sym as (select contract_address, max(symbol) symbol from tokens.erc20 where blockchain = 'ethereum' and (contract_address in (select coll from tx) or contract_address in (select debt from tx)) group by 1),days as (select 'DAY' sec, cast(d as varchar) k1, null k2, count(*) n_tx, sum(bonus) bonus, sum(builder) builder, count(distinct liq) winners, sum(bonus) filter (where is_svr = 1) svr_bonusfrom tx group by d having sum(bonus) >= 50000),mo as (select * from (select 'MORPHO_MKT' sec, coalesce(sc.symbol, '?') || '/' || coalesce(sd.symbol, '?') k1, to_hex(substr(tx.mkt, 1, 6)) k2, count(*) n_tx, sum(bonus) bonus, sum(builder) builder, count(distinct liq) winners, sum(bonus) filter (where is_svr = 1) svr_bonusfrom tx left join sym sc on sc.contract_address = tx.coll left join sym sd on sd.contract_address = tx.debtwhere pgrp = 'morpho' group by 2, 3) where bonus > 20000),an as (select * from (select 'AAVE_NONSVR' sec, coalesce(sc.symbol, '?') || '/' || coalesce(sd.symbol, '?') k1, null k2, count(*) n_tx, sum(bonus) bonus, sum(builder) builder, count(distinct liq) winners, null svr_bonusfrom tx left join sym sc on sc.contract_address = tx.coll left join sym sd on sd.contract_address = tx.debtwhere pgrp = 'aave' and is_svr = 0 group by 2) where bonus > 20000),ad as (select 'AAVE_DEBT' sec, coalesce(sd.symbol, '?') k1, cast(is_svr as varchar) k2, count(*) n_tx, sum(bonus) bonus, sum(builder) builder, count(distinct liq) winners, null svr_bonusfrom tx left join sym sd on sd.contract_address = tx.debt where pgrp = 'aave' group by 2, 3),fa as (select 'SVR_FEED_ANSWER' sec, to_hex(contract_address) k1, cast(max_by(bytearray_to_int256(topic1), block_number) as varchar) k2, count(*) n_tx, null bonus, null builder, null winners, null svr_bonusfrom ethereum.logswhere block_date = date '2026-12-01' and topic0 = 0x0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5fand contract_address in (0x320E22C489E4BB634AC1AA5822543014A6FBB292, 0x458138FC0D67027E9A6778EF40A6FFC318C69061, 0x4F3EBF190F8889734424AE71AC0B00E1A8013F3C, 0x64C67984A458513C6BAB23A815916B1B1075CF3A,0x6F3F8D82694D52E6B6171A7B26A88C9554E7999B, 0x7C7FDFCA295A787DED12BB5C1A49A8D2CC20E3F8, 0x95DC7C293AD1706C80BCDE068B609CA61B3FF78C, 0xAD88FC1A810379EF4EFBF2D97EDE57E306178E5A,0xCD07B31D85756098334EDDC92DE755DEAE8FE62F, 0xDC715C751F1CC129A6B47FEDC87D9918A4580502)group by contract_address),svrn as (select 'SVR_UPDATES_TOTAL' sec, to_hex(contract_address) k1, null k2, count(*) n_tx, null bonus, null builder, null winners, null svr_bonusfrom ethereum.logswhere block_date >= date '2026-10-01' and block_date < date '2026-12-04'and topic0 = 0x8d530b9ddc4b318d28fdd4c3a21fcfecece54c1a72a824f262985b99afef009bgroup by contract_address)select * from days union all select * from mo union all select * from an union all select * from ad union all select * from fa union all select * from svrnorder by 1, 5 desc