Query editor
WITH marketplaces AS (SELECTname AS marketplace_name,address AS marketplace_address,subcategoryFROM dune.ton_foundation.dataset_labelsWHERE tags LIKE '%telegram-gifts%'),all_users AS (SELECT DISTINCT prev_owner AS user_address FROM ton.nft_eventsWHERE type = 'sale'AND collection_address IN (SELECT col_address FROM dune.rdmcd.result_gifts_collection_addresses)UNION ALLSELECT DISTINCT owner_address FROM ton.nft_eventsWHERE type = 'sale'AND collection_address IN (SELECT col_address FROM dune.rdmcd.result_gifts_collection_addresses)UNION ALLSELECT DISTINCT source FROM ton.messagesWHERE destination IN (SELECT marketplace_address FROM marketplaces WHERE subcategory = 'offchain_marketplace') and block_date > CAST('2025-01-01' AS TIMESTAMP)UNION ALLSELECT DISTINCT destination FROM ton.messagesWHERE source IN (SELECT marketplace_address FROM marketplaces WHERE subcategory = 'offchain_marketplace') and block_date > CAST('2025-01-01' AS TIMESTAMP)UNION ALLSELECT DISTINCT source FROM ton.messagesWHERE destination = upper('0:ee59aff2efcd2ba6211ead3bf9259b41abcb24a2f5a9d0d3cb1ed2558b7441e3') and block_date > CAST('2025-01-01' AS TIMESTAMP)UNION ALLSELECT DISTINCT destination FROM ton.messagesWHERE source = upper('0:ee59aff2efcd2ba6211ead3bf9259b41abcb24a2f5a9d0d3cb1ed2558b7441e3') and block_date > CAST('2025-01-01' AS TIMESTAMP) -- tonnel withdraw address),total_volume AS (SELECT SUM(total_volume_ton) AS total_volume_ton,SUM(total_volume_usd) AS total_volume_usdFROM query_4833850)SELECT'TOTAL' AS marketplace_name,COUNT(DISTINCT user_address) AS unique_users,(SELECT total_volume_ton FROM total_volume) AS total_volume_ton,(SELECT total_volume_usd FROM total_volume) AS total_volume_usdFROM all_users;