Query editor
-- sfrxUSD (Ethereum) — Top Holders with Trailing Deltas-- The 200 rows are selected by PEAK balance (so holders who have fully EXITED still appear — for a-- drawdown, the whales who left matter as much as those who stayed), but the default display is-- sorted by CURRENT balance. Exited holders sort to the bottom; re-sort on `peak` for the exit board.-- status = 'exited' / 'reduced' / 'holding' vs. that address's own peak-- pct_of_peak = how much of its peak the address still holds-- Balances are in sfrxUSD SHARES (non-rebasing). Multiply by price_per_share for frxUSD value.-- `label`/`category` come from a curated known-address list (see known_labels CTE); unknown-- addresses fall back to contract/EOA. Keep the list in sync with labeling/registry.py.-- Chart type: tableWITH transfers AS (SELECTblock_time,bytearray_substring(topic1, 13, 20) AS from_addr,bytearray_substring(topic2, 13, 20) AS to_addr,CAST(bytearray_to_uint256(data) AS DOUBLE) / 1e18 AS amountFROM ethereum.logsWHERE contract_address = 0xcf62F905562626CfcDD2261162a51fd02Fc9c5b6AND topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef),-- Signed ledger: one row per (address, time) balance changeledger AS (SELECT to_addr AS address, block_time, amount AS delta FROM transfers WHERE to_addr != 0x0000000000000000000000000000000000000000UNION ALLSELECT from_addr AS address, block_time, -amount AS delta FROM transfers WHERE from_addr != 0x0000000000000000000000000000000000000000),balances AS (SELECTaddress,SUM(delta) AS balance_now,SUM(CASE WHEN block_time < NOW() - INTERVAL '7' DAY THEN delta ELSE 0 END) AS balance_7d_ago,SUM(CASE WHEN block_time < NOW() - INTERVAL '30' DAY THEN delta ELSE 0 END) AS balance_30d_ago,SUM(CASE WHEN block_time < NOW() - INTERVAL '60' DAY THEN delta ELSE 0 END) AS balance_60d_ago,SUM(CASE WHEN block_time < NOW() - INTERVAL '90' DAY THEN delta ELSE 0 END) AS balance_90d_ago,MIN(block_time) AS first_seen,MAX(block_time) AS last_activity,COUNT(*) AS transfer_countFROM ledgerGROUP BY address-- NOTE: no HAVING filter on current balance — an exited holder nets to ~0 and must be kept.-- Dust is dropped later via the peak_balance threshold instead.),-- Peak balance ever held, from the running per-address balance. This is what surfaces exited whales.peak AS (SELECT address, MAX(running_bal) AS peak_balanceFROM (SELECT address,SUM(delta) OVER (PARTITION BY address ORDER BY block_timeROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS running_balFROM ledger) rGROUP BY address),-- Curated labels — hardcoded because labels.all isn't usable here. Keep this list in sync with-- labeling/registry.py (same source of truth). Add rows as new addresses are positively identified.