Query editor
/*-- @title: ENS - Holdings over time-- @description: Calculates and tracks the USD holdings value (ENS, USDC, WETH, and ETH) forspecific ENS-related wallets over time.-- @author: Steakhouse Financial-- @notes:- Block 9380471 corresponds to the creation of ETH Registrar controller 3- Current ENS wallets are DAO wallet and ETH Registrar controllers 3 & 4-- @version:- 1.0 - 2023-10-08 - Initial version- 2.0 - 2024-02-18 - Added comment header, added ETH Registrar 4, and added filter by block number- 3.0 - 2026-06-17 - Use direct transfers table for tokens- 4.0 - 2026-09-01 - Optimise the query and use token.transfers*/with wallets as (select 0x283af0b28c62c092c9727f1ee09c02ca627eb7f5 as wallet, 'ETH Registrar 3' as nameunion allselect 0x253553366Da8546fC250F225fe3d25d0C782303b as wallet, 'ETH Registrar 4' as nameunion allselect 0xfe89cc7abb2c4183683ab71653c4cdc9b02d44b7 as wallet, 'DAO Wallet' as name),tokens as (select contract_address, symbol, decimals, power(10, decimals) as divisorfrom tokens.erc20where blockchain = 'ethereum'and contract_address in (0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48, -- USDC0xc18360217d8f7ab5e7c516566761ea12ce7f9d72, -- ENS0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 -- WETH)),tokenflows as (-- ERC-20 tokens: ENS, USDC and WETH-- select evt_block_time as ts, wallet, "dst" as counterparty, contract_address, -cast(wad as double) as qty-- from zeroex_ethereum.weth9_evt_transfer-- inner join tokens using (contract_address)-- inner join wallets on "src" = wallet-- where evt_block_number > 9380471 --2020.01.30-- and contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 -- WETH-- union all-- select evt_block_time as ts, wallet, "src" as counterparty, contract_address, cast(wad as double) as qty-- from zeroex_ethereum.weth9_evt_transfer-- inner join tokens using (contract_address)-- inner join wallets on "dst" = wallet-- where evt_block_number > 9380471 --2020.01.30-- and contract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 -- WETH-- union all-- select evt_block_time as ts, wallet, "to" as counterparty, contract_address, -cast(value as double) as qty-- from circle_ethereum.usdc_evt_transfer-- inner join tokens using (contract_address)-- inner join wallets on "from" = wallet-- where evt_block_number > 9380471 --2020.01.30-- and contract_address = 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 -- USDC-- union all-- select evt_block_time as ts, wallet, "from" as counterparty, contract_address, cast(value as double) as qty-- from circle_ethereum.usdc_evt_transfer-- inner join tokens using (contract_address)-- inner join wallets on "to" = wallet-- where evt_block_number > 9380471 --2020.01.30