Query editor
/*This query identifies the top 15 projects with the highest cumulative deposit amounts*/-- This CTE generates a sequence of dates with a 7-day interval starting from November 2, 2020, up to the current datewithdates AS (withday_seq AS (SELECT(SEQUENCE(CAST('2020-11-02' AS TIMESTAMP),CAST(NOW() AS TIMESTAMP),INTERVAL '7' day)) AS day)SELECTdays.dayFROMday_seqCROSS JOIN unnest (day) AS days (day))-- This CTE retrieves the list of projects from materialized view `dune.lido.result_eth_depositors_labels`,project_list AS (SELECTaddress AS project,name,categoryFROMdune.lido.result_eth_depositors_labels--FROM query_2005642)-- EigenLayer deposits, the CTE puts together EigenPods deposits and WC rotated validators and known EigenLayer Hubs, eigenlayer_deposits as (SELECT name, time, sum(amount) as amountFROM (SELECT name, date_trunc('week', time) AS time, sum(amount) as amountFROM dune.lido.result_deposits_assigned_to_projectsWHERE name1 like '%EigenLayer%' -- put together all EigenLayer (with hubs)GROUP BY 1, 2union allSELECT 'EigenPods' as name, date_trunc('week', time) AS time, -sum(amount)FROM dune.lido.result_deposits_assigned_to_projectsWHERE name1 like '%EigenLayer%' and name != 'EigenPods' --minus EigenPods because it doublecountedGROUP BY 1, 2)GROUP BY 1, 2)-- This CTE combines data from two materialized views to retrieves the weekly amount of net deposit