Query editor
withparams as (select now() - interval '24' hour as start_time, now() as end_time),quote_assets(asset) as (values (0x0000000000000000000000000000000000000000),(0x4200000000000000000000000000000000000006),(0x833589fcd6edb6e08f4c7c32d4f71b54bda02913),(0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca),(0xfde4c96c8593536e31f229ea8f37b2adac6adbb9),(0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf),(0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b)),denied_factories(factory, label) as (values (0xaec49a050917ddba7a09db04fa27360f44df6db3, 'baesscan denied factory')),trusted_hooks(hook, label) as (-- Public allowlist placeholder. Keep zero hook excluded; add audited/known-good hooks here as baesscan chooses to publish them.values (0x0000000000000000000000000000000000000000, 'zero/no hook')),clean_trades as (selectd.block_time,date_trunc('hour', d.block_time) as hour,d.block_number,d.tx_hash,d.evt_index,coalesce(d.taker, d.tx_from) as wallet,d.project,d.version,d.amount_usd,d.token_bought_address,d.token_sold_address,d.token_bought_symbol,d.token_sold_symbol,casewhen d.token_bought_address not in (select asset from quote_assets) then d.token_bought_addresswhen d.token_sold_address not in (select asset from quote_assets) then d.token_sold_addresselse nullend as primary_token,casewhen d.token_bought_address not in (select asset from quote_assets) then d.token_bought_symbolwhen d.token_sold_address not in (select asset from quote_assets) then d.token_sold_symbolelse nullend as primary_symbol,casewhen d.token_bought_address not in (select asset from quote_assets) and d.token_sold_address in (select asset from quote_assets) then 'buy'when d.token_sold_address not in (select asset from quote_assets) and d.token_bought_address in (select asset from quote_assets) then 'sell'else 'other'end as side,casewhen d.token_bought_address not in (select asset from quote_assets) and d.token_sold_address in (select asset from quote_assets) then d.token_bought_amountwhen d.token_sold_address not in (select asset from quote_assets) and d.token_bought_address in (select asset from quote_assets) then d.token_sold_amountelse nullend as primary_token_amountfrom dex.trades dwhere d.blockchain = 'base'and d.block_time >= (select start_time from params)and d.amount_usd is not nulland d.amount_usd > 0and (d.token_bought_address not in (select asset from quote_assets)or d.token_sold_address not in (select asset from quote_assets))),