-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
257 additions
and
6 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
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
5 changes: 5 additions & 0 deletions
5
models/metrics/stablecoins/breakdowns/daily/agg_ton_stablecoin_breakdown_daily.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,5 @@ | ||
-- depends_on: {{ ref('fact_ton_stablecoin_contracts') }} | ||
-- depends_on: {{ ref('ez_ton_address_balances_by_token') }} | ||
-- depends_on: {{ ref('ez_ton_stablecoin_transfers') }} | ||
{{ config(materialized="table", snowflake_warehouse="TON_MD") }} | ||
{{ agg_chain_stablecoin_breakdown_ton("day") }} |
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
5 changes: 5 additions & 0 deletions
5
models/metrics/stablecoins/breakdowns/monthly/agg_ton_stablecoin_breakdown_monthly.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,5 @@ | ||
-- depends_on: {{ ref('fact_ton_stablecoin_contracts') }} | ||
-- depends_on: {{ ref('ez_ton_address_balances_by_token') }} | ||
-- depends_on: {{ ref('ez_ton_stablecoin_transfers') }} | ||
{{ config(materialized="table", snowflake_warehouse="TON_MD") }} | ||
{{ agg_chain_stablecoin_breakdown_ton("month") }} |
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
5 changes: 5 additions & 0 deletions
5
models/metrics/stablecoins/breakdowns/weekly/agg_ton_stablecoin_breakdown_weekly.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,5 @@ | ||
-- depends_on: {{ ref('fact_ton_stablecoin_contracts') }} | ||
-- depends_on: {{ ref('ez_ton_address_balances_by_token') }} | ||
-- depends_on: {{ ref('ez_ton_stablecoin_transfers') }} | ||
{{ config(materialized="table", snowflake_warehouse="TON_MD") }} | ||
{{ agg_chain_stablecoin_breakdown_ton("week") }} |
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,6 @@ | ||
sources: | ||
- name: BALANCES | ||
schema: PROD_CORE | ||
database: TON | ||
tables: | ||
- name: ez_ton_current_balances |
14 changes: 14 additions & 0 deletions
14
models/projects/ton/core/ez_ton_address_balances_by_token.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,14 @@ | ||
-- depends_on: {{ ref("fact_ton_address_credit_by_token") }} | ||
-- depends_on: {{ ref("fact_ton_address_debit_by_token") }} | ||
-- depends_on: {{ source("BALANCES", "ez_ton_current_balances") }} | ||
{{ | ||
config( | ||
materialized="table", | ||
database="ton", | ||
schema="core", | ||
name="ez_address_balances_by_token", | ||
snowflake_warehouse="TON_MD", | ||
) | ||
}} | ||
|
||
{{ address_balances("ton") }} |
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,12 @@ | ||
-- depends_on: {{ ref("ez_ton_address_balances_by_token") }} | ||
{{ | ||
config( | ||
materialized="table", | ||
database="ton", | ||
schema="core", | ||
name="ez_current_balances", | ||
snowflake_warehouse="TON_MD", | ||
) | ||
}} | ||
|
||
{{ current_balances("ton") }} |
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,30 @@ | ||
{{ | ||
config( | ||
materialized="table", | ||
unique_key=["block_timestamp", "address"], | ||
snowflake_warehouse="TON_MD", | ||
) | ||
}} | ||
|
||
with ton_transfers as ( | ||
{{ | ||
dbt_utils.union_relations( | ||
relations=[ | ||
ref("ez_ton_stablecoin_transfers"), | ||
] | ||
) | ||
}} | ||
) | ||
select | ||
to_address as address, | ||
contract_address, | ||
block_timestamp, | ||
cast(amount as float) as credit, | ||
tx_hash | ||
from ton_transfers | ||
where | ||
block_timestamp < to_date(sysdate()) | ||
{% if is_incremental() %} | ||
and block_timestamp | ||
>= (select dateadd('day', -3, max(block_timestamp)) from {{ this }}) | ||
{% endif %} |
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,30 @@ | ||
{{ | ||
config( | ||
materialized="table", | ||
unique_key=["block_timestamp", "address"], | ||
snowflake_warehouse="TON_MD", | ||
) | ||
}} | ||
|
||
with ton_transfers as ( | ||
{{ | ||
dbt_utils.union_relations( | ||
relations=[ | ||
ref("ez_ton_stablecoin_transfers"), | ||
] | ||
) | ||
}} | ||
) | ||
select | ||
from_address as address, | ||
contract_address, | ||
block_timestamp, | ||
cast(amount * -1 as float) as debit, | ||
tx_hash | ||
from ton_transfers | ||
where | ||
block_timestamp < to_date(sysdate()) | ||
{% if is_incremental() %} | ||
and block_timestamp | ||
>= (select dateadd('day', -3, max(block_timestamp)) from {{ this }}) | ||
{% endif %} |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ from | |
( | ||
values | ||
( | ||
'USD₮', | ||
'USDT', | ||
'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs', | ||
6, | ||
'tether', | ||
|
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