Query editor
with total_cvx as(select date_trunc('day',evt_block_time) as day, sum(cast(value as int256) / 1e18) total_cvxfrom erc20_ethereum.evt_Transfer twhere contract_address = 0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2band t."from" = 0x0000000000000000000000000000000000000000group by 1),total_cvx_staked as(select day, sum(cast(amount as int256)) as cvx_staked from (select date_trunc('day', evt_block_time) as day, sum(amount)/1e18 as amountfrom convex_ethereum.cvxRewardPool_evt_Stakedgroup by 1union allselect date_trunc('day', evt_block_time) as day, -sum(amount)/1e18 as amountfrom convex_ethereum.cvxRewardPool_evt_Withdrawngroup by 1) group by 1),total_cvx_locked as(select day, sum(cast(amount as int256)) as cvx_locked from (select date_trunc('day', evt_block_time) as day, sum("_lockedAmount")/1e18 as amount from convex_ethereum.CvxLockerV2_evt_Staked--where contract_address = '\xd18140b4b819b895a3dba5442f959fa44994af50'group by 1union allselect date_trunc('day', evt_block_time) as day, -sum("_amount")/1e18 as amount from convex_ethereum.CvxLockerV2_evt_Withdrawn--where contract_address = '\xd18140b4b819b895a3dba5442f959fa44994af50'group by 1) group by 1),total_cvx_locked_old as(select day, sum(amount) as cvx_locked_old from (select date_trunc('day', evt_block_time) as day, sum("_lockedAmount")/1e18 as amount from convex_ethereum.CvxLocker_evt_Staked where contract_address = 0xd18140b4b819b895a3dba5442f959fa44994af50and evt_block_time< DATE('2022-03-04' )group by 1union allselect date_trunc('day', evt_block_time) as day, -sum("_amount")/1e18 as amount from convex_ethereum.CvxLocker_evt_Withdrawn where contract_address = 0xd18140b4b819b895a3dba5442f959fa44994af50and evt_block_time< DATE('2022-03-04')group by 1) group by 1 ),days AS (SELECTdate_trunc('day',date_column) AS timeFROM (VALUES(SEQUENCE(CAST('2021-05-17' AS timestamp), CAST(DATE_TRUNC('day', CURRENT_TIMESTAMP) AS timestamp), INTERVAL '1' DAY))) AS t1(date_array)CROSS JOIN UNNEST(date_array) AS t2(date_column))select t1.time, sum(coalesce(t2.total_cvx,0)) over(order by time) as total_cvx, sum(coalesce(t3.cvx_staked,0)) over(order by time) as cvx_staked, sum(coalesce(t4.cvx_locked,0)) over(order by time) as cvx_locked, sum(coalesce(t5.cvx_locked_old,0)) over(order by time) as cvx_locked_oldfrom days as t1left join total_cvx as t2 on t1.time=t2.dayleft join total_cvx_staked as t3 on t1.time=t3.dayleft join total_cvx_locked as t4 on t1.time=t4.dayleft join total_cvx_locked_old as t5 on t1.time=t5.day