From 922c26ce0a2156cba5edb2c9c75e2b25702ff63e Mon Sep 17 00:00:00 2001 From: Son Do <34179343+Sunny77D@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:56:48 -0500 Subject: [PATCH] Added Internet Computer Metrics (#684) --- .../internet_computer/core/ez_internet_computer_metrics.sql | 1 + models/staging/drift/fact_drift_amm_revenue.sql | 2 +- .../fact_internet_computer_fundamental_metrics_silver.sql | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/models/projects/internet_computer/core/ez_internet_computer_metrics.sql b/models/projects/internet_computer/core/ez_internet_computer_metrics.sql index 940e1b43..7d5aed6d 100644 --- a/models/projects/internet_computer/core/ez_internet_computer_metrics.sql +++ b/models/projects/internet_computer/core/ez_internet_computer_metrics.sql @@ -18,6 +18,7 @@ with select coalesce(price_data.date, defillama_data.date, icp_metrics.date, icp_total_canister_state.date, icp_neuron_funds.date, icp_blocks.date) as date , total_transactions + , icp_txns , dau , txns , neurons_total -- accounts that are staking ICP diff --git a/models/staging/drift/fact_drift_amm_revenue.sql b/models/staging/drift/fact_drift_amm_revenue.sql index 8f7c4aaa..08b10bf1 100644 --- a/models/staging/drift/fact_drift_amm_revenue.sql +++ b/models/staging/drift/fact_drift_amm_revenue.sql @@ -12,7 +12,7 @@ WITH fact_drift_daily_perp_data AS ( SELECT date , latest_timestamp - , latest_excess_pnl - LAG(latest_excess_pnl) OVER (ORDER BY date) as total_revenue + , latest_excess_pnl - LAG(latest_excess_pnl, 1, null) OVER (ORDER BY date) as total_revenue , latest_excess_pnl FROM fact_drift_daily_perp_data diff --git a/models/staging/internet_computer/fact_internet_computer_fundamental_metrics_silver.sql b/models/staging/internet_computer/fact_internet_computer_fundamental_metrics_silver.sql index f02e80ab..fc72646c 100644 --- a/models/staging/internet_computer/fact_internet_computer_fundamental_metrics_silver.sql +++ b/models/staging/internet_computer/fact_internet_computer_fundamental_metrics_silver.sql @@ -26,6 +26,7 @@ max_extraction as ( ,value:proposals_count::int as total_proposals_count ,value:registered_canisters_count::int as total_registered_canister_count ,value:total_transactions::int as total_transactions + ,value:total_update_transactions_till_date::int + value:total_query_transactions_till_date::int as new_total_transactions -- DQ issues where estimated returns are sometimes >> 1 Trillion , case when @@ -52,7 +53,8 @@ select date , total_transactions , dau - , total_transactions - LAG(total_transactions, 1, null) OVER (ORDER BY date) as txns + , total_transactions - LAG(total_transactions, 1, null) OVER (ORDER BY date) as icp_txns + , new_total_transactions - LAG(NEW_TOTAL_TRANSACTIONS, 1, null) OVER (ORDER BY date) as txns , neurons_total , avg_tps , avg_blocks_per_second