Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sqlmesh): s7 int models #2908

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MODEL (
name metrics.int_superchain_s7_devtooling_metrics_by_project,
kind FULL,
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MODEL (
name metrics.int_superchain_s7_project_to_dependency_graph,
kind FULL,
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MODEL (
name metrics.int_superchain_s7_project_to_developer_graph,
kind FULL,
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MODEL (
name metrics.int_superchain_s7_project_to_project_graph,
kind FULL,
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MODEL (
name metrics.int_superchain_s7_trusted_developers,
kind FULL,
);
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,21 @@ MODEL (
from_address_tx,
to_address_tx,
from_address_trace,
to_address_trace,
gas_used_tx,
gas_used_trace,
gas_price
to_address_trace
)
);

select
transactions.block_timestamp,
transactions.chain as chain,
transactions.transaction_hash,
transactions.chain,
transactions.from_address as from_address_tx,
transactions.to_address as to_address_tx,
traces.from_address as from_address_trace,
traces.to_address as to_address_trace,
transactions.to_address as to_address_tx,
transactions.gas_used as gas_used_tx,
traces.gas_used as gas_used_trace,
transactions.gas_price as gas_price
transactions.gas_price as gas_price_tx
from metrics.stg_superchain__transactions as transactions
left join metrics.stg_superchain__traces as traces
on transactions.transaction_hash = traces.transaction_hash
and transactions.chain = traces.chain
on transactions.transaction_hash = traces.transaction_hash
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MODEL (
name metrics.int_superchain_events,
name metrics.int_superchain_s7_events_by_project,
description 'Events (transactions, traces, gas, etc.) involving known contracts',
kind INCREMENTAL_BY_TIME_RANGE (
time_column "time",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
-- TODO: turn this into a rolling model that includes a sample date (eg, every week)

MODEL (
name metrics.int_superchain_s7_onchain_builder_eligibility,
description "Determines if a project is eligible for measurement in the S7 onchain builder round",
kind FULL,
);


@DEF(lookback_days, 180);
@DEF(single_chain_tx_threshold, 10000);
@DEF(multi_chain_tx_threshold, 1000);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MODEL (
name metrics.int_superchain_events_by_project_and_user,
description 'Events by project and user (if known), with bots filtered out',
name metrics.int_superchain_s7_onchain_metrics_by_project,
description 'Onchain metrics by project',
kind INCREMENTAL_BY_TIME_RANGE (
time_column "time",
batch_size 90,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
MODEL (
name metrics.int_superchain_s7_onchain_user_labels,
kind FULL,
);

with user_labels as (
select
artifacts.artifact_id,
artifacts.user_source = 'FARCASTER' as is_farcaster_user,
bots.artifact_id is not null as is_bot
from metrics.int_artifacts_by_user as artifacts
left outer join @oso_source('bigquery.oso.int_superchain_potential_bots') as bots
on artifacts.artifact_id = bots.artifact_id
)

select *
from user_labels
where
is_farcaster_user = true
or is_bot = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
MODEL (
name metrics.int_superchain_s7_tvl_by_project,
description 'TVL by project (placeholder for now)',
kind FULL,
);

select
"time",
upper(tvl.to_artifact_namespace) as chain,
abp.project_id,
sum(tvl.amount) as tvl
from metrics.int_defillama_tvl_events as tvl
join metrics.int_artifacts_by_project as abp
on tvl.to_artifact_id = abp.artifact_id
where upper(tvl.from_artifact_name) in (
'USDC', 'OP', 'VELO'
)
group by 1, 2, 3
Loading