Query editor
-- This query is used for reconciling BE transaction hashes with Dune.-- Don't edit this query unless you're specifically editing/fixing scripts in the oev-dashboard repository.WITH filtered_liquidations AS (WITH raw_liquidations AS (SELECT evt_tx_hash, evt_tx_from, evt_block_time FROM moonwell_base.musdcnative_evt_liquidateborrowUNION ALLSELECT evt_tx_hash, evt_tx_from, evt_block_time FROM moonwell_base.maero_evt_liquidateborrowUNION ALLSELECT evt_tx_hash, evt_tx_from, evt_block_time FROM moonwell_base.musdc_evt_liquidateborrowUNION ALLSELECT evt_tx_hash, evt_tx_from, evt_block_time FROM moonwell_base.mweth_evt_liquidateborrowUNION ALLSELECT evt_tx_hash, evt_tx_from, evt_block_time FROM moonwell_base.mcbeth_evt_liquidateborrowUNION ALLSELECT evt_tx_hash, evt_tx_from, evt_block_time FROM moonwell_base.mdai_evt_liquidateborrowUNION ALLSELECT evt_tx_hash, evt_tx_from, evt_block_time FROM moonwell_base.mreth_evt_liquidateborrowUNION ALLSELECT evt_tx_hash, evt_tx_from, evt_block_time FROM moonwell_base.mwsteth_evt_liquidateborrowUNION ALLSELECT evt_tx_hash, evt_tx_from, evt_block_time FROM moonwell_base.mcbbtc_evt_liquidateborrowUNION ALLSELECT evt_tx_hash, evt_tx_from, evt_block_time FROM moonwell_base.merc20delegate_evt_liquidateborrow)SELECTrl.evt_tx_hash AS rl_tx_hash,usd.evt_tx_hash AS usd_tx_hash,pob.evt_tx_hash AS pib_tx_hashFROM raw_liquidations rlFULL OUTER JOIN api3_multichain.api3serverv1_evt_updatedbeaconsetwithbeacons usd ON usd.evt_tx_hash = rl.evt_tx_hashFULL OUTER JOIN api3_multichain.api3serverv1oevextension_evt_paidoevbid pob ON pob.evt_tx_hash = rl.evt_tx_hashWHERE({{all_liquidations}} = true OR(COALESCE(usd.evt_tx_hash, pob.evt_tx_hash) IS NOT NULL))AND rl.evt_block_time > CAST('{{start_date}}' AS timestamp)AND rl.evt_block_time < CAST('{{end_date}}' AS timestamp))SELECTrl_tx_hash AS call_tx_hashFROM filtered_liquidationsGROUP BY rl_tx_hash