Query editor
/* ===================================================STAGE 3a: SCREENS (flags only, nothing dropped)Save as dune.boc.result_wallet_screens.One row per (wallet, country) from result_linked_wallets, with every inputthe screens use and a flag per screen. Thresholds can be changed laterwith a cheap query on this table, without rescanning raw data.Reads result_weekly_balances (Stage 2a, already built). Scansethereum.transactions (sent transactions) and ethereum.creation_tracesonce, for the linked wallets only.Screens (lifetime versions of the old yearly filters):- flag_institutional: in dune.boc.result_institutional_addresses (thelist used for the draft: labelled CEX addresses; named market makers,OTC desks, funds and custodians; bridges, L2, protocol, vault, router,treasury, issuer and multisig contracts, all by name pattern inlabels.addresses) or the hand list (OpenSea Wyvern registry).- flag_tx: more than 5,000 transactions sent in any 12 consecutivemonths in 2021-2025- flag_size: stablecoin balance ever above $5M and more than 1,000transactions in any 12 consecutive months- flag_contract: deployed contract (creation_traces) with a balance everabove $1M. EIP-7702 delegated EOAs are not deployedcontracts and are not flagged.- passes_screens: none of the four flagsPersistence (reported both ways in the final sample):- holding_weeks: weeks with a balance of $10+ on some day- observed_weeks: weeks from the wallet's first sign of life (first link,first transaction sent, or first holding week; not before 2021) to theend of 2025- passes_persistence: holding_weeks >= min(26, half of observed_weeks)Velocity is screened later, on the transfer panel (Stage 3b).=================================================== */WITH linked AS (SELECT wallet, country, first_link_date, is_direct, is_via_deposit,is_via_payout, n_countries, has_domestic_tier_linkFROM dune.boc.result_linked_wallets),wallets AS (SELECT DISTINCT wallet FROM linked),bal AS (SELECT wallet,MAX(max_usd) AS max_usd,COUNT_IF(max_usd >= 10) AS holding_weeks,MIN(week) AS first_week_heldFROM dune.boc.result_weekly_balancesGROUP BY wallet),institutional AS (SELECT DISTINCT address AS wallet FROM dune.boc.result_institutional_addressesUNIONSELECT 0xa5409ec958c83c3f309868babaca7c86dcb077c1 -- OpenSea Wyvern proxy registry),