Query editor
WITH-- Aggregate all TokenMint and TokenMintAndSwap eventsevents_all AS (SELECT'M' AS event,evt_tx_hash,amount,fee,tokenFROMsynapse_bnb.SynapseBridge_evt_TokenMintUNION ALLSELECT'MS' AS event,evt_tx_hash,amount,fee,tokenFROMsynapse_bnb.SynapseBridge_evt_TokenMintAndSwap),-- Add bridge token symbol for nUSDevents_symbol AS (SELECT*,CASEWHEN bytearray_starts_with (token, 0x23b891e5c62e0955ae2bd185990103928ab817b3) THEN 'nUSD'ELSE 'Other'END AS symbol,-- Adjust this if tracking of BNB token bridging is required0 AS amount_nativeFROMevents_all),events_filtered AS (SELECT*FROMevents_symbolWHEREsymbol <> 'Other'),-- Collect all executor transactionsexecutor_txs AS (SELECTblock_time,hash,gas_price,gas_used,to AS bridgeFROMbnb.transactionsWHERE"from" = 0x230A1AC45690B9Ae1176389434610B9526d2f21b),-- Left join with call traces from bridge - these are the all native transfers from the Bridge to the user:-- 1. If user ended up with the native asset, its amount will be included-- 2. If there was a gas airdrop, its amount will be includedtxs_with_traces AS (SELECT