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

Remove Unncessary starknet + mantle models #204

Merged
merged 3 commits into from
Jun 18, 2024
Merged
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
2 changes: 0 additions & 2 deletions models/data_hubs/fact_daily_chain_datahub.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ with
{{
dbt_utils.union_relations(
relations=[
ref("agg_daily_polygon_zk_revenue_gold"),
ref("agg_daily_gnosis_revenue_gold"),
ref("fact_linea_contracts_gold"),
ref("fact_zora_contracts_gold"),
Expand Down Expand Up @@ -39,7 +38,6 @@ with
ref("fact_fantom_txns_gold"),
ref("fact_fuse_daa_txns_gas_gas_usd_gold"),
ref("fact_flow_daa_txns_gold"),
ref("fact_polygon_zk_daa_txns_gas_usd_gold"),
ref("ez_tron_metrics"),
ref("fact_scroll_daa_gold"),
ref("fact_scroll_gas_gas_usd_revenue_gold"),
Expand Down

This file was deleted.

23 changes: 0 additions & 23 deletions models/metrics/revenue/_test_agg_daily_polygon_zk_revenue.yml

This file was deleted.

20 changes: 0 additions & 20 deletions models/metrics/revenue/agg_daily_polygon_zk_revenue.sql

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions models/projects/arbitrum/core/ez_arbitrum_metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ select
fees,
l1_data_cost_native, -- fees paid to l1 by sequencer (L1 Fees)
l1_data_cost,
fees_native - l1_data_cost_native as revenue_native, -- supply side: fees paid to squencer - fees paied to l1 (L2 Revenue)
fees - l1_data_cost as revenue,
coalesce(fees_native, 0) - l1_data_cost_native as revenue_native, -- supply side: fees paid to squencer - fees paied to l1 (L2 Revenue)
coalesce(fees, 0) - l1_data_cost as revenue,
avg_txn_fee,
returning_users,
new_users,
Expand Down
4 changes: 2 additions & 2 deletions models/projects/base/core/ez_base_metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ select
fees,
l1_data_cost_native, -- fees paid to l1 by sequencer (L1 Fees)
l1_data_cost,
fees_native - l1_data_cost_native as revenue_native, -- supply side: fees paid to squencer - fees paied to l1 (L2 Revenue)
fees - l1_data_cost as revenue,
coalesce(fees_native, 0) - l1_data_cost_native as revenue_native, -- supply side: fees paid to squencer - fees paied to l1 (L2 Revenue)
coalesce(fees, 0) - l1_data_cost as revenue,
avg_txn_fee,
returning_users,
new_users,
Expand Down
4 changes: 2 additions & 2 deletions models/projects/blast/core/ez_blast_metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ select
fees,
l1_data_cost_native,
l1_data_cost,
fees_native - l1_data_cost_native as revenue_native, -- supply side: fees paid to squencer - fees paied to l1 (L2 Revenue)
fees - l1_data_cost as revenue,
coalesce(fees_native, 0) - l1_data_cost_native as revenue_native, -- supply side: fees paid to squencer - fees paied to l1 (L2 Revenue)
coalesce(fees, 0) - l1_data_cost as revenue,
returning_users,
new_users,
low_sleep_users,
Expand Down
4 changes: 2 additions & 2 deletions models/projects/optimism/core/ez_optimism_metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ select
fees,
l1_data_cost_native, -- fees paid to l1 by sequencer (L1 Fees)
l1_data_cost,
fees_native - l1_data_cost_native as revenue_native, -- supply side: fees paid to squencer - fees paied to l1 (L2 Revenue)
fees - l1_data_cost as revenue,
coalesce(fees_native, 0) - l1_data_cost_native as revenue_native, -- supply side: fees paid to squencer - fees paied to l1 (L2 Revenue)
coalesce(fees, 0) - l1_data_cost as revenue,
avg_txn_fee,
sybil_users,
non_sybil_users,
Expand Down
13 changes: 6 additions & 7 deletions models/projects/polygon_zk/core/ez_polygon_zk_metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ with
),
price_data as ({{ get_coingecko_metrics("matic-network") }}),
defillama_data as ({{ get_defillama_metrics("polygon zkevm") }}),
revenue_data as (
l1_data_cost as (
select
date,
expenses_native as l1_data_cost_native,
expenses as l1_data_cost,
revenue
from {{ ref("agg_daily_polygon_zk_revenue") }}
l1_data_cost_native,
l1_data_cost
from {{ ref("fact_polygon_zk_l1_data_cost") }}
),
github_data as ({{ get_github_metrics("Polygon Hermez") }})
select
Expand All @@ -32,7 +31,7 @@ select
l1_data_cost_native,
l1_data_cost,
fees,
revenue,
coalesce(fees, 0) - l1_data_cost as revenue,
price,
market_cap,
fdmc,
Expand All @@ -45,6 +44,6 @@ select
from fundamental_data
left join price_data on fundamental_data.date = price_data.date
left join defillama_data on fundamental_data.date = defillama_data.date
left join revenue_data on fundamental_data.date = revenue_data.date
left join l1_data_cost on fundamental_data.date = l1_data_cost.date
left join github_data on fundamental_data.date = github_data.date
where fundamental_data.date < to_date(sysdate())
8 changes: 4 additions & 4 deletions models/projects/starknet/core/ez_starknet_metrics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ with
price_data as ({{ get_coingecko_metrics("starknet") }}),
defillama_data as ({{ get_defillama_metrics("starknet") }}),
expenses_data as (
select date, chain, l1_data_cost_native, l1_data_cost, revenue_native, revenue
from {{ ref("agg_daily_starknet_revenue") }}
select date, chain, l1_data_cost_native, l1_data_cost
from {{ ref("fact_starknet_l1_data_cost") }}
),
github_data as ({{ get_github_metrics("starknet") }})

Expand All @@ -27,8 +27,8 @@ select
fees,
l1_data_cost_native, -- fees paid to l1 by sequencer (L1 Fees)
l1_data_cost,
revenue_native, -- supply side: fees paid to squencer - fees paied to l1 (L2 Revenue)
revenue,
coalesce(fees_native, 0) - l1_data_cost_native as revenue_native, -- supply side: fees paid to squencer - fees paied to l1 (L2 Revenue)
coalesce(fees, 0) - l1_data_cost as revenue,
avg_txn_fee,
returning_users,
new_users,
Expand Down

This file was deleted.

24 changes: 24 additions & 0 deletions models/staging/polygon_zk/fact_polygon_zk_l1_data_cost.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{ config(materialized="incremental", unique_key="date") }}
with
expenses as (
select raw_date as date, sum(tx_fee) as fees_native, sum(gas_usd) as fees
from {{ ref("ez_ethereum_transactions") }}
where
lower(contract_address)
in (lower('0x5132A183E9F3CB7C848b0AAC5Ae0c4f0491B7aB2'))
group by raw_date
order by raw_date desc
)
select
date,
fees_native as l1_data_cost_native,
fees as l1_data_cost,
'polygon_zk' as chain
from expenses
where expenses.date < to_date(sysdate())
{% if is_incremental() %}
and expenses.date >= (
select dateadd('day', -5, max(date))
from {{ this }}
)
{% endif %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ config(materialized="table", unique_key="date") }}
{{ config(materialized="incremental", unique_key="date") }}
with
starknet_data as (
select raw_date as date, sum(tx_fee) as fees_native, sum(gas_usd) as fees
Expand All @@ -16,12 +16,14 @@ with
)
select
starknet_data.date,
coalesce(starknet.fees_native, 0) - starknet_data.fees_native as revenue_native,
starknet.fees - starknet_data.fees as revenue,
starknet_data.fees_native as l1_data_cost_native,
starknet_data.fees as l1_data_cost,
'starknet' as chain
from starknet_data
left join
{{ ref("agg_daily_starknet_fundamental_usage") }} as starknet on starknet_data.date = starknet.date
where starknet_data.date < to_date(sysdate()) and revenue is not null
where starknet_data.date < to_date(sysdate())
{% if is_incremental() %}
and starknet_data.date >= (
select dateadd('day', -5, max(date))
from {{ this }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sunny77D In our incremental logic, any particular reason why we do -5 vs. -3 instead of just look at the MAX(DATE)?

)
{% endif %}
Loading