Query editor
WITHSNX_stake AS (SELECTaccount,amount,evt_block_time AS time,evt_tx_hash,'L2' AS layerFROMsynthetix_optimism.SynthetixDebtShare_evt_MintUNIONSELECTaccount,amount,evt_block_time AS time,evt_tx_hash,'L1' AS layerFROMsynthetix_ethereum.SynthetixDebtShare_evt_Mint)SELECT*,SUM(unique_evt) OVER (ORDER BYday NULLS FIRST) AS cumulative_evt,SUM(unique_L1_evt) OVER (ORDER BYday NULLS FIRST) AS cumulative_L1_evt,SUM(unique_L2_evt) OVER (ORDER BYday NULLS FIRST) AS cumulative_L2_evtFROM(SELECTday,SUM(unique_evt) AS unique_evt,SUM(unique_L1_evt) AS unique_L1_evt,SUM(unique_L2_evt) AS unique_L2_evtFROM(SELECTDATE_TRUNC('day', time) AS day,layer,CASEWHEN unique_evt = 1 THEN 1ELSE 0END AS unique_evt,CASEWHEN unique_evt_layer = 1AND layer = 'L1' THEN 1ELSE 0END AS unique_L1_evt,CASEWHEN unique_evt_layer = 1AND layer = 'L2' THEN 1ELSE 0END AS unique_L2_evt