-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stablecoin V2: Optimism Pipeline (#318)
- Loading branch information
1 parent
d03bff8
commit 26207da
Showing
9 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% macro genesis_stablecoin_balances(source_table, genesis_timestamp) %} | ||
|
||
select | ||
'{{genesis_timestamp}}'::timestamp as block_timestamp | ||
, lower(value:contract_address::string) as contract_address | ||
, lower(value:address::string) as address | ||
, value:balance::float as balance | ||
from {{ source("PROD_LANDING", source_table)}}, | ||
lateral flatten(input => parse_json(source_json)) | ||
where extraction_date = (select max(extraction_date) from {{ source("PROD_LANDING", source_table)}}) | ||
{% endmacro %} |
13 changes: 13 additions & 0 deletions
13
models/projects/optimism/core/ez_optimism_stablecoin_metrics_by_address.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{ | ||
config( | ||
materialized="incremental", | ||
unique_key="unique_id", | ||
database="optimism", | ||
schema="core", | ||
alias="ez_stablecoin_metrics_by_address", | ||
snowflake_warehouse="STABLECOIN_V2_LG_2", | ||
) | ||
}} | ||
|
||
|
||
{{stablecoin_metrics("optimism")}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
models/staging/optimism/fact_optimism_genesis_stablecoin_balances.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{ config(materialized="table") }} | ||
|
||
{% set genesis_timestamp = "2021-11-10 00:00:00.000" %} | ||
|
||
with | ||
dai as ({{genesis_stablecoin_balances("raw_optimism_genesis_dai_stablecoin_balances", genesis_timestamp)}}) | ||
|
||
, usdce as ({{genesis_stablecoin_balances("raw_optimism_genesis_usdce_stablecoin_balances", genesis_timestamp)}}) | ||
|
||
, usdt as ({{genesis_stablecoin_balances("raw_optimism_genesis_usdt_stablecoin_balances", genesis_timestamp)}}) | ||
|
||
select * from dai | ||
union all | ||
select * from usdce | ||
union all | ||
select * from usdt |
10 changes: 10 additions & 0 deletions
10
models/staging/optimism/fact_optimism_stablecoin_balances.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{{ | ||
config( | ||
materialized="incremental", | ||
unique_key="unique_id", | ||
snowflake_warehouse="STABLECOIN_V2_LG_2", | ||
) | ||
}} | ||
|
||
|
||
{{stablecoin_balances("optimism")}} |
10 changes: 10 additions & 0 deletions
10
models/staging/optimism/fact_optimism_stablecoin_metrics_all.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{{ | ||
config( | ||
materialized="incremental", | ||
unique_key="unique_id", | ||
snowflake_warehouse="STABLECOIN_V2_LG_2", | ||
) | ||
}} | ||
|
||
|
||
{{stablecoin_metrics_all("optimism")}} |
10 changes: 10 additions & 0 deletions
10
models/staging/optimism/fact_optimism_stablecoin_metrics_artemis.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{{ | ||
config( | ||
materialized="incremental", | ||
unique_key="unique_id", | ||
snowflake_warehouse="STABLECOIN_V2_LG_2", | ||
) | ||
}} | ||
|
||
|
||
{{stablecoin_metrics_p2p("optimism")}} |
10 changes: 10 additions & 0 deletions
10
models/staging/optimism/fact_optimism_stablecoin_metrics_p2p.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{{ | ||
config( | ||
materialized="incremental", | ||
unique_key="unique_id", | ||
snowflake_warehouse="STABLECOIN_V2_LG_2", | ||
) | ||
}} | ||
|
||
|
||
{{stablecoin_metrics_p2p("optimism")}} |