Query editor
WITHlabel_contracts AS (SELECTq.*,l.project,l.categoryFROMdune.ether_fi.result_protocol_tokens_holders qLEFT JOINquery_3891942 l -- restaking defi contracts labelledON q.blockchain = l.blockchainAND q.address = l.addressWHERE q.day >= CAST('2024-01-01' AS TIMESTAMP) -- Cast the string to a timestampAND token_symbol = 'weETH'),classifications AS (SELECT1 AS order_num,day,SUM(token_balance) AS balance,'DeFi' AS classFROMlabel_contractsWHERE category IN ('Lending Protocol', 'Yield', 'Farm', 'Restaking', 'Dex', 'CDP', 'Leveraged Farming', 'LRT Stablecoin')GROUP BY 1, 2, 4UNION ALLSELECT2 AS order_num,day,SUM(token_balance) AS balance,'Aave' AS classFROMlabel_contractsWHERE project = 'Aave'GROUP BY 1, 2, 4UNION ALLSELECT3 AS order_num,day,SUM(token_balance) AS balance,'Pendle' AS classFROMlabel_contractsWHERE project = 'Pendle'GROUP BY 1, 2, 4UNION ALLSELECT4 AS order_num,day,SUM(token_balance) AS balance,'Dex' AS classFROM