Query editor
-- Query here defines DAU as EOAs that have called the Endpoint contract regardless of function called (till further specification)/*WITH user_interactions AS(SELECT date_trunc('day', block_time) AS "date","from",--tx_hash,--BYTEARRAY_SUBSTRING(input, 1, 4) AS function_sigCOUNT("from") OVER (PARTITION BY "from" ORDER BY date_trunc('day', block_time)) AS interactionsFROM arbitrum.tracesWHERE to = 0xbbEE07B3e8121227AfCFe1E2B82772246226128e -- EndpointAND tx_success = trueAND "type" = 'call'AND cardinality(trace_address) = 0AND block_time >= TIMESTAMP '2023-04-26'GROUP BY 1, 2ORDER BY 1 DESC)SELECT "date",COUNT_IF(user = 'new') AS new,COUNT_IF(user = 'active') AS activeFROM (SELECT *,IF(interactions = 1, 'new', 'active') AS userFROM user_interactions)GROUP BY 1ORDER BY 1 DESC*/-- SELECT block_time,-- "from",-- to,-- hash-- FROM arbitrum.transactions-- WHERE to = 0xbbEE07B3e8121227AfCFe1E2B82772246226128e-- AND success = true-- 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 user_interactions AS(SELECT CASE WHEN '{{Timeframe}}' = 'Daily' THEN date_trunc('day', block_time)WHEN '{{Timeframe}}' = 'Weekly' THEN date_trunc('week', block_time)WHEN '{{Timeframe}}' = 'Monthly' THEN date_trunc('month', block_time)END AS "date", -- date_trunc('day', evt_block_time) AS "date",subaccount,COUNT(subaccount) OVER (PARTITION BY subaccount ORDER BY CASE WHEN '{{Timeframe}}' = 'Daily' THEN date_trunc('day', block_time) WHEN '{{Timeframe}}' = 'Weekly' THEN date_trunc('week', block_time) WHEN '{{Timeframe}}' = 'Monthly' THEN date_trunc('month', block_time) END) AS interactionsFROM (SELECT block_time, topic2 AS subaccount FROM arbitrum.logsWHERE topic0 = 0x224253ad5cda2459ff587f559a41374ab9243acbd2daff8c13f05473db79d14c -- evt_FillOrder (OffchainBook)AND block_time >= TIMESTAMP '2023-04-26'UNION ALLSELECT block_time, topic3 AS subaccount FROM arbitrum.logsWHERE topic0 = 0x7c57459d6f4f0fb2fc5b1e298c8c0eb238422944964aa1e249eaa78747f0cca9 -- evt_FillOrder (OffchainExchange))GROUP BY 1, 2ORDER BY 1 DESC