Query editor
WITHenrich_balances as (selectrv.*,COALESCE(en.label, 'Others') as protocol,en.category,va.project,va.token_type,va.token_address as replace_address,sv.address as sym_vault_addressfromquery_3910744 rvleft joinquery_3910656 enon rv.address = en.addressleft joinquery_4917479 sv -- symbiotic vaultsON rv.address = sv.addressinner joinquery_3911332 vaon (case when sv.address is null then rv.token_address else rv.address end) = va.addressand (case when sv.address is not null then rv.token_address else 0x end) = (case when sv.address is not null then va.token_address else 0x end))select * from enrich_balanceswhere day = date_trunc('day', now() - interval '4' hour)and project = 'eigenlayer'and token_address = 0xacb55c530acdb2849e6d4f36992cd8c9d50ed8f7and address = 0x051c563c681e8148a03c0dfc81f5575368f918d3-- aggregate_tvl as (-- select-- day,-- project,-- case-- when sym_vault_address is null then token_address-- else address-- end as strategy_address,-- replace_address as token_address,-- token_symbol,-- token_type,-- protocol,-- case-- when project = 'eigenlayer' and category is null and token_type != 'Native Staked ETH' then CONCAT(token_type, ' ', 'Restaking')-- when project = 'eigenlayer' AND category is null and token_type = 'Native Staked ETH' then 'Native Restaking'-- when project = 'eigenlayer' AND category is null and token_type = 'Native Staked ETH' then category-- when project = 'eigenlayer' AND category is null and token_type != 'Native Staked ETH' then CONCAT('Liquid', ' ', token_type, ' Restaking')-- when project in ('symbiotic', 'karak') and category is null then CONCAT('Liquid', ' ', token_type, ' Restaking')-- else CONCAT(token_type, ' ', 'Restaking')-- end as category,-- sum(token_balance) as token_balance-- from-- enrich_balances-- group by 1, 2, 3, 4, 5, 6, 7, 8-- )-- select-- day,