Query editor
--WITH time AS(SELECT dayfromUNNEST (SEQUENCE(TRY_CAST('2023-04-01 00:00' AS TIMESTAMP),CAST(CURRENT_TIMESTAMP AS TIMESTAMP),INTERVAL '1' Day)) as _u (day)),Pool_Binance as(select distinct pool from pancakeswap_v3_bnb.PancakeV3Factory_evt_PoolCreated pLEFT JOIN tokens.erc20 t1 ON p.token0 = t1.contract_address and t1.blockchain = 'bnb'LEFT JOIN tokens.erc20 t2 ON p.token1 = t2.contract_address and t2.blockchain = 'bnb'WHERE ( t1.symbol = 'wBETH' or t2.symbol = 'wBETH')),Pool_Ethereum as(select distinct pool from pancakeswap_v3_ethereum.PancakeV3Factory_evt_PoolCreated pLEFT JOIN tokens.erc20 t1 ON p.token0 = t1.contract_address and t1.blockchain = 'ethereum'LEFT JOIN tokens.erc20 t2 ON p.token1 = t2.contract_address and t2.blockchain = 'ethereum'WHERE ( t1.symbol = 'wBETH' or t2.symbol = 'wBETH')),wbeth_bsc as(SELECTt.day,'BSC' as chain,SUM(wbeth) OVER (ORDER BY t.day) AS wbethFROM(SELECTDATE_TRUNC('day', evt_block_time) AS day,SUM((CASEWHEN contract_address = 0xa2e3356610840701bdf5611a53974510ae27e2e1 THEN CAST(value AS DOUBLE) / 1e18ELSE 0END) *(CASEWHEN "to" in (select pool from Pool_Binance) THEN 1ELSE -1END)) AS wbethFROM(select *from