Query editor
with markets as (select *from (values(0x703843c3379b52f9ff486c9f5892218d2a065cc8, 0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca, 'mUSDbC', 'USDC', 1e6),(0x628ff693426583D9a7FB391E54366292F509D457, 0x4200000000000000000000000000000000000006, 'mWETH', 'WETH', 1e18),(0x3bf93770f2d4a794c3d9EBEfBAeBAE2a8f09A5E5, 0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22, 'mcbETH', 'cbETH', 1e18),(0x73b06D8d18De422E269645eaCe15400DE7462417, 0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb, 'mDAI', 'DAI', 1e18),(0xedc817a28e8b93b03976fbd4a3ddbc9f7d176c22, 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913, 'mUSDC', 'USDC', 1e6),(0x627fe393bc6edda28e99ae648fd6ff362514304b, 0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452, 'mwstETH', 'wstETH', 1e18),(0xcb1dacd30638ae38f2b94ea64f066045b7d45f44, 0xB6fe221Fe9EeF5aBa221c348bA20A1Bf5e73624c, 'mrETH', 'rETH', 1e18)) AS t(contract_address, underlying_address, market, underlying, decimals)),liquidation_events as (select * from moonwell_base.mUSDC_evt_LiquidateBorrowunionselect * from moonwell_base.mcbETH_evt_LiquidateBorrowunionselect * from moonwell_base.mWETH_evt_LiquidateBorrowunionselect * from moonwell_base.mDAI_evt_LiquidateBorrowunionselect * from moonwell_base.mUSDCnative_evt_LiquidateBorrowunionselect * from moonwell_base.mwstETH_evt_LiquidateBorrowunionselect * from moonwell_base.mrETH_evt_LiquidateBorrow),price_lookup as (select symbol, price, minutefrom prices.usdwhere blockchain = 'ethereum' -- Base still unsupported for most assetsorder by minute asc)selectle.evt_block_time as date,m.underlying as borrowed_token,cm.underlying as collateral_token,concat('<a href=https://basescan.org/tx/', cast(le.evt_tx_hash as varchar), ' target=blank>', cast(le.evt_tx_hash as varchar), '</a>') as "transaction_hash",concat('<a href=https://basescan.org/address/', cast(le.borrower as varchar), ' target=blank>', cast(le.borrower as varchar), '</a>') as "borrower",concat('<a href=https://basescan.org/address/', cast(le.liquidator as varchar), ' target=blank>', cast(le.liquidator as varchar), '</a>') as "liquidator",le.repayAmount / m.decimals as repay_amount,le.seizeTokens / 1e8 as seized_collateral_amount,max_by(pl.price, pl.symbol) * (le.repayAmount / m.decimals) as liquidation_size_usd,max_by(pl.price, pl.symbol) * (le.repayAmount / m.decimals)* 0.07 as liquidation_incentivefrom liquidation_events leinner join markets mon le.contract_address = m.contract_addressinner join markets cmon le.mTokenCollateral = cm.contract_addressleft join price_lookup plon pl.symbol = m.underlying and pl.minute <= le.evt_block_time and pl.minute >= le.evt_block_time - interval '1' daygroup by 1,2,3,4,5,6,7,8order by evt_block_time desc;