Skip to content

Commit

Permalink
Merge pull request #89 from Artemis-xyz/add-swell
Browse files Browse the repository at this point in the history
Add Swell
  • Loading branch information
0xnirmal authored May 20, 2024
2 parents 17eb024 + 01b5a73 commit 147056c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions models/data_hubs/fact_daily_app_datahub.sql
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ with
ref("fact_lido_staked_eth_count_with_USD_and_change_gold"),
ref("fact_meth_staked_eth_count_with_USD_and_change_gold"),
ref("fact_binance_staked_eth_count_with_usd_and_change"),
ref("fact_sweth_staked_eth_count_with_usd_and_change"),
ref("fact_rocketpool_staked_eth_count_with_USD_and_change_gold"),
ref("fact_frax_staked_eth_count_with_USD_and_change_gold"),
ref("fact_stakewise_staked_eth_count_with_USD_and_change_gold"),
Expand Down
6 changes: 6 additions & 0 deletions models/staging/swell/__sweth_staked_eth__sources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sources:
- name: PROD_LANDING
schema: PROD_LANDING
database: LANDING_DATABASE
tables:
- name: raw_sweth_staked_count_ethereum
18 changes: 18 additions & 0 deletions models/staging/swell/fact_sweth_staked_eth_count.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{ config(materialized="table") }}
-- depends_on: {{ source("PROD_LANDING", "raw_sweth_staked_count_ethereum") }}
with raw_eth_supply as (
{{ raw_partitioned_array_to_fact_table_many_columns('landing_database.prod_landing.raw_sweth_staked_count_ethereum', 'date', ['totalSupply', 'swETHToETHRate']) }}
),
eth_supply as (
select
date,
totalSupply * swETHToETHRate as total_supply
from raw_eth_supply
),
eth_supply_forward_filled as (
{{ forward_fill('date', 'total_supply', 'eth_supply') }}
)
select
eth_supply_forward_filled.date as date,
coalesce(eth_supply_forward_filled.value, 0) as total_supply
from eth_supply_forward_filled
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{ config(materialized="table") }}

select *, 'ethereum' as chain, 'sweth' as app, 'DeFi' as category
from (
{{ calc_staked_eth('fact_sweth_staked_eth_count') }}
)

0 comments on commit 147056c

Please sign in to comment.