Query editor
-- This query defines users as subaccounts that have executed 1 or more trades via their orders being filled. The figures may be slightly-- inflated because if a user places a post-only order someday that wasn't executed on that same day, the user would not have their transaction-- recorded on-chain that day. Instead, it would be recorded once the liquidity is taken on a subsequent day and thus, the user can only-- be counted as a new or active user that day of trade execution. Also at the moment, 1 wallet is limited to 1 subaccount.WITH pearCM_users AS(SELECT DISTINCT "from" FROM arbitrum.transactions WHERE to = 0xcb9d50ec8447c32475c6ce34526091c38c6ec422 AND success = true),user_interactions AS(SELECT date_trunc('day', block_time) AS "date",topic2 AS subaccount,COUNT(topic2) OVER (PARTITION BY topic2 ORDER BY date_trunc('day', block_time)) AS interactionsFROM arbitrum.logsWHERE topic0 = 0x224253ad5cda2459ff587f559a41374ab9243acbd2daff8c13f05473db79d14c -- evt_FillOrder-- retrieve all EOAs that called the fee contract and concat 'pear' in bytes to form their pear subaccount and map it to their Vertex tradesAND topic2 IN (SELECT VARBINARY_CONCAT("from", 0x706561720000000000000000) FROM pearCM_users) -- 0xacf6ade9613a4d9b2801a8a490c4bbba5b9f1ca9 (no trades on vertex despite contract called)GROUP BY 1, 2ORDER BY 1 DESC)SELECT "date",COUNT_IF(user = 'new') AS new,COUNT_IF(user = 'active') AS active,COUNT_IF(user = 'new') + COUNT_IF(user = 'active') AS total,SUM(COUNT_IF(user = 'new')) OVER (ORDER BY "date") AS uniqueFROM (SELECT *,IF(interactions = 1, 'new', 'active') AS userFROM user_interactions)GROUP BY 1ORDER BY 1 DESC