Skip to content

Commit

Permalink
Stablecoin V2: BSC and Pricing (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebMelendez01 authored Aug 5, 2024
1 parent a41f404 commit 35855b2
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 6 deletions.
4 changes: 2 additions & 2 deletions macros/stablecoins/stablecoin_balances.sql
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ with
, st.symbol
, stablecoin_supply as stablecoin_supply_native
, stablecoin_supply * coalesce(
d.token_current_price, 1
d.shifted_token_price_usd, 1
) as stablecoin_supply
from historical_supply_by_address_balances st
left join {{ ref( "fact_" ~ chain ~ "_stablecoin_contracts") }} c
on lower(st.contract_address) = lower(c.contract_address)
left join {{ ref( "fact_coingecko_token_realtime_data") }} d
left join {{ ref( "fact_coingecko_token_date_adjusted_gold") }} d
on lower(c.coingecko_id) = lower(d.token_id)
and st.date = d.date::date
)
Expand Down
4 changes: 2 additions & 2 deletions macros/stablecoins/stablecoin_metrics_all.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ with
, stablecoin_metrics.symbol
, from_address
, stablecoin_transfer_volume * coalesce(
d.token_current_price, 1
d.shifted_token_price_usd, 1
) as stablecoin_transfer_volume
, stablecoin_daily_txns
from stablecoin_metrics
left join {{ ref( "fact_" ~ chain ~ "_stablecoin_contracts") }} c
on lower(stablecoin_metrics.contract_address) = lower(c.contract_address)
left join {{ ref( "fact_coingecko_token_realtime_data") }} d
left join {{ ref( "fact_coingecko_token_date_adjusted_gold") }} d
on lower(c.coingecko_id) = lower(d.token_id)
and stablecoin_metrics.date = d.date::date
)
Expand Down
4 changes: 2 additions & 2 deletions macros/stablecoins/stablecoin_metrics_artemis.sql
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ with
, stablecoin_metrics.symbol
, from_address
, stablecoin_transfer_volume * coalesce(
d.token_current_price, 1
d.shifted_token_price_usd, 1
) as stablecoin_transfer_volume
, stablecoin_daily_txns
from stablecoin_metrics
left join {{ ref( "fact_" ~ chain ~ "_stablecoin_contracts") }} c
on lower(stablecoin_metrics.contract_address) = lower(c.contract_address)
left join {{ ref( "fact_coingecko_token_realtime_data") }} d
left join {{ ref( "fact_coingecko_token_date_adjusted_gold") }} d
on lower(c.coingecko_id) = lower(d.token_id)
and stablecoin_metrics.date = d.date::date
)
Expand Down
9 changes: 9 additions & 0 deletions models/staging/bsc/fact_bsc_p2p_stablecoin_transfers.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--depends_on: {{ ref("fact_bsc_stablecoin_transfers") }}
{{
config(
materialized="incremental",
unique_key=["tx_hash", "index"],
)
}}

{{ p2p_stablecoin_transfers("bsc") }}
10 changes: 10 additions & 0 deletions models/staging/bsc/fact_bsc_stablecoin_balances.sql
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("bsc")}}
10 changes: 10 additions & 0 deletions models/staging/bsc/fact_bsc_stablecoin_metrics_all.sql
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("bsc")}}
10 changes: 10 additions & 0 deletions models/staging/bsc/fact_bsc_stablecoin_metrics_artemis.sql
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_artemis("bsc")}}
10 changes: 10 additions & 0 deletions models/staging/bsc/fact_bsc_stablecoin_metrics_p2p.sql
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("bsc")}}

0 comments on commit 35855b2

Please sign in to comment.