datavortexdistribution
Updated 2024-12-17
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
WITH platform_totals AS (
SELECT
platform,
COUNT(DISTINCT origin_from_address) AS total_users,
COUNT(DISTINCT tx_hash) AS total_swaps,
SUM(amount_in_usd) AS total_volume_usd
FROM
kaia.defi.ez_dex_swaps
GROUP BY
platform
),
overall_totals AS (
SELECT
SUM(total_users) AS overall_total_users,
SUM(total_swaps) AS overall_total_swaps,
SUM(total_volume_usd) AS overall_total_volume_usd
FROM
platform_totals
),
capybara_totals AS (
SELECT
total_users AS capybara_users,
total_swaps AS capybara_swaps,
total_volume_usd AS capybara_volume_usd
FROM
platform_totals
WHERE
platform = 'capybara'
)
SELECT
t.overall_total_users AS total_users_all_platforms,
c.capybara_users AS total_capybara_users,
ROUND(
c.capybara_users * 100.0 / NULLIF(t.overall_total_users, 0),
2
) AS user_percentage,
QueryRunArchived: QueryRun has been archived