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),-- V4 vault creations on Ethereum — same event signature, same topic0.-- Also filtered to the V4.1.2 factory address (verified on-chain), since the-- Ethereum factory is not decoded on Dune and only v4 exists there.v4_ethereum_creations AS (SELECTsubstr(topic2, 13) AS user_address,DATE_TRUNC('day', block_time) AS dayFROM ethereum.logsWHERE contract_address = 0x8fa50dea8db10987d7d22ac092001c3613c18779AND topic0 = 0x974c8040a9cc92c8ee6c077423071c05007f5382617d4b92868938f33d3d197e),-- Combine all versions, tagged with the chain they happened onall_creations AS (SELECT 'base' AS chain, user_address, day FROM v2_creationsUNION ALLSELECT 'base' AS chain, user_address, day FROM v3_creationsUNION ALLSELECT 'base' AS chain, user_address, day FROM v4_base_creationsUNION ALLSELECT 'polygon' AS chain, user_address, day FROM v4_polygon_creationsUNION ALLSELECT 'ethereum' AS chain, user_address, day FROM v4_ethereum_creations),