Query editor
/*This query calculates weekly and cumulative Lido deposits, compares them to the total deposits,and determines the Lido share of the total deposits over the past six months.*/-- A one column CTE: a sequence of dates from '2020-11-02' to the current date, with an interval of 7 dayswithdates 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 project addresses from materialized view 'dune.lido.result_eth_depositors_labels'-- A 2 columns: project_address and project_name-- FIX project -> project_address, name -> project_nameproject_list AS (SELECTaddress AS project,nameFROMdune.lido.result_eth_depositors_labels),-- Set select_project to 'Lido'selected_project AS (SELECT'Lido' AS name),-- We use 2 materialized views to gather following info on all deposits and withdrawals transactions:-- name (label of the address), time and amount (ETH)all_txns AS (SELECTCOALESCE(t.name, 'Unidentified') AS name,t.time,t.amount AS amountFROM(SELECTname,date_trunc('week', time) AS time,amountFROMdune.lido.result_deposits_assigned_to_projectsUNION allSELECT