Skip to content

Commit 03494bd

Browse files
authored
chore(slqmesh): bump M6 models (#4665)
* chore(slqmesh): bump M6 models * chore(sqlmesh): update project flags * fix(sqlmesh): make handling for duplicated deployers more explicit
1 parent 060b9dd commit 03494bd

File tree

8 files changed

+133
-32
lines changed

8 files changed

+133
-32
lines changed

warehouse/oso_sqlmesh/models/intermediate/domain-specific/superchain/s7/int_superchain_s7_defillama_adapter_checks.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ MODEL (
1111
),
1212
);
1313

14-
@DEF(sample_date, '2025-06-01');
14+
@DEF(sample_date, '2025-07-01');
1515

1616
WITH project_data AS (
1717
SELECT

warehouse/oso_sqlmesh/models/intermediate/domain-specific/superchain/s7/int_superchain_s7_devtooling_metrics_by_project.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ MODEL (
1313

1414
@DEF(min_package_connection_count, 3);
1515
@DEF(min_developer_connection_count, 5);
16-
@DEF(start_gas_date, DATE('2025-06-01'));
17-
@DEF(end_gas_date, DATE('2025-07-01'));
16+
@DEF(start_gas_date, DATE('2025-07-01'));
17+
@DEF(end_gas_date, DATE('2025-08-01'));
1818

1919
WITH devtooling_projects AS (
2020
SELECT

warehouse/oso_sqlmesh/models/intermediate/domain-specific/superchain/s7/int_superchain_s7_summary_metrics_by_project.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ MODEL (
1313
);
1414

1515

16-
@DEF(default_sample_date, DATE '2025-06-01');
16+
@DEF(default_sample_date, DATE '2025-07-01');
1717

1818
WITH onchain_builder_eligibility AS (
1919
SELECT DISTINCT

warehouse/oso_sqlmesh/models/intermediate/entities/collections/op-atlas/int_projects_by_collection_in_op_atlas.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ MODEL (
1313
'0x8bfdc42f26bf691d378d2073ae509c46b85c0eed8db8abc6987b6725dd0d056a', -- Spam
1414
'0x10da43868e7439419af2859f2539ed8b355a0f330bd05a6d028ddff8fd4a03d8', -- Spam
1515
'0x51504348243d8e8fa59cf2ba983d9255373e5eb23fe22a0d18c0d36028561ace', -- Test
16-
'0xaa1b878800206da24ee7297fb202ef98a6af0fb3ec298a65ba6b675cb4f4144b' -- Test
16+
'0xaa1b878800206da24ee7297fb202ef98a6af0fb3ec298a65ba6b675cb4f4144b', -- Test
17+
'0xcbfdcf8f724d73504d1518d5ecd7d7256b12d37e68cd84569b383bfb6e2eeea4' -- Dmail
1718
]);
1819

1920
WITH measurement_periods AS (

warehouse/oso_sqlmesh/models/intermediate/entities/projects/op-atlas/int_artifacts_by_project_in_op_atlas.sql

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -111,49 +111,43 @@ github_artifacts AS (
111111
),
112112

113113
-- =============================================================================
114-
-- CONTRACT ARTIFACTS
114+
-- DEPLOYER ARTIFACTS
115115
-- =============================================================================
116-
contract_artifacts AS (
116+
deployer_artifacts AS (
117117
SELECT
118-
stg.atlas_id,
118+
deployers.atlas_id,
119119
parsed.artifact_name AS artifact_source_id,
120120
chain_name.chain_name AS artifact_source,
121121
parsed.artifact_namespace,
122122
parsed.artifact_name,
123123
parsed.artifact_url,
124-
'CONTRACT' AS artifact_type
125-
FROM oso.stg_op_atlas_published_contract AS stg
124+
'DEPLOYER' AS artifact_type
125+
FROM oso.int_op_atlas_deduped_deployers AS deployers
126126
JOIN oso.seed_chain_id_to_chain_name AS chain_name
127-
ON chain_name.chain_id = stg.chain_id
128-
CROSS JOIN LATERAL @parse_blockchain_artifact(stg.contract_address) AS parsed
129-
WHERE parsed.artifact_name IS NOT NULL
127+
ON chain_name.chain_id = deployers.chain_id
128+
CROSS JOIN LATERAL @parse_blockchain_artifact(deployers.deployer_address) AS parsed
130129
),
131130

132131
-- =============================================================================
133-
-- DEPLOYER ARTIFACTS
132+
-- CONTRACT ARTIFACTS
134133
-- =============================================================================
135-
all_deployers AS (
134+
contract_artifacts AS (
136135
SELECT
137136
stg.atlas_id,
138-
stg.deployer_address,
139-
chain_name.chain_name,
140-
COUNT(DISTINCT stg.atlas_id) OVER (PARTITION BY stg.deployer_address, chain_name.chain_name) as project_count_for_deployer
141-
FROM oso.stg_op_atlas_project_contract AS stg
142-
JOIN oso.seed_chain_id_to_chain_name AS chain_name
143-
ON chain_name.chain_id = stg.chain_id
144-
),
145-
deployer_artifacts AS (
146-
SELECT
147-
all_deployers.atlas_id,
148137
parsed.artifact_name AS artifact_source_id,
149-
all_deployers.chain_name AS artifact_source,
138+
chain_name.chain_name AS artifact_source,
150139
parsed.artifact_namespace,
151140
parsed.artifact_name,
152141
parsed.artifact_url,
153-
'DEPLOYER' AS artifact_type
154-
FROM all_deployers
155-
CROSS JOIN LATERAL @parse_blockchain_artifact(all_deployers.deployer_address) AS parsed
156-
WHERE all_deployers.project_count_for_deployer = 1
142+
'CONTRACT' AS artifact_type
143+
FROM oso.stg_op_atlas_published_contract AS stg
144+
JOIN oso.seed_chain_id_to_chain_name AS chain_name
145+
ON chain_name.chain_id = stg.chain_id
146+
JOIN oso.int_op_atlas_deduped_deployers AS dd
147+
ON dd.atlas_id = stg.atlas_id
148+
AND dd.contract_address = stg.contract_address
149+
AND dd.chain_id = stg.chain_id
150+
CROSS JOIN LATERAL @parse_blockchain_artifact(stg.contract_address) AS parsed
157151
),
158152

159153
-- =============================================================================

warehouse/oso_sqlmesh/models/intermediate/entities/projects/op-atlas/int_artifacts_by_project_in_op_atlas_downstream.sql

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ MODEL (
1717
WITH project_deployers AS (
1818
SELECT
1919
project_id,
20-
artifact_name AS deployer_address
20+
artifact_name AS deployer_address,
21+
artifact_source AS chain
2122
FROM oso.int_artifacts_by_project_in_op_atlas
2223
WHERE artifact_type = 'DEPLOYER'
2324
),
@@ -39,6 +40,12 @@ first_level_contracts AS (
3940
FROM oso.int_derived_contracts AS dc
4041
JOIN project_deployers AS pd
4142
ON pd.deployer_address = dc.originating_address
43+
AND (
44+
CASE
45+
WHEN pd.chain = 'ANY_EVM' THEN TRUE
46+
ELSE pd.chain = dc.chain
47+
END
48+
)
4249
),
4350

4451
all_contracts AS (
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
MODEL (
2+
name oso.int_op_atlas_deduped_deployers,
3+
description "Deduplicates deployers in OP Atlas",
4+
kind FULL,
5+
dialect trino,
6+
audits (
7+
has_at_least_n_rows(threshold := 0)
8+
)
9+
);
10+
11+
WITH all_deployers AS (
12+
SELECT
13+
op_atlas_project.display_name,
14+
pc.atlas_id,
15+
pc.deployer_address,
16+
pc.contract_address,
17+
pc.chain_id,
18+
op_atlas_project.created_at AS project_created_at,
19+
app.created_at AS application_created_at,
20+
app.round_id AS application_round_id,
21+
COUNT(DISTINCT pc.atlas_id) OVER (PARTITION BY pc.deployer_address, pc.chain_id) AS project_count_for_deployer
22+
FROM oso.stg_op_atlas_project_contract AS pc
23+
JOIN oso.stg_op_atlas_project AS op_atlas_project
24+
ON op_atlas_project.atlas_id = pc.atlas_id
25+
LEFT JOIN oso.stg_op_atlas_application AS app
26+
ON app.atlas_id = pc.atlas_id
27+
AND app.status = 'submitted'
28+
),
29+
30+
-- Single project gets the deployer
31+
single_project_deployers AS (
32+
SELECT
33+
display_name,
34+
atlas_id,
35+
deployer_address,
36+
contract_address,
37+
chain_id,
38+
project_created_at,
39+
application_created_at,
40+
application_round_id,
41+
'SINGLE_PROJECT' AS assignment_reason
42+
FROM all_deployers
43+
WHERE project_count_for_deployer = 1
44+
),
45+
46+
-- Multiple projects - prioritize by application or project creation date
47+
multi_project_deployers AS (
48+
SELECT
49+
display_name,
50+
atlas_id,
51+
deployer_address,
52+
contract_address,
53+
chain_id,
54+
project_created_at,
55+
application_created_at,
56+
application_round_id,
57+
CASE
58+
WHEN application_created_at IS NOT NULL THEN 'EARLIEST_APP_FOR_GREATEST_ROUND'
59+
ELSE 'EARLIEST_PROJECT_CREATION'
60+
END AS assignment_reason,
61+
ROW_NUMBER() OVER (
62+
PARTITION BY deployer_address, chain_id
63+
ORDER BY
64+
-- First prioritize by greatest round_id (descending)
65+
COALESCE(CAST(application_round_id AS INTEGER), 0) DESC,
66+
-- Then by earliest project created_at (ascending)
67+
COALESCE(project_created_at, DATE('9999-12-31')) ASC
68+
) AS deployer_rank
69+
FROM all_deployers
70+
WHERE project_count_for_deployer > 1
71+
)
72+
73+
SELECT
74+
display_name,
75+
atlas_id,
76+
deployer_address,
77+
contract_address,
78+
chain_id,
79+
project_created_at,
80+
application_created_at,
81+
application_round_id,
82+
assignment_reason
83+
FROM single_project_deployers
84+
85+
UNION ALL
86+
87+
SELECT
88+
display_name,
89+
atlas_id,
90+
deployer_address,
91+
contract_address,
92+
chain_id,
93+
project_created_at,
94+
application_created_at,
95+
application_round_id,
96+
assignment_reason
97+
FROM multi_project_deployers
98+
WHERE deployer_rank = 1

warehouse/oso_sqlmesh/seeds/op_atlas_registry_updates.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ atlas_id,artifact_type,value,action
3232
0x808b31862cec6dccf3894bb0e76ce4ca298e4c2820e2ccbf4816da740463b220,OSO_SLUG,fractal-visions,INCLUDE
3333
0xed3d54e5394dc3ed01f15a67fa6a70e203df31c928dad79f70e25cb84f6e2cf9,OSO_SLUG,host-it,INCLUDE
3434
0x15b210abdc6acfd99e60255792b2b78714f4e8c92c4c5e91b898d48d046212a4,OSO_SLUG,defieye,INCLUDE
35-
0x2c1d2ae68e4a718a04a41f1a9fde1ed0648602e08c150e3f72d3dc7ef22dd71a,OSO_SLUG,inkonchain,INCLUDE
35+
0x2c1d2ae68e4a718a04a41f1a9fde1ed0648602e08c150e3f72d3dc7ef22dd71a,OSO_SLUG,inkonchain,INCLUDE
36+
0x5fcb5b5c96378c69afb73677a80bf38ca5032dea8759be6f29f191945ebc3ade,DEFILLAMA_PROTOCOL,polymarket,EXCLUDE

0 commit comments

Comments
 (0)