From 18b8a90ffcfec9c42b85beba81e42691d865d29e Mon Sep 17 00:00:00 2001 From: Austin <93135983+austinFlipside@users.noreply.github.com> Date: Fri, 5 Sep 2025 08:45:56 -0400 Subject: [PATCH] Stablecoin/updates (#134) --- .../gold/defillama__ez_stablecoin_metrics.sql | 26 +++++++++---------- .../gold/defillama__ez_stablecoin_metrics.yml | 2 +- .../silver__defillama_stablecoin_metrics.yml | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/models/defillama/gold/defillama__ez_stablecoin_metrics.sql b/models/defillama/gold/defillama__ez_stablecoin_metrics.sql index 7381877..6b13ffe 100644 --- a/models/defillama/gold/defillama__ez_stablecoin_metrics.sql +++ b/models/defillama/gold/defillama__ez_stablecoin_metrics.sql @@ -7,18 +7,18 @@ with base as ( select - replace(lower(chain), ' ', '_') as chain, - date_day, - stablecoin_id, - stablecoin, - symbol, - peg_type, - peg_mechanism, - GET_PATH(total_circulating_usd, peg_type)::float as total_circulating_usd, - GET_PATH(total_minted_usd, peg_type)::float as total_minted_usd, - GET_PATH(total_circulating, peg_type)::float as total_circulating, - GET_PATH(total_bridged_to_usd, peg_type)::float as total_bridged_to_usd, - GET_PATH(total_unreleased, peg_type)::float as total_unreleased, + replace(lower(s.chain), ' ', '_') as chain, + s.date_day, + s.stablecoin_id, + sc.stablecoin, + sc.symbol, + sc.peg_type, + sc.peg_mechanism, + GET_PATH(s.total_circulating_usd, sc.peg_type)::float as total_circulating_usd, + GET_PATH(s.total_minted_usd, sc.peg_type)::float as total_minted_usd, + GET_PATH(s.total_circulating, sc.peg_type)::float as total_circulating, + GET_PATH(s.total_bridged_to_usd, sc.peg_type)::float as total_bridged_to_usd, + GET_PATH(s.total_unreleased, sc.peg_type)::float as total_unreleased, run_timestamp from {{ ref('silver__defillama_stablecoin_metrics') }} s @@ -57,7 +57,7 @@ select total_unreleased, {{ dbt_utils.generate_surrogate_key( ['chain','date_day','stablecoin_id'] - ) }} as defillama_ez_stablecoin_metrics_id, + ) }} as ez_stablecoin_metrics_id, sysdate() as inserted_timestamp, sysdate() as modified_timestamp from latest_records \ No newline at end of file diff --git a/models/defillama/gold/defillama__ez_stablecoin_metrics.yml b/models/defillama/gold/defillama__ez_stablecoin_metrics.yml index a599aa2..259802a 100644 --- a/models/defillama/gold/defillama__ez_stablecoin_metrics.yml +++ b/models/defillama/gold/defillama__ez_stablecoin_metrics.yml @@ -109,7 +109,7 @@ models: providing insight into the stablecoin issuer's reserve management strategy. See peg_type for the unit of the total_unreleased. - - name: defillama_ez_stablecoin_metrics_id + - name: ez_stablecoin_metrics_id description: | A unique surrogate key generated from the combination of chain, date_day, and stablecoin_id. This serves as the primary key for the table and ensures uniqueness across the combination of diff --git a/models/defillama/silver/silver__defillama_stablecoin_metrics.yml b/models/defillama/silver/silver__defillama_stablecoin_metrics.yml index 63d8b4b..6389e8e 100644 --- a/models/defillama/silver/silver__defillama_stablecoin_metrics.yml +++ b/models/defillama/silver/silver__defillama_stablecoin_metrics.yml @@ -21,7 +21,7 @@ models: - not_null - dbt_expectations.expect_column_values_to_be_in_type_list: column_type_list: - - TIMESTAMP_NTZ + - DATE - dbt_expectations.expect_row_values_to_have_recent_data: datepart: day interval: 2