From 6d40ca9a593a8e71ce5ee4b5e825c3c170b8ccaa Mon Sep 17 00:00:00 2001 From: Mike Stepanovic Date: Wed, 10 Sep 2025 10:24:26 -0600 Subject: [PATCH] Revert "added new models from midgard upgrade" This reverts commit 2cf24ab1f23345de0cb5f788b58ed4fc2ca15f99. --- models/bronze/bronze__instantiate_events.sql | 25 -------- models/bronze/bronze__tcy_claim_events.sql | 22 ------- .../bronze__tcy_distribution_events.sql | 19 ------ models/bronze/bronze__tcy_stake_events.sql | 20 ------ models/bronze/bronze__tcy_unstake_events.sql | 20 ------ models/descriptions/__overview__.md | 6 -- .../core/core__fact_instantiate_events.sql | 64 ------------------- .../core/core__fact_instantiate_events.yml | 55 ---------------- .../gold/defi/defi__fact_tcy_claim_events.sql | 60 ----------------- .../gold/defi/defi__fact_tcy_claim_events.yml | 57 ----------------- .../defi__fact_tcy_distribution_events.sql | 52 --------------- .../defi__fact_tcy_distribution_events.yml | 43 ------------- .../gold/defi/defi__fact_tcy_stake_events.sql | 56 ---------------- .../gold/defi/defi__fact_tcy_stake_events.yml | 49 -------------- .../defi/defi__fact_tcy_unstake_events.sql | 56 ---------------- .../defi/defi__fact_tcy_unstake_events.yml | 49 -------------- models/silver/silver__instantiate_events.sql | 26 -------- models/silver/silver__instantiate_events.yml | 31 --------- models/silver/silver__tcy_claim_events.sql | 23 ------- models/silver/silver__tcy_claim_events.yml | 35 ---------- .../silver__tcy_distribution_events.sql | 20 ------ .../silver__tcy_distribution_events.yml | 25 -------- models/silver/silver__tcy_stake_events.sql | 21 ------ models/silver/silver__tcy_stake_events.yml | 29 --------- models/silver/silver__tcy_unstake_events.sql | 21 ------ models/silver/silver__tcy_unstake_events.yml | 29 --------- models/sources.yml | 5 -- 27 files changed, 918 deletions(-) delete mode 100644 models/bronze/bronze__instantiate_events.sql delete mode 100644 models/bronze/bronze__tcy_claim_events.sql delete mode 100644 models/bronze/bronze__tcy_distribution_events.sql delete mode 100644 models/bronze/bronze__tcy_stake_events.sql delete mode 100644 models/bronze/bronze__tcy_unstake_events.sql delete mode 100644 models/gold/core/core__fact_instantiate_events.sql delete mode 100644 models/gold/core/core__fact_instantiate_events.yml delete mode 100644 models/gold/defi/defi__fact_tcy_claim_events.sql delete mode 100644 models/gold/defi/defi__fact_tcy_claim_events.yml delete mode 100644 models/gold/defi/defi__fact_tcy_distribution_events.sql delete mode 100644 models/gold/defi/defi__fact_tcy_distribution_events.yml delete mode 100644 models/gold/defi/defi__fact_tcy_stake_events.sql delete mode 100644 models/gold/defi/defi__fact_tcy_stake_events.yml delete mode 100644 models/gold/defi/defi__fact_tcy_unstake_events.sql delete mode 100644 models/gold/defi/defi__fact_tcy_unstake_events.yml delete mode 100644 models/silver/silver__instantiate_events.sql delete mode 100644 models/silver/silver__instantiate_events.yml delete mode 100644 models/silver/silver__tcy_claim_events.sql delete mode 100644 models/silver/silver__tcy_claim_events.yml delete mode 100644 models/silver/silver__tcy_distribution_events.sql delete mode 100644 models/silver/silver__tcy_distribution_events.yml delete mode 100644 models/silver/silver__tcy_stake_events.sql delete mode 100644 models/silver/silver__tcy_stake_events.yml delete mode 100644 models/silver/silver__tcy_unstake_events.sql delete mode 100644 models/silver/silver__tcy_unstake_events.yml diff --git a/models/bronze/bronze__instantiate_events.sql b/models/bronze/bronze__instantiate_events.sql deleted file mode 100644 index 7693653..0000000 --- a/models/bronze/bronze__instantiate_events.sql +++ /dev/null @@ -1,25 +0,0 @@ -{{ config( - materialized = 'view' -) }} - -SELECT - tx_id, - contract_address, - admin_address, - code_id, - sender, - label, - msg, - funds, - event_id, - block_timestamp, - __HEVO__DATABASE_NAME, - __HEVO__SCHEMA_NAME, - __HEVO__INGESTED_AT, - __HEVO__LOADED_AT -FROM - {{ source( - 'thorchain_midgard', - 'midgard_instantiate_events' - ) }} - diff --git a/models/bronze/bronze__tcy_claim_events.sql b/models/bronze/bronze__tcy_claim_events.sql deleted file mode 100644 index d36b620..0000000 --- a/models/bronze/bronze__tcy_claim_events.sql +++ /dev/null @@ -1,22 +0,0 @@ -{{ config( - materialized = 'view' -) }} - -SELECT - tx_id, - rune_address, - l1_address, - asset, - tcy_amt, - memo, - event_id, - block_timestamp, - __HEVO__DATABASE_NAME, - __HEVO__SCHEMA_NAME, - __HEVO__INGESTED_AT, - __HEVO__LOADED_AT -FROM - {{ source( - 'thorchain_midgard', - 'midgard_tcy_claim_events' - ) }} diff --git a/models/bronze/bronze__tcy_distribution_events.sql b/models/bronze/bronze__tcy_distribution_events.sql deleted file mode 100644 index 1203e70..0000000 --- a/models/bronze/bronze__tcy_distribution_events.sql +++ /dev/null @@ -1,19 +0,0 @@ -{{ config( - materialized = 'view' -) }} - -SELECT - rune_address, - rune_amt, - event_id, - block_timestamp, - __HEVO__DATABASE_NAME, - __HEVO__SCHEMA_NAME, - __HEVO__INGESTED_AT, - __HEVO__LOADED_AT -FROM - {{ source( - 'thorchain_midgard', - 'midgard_tcy_distribution_events' - ) }} - diff --git a/models/bronze/bronze__tcy_stake_events.sql b/models/bronze/bronze__tcy_stake_events.sql deleted file mode 100644 index 2be27e9..0000000 --- a/models/bronze/bronze__tcy_stake_events.sql +++ /dev/null @@ -1,20 +0,0 @@ -{{ config( - materialized = 'view' -) }} - -SELECT - tx_id, - amount, - rune_address, - memo, - event_id, - block_timestamp, - __HEVO__DATABASE_NAME, - __HEVO__SCHEMA_NAME, - __HEVO__INGESTED_AT, - __HEVO__LOADED_AT -FROM - {{ source( - 'thorchain_midgard', - 'midgard_tcy_stake_events' - ) }} diff --git a/models/bronze/bronze__tcy_unstake_events.sql b/models/bronze/bronze__tcy_unstake_events.sql deleted file mode 100644 index 0bc40dd..0000000 --- a/models/bronze/bronze__tcy_unstake_events.sql +++ /dev/null @@ -1,20 +0,0 @@ -{{ config( - materialized = 'view' -) }} - -SELECT - tx_id, - amount, - rune_address, - memo, - event_id, - block_timestamp, - __HEVO__DATABASE_NAME, - __HEVO__SCHEMA_NAME, - __HEVO__INGESTED_AT, - __HEVO__LOADED_AT -FROM - {{ source( - 'thorchain_midgard', - 'midgard_tcy_unstake_events' - ) }} diff --git a/models/descriptions/__overview__.md b/models/descriptions/__overview__.md index 5af0c60..c8d846e 100644 --- a/models/descriptions/__overview__.md +++ b/models/descriptions/__overview__.md @@ -24,7 +24,6 @@ There is more information on how to use dbt docs in the last section of this doc - [core.dim_block](#!/model/model.thorchain_models.core__dim_block) - [core.dim_labels](#!/model/model.thorchain_models.core__dim_labels) - [core.dim_midgard](#!/model/model.thorchain_models.core__dim_midgard) -- [core.fact_instantiate_events](#!/model/model.thorchain_models.core__fact_instantiate_events) - [core.fact_network_version_events](#!/model/model.thorchain_models.core__fact_network_version_events) - [core.fact_set_mimir_events](#!/model/model.thorchain_models.core__fact_set_mimir_events) - [core.fact_thorname_change_events](#!/model/model.thorchain_models.core__fact_thorname_change_events) @@ -78,10 +77,6 @@ There is more information on how to use dbt docs in the last section of this doc - [defi.fact_swaps](#!/model/model.thorchain_models.defi__fact_swaps) - [defi.fact_swaps_events](#!/model/model.thorchain_models.defi__fact_swaps_events) - [defi.fact_switch_events](#!/model/model.thorchain_models.defi__fact_switch_events) -- [defi.fact_tcy_claim_events](#!/model/model.thorchain_models.defi__fact_tcy_claim_events) -- [defi.fact_tcy_distribution_events](#!/model/model.thorchain_models.defi__fact_tcy_distribution_events) -- [defi.fact_tcy_stake_events](#!/model/model.thorchain_models.defi__fact_tcy_stake_events) -- [defi.fact_tcy_unstake_events](#!/model/model.thorchain_models.defi__fact_tcy_unstake_events) - [defi.fact_total_block_rewards](#!/model/model.thorchain_models.defi__fact_total_block_rewards) - [defi.fact_total_value_locked](#!/model/model.thorchain_models.defi__fact_total_value_locked) - [defi.fact_trade_account_deposit_events](#!/model/model.thorchain_models.defi__fact_trade_account_deposit_events) @@ -122,7 +117,6 @@ The dimension tables are sourced from a variety of on-chain and off-chain source Convenience views (denoted ez\_) are a combination of different fact and dimension tables. These views are built to make it easier to query the data. - ## **Using dbt docs** ### Navigation diff --git a/models/gold/core/core__fact_instantiate_events.sql b/models/gold/core/core__fact_instantiate_events.sql deleted file mode 100644 index 37f2781..0000000 --- a/models/gold/core/core__fact_instantiate_events.sql +++ /dev/null @@ -1,64 +0,0 @@ -{{ config( - materialized = 'incremental', - meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} }, - unique_key = 'FACT_INSTANTIATE_EVENTS_ID', - incremental_strategy = 'merge', - incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp >= (select min(block_timestamp) from ' ~ generate_tmp_view_name(this) ~ ')'], - cluster_by = ['block_timestamp::DATE'] -) }} - -WITH base AS ( - - SELECT - tx_id, - contract_address, - admin_address, - code_id, - sender, - label, - msg, - funds, - event_id, - block_timestamp, - _INSERTED_TIMESTAMP - FROM - {{ ref('silver__instantiate_events') }} -) -SELECT - {{ dbt_utils.generate_surrogate_key( - ['a.event_id','a.contract_address','a.block_timestamp'] - ) }} AS FACT_INSTANTIATE_EVENTS_ID, - b.block_timestamp, - COALESCE( - b.dim_block_id, - '-1' - ) AS dim_block_id, - A.tx_id, - A.contract_address, - A.admin_address, - A.code_id, - A.sender, - A.label, - A.msg, - A.funds, - A.event_id, - A._INSERTED_TIMESTAMP, - '{{ invocation_id }}' AS _audit_run_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp -FROM - base A - JOIN {{ ref('core__dim_block') }} - b - ON A.block_timestamp = b.timestamp -{% if is_incremental() %} -WHERE - b.block_timestamp >= ( - SELECT - MAX( - block_timestamp - INTERVAL '1 HOUR' - ) - FROM - {{ this }} - ) -{% endif %} \ No newline at end of file diff --git a/models/gold/core/core__fact_instantiate_events.yml b/models/gold/core/core__fact_instantiate_events.yml deleted file mode 100644 index c136847..0000000 --- a/models/gold/core/core__fact_instantiate_events.yml +++ /dev/null @@ -1,55 +0,0 @@ -version: 2 -models: - - name: core__fact_instantiate_events - description: "Comprehensive fact table tracking smart contract instantiation events on THORchain blockchain. This table captures detailed information about new smart contract deployments including contract addresses, admin addresses, code IDs, senders, labels, initialization messages, and funding details. Essential for monitoring THORchain ecosystem development, tracking contract creation patterns, analyzing developer activity, and understanding the growth and evolution of the smart contract landscape. Each record represents a unique contract instantiation event with complete deployment metadata for thorough blockchain development analysis and ecosystem monitoring." - columns: - - name: FACT_INSTANTIATE_EVENTS_ID - description: "{{ doc('sk') }}" - tests: - - dbt_expectations.expect_column_to_exist - - unique - - name: BLOCK_TIMESTAMP - description: "{{ doc('block_timestamp') }}" - tests: - - not_null: - where: DIM_BLOCK_ID not in ('-1','-2') - - name: DIM_BLOCK_ID - description: "FK to DIM_BLOCK table" - tests: - - negative_one: - where: _inserted_timestamp < (CURRENT_TIMESTAMP - INTERVAL '8 HOURS') - - name: TX_ID - description: "{{ doc('tx_id') }}" - - name: CONTRACT_ADDRESS - description: "The contract address" - tests: - - not_null - - name: ADMIN_ADDRESS - description: "The admin address" - - name: CODE_ID - description: "The code ID" - tests: - - not_null - - name: SENDER - description: "{{ doc('from_address') }}" - - name: LABEL - description: "The label" - - name: MSG - description: "The message" - - name: FUNDS - description: "The funds" - - name: EVENT_ID - description: "{{ doc('id') }}" - tests: - - not_null - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' - tests: - - dbt_constraints.primary_key: - column_name: FACT_INSTANTIATE_EVENTS_ID - - dbt_constraints.foreign_key: - fk_column_name: DIM_BLOCK_ID - pk_table_name: ref('core__dim_block') - pk_column_name: DIM_BLOCK_ID diff --git a/models/gold/defi/defi__fact_tcy_claim_events.sql b/models/gold/defi/defi__fact_tcy_claim_events.sql deleted file mode 100644 index 2041acf..0000000 --- a/models/gold/defi/defi__fact_tcy_claim_events.sql +++ /dev/null @@ -1,60 +0,0 @@ -{{ config( - materialized = 'incremental', - meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} }, - unique_key = 'fact_tcy_claim_events_id', - incremental_strategy = 'merge', - incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp >= (select min(block_timestamp) from ' ~ generate_tmp_view_name(this) ~ ')'], - cluster_by = ['block_timestamp::DATE'] -) }} - -WITH base AS ( - - SELECT - tx_id, - rune_address, - l1_address, - asset, - tcy_amt, - memo, - event_id, - block_timestamp, - _INSERTED_TIMESTAMP - FROM - {{ ref('silver__tcy_claim_events') }} -) -SELECT - {{ dbt_utils.generate_surrogate_key( - ['a.event_id','a.tx_id','a.rune_address','a.l1_address','a.asset'] - ) }} AS fact_tcy_claim_events_id, - b.block_timestamp, - COALESCE( - b.dim_block_id, - '-1' - ) AS dim_block_id, - tx_id, - rune_address, - l1_address, - asset, - tcy_amt, - memo, - event_id, - A._INSERTED_TIMESTAMP, - '{{ invocation_id }}' AS _audit_run_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp -FROM - base A - JOIN {{ ref('core__dim_block') }} - b - ON A.block_timestamp = b.timestamp -{% if is_incremental() %} -WHERE - b.block_timestamp >= ( - SELECT - MAX( - block_timestamp - INTERVAL '1 HOUR' - ) - FROM - {{ this }} - ) -{% endif %} \ No newline at end of file diff --git a/models/gold/defi/defi__fact_tcy_claim_events.yml b/models/gold/defi/defi__fact_tcy_claim_events.yml deleted file mode 100644 index f3b6e27..0000000 --- a/models/gold/defi/defi__fact_tcy_claim_events.yml +++ /dev/null @@ -1,57 +0,0 @@ -version: 2 -models: - - name: defi__fact_tcy_claim_events - description: "Comprehensive fact table tracking THORchain Yield (TCY) reward claim events and transactions. This table captures detailed information about users claiming their earned TCY rewards including transaction IDs, claimed TCY amounts, asset types, RUNE addresses, L1 addresses for cross-chain operations, memo fields, and precise timing information. Essential for yield analysis and reward distribution tracking, understanding user claiming behavior patterns, calculating total rewards distributed, and analyzing cross-chain reward mechanics. Each record represents a unique TCY reward claim transaction with complete user and transaction metadata for thorough yield farming analysis, reward distribution monitoring, and protocol performance evaluation." - columns: - - name: FACT_TCY_CLAIM_EVENTS_ID - description: "{{ doc('sk') }}" - tests: - - dbt_expectations.expect_column_to_exist - - unique - - name: BLOCK_TIMESTAMP - description: "{{ doc('block_timestamp') }}" - tests: - - not_null: - where: DIM_BLOCK_ID not in ('-1','-2') - - name: DIM_BLOCK_ID - description: "FK to DIM_BLOCK table" - tests: - - negative_one: - where: _inserted_timestamp < (CURRENT_TIMESTAMP - INTERVAL '8 HOURS') - - name: TX_ID - description: "{{ doc('tx_id') }}" - tests: - - not_null - - name: RUNE_ADDRESS - description: "{{ doc('address') }}" - tests: - - not_null - - name: L1_ADDRESS - description: "The L1 address" - tests: - - not_null - - name: ASSET - description: "{{ doc('asset') }}" - tests: - - not_null - - name: TCY_AMT - description: "The TCY amount" - tests: - - not_null - - name: MEMO - description: "{{ doc('memo') }}" - - name: EVENT_ID - description: "{{ doc('id') }}" - tests: - - not_null - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' - tests: - - dbt_constraints.primary_key: - column_name: FACT_TCY_CLAIM_EVENTS_ID - - dbt_constraints.foreign_key: - fk_column_name: DIM_BLOCK_ID - pk_table_name: ref('core__dim_block') - pk_column_name: DIM_BLOCK_ID diff --git a/models/gold/defi/defi__fact_tcy_distribution_events.sql b/models/gold/defi/defi__fact_tcy_distribution_events.sql deleted file mode 100644 index f9b6f1a..0000000 --- a/models/gold/defi/defi__fact_tcy_distribution_events.sql +++ /dev/null @@ -1,52 +0,0 @@ -{{ config( - materialized = 'incremental', - meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} }, - unique_key = 'fact_tcy_distribution_events_id', - incremental_strategy = 'merge', - incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp >= (select min(block_timestamp) from ' ~ generate_tmp_view_name(this) ~ ')'], - cluster_by = ['block_timestamp::DATE'] -) }} - -WITH base AS ( - - SELECT - rune_address, - rune_amt, - event_id, - block_timestamp, - _INSERTED_TIMESTAMP - FROM - {{ ref('silver__tcy_distribution_events') }} -) -SELECT - {{ dbt_utils.generate_surrogate_key( - ['a.event_id','a.rune_address','a.rune_amt'] - ) }} AS fact_tcy_distribution_events_id, - b.block_timestamp, - COALESCE( - b.dim_block_id, - '-1' - ) AS dim_block_id, - rune_address, - rune_amt, - event_id, - A._INSERTED_TIMESTAMP, - '{{ invocation_id }}' AS _audit_run_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp -FROM - base A - JOIN {{ ref('core__dim_block') }} - b - ON A.block_timestamp = b.timestamp -{% if is_incremental() %} -WHERE - b.block_timestamp >= ( - SELECT - MAX( - block_timestamp - INTERVAL '1 HOUR' - ) - FROM - {{ this }} - ) -{% endif %} \ No newline at end of file diff --git a/models/gold/defi/defi__fact_tcy_distribution_events.yml b/models/gold/defi/defi__fact_tcy_distribution_events.yml deleted file mode 100644 index 884e79f..0000000 --- a/models/gold/defi/defi__fact_tcy_distribution_events.yml +++ /dev/null @@ -1,43 +0,0 @@ -version: 2 -models: - - name: defi__fact_tcy_distribution_events - description: "Comprehensive fact table tracking THORchain Yield (TCY) automatic reward distribution events and transactions. This table captures detailed information about protocol-level reward distributions to users including RUNE addresses, distribution amounts, and precise timing information. Essential for tracking protocol-level reward mechanisms, calculating total distributed yields across the ecosystem, analyzing reward distribution patterns and frequencies, and monitoring the overall health of the TCY reward system. Each record represents a unique TCY reward distribution event with complete recipient and transaction metadata for thorough yield farming analysis, reward distribution monitoring, and protocol performance evaluation." - columns: - - name: FACT_TCY_DISTRIBUTION_EVENTS_ID - description: "{{ doc('sk') }}" - tests: - - dbt_expectations.expect_column_to_exist - - unique - - name: BLOCK_TIMESTAMP - description: "{{ doc('block_timestamp') }}" - tests: - - not_null: - where: DIM_BLOCK_ID not in ('-1','-2') - - name: DIM_BLOCK_ID - description: "FK to DIM_BLOCK table" - tests: - - negative_one: - where: _inserted_timestamp < (CURRENT_TIMESTAMP - INTERVAL '8 HOURS') - - name: RUNE_ADDRESS - description: "{{ doc('address') }}" - tests: - - not_null - - name: RUNE_AMT - description: "The RUNE amount" - tests: - - not_null - - name: EVENT_ID - description: "{{ doc('id') }}" - tests: - - not_null - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' - tests: - - dbt_constraints.primary_key: - column_name: FACT_TCY_DISTRIBUTION_EVENTS_ID - - dbt_constraints.foreign_key: - fk_column_name: DIM_BLOCK_ID - pk_table_name: ref('core__dim_block') - pk_column_name: DIM_BLOCK_ID diff --git a/models/gold/defi/defi__fact_tcy_stake_events.sql b/models/gold/defi/defi__fact_tcy_stake_events.sql deleted file mode 100644 index 19230aa..0000000 --- a/models/gold/defi/defi__fact_tcy_stake_events.sql +++ /dev/null @@ -1,56 +0,0 @@ -{{ config( - materialized = 'incremental', - meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} }, - unique_key = 'fact_tcy_stake_events_id', - incremental_strategy = 'merge', - incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp >= (select min(block_timestamp) from ' ~ generate_tmp_view_name(this) ~ ')'], - cluster_by = ['block_timestamp::DATE'] -) }} - -WITH base AS ( - - SELECT - tx_id, - amount, - rune_address, - memo, - event_id, - block_timestamp, - _INSERTED_TIMESTAMP - FROM - {{ ref('silver__tcy_stake_events') }} -) -SELECT - {{ dbt_utils.generate_surrogate_key( - ['a.event_id','a.tx_id','a.rune_address','a.memo'] - ) }} AS fact_tcy_stake_events_id, - b.block_timestamp, - COALESCE( - b.dim_block_id, - '-1' - ) AS dim_block_id, - tx_id, - rune_address, - amount, - memo, - event_id, - A._INSERTED_TIMESTAMP, - '{{ invocation_id }}' AS _audit_run_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp -FROM - base A - JOIN {{ ref('core__dim_block') }} - b - ON A.block_timestamp = b.timestamp -{% if is_incremental() %} -WHERE - b.block_timestamp >= ( - SELECT - MAX( - block_timestamp - INTERVAL '1 HOUR' - ) - FROM - {{ this }} - ) -{% endif %} \ No newline at end of file diff --git a/models/gold/defi/defi__fact_tcy_stake_events.yml b/models/gold/defi/defi__fact_tcy_stake_events.yml deleted file mode 100644 index 9c9ce85..0000000 --- a/models/gold/defi/defi__fact_tcy_stake_events.yml +++ /dev/null @@ -1,49 +0,0 @@ -version: 2 -models: - - name: defi__fact_tcy_stake_events - description: "Comprehensive fact table tracking THORchain Yield (TCY) staking events and transactions. This table captures detailed information about user staking activities including transaction IDs, staked amounts, RUNE addresses, memo fields, and precise timing information. Essential for analyzing user staking behavior patterns, calculating total value locked (TVL) in TCY pools, measuring staking trends over time, and understanding liquidity provision dynamics. Each record represents a unique TCY staking transaction with complete user and transaction metadata for thorough yield farming analysis, user behavior tracking, and protocol performance monitoring." - columns: - - name: FACT_TCY_STAKE_EVENTS_ID - description: "{{ doc('sk') }}" - tests: - - dbt_expectations.expect_column_to_exist - - unique - - name: BLOCK_TIMESTAMP - description: "{{ doc('block_timestamp') }}" - tests: - - not_null: - where: DIM_BLOCK_ID not in ('-1','-2') - - name: DIM_BLOCK_ID - description: "FK to DIM_BLOCK table" - tests: - - negative_one: - where: _inserted_timestamp < (CURRENT_TIMESTAMP - INTERVAL '8 HOURS') - - name: TX_ID - description: "{{ doc('tx_id') }}" - tests: - - not_null - - name: RUNE_ADDRESS - description: "{{ doc('address') }}" - tests: - - not_null - - name: AMOUNT - description: "The amount" - tests: - - not_null - - name: MEMO - description: "{{ doc('memo') }}" - - name: EVENT_ID - description: "{{ doc('id') }}" - tests: - - not_null - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' - tests: - - dbt_constraints.primary_key: - column_name: FACT_TCY_STAKE_EVENTS_ID - - dbt_constraints.foreign_key: - fk_column_name: DIM_BLOCK_ID - pk_table_name: ref('core__dim_block') - pk_column_name: DIM_BLOCK_ID diff --git a/models/gold/defi/defi__fact_tcy_unstake_events.sql b/models/gold/defi/defi__fact_tcy_unstake_events.sql deleted file mode 100644 index 176018b..0000000 --- a/models/gold/defi/defi__fact_tcy_unstake_events.sql +++ /dev/null @@ -1,56 +0,0 @@ -{{ config( - materialized = 'incremental', - meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'DEX, AMM' }} }, - unique_key = 'fact_tcy_unstake_events_id', - incremental_strategy = 'merge', - incremental_predicates = ['DBT_INTERNAL_DEST.block_timestamp >= (select min(block_timestamp) from ' ~ generate_tmp_view_name(this) ~ ')'], - cluster_by = ['block_timestamp::DATE'] -) }} - -WITH base AS ( - - SELECT - tx_id, - amount, - rune_address, - memo, - event_id, - block_timestamp, - _INSERTED_TIMESTAMP - FROM - {{ ref('silver__tcy_unstake_events') }} -) -SELECT - {{ dbt_utils.generate_surrogate_key( - ['a.event_id','a.tx_id','a.rune_address','a.memo'] - ) }} AS fact_tcy_unstake_events_id, - b.block_timestamp, - COALESCE( - b.dim_block_id, - '-1' - ) AS dim_block_id, - tx_id, - amount, - rune_address, - memo, - event_id, - A._INSERTED_TIMESTAMP, - '{{ invocation_id }}' AS _audit_run_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp -FROM - base A - JOIN {{ ref('core__dim_block') }} - b - ON A.block_timestamp = b.timestamp -{% if is_incremental() %} -WHERE - b.block_timestamp >= ( - SELECT - MAX( - block_timestamp - INTERVAL '1 HOUR' - ) - FROM - {{ this }} - ) -{% endif %} \ No newline at end of file diff --git a/models/gold/defi/defi__fact_tcy_unstake_events.yml b/models/gold/defi/defi__fact_tcy_unstake_events.yml deleted file mode 100644 index 86b6b8f..0000000 --- a/models/gold/defi/defi__fact_tcy_unstake_events.yml +++ /dev/null @@ -1,49 +0,0 @@ -version: 2 -models: - - name: defi__fact_tcy_unstake_events - description: "Comprehensive fact table tracking THORchain Yield (TCY) unstaking events and withdrawal transactions. This table captures detailed information about users withdrawing their staked assets from TCY pools including transaction IDs, unstaked amounts, RUNE addresses, memo fields, and precise timing information. Essential for calculating actual yield earned by users, understanding user exit patterns and behaviors, measuring pool retention rates, and analyzing the lifecycle of TCY staking positions. Each record represents a unique TCY unstaking transaction with complete user and transaction metadata for thorough yield farming analysis, liquidity flow tracking, and protocol performance monitoring." - columns: - - name: FACT_TCY_UNSTAKE_EVENTS_ID - description: "{{ doc('sk') }}" - tests: - - dbt_expectations.expect_column_to_exist - - unique - - name: BLOCK_TIMESTAMP - description: "{{ doc('block_timestamp') }}" - tests: - - not_null: - where: DIM_BLOCK_ID not in ('-1','-2') - - name: DIM_BLOCK_ID - description: "FK to DIM_BLOCK table" - tests: - - negative_one: - where: _inserted_timestamp < (CURRENT_TIMESTAMP - INTERVAL '8 HOURS') - - name: TX_ID - description: "{{ doc('tx_id') }}" - tests: - - not_null - - name: AMOUNT - description: "The amount" - tests: - - not_null - - name: RUNE_ADDRESS - description: "{{ doc('address') }}" - tests: - - not_null - - name: MEMO - description: "{{ doc('memo') }}" - - name: EVENT_ID - description: "{{ doc('id') }}" - tests: - - not_null - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' - tests: - - dbt_constraints.primary_key: - column_name: FACT_TCY_UNSTAKE_EVENTS_ID - - dbt_constraints.foreign_key: - fk_column_name: DIM_BLOCK_ID - pk_table_name: ref('core__dim_block') - pk_column_name: DIM_BLOCK_ID diff --git a/models/silver/silver__instantiate_events.sql b/models/silver/silver__instantiate_events.sql deleted file mode 100644 index 70a3c04..0000000 --- a/models/silver/silver__instantiate_events.sql +++ /dev/null @@ -1,26 +0,0 @@ -{{ config( - materialized = 'view' -) }} - -SELECT - tx_id, - contract_address, - admin_address, - code_id, - sender, - label, - msg, - funds, - event_id, - block_timestamp, - DATEADD( - ms, - __HEVO__LOADED_AT, - '1970-01-01' - ) AS _INSERTED_TIMESTAMP -FROM - {{ ref('bronze__instantiate_events') }} - qualify(ROW_NUMBER() over(PARTITION BY event_id -ORDER BY - __HEVO__LOADED_AT DESC)) = 1 - diff --git a/models/silver/silver__instantiate_events.yml b/models/silver/silver__instantiate_events.yml deleted file mode 100644 index e668860..0000000 --- a/models/silver/silver__instantiate_events.yml +++ /dev/null @@ -1,31 +0,0 @@ -version: 2 -models: - - name: silver__instantiate_events - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - EVENT_ID - - CONTRACT_ADDRESS - - BLOCK_TIMESTAMP - columns: - - name: TX_ID - - name: CONTRACT_ADDRESS - tests: - - not_null - - name: ADMIN_ADDRESS - - name: CODE_ID - tests: - - not_null - - name: SENDER - - name: LABEL - - name: MSG - - name: FUNDS - - name: EVENT_ID - tests: - - not_null - - name: BLOCK_TIMESTAMP - tests: - - not_null - - name: _INSERTED_TIMESTAMP - tests: - - not_null diff --git a/models/silver/silver__tcy_claim_events.sql b/models/silver/silver__tcy_claim_events.sql deleted file mode 100644 index b1faf81..0000000 --- a/models/silver/silver__tcy_claim_events.sql +++ /dev/null @@ -1,23 +0,0 @@ -{{ config( - materialized = 'view' -) }} - -SELECT - tx_id, - rune_address, - l1_address, - asset, - tcy_amt, - memo, - event_id, - block_timestamp, - DATEADD( - ms, - __HEVO__LOADED_AT, - '1970-01-01' - ) AS _INSERTED_TIMESTAMP -FROM - {{ ref('bronze__tcy_claim_events') }} - qualify(ROW_NUMBER() over(PARTITION BY event_id -ORDER BY - __HEVO__LOADED_AT DESC)) = 1 diff --git a/models/silver/silver__tcy_claim_events.yml b/models/silver/silver__tcy_claim_events.yml deleted file mode 100644 index a0e8612..0000000 --- a/models/silver/silver__tcy_claim_events.yml +++ /dev/null @@ -1,35 +0,0 @@ -version: 2 -models: - - name: silver__tcy_claim_events - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - EVENT_ID - - TX_ID - - RUNE_ADDRESS - columns: - - name: TX_ID - tests: - - not_null - - name: RUNE_ADDRESS - tests: - - not_null - - name: L1_ADDRESS - tests: - - not_null - - name: ASSET - tests: - - not_null - - name: TCY_AMT - tests: - - not_null - - name: MEMO - - name: EVENT_ID - tests: - - not_null - - name: BLOCK_TIMESTAMP - tests: - - not_null - - name: _INSERTED_TIMESTAMP - tests: - - not_null diff --git a/models/silver/silver__tcy_distribution_events.sql b/models/silver/silver__tcy_distribution_events.sql deleted file mode 100644 index 53b829e..0000000 --- a/models/silver/silver__tcy_distribution_events.sql +++ /dev/null @@ -1,20 +0,0 @@ -{{ config( - materialized = 'view' -) }} - -SELECT - rune_address, - rune_amt, - event_id, - block_timestamp, - DATEADD( - ms, - __HEVO__LOADED_AT, - '1970-01-01' - ) AS _INSERTED_TIMESTAMP -FROM - {{ ref('bronze__tcy_distribution_events') }} - qualify(ROW_NUMBER() over(PARTITION BY event_id -ORDER BY - __HEVO__LOADED_AT DESC)) = 1 - diff --git a/models/silver/silver__tcy_distribution_events.yml b/models/silver/silver__tcy_distribution_events.yml deleted file mode 100644 index f05ca46..0000000 --- a/models/silver/silver__tcy_distribution_events.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: 2 -models: - - name: silver__tcy_distribution_events - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - EVENT_ID - - RUNE_ADDRESS - - RUNE_AMT - columns: - - name: RUNE_ADDRESS - tests: - - not_null - - name: RUNE_AMT - tests: - - not_null - - name: EVENT_ID - tests: - - not_null - - name: BLOCK_TIMESTAMP - tests: - - not_null - - name: _INSERTED_TIMESTAMP - tests: - - not_null diff --git a/models/silver/silver__tcy_stake_events.sql b/models/silver/silver__tcy_stake_events.sql deleted file mode 100644 index 4cb375f..0000000 --- a/models/silver/silver__tcy_stake_events.sql +++ /dev/null @@ -1,21 +0,0 @@ -{{ config( - materialized = 'view' -) }} - -SELECT - tx_id, - amount, - rune_address, - memo, - event_id, - block_timestamp, - DATEADD( - ms, - __HEVO__LOADED_AT, - '1970-01-01' - ) AS _INSERTED_TIMESTAMP -FROM - {{ ref('bronze__tcy_stake_events') }} - qualify(ROW_NUMBER() over(PARTITION BY event_id -ORDER BY - __HEVO__LOADED_AT DESC)) = 1 diff --git a/models/silver/silver__tcy_stake_events.yml b/models/silver/silver__tcy_stake_events.yml deleted file mode 100644 index d8cfbf9..0000000 --- a/models/silver/silver__tcy_stake_events.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: 2 -models: - - name: silver__tcy_stake_events - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - EVENT_ID - - TX_ID - - RUNE_ADDRESS - columns: - - name: TX_ID - tests: - - not_null - - name: AMOUNT - tests: - - not_null - - name: RUNE_ADDRESS - tests: - - not_null - - name: MEMO - - name: EVENT_ID - tests: - - not_null - - name: BLOCK_TIMESTAMP - tests: - - not_null - - name: _INSERTED_TIMESTAMP - tests: - - not_null diff --git a/models/silver/silver__tcy_unstake_events.sql b/models/silver/silver__tcy_unstake_events.sql deleted file mode 100644 index bffc4da..0000000 --- a/models/silver/silver__tcy_unstake_events.sql +++ /dev/null @@ -1,21 +0,0 @@ -{{ config( - materialized = 'view' -) }} - -SELECT - tx_id, - amount, - rune_address, - memo, - event_id, - block_timestamp, - DATEADD( - ms, - __HEVO__LOADED_AT, - '1970-01-01' - ) AS _INSERTED_TIMESTAMP -FROM - {{ ref('bronze__tcy_unstake_events') }} - qualify(ROW_NUMBER() over(PARTITION BY event_id -ORDER BY - __HEVO__LOADED_AT DESC)) = 1 diff --git a/models/silver/silver__tcy_unstake_events.yml b/models/silver/silver__tcy_unstake_events.yml deleted file mode 100644 index 398ca5d..0000000 --- a/models/silver/silver__tcy_unstake_events.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: 2 -models: - - name: silver__tcy_unstake_events - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - EVENT_ID - - TX_ID - - RUNE_ADDRESS - columns: - - name: TX_ID - tests: - - not_null - - name: AMOUNT - tests: - - not_null - - name: RUNE_ADDRESS - tests: - - not_null - - name: MEMO - - name: EVENT_ID - tests: - - not_null - - name: BLOCK_TIMESTAMP - tests: - - not_null - - name: _INSERTED_TIMESTAMP - tests: - - not_null diff --git a/models/sources.yml b/models/sources.yml index 1e7f967..54e973c 100644 --- a/models/sources.yml +++ b/models/sources.yml @@ -18,7 +18,6 @@ sources: - name: midgard_fee_events - name: midgard_gas_events - name: midgard_inactive_vault_events - - name: midgard_instantiate_events - name: midgard_loan_open_events - name: midgard_loan_repayment_events - name: midgard_mint_burn_events @@ -50,10 +49,6 @@ sources: - name: midgard_streaming_swap_details_events - name: midgard_swap_events - name: midgard_switch_events - - name: midgard_tcy_claim_events - - name: midgard_tcy_distribution_events - - name: midgard_tcy_stake_events - - name: midgard_tcy_unstake_events - name: midgard_thorname_change_events - name: midgard_trade_account_deposit_events - name: midgard_trade_account_withdraw_events