Query editor
/*This query identifys the top 10 projects with the highest net inflow of ETH deposits over a specified period of time*/-- This CTE generate a list of project labeled by liquidity from materialized view 'dune.lido.result_eth_depositors_labels'withaddresses_list AS (SELECTaddress,nameFROMdune.lido.result_eth_depositors_labels),-- This CTE aggregates the total amount of ETH deposited by each project from the materilized view--`dune.lido.result_deposits_assigned_to_projects' over the specified number of daysdeposits_projects AS (SELECT name, sum(amount) as amountFROM (SELECT--case when trim(name1) = '' then COALESCE(name, 'Unidentified') else name ||'('||name1||')' end as name,COALESCE(if(name = 'Lido v3', 'Lido', name), 'Unidentified') AS name,SUM(amount) AS amountFROMdune.lido.result_deposits_assigned_to_projectsWHEREdate_trunc('day', time) >= NOW() - interval '{{number_of_days}}' dayGROUP BY 1)GROUP BY 1),-- This CTE selects the project and the amount of ETH withdrawn from the materilized view--`dune.lido.result_withdrawals_transactions_assigned_to_projects` over the specified number of daysallwithdrawals AS (SELECTproject,--case when trim(project1) = '' then project else project||'('||project1||')' end as project,withdrawn_principal AS amountFROMdune.lido.result_withdrawals_transactions_assigned_to_projectsWHEREdate_trunc('day', time) >= NOW() - interval '{{number_of_days}}' dayAND withdrawn_principal > 0),-- This CTE aggregates the total amount of ETH withdrawn by each project from CTE 'allwithdrawals'withdrawals_projects AS (SELECTif(project = 'Lido v3', 'Lido', project) AS name,SUM(amount) AS amountFROMallwithdrawalsGROUP BY1