This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
generated from duneanalytics/DuneQueryRepo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9de39d3
commit 2127243
Showing
11 changed files
with
213 additions
and
53 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
query_ids: | ||
- 123456 | ||
- 3396975 | ||
- 3393781 | ||
- 3397059 | ||
- 3397041 | ||
- 3396989 | ||
- 3397026 | ||
- 3393722 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- part of a query repo | ||
-- query name: daily_dot_locked | ||
-- query link: https://dune.com/queries/3396989 | ||
|
||
|
||
SELECT | ||
eds."day_timestamp", | ||
eds."net_stake" / 1e10 AS "daily_total", | ||
eds."total_stake" / 1e10 AS "daily_stake", | ||
eds."total_unstake" / 1e10 AS "daily_unstake", | ||
(eds."stake_pool_0" - eds."unstake_pool_0") / 1e10 AS "lcdot_ldot", | ||
(eds."stake_pool_1" - eds."unstake_pool_1") / 1e10 AS "lcdot_tdot", | ||
(eds."stake_pool_2" - eds."unstake_pool_2") / 1e10 AS "dot_ldot", | ||
(eds."stake_pool_3" - eds."unstake_pool_3") / 1e10 AS "dot_tdot", | ||
(eds."stake_pool_4" - eds."unstake_pool_4") / 1e10 AS "dot_starlay", | ||
(eds."stake_pool_5" - eds."unstake_pool_5") / 1e10 AS "ldot_starlay", | ||
SUM(eds."net_stake") OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "dot_tvl" | ||
FROM dune.euphrates.result_euphrates_daily_stake AS eds | ||
ORDER BY eds."day_timestamp" ASC | ||
LIMIT 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-- part of a query repo | ||
-- query name: euphrates_stake | ||
-- query link: https://dune.com/queries/3393722 | ||
|
||
|
||
|
||
SELECT | ||
from_iso8601_timestamp("timestamp") as "timestamp", | ||
"pool_id", | ||
"amount", | ||
"amount" / 1e10 as "dot_amount", | ||
"from", | ||
"from" as "user_addr", | ||
"type", | ||
"tx_hash", | ||
"block_number", | ||
CASE | ||
WHEN "pool_id" = 0 THEN 'lcdot_ldot' | ||
WHEN "pool_id" = 1 THEN 'lcdot_tdot' | ||
WHEN "pool_id" = 2 THEN 'dot_ldot' | ||
WHEN "pool_id" = 3 THEN 'dot_tdot' | ||
WHEN "pool_id" = 4 THEN 'dot_starlay' | ||
WHEN "pool_id" = 5 THEN 'ldot_starlay' | ||
ELSE '???' | ||
END as "pool_name", | ||
CASE | ||
WHEN "type" = 1 THEN 'stake' ELSE 'unstake' | ||
END as "action" | ||
FROM dune.euphrates.dataset_euphrates_txs | ||
ORDER by 1 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- part of a query repo | ||
-- query name: latest_overall_stats | ||
-- query link: https://dune.com/queries/3397059 | ||
|
||
|
||
SELECT | ||
t1.day_timestamp, | ||
t1.TOTAL as total_value_locked, | ||
t2.total as total_dot_locked, | ||
t2."lcdot_ldot", | ||
t2."lcdot_tdot", | ||
t2."dot_ldot", | ||
t2."dot_tdot", | ||
t2."cumulative_dot" + t2."cumulative_lcdot" + t2."cumulative_ldot" as total_dot_volume, | ||
t3.total_tx_count | ||
FROM | ||
query_3396975 t1 -- total value locked | ||
JOIN | ||
query_3393781 t2 -- total dot locked | ||
ON | ||
t1.day_timestamp = t2.day_timestamp | ||
JOIN | ||
query_3397026 t3 -- transaction & users | ||
ON | ||
t1.day_timestamp = t3.day_timestamp | ||
ORDER BY | ||
t1.day_timestamp DESC | ||
LIMIT 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
-- part of a query repo | ||
-- query name: total_dot_locked | ||
-- query link: https://dune.com/queries/3393781 | ||
|
||
|
||
SELECT | ||
dot_tvl."day_timestamp", | ||
dot_tvl."lcdot_ldot", | ||
dot_tvl."lcdot_tdot", | ||
dot_tvl."dot_ldot", | ||
dot_tvl."dot_tdot", | ||
dot_tvl."dot_starlay", | ||
dot_tvl."ldot_starlay", | ||
dot_tvl."total", | ||
dot_tvl."lcdot_ldot" + dot_tvl."lcdot_tdot" AS "lcdot", | ||
dot_tvl."dot_ldot" + dot_tvl."dot_tdot" + dot_tvl."dot_starlay" AS "dot", | ||
dot_tvl."ldot_starlay" AS "ldot", | ||
dot_tvl."lcdot_ldot_volume" + dot_tvl."lcdot_tdot_volume" AS "cumulative_lcdot", | ||
dot_tvl."dot_ldot_volume" + dot_tvl."dot_tdot_volume" + dot_tvl."dot_idot_volume" AS "cumulative_dot", | ||
dot_tvl."ldot_starlay" AS "cumulative_ldot" | ||
from ( | ||
SELECT | ||
eds."day_timestamp", | ||
SUM((eds."stake_pool_0" - eds."unstake_pool_0")) OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "lcdot_ldot", | ||
SUM((eds."stake_pool_1" - eds."unstake_pool_1")) OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "lcdot_tdot", | ||
SUM((eds."stake_pool_2" - eds."unstake_pool_2")) OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "dot_ldot", | ||
SUM((eds."stake_pool_3" - eds."unstake_pool_3")) OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "dot_tdot", | ||
SUM((eds."stake_pool_4" - eds."unstake_pool_4")) OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "dot_starlay", | ||
SUM((eds."stake_pool_5" - eds."unstake_pool_5")) OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "ldot_starlay", | ||
|
||
SUM((eds."stake_pool_0")) OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "lcdot_ldot_volume", | ||
SUM((eds."stake_pool_1")) OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "lcdot_tdot_volume", | ||
SUM((eds."stake_pool_2")) OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "dot_ldot_volume", | ||
SUM((eds."stake_pool_3")) OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "dot_tdot_volume", | ||
SUM((eds."stake_pool_4")) OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "dot_idot_volume", | ||
SUM((eds."stake_pool_5")) OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "ldot_ildot_volume", | ||
SUM(eds."net_stake") OVER (ORDER BY eds."day_timestamp" ASC) / 1e10 AS "total" | ||
FROM dune.euphrates.result_euphrates_daily_stake AS eds | ||
ORDER BY eds."day_timestamp" ASC | ||
) as dot_tvl | ||
LIMIT 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
-- part of a query repo | ||
-- query name: total_value_locked | ||
-- query link: https://dune.com/queries/3396975 | ||
|
||
|
||
SELECT | ||
dot_tvl."day_timestamp", | ||
dot_tvl."lcdot_ldot" * lastPrice."dot" AS lcdot_ldot, | ||
dot_tvl."lcdot_tdot" * lastPrice."dot" AS lcdot_tdot, | ||
dot_tvl."dot_ldot" * lastPrice."dot" AS dot_ldot, | ||
dot_tvl."dot_tdot" * lastPrice."dot" AS dot_tdot, | ||
dot_tvl."dot_starlay" * lastPrice."dot" AS dot_starlay, | ||
dot_tvl."ldot_starlay" * lastPrice."dot" AS ldot_starlay, | ||
|
||
dot_tvl."lcdot" * lastPrice."dot" AS lcdot, | ||
dot_tvl."dot" * lastPrice."dot" AS dot, | ||
dot_tvl."ldot" * lastPrice."dot" AS ldot, | ||
|
||
dot_tvl."total" * lastPrice."dot" AS total | ||
FROM query_3393781 AS dot_tvl | ||
CROSS JOIN ( | ||
SELECT price AS dot | ||
FROM prices.usd | ||
WHERE symbol = 'DOT' | ||
ORDER BY minute DESC | ||
LIMIT 1 | ||
) AS lastPrice | ||
ORDER BY dot_tvl."day_timestamp" ASC | ||
LIMIT 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-- part of a query repo | ||
-- query name: user_total_staked_dot_distribution | ||
-- query link: https://dune.com/queries/3397041 | ||
|
||
|
||
WITH total_staked_distribution AS ( | ||
SELECT | ||
COUNT(*) as total_users, | ||
SUM(CASE WHEN total_staked_dot < 1000 THEN 1 ELSE 0 END) as "<1k", | ||
SUM(CASE WHEN total_staked_dot BETWEEN 1000 AND 10000 THEN 1 ELSE 0 END) as "1k-10k", | ||
SUM(CASE WHEN total_staked_dot > 10000 THEN 1 ELSE 0 END) as ">10k" | ||
FROM query_3397040 -- total_user_staked | ||
) | ||
|
||
-- transpose the above table | ||
SELECT | ||
'<1k' as total_staked_dot, | ||
"<1k" as count, | ||
"<1k" * 100.0 / total_users as percentage | ||
FROM total_staked_distribution | ||
|
||
UNION ALL | ||
|
||
SELECT | ||
'1k-10k' as total_staked_dot, | ||
"1k-10k" as count, | ||
"1k-10k" * 100.0 / total_users as percentage | ||
FROM total_staked_distribution | ||
|
||
UNION ALL | ||
|
||
SELECT | ||
'>10k' as total_staked_dot, | ||
">10k" as count, | ||
">10k" * 100.0 / total_users as percentage | ||
FROM total_staked_distribution; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- part of a query repo | ||
-- query name: users_and_transactions | ||
-- query link: https://dune.com/queries/3397026 | ||
|
||
|
||
SELECT | ||
eds."day_timestamp", | ||
eds."daily_tx_count", | ||
SUM(eds."daily_tx_count") OVER (ORDER BY eds."day_timestamp" ASC) AS "total_tx_count", | ||
eds."daily_users", | ||
SUM(eds."daily_users") OVER (ORDER BY eds."day_timestamp" ASC) AS "cumulative_users" | ||
FROM dune.euphrates.result_euphrates_daily_stake AS eds | ||
ORDER BY eds."day_timestamp" ASC | ||
LIMIT 1000 |