Query editor
WITH-- Collect average daily prices for ETHprices as (select'nETH' as symbol,DATE_TRUNC('day', p.minute) AS day,AVG(p.price) as pricefromprices.usd pWHEREp.blockchain = 'ethereum'AND p.symbol = 'WETH'group BY1,2),-- Aggregate all TokenMint and TokenMintAndSwap eventsevents_all as (SELECT'M' as event,evt_tx_hash,amount,fee,token,FALSE as swapSuccessFROMsynapse_base.SynapseBridge_evt_TokenMintWHEREevt_block_time >= timestamp '{{start_date}}'UNION ALLSELECT'MS' as event,evt_tx_hash,amount,fee,token,swapSuccessFROMsynapse_base.SynapseBridge_evt_TokenMintAndSwapWHEREevt_block_time >= timestamp '{{start_date}}'),-- Add bridge token symbol for nETH, nUSD-- Figure out how much native asset user received from bridging, excluding gas airdropevents_symbol as (SELECT*,CASEWHEN bytearray_starts_with (token, 0xb554A55358fF0382Fb21F0a478C3546d1106Be8c) then 'nETH'ELSE 'Other'END as symbol,CASEWHEN bytearray_starts_with (token, 0xb554A55358fF0382Fb21F0a478C3546d1106Be8c)AND event = 'MS'AND swapSuccess = TRUE THEN amountELSE 0END as amount_nativeFROMevents_all),