diff --git a/warehouse/dbt/models/marts/superchain/metrics/rf4_gas_fees.sql b/warehouse/dbt/models/marts/superchain/metrics/rf4_gas_fees.sql index dbee9b784..9bf717fb0 100644 --- a/warehouse/dbt/models/marts/superchain/metrics/rf4_gas_fees.sql +++ b/warehouse/dbt/models/marts/superchain/metrics/rf4_gas_fees.sql @@ -5,5 +5,6 @@ select from {{ ref('rf4_events_daily_to_project') }} where event_type = 'CONTRACT_INVOCATION_DAILY_L2_GAS_USED' + and bucket_day >= '2023-10-01' group by project_id diff --git a/warehouse/dbt/models/marts/superchain/rf4_events_daily_to_project.sql b/warehouse/dbt/models/marts/superchain/rf4_events_daily_to_project.sql index 3b070926e..7709dc67d 100644 --- a/warehouse/dbt/models/marts/superchain/rf4_events_daily_to_project.sql +++ b/warehouse/dbt/models/marts/superchain/rf4_events_daily_to_project.sql @@ -21,7 +21,7 @@ with events as ( 'MODE', 'ZORA' ) - and time < '2024-05-23' + and time < '2024-06-01' group by project_id, from_artifact_id, @@ -29,6 +29,13 @@ with events as ( event_source, event_type, TIMESTAMP_TRUNC(time, day) +), + +artifacts as ( + select distinct + artifact_id, + artifact_name + from {{ ref('artifacts_v1') }} ) select @@ -45,13 +52,12 @@ select then rf4_trusted_users.address end as trusted_user_id from events -left join {{ ref('int_artifact_types') }} as to_artifacts +left join artifacts as to_artifacts on events.to_artifact_id = to_artifacts.artifact_id -left join {{ ref('artifacts_v1') }} as from_artifacts +left join artifacts as from_artifacts on events.from_artifact_id = from_artifacts.artifact_id left join {{ ref('projects_v1') }} on events.project_id = projects_v1.project_id left join {{ ref('rf4_trusted_users') }} on from_artifacts.artifact_name = rf4_trusted_users.address -where - to_artifacts.artifact_type = 'CONTRACT' +where events.amount > 0 diff --git a/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project.sql b/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project.sql index 3d9857f55..265fd2034 100644 --- a/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project.sql +++ b/warehouse/dbt/models/marts/superchain/rf4_impact_metrics_by_project.sql @@ -82,8 +82,8 @@ pivot_metrics as ( ) select - pivot_metrics.project_id, - projects_v1.project_name, + agora_rf4_to_ossd.application_id, + agora_rf4_to_ossd.oso_project_name, pivot_metrics.check_oss_requirements, pivot_metrics.gas_fees, pivot_metrics.transaction_count, @@ -101,3 +101,6 @@ select from pivot_metrics left join {{ ref('projects_v1') }} on pivot_metrics.project_id = projects_v1.project_id +left join {{ source("static_data_sources", "agora_rf4_to_ossd") }} + on projects_v1.project_name = agora_rf4_to_ossd.oso_project_name +where agora_rf4_to_ossd.application_id is not null