diff --git a/warehouse/dbt/models/base_playground_sources.yml b/warehouse/dbt/models/base_playground_sources.yml index b0f2f7174..a5fe6c224 100644 --- a/warehouse/dbt/models/base_playground_sources.yml +++ b/warehouse/dbt/models/base_playground_sources.yml @@ -62,9 +62,6 @@ sources: - name: optimism_traces identifier: int_optimism_traces - - name: superchain_optimism_traces - identifier: int_optimism_traces - - name: optimism_transactions identifier: int_optimism_transactions diff --git a/warehouse/dbt/models/intermediate/blockchain_events/int_optimism_traces.sql b/warehouse/dbt/models/intermediate/blockchain_events/int_optimism_traces.sql index 88420960e..21e634d32 100644 --- a/warehouse/dbt/models/intermediate/blockchain_events/int_optimism_traces.sql +++ b/warehouse/dbt/models/intermediate/blockchain_events/int_optimism_traces.sql @@ -14,7 +14,7 @@ {{ filtered_blockchain_events( "OPTIMISM", - "superchain", - "optimism_traces" + "optimism", + "traces" ) }} diff --git a/warehouse/dbt/models/intermediate/blockchain_events/int_optimism_transactions.sql b/warehouse/dbt/models/intermediate/blockchain_events/int_optimism_transactions.sql index 900935705..bbeeb0a03 100644 --- a/warehouse/dbt/models/intermediate/blockchain_events/int_optimism_transactions.sql +++ b/warehouse/dbt/models/intermediate/blockchain_events/int_optimism_transactions.sql @@ -11,93 +11,4 @@ incremental_strategy="insert_overwrite" ) }} -with known_addresses as ( - select distinct `artifact_source_id` as `address` - from {{ ref("int_all_artifacts") }} - where `artifact_source` = 'OPTIMISM' -), -{% if target.name == 'production' %} -receipts as ( - select * - from {{ source("optimism", "receipts") }} - {% if is_incremental() %} - where block_timestamp > TIMESTAMP_SUB(_dbt_max_partition, INTERVAL 1 DAY) - {{ playground_filter("block_timestamp", is_start=False) }} - {% else %} - {{ playground_filter("block_timestamp") }} - {% endif %} -), blocks as ( - select * - from {{ source("optimism", "blocks") }} - {% if is_incremental() %} - where `block_timestamp` > TIMESTAMP_SUB(_dbt_max_partition, INTERVAL 1 DAY) - {{ playground_filter("`block_timestamp`", is_start=False) }} - {% else %} - {{ playground_filter("`block_timestamp`") }} - {% endif %} - -), transactions_with_receipts as ( - -select - transactions.*, - blocks.block_number as block_number, - receipts.contract_address as receipt_contract_address, - receipts.cumulative_gas_used as receipt_cumulative_gas_used, - receipts.gas_used as receipt_gas_used, - receipts.effective_gas_price as receipt_effective_gas_price, - receipts.root as receipt_root, - receipts.status as receipt_status -from {{ source("optimism", "transactions") }} as transactions -inner join receipts as receipts - on transactions.transaction_hash = receipts.transaction_hash -inner join {{ source("optimism", "blocks") }} as blocks - on transactions.block_hash = blocks.block_hash -{% if is_incremental() %} -where - {# - We are using insert_overwrite so this will consistently select everything - that would go into the latest partition (and any new partitions after - that). It will overwrite any data in the partitions for which this select - statement matches - #} - transactions.block_timestamp > TIMESTAMP_SUB(_dbt_max_partition, INTERVAL 1 DAY) - {{ playground_filter("block_timestamp", is_start=False) }} -{% else %} - {{ playground_filter("block_timestamp") }} -{% endif %} -), -{% else %} - transactions_with_receipts as ( -{# - We need a separate query for the playground because we transform the data in - production. -#} - select * - from {{ source(current_playground(), "optimism_transactions") }} - {% if is_incremental() %} - where - block_timestamp > TIMESTAMP_SUB(_dbt_max_partition, interval 1 day) - {{ playground_filter("block_timestamp", is_start=False) }} - {% else %} - {{ playground_filter("block_timestamp") }} -{% endif %} - ), -{% endif %} -txs_with_dupes as ( - select txs_to.* - from transactions_with_receipts as txs_to - inner join known_addresses as known_to - on txs_to.to_address = known_to.address - union all - select txs_from.* - from transactions_with_receipts as txs_from - inner join known_addresses as known_from - on txs_from.from_address = known_from.address -) - -select * -from txs_with_dupes -qualify - ROW_NUMBER() - over (partition by `transaction_hash` order by block_timestamp asc) - = 1 +{{ filtered_blockchain_events("OPTIMISM", "optimism", "transactions") }} diff --git a/warehouse/dbt/models/playground_sources.yml b/warehouse/dbt/models/playground_sources.yml index 211a83a0a..88257f462 100644 --- a/warehouse/dbt/models/playground_sources.yml +++ b/warehouse/dbt/models/playground_sources.yml @@ -62,9 +62,6 @@ sources: - name: optimism_traces identifier: int_optimism_traces - - - name: superchain_optimism_traces - identifier: int_optimism_traces - name: optimism_transactions identifier: int_optimism_transactions diff --git a/warehouse/dbt/models/staging/optimism/stg_optimism__factories.sql b/warehouse/dbt/models/staging/optimism/stg_optimism__factories.sql index 6c4afe90e..d832b9ed7 100644 --- a/warehouse/dbt/models/staging/optimism/stg_optimism__factories.sql +++ b/warehouse/dbt/models/staging/optimism/stg_optimism__factories.sql @@ -11,11 +11,4 @@ incremental_strategy="insert_overwrite" ) }} -{{ - factory_deployments( - "superchain", - traces="optimism_traces", - transactions_source=oso_source("optimism", "transactions"), - transactions_table_transaction_hash_column="transaction_hash", - ) -}} +{{ factory_deployments("optimism") }} diff --git a/warehouse/dbt/models/staging/optimism/stg_optimism__proxies.sql b/warehouse/dbt/models/staging/optimism/stg_optimism__proxies.sql index 110e4615c..89adea473 100644 --- a/warehouse/dbt/models/staging/optimism/stg_optimism__proxies.sql +++ b/warehouse/dbt/models/staging/optimism/stg_optimism__proxies.sql @@ -16,4 +16,4 @@ {% else %} {% set start = "'1970-01-01'" %} {% endif %} -{{ known_proxies("superchain", start, traces="optimism_traces") }} +{{ known_proxies("optimism", start) }}