Query editor
WITH-- Collect average daily prices for ETH and GMXprices 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,2UNION allSELECTsymbol,DATE_TRUNC('day', p.minute) AS day,AVG(p.price) as pricefromprices.usd pWHEREp.blockchain = 'arbitrum'AND p.symbol = 'GMX'group BY1,2),-- Aggregate all TokenMint and TokenMintAndSwap eventsevents_all as (SELECT'M' as event,evt_tx_hash,amount,fee,token,FALSE as swapSuccessFROMsynapse_arbitrum.SynapseBridge_evt_TokenMintWHEREevt_block_time >= timestamp '{{start_date}}'UNION ALLSELECT'MS' as event,evt_tx_hash,amount,fee,token,swapSuccessFROMsynapse_arbitrum.SynapseBridge_evt_TokenMintAndSwapWHEREevt_block_time >= timestamp '{{start_date}}'UNION ALLSELECT'W' as event,evt_tx_hash,-- TokenWithdraw event includes the bridge fee into the amount.amount - fee as amount,