Query editor
WITH deduped_flows AS (SELECT *,ROW_NUMBER() OVER (PARTITION BY deposit_tx_hash, withdrawal_tx_hashORDER BY amount_usd DESC) AS rnFROM bridges_crosschain.flowsWHERE ((withdrawal_chain = 'base' AND withdrawal_block_time >= NOW() - INTERVAL '{{days}}' DAY)OR(deposit_chain = 'base' AND deposit_block_time >= NOW() - INTERVAL '{{days}}' DAY))),whale_transactions AS (SELECTCASEWHEN withdrawal_chain = 'base' THEN withdrawal_block_timeELSE deposit_block_timeENDAS "date",CASEWHEN withdrawal_chain = 'base' THEN 'inflow'ELSE 'outflow'END AS flow_direction,CASEWHEN withdrawal_chain = 'base' THEN deposit_chainELSE withdrawal_chainEND AS counterparty_chain,bridge_name,amount_usd AS amount_bridged,CASEWHEN amount_usd >= 1000000 THEN '>$1M'WHEN amount_usd >= 500000 THEN '>$500K'WHEN amount_usd >= 250000 THEN '>$250K'WHEN amount_usd >= 100000 THEN '>$100K'END AS whale_tier,sender,recipient,CASEWHEN withdrawal_chain = 'base' THEN withdrawal_token_addressELSE deposit_token_addressEND AS token_address,CASEWHEN withdrawal_chain = 'base' THEN withdrawal_tx_hashELSE deposit_tx_hashEND AS txn_hashFROM deduped_flowsWHERE rn = 1AND amount_usd >= 100000),whale_with_tokens AS (SELECTwt."date",wt.token_address,CASEWHEN lower(wt.token_address) = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'THEN 'ETH (Native)'WHEN lower(wt.token_address) = '0x0000000000000000000000000000000000000000'THEN 'ETH (Protocol / Accounting)'ELSE COALESCE(