Query editor
-- V2 vault creations (function call)WITH v2_creations AS (SELECTowner AS user_address,DATE_TRUNC('day', call_block_time) AS dayFROM surf_liquid_v2_base.factory_call_deployvaultWHERE call_success = TRUE),-- V3 vault creations (event)v3_creations AS (SELECTowner AS user_address,DATE_TRUNC('day', evt_block_time) AS dayFROM surfliquid_v3_base.factory_v3_evt_vaultdeployed),-- V4 vault creations on Base.-- Event: VaultDeployed(index_topic_1 address company, index_topic_2 address vault, bytes32 salt)-- topic1 = smart-wallet vault contract (used by TVL/volume queries, joins against logs.contract_address)-- topic2 = user EOA who owns the vault — that's what counts as a unique user-- topic0 = 0x974c8040a9cc92c8ee6c077423071c05007f5382617d4b92868938f33d3d197e-- Reading topic2 straight from base.logs (substr to strip the 12-byte bytes32 padding)-- to avoid ambiguity about Dune's decoded column names.v4_base_creations AS (SELECTsubstr(topic2, 13) AS user_address,DATE_TRUNC('day', block_time) AS dayFROM base.logsWHERE topic0 = 0x974c8040a9cc92c8ee6c077423071c05007f5382617d4b92868938f33d3d197e),-- V4 vault creations on Polygon — same event signature, same topic0.v4_polygon_creations AS (SELECTsubstr(topic2, 13) AS user_address,DATE_TRUNC('day', block_time) AS dayFROM polygon.logsWHERE topic0 = 0x974c8040a9cc92c8ee6c077423071c05007f5382617d4b92868938f33d3d197e),-- Combine all versionsall_creations AS (SELECT * FROM v2_creationsUNION ALLSELECT * FROM v3_creationsUNION ALLSELECT * FROM v4_base_creationsUNION ALLSELECT * FROM v4_polygon_creations),-- Deduplicate users - keep their earliest appearanceunique_users AS (SELECT user_address, dayFROM (SELECTuser_address,day,ROW_NUMBER() OVER (PARTITION BY user_address ORDER BY day) AS rnFROM all_creations) tWHERE rn = 1),-- Build full date range