Query editor
with p as (selectblock_number,index,bytearray_to_uint256(data) / 1e18 as price,null as trovefrom ethereum.logswherecontract_address = 0x4c517d4e2c851ca76d7ec94b805269df0f2201de andtopic0 = 0x4d29de21de555af78a62fc82dd4bc05e9ae5b0660a37f04729527e0f22780cd3),l as (selectevt_block_number as block_number,evt_index as index,null as price,_borrower as trovefrom liquity_ethereum.TroveManager_evt_TroveLiquidated),uuu as (select * from punion allselect * from l),uu as (select *, COUNT(price) over (order by block_number, index) as priceUpdatefrom uuu),u as (select block_number, index, trove, MIN(price) over (partition by priceUpdate) as pricefrom uu),lp as (select block_number, index, trove, pricefrom uwhere trove is not null),ttt as (selectevt_block_number as block_number,evt_index as index,_borrower as trove,_coll as collateral,_debt as debt,null as pricefrom liquity_ethereum.BorrowerOperations_evt_TroveUpdated