From b09e50a07de3fd3455b993da213f58f51ea6b6fa Mon Sep 17 00:00:00 2001 From: Alex Kan <29241719+akan72@users.noreply.github.com> Date: Mon, 17 Jun 2024 11:49:09 -0400 Subject: [PATCH 1/3] Ez moonwell --- models/data_hubs/fact_daily_app_datahub.sql | 1 - .../core/ez_moonwell_metrics_by_chain.sql | 29 +++++++++++++++++++ .../fact_moonwell_base_borrows_deposits.sql | 2 +- ...ct_moonwell_base_borrows_deposits_gold.sql | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 models/projects/moonwell/core/ez_moonwell_metrics_by_chain.sql diff --git a/models/data_hubs/fact_daily_app_datahub.sql b/models/data_hubs/fact_daily_app_datahub.sql index 8e99b371..fa8403df 100644 --- a/models/data_hubs/fact_daily_app_datahub.sql +++ b/models/data_hubs/fact_daily_app_datahub.sql @@ -30,7 +30,6 @@ with ref("fact_aevo_trading_volume_gold"), ref("fact_sonne_optimism_borrows_deposits_gold"), ref("fact_sonne_base_borrows_deposits_gold"), - ref("fact_moonwell_base_borrows_deposits_gold"), ref("fact_benqi_avalanche_borrows_deposits_gold"), ref("fact_spark_gnosis_borrows_deposits_gold"), ref("fact_quickswap_polygon_gold"), diff --git a/models/projects/moonwell/core/ez_moonwell_metrics_by_chain.sql b/models/projects/moonwell/core/ez_moonwell_metrics_by_chain.sql new file mode 100644 index 00000000..67cf90a0 --- /dev/null +++ b/models/projects/moonwell/core/ez_moonwell_metrics_by_chain.sql @@ -0,0 +1,29 @@ +{{ + config( + materialized="table", + snowflake_warehouse="MOONWELL", + database="moonwell", + schema="core", + alias="ez_metrics_by_chain", + ) +}} + +with + moonwell_by_chain as ( + {{ + dbt_utils.union_relations( + relations=[ + ref("fact_moonwell_base_borrows_deposits_gold"), + ], + ) + }} + ) +select + moonwell_by_chain.date, + 'moonwell' as app, + 'DeFi' as category, + moonwell_by_chain.chain, + moonwell_by_chain.daily_borrows_usd, + moonwell_by_chain.daily_supply_usd +from moonwell_by_chain +where moonwell_by_chain.date < to_date(sysdate()) \ No newline at end of file diff --git a/models/staging/moonwell/fact_moonwell_base_borrows_deposits.sql b/models/staging/moonwell/fact_moonwell_base_borrows_deposits.sql index b79a2ce6..c801149f 100644 --- a/models/staging/moonwell/fact_moonwell_base_borrows_deposits.sql +++ b/models/staging/moonwell/fact_moonwell_base_borrows_deposits.sql @@ -1,4 +1,4 @@ -{{ config(materialized="table") }} +{{ config(materialized="table", snowflake_warehouse="MOONWELL") }} {{ fact_compound_v2_fork_lending( "raw_moonwell_base_borrows_deposits", "base", "moonwell" diff --git a/models/staging/moonwell/fact_moonwell_base_borrows_deposits_gold.sql b/models/staging/moonwell/fact_moonwell_base_borrows_deposits_gold.sql index ae7d1cc8..e39f7215 100644 --- a/models/staging/moonwell/fact_moonwell_base_borrows_deposits_gold.sql +++ b/models/staging/moonwell/fact_moonwell_base_borrows_deposits_gold.sql @@ -1,3 +1,3 @@ -{{ config(materialized="table") }} +{{ config(materialized="table", snowflake_warehouse="MOONWELL") }} select date, chain, app, category, daily_borrows_usd, daily_supply_usd from {{ ref("fact_moonwell_base_borrows_deposits") }} From b55addb90db00381f2f04f96a9337a1950a38b44 Mon Sep 17 00:00:00 2001 From: Alex Kan <29241719+akan72@users.noreply.github.com> Date: Wed, 19 Jun 2024 14:37:57 -0400 Subject: [PATCH 2/3] rm metrics --- models/data_hubs/fact_daily_app_datahub.sql | 4 ---- 1 file changed, 4 deletions(-) diff --git a/models/data_hubs/fact_daily_app_datahub.sql b/models/data_hubs/fact_daily_app_datahub.sql index 84bd0a74..28589f73 100644 --- a/models/data_hubs/fact_daily_app_datahub.sql +++ b/models/data_hubs/fact_daily_app_datahub.sql @@ -83,8 +83,6 @@ with max(unique_traders) as unique_traders, max(fees) as fees, max(bridge_volume) as bridge_volume, - max(daily_borrows_usd) as daily_borrows_usd, - max(daily_supply_usd) as daily_supply_usd, max(tvl) as tvl, max(inflow) as inflow, max(outflow) as outflow, @@ -113,8 +111,6 @@ select app_data_tagged.inflow as inflow, app_data_tagged.outflow as outflow, app_data_tagged.bridge_daa as bridge_daa, - app_data_tagged.daily_borrows_usd as daily_borrows_usd, - app_data_tagged.daily_supply_usd as daily_supply_usd, app_data_tagged.tvl as tvl, coingecko.coingecko_id as coingecko_id, coalesce( From e311d6e86a54c1334a626cdfe466f469720c1031 Mon Sep 17 00:00:00 2001 From: SebMelendez01 <78228475+SebMelendez01@users.noreply.github.com> Date: Wed, 19 Jun 2024 17:41:49 -0400 Subject: [PATCH 3/3] Zksync: adding new contract (#214) --- models/staging/zksync/fact_zksync_revenue.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/models/staging/zksync/fact_zksync_revenue.sql b/models/staging/zksync/fact_zksync_revenue.sql index 223eacb9..90f90fcc 100644 --- a/models/staging/zksync/fact_zksync_revenue.sql +++ b/models/staging/zksync/fact_zksync_revenue.sql @@ -19,8 +19,10 @@ with where lower(to_address) in ( lower('0x3dB52cE065f728011Ac6732222270b3F2360d919'), - lower('0xa0425d71cB1D6fb80E65a5361a04096E0672De03') - ) + lower('0xa0425d71cB1D6fb80E65a5361a04096E0672De03'), + lower('0xa8CB082A5a689E0d594d7da1E2d72A3D63aDc1bD'), + lower('0x32400084C286CF3E17e7B677ea9583e60a000324') + ) and block_timestamp >= dateadd(day, -5, (select min(date) from gas)) group by 1 )