-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init stablecoin balances evm chains * remove blast * remove gnosis & fantom * remove duplicate entry * handle duplicate entries * open time limit * remove optimism model * fix naming * update decimals
- Loading branch information
1 parent
07548db
commit a02c461
Showing
17 changed files
with
697 additions
and
4 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...aily_spellbook/models/_sector/stablecoins/avalance_c/stablecoins_avalanche_c_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,38 @@ | ||
{{ | ||
config( | ||
schema = 'stablecoins_avalanche_c', | ||
alias = 'balances', | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['day', 'address', 'token_address', 'blockchain'], | ||
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')] | ||
) | ||
}} | ||
|
||
with | ||
stablecoin_tokens as ( | ||
select distinct | ||
symbol, | ||
contract_address as token_address | ||
from | ||
{{ source('tokens_avalanche_c', 'erc20_stablecoins')}} | ||
) | ||
|
||
,balances as ( | ||
{{ | ||
balances_incremental_subset_daily( | ||
blockchain = 'avalanche_c', | ||
token_list = 'stablecoin_tokens', | ||
start_date = '2021-01-27' | ||
) | ||
}} | ||
) | ||
|
||
select | ||
t.symbol | ||
,b.* | ||
from balances b | ||
left join stablecoin_tokens t | ||
on b.token_address = t.token_address | ||
|
62 changes: 62 additions & 0 deletions
62
.../daily_spellbook/models/_sector/stablecoins/avalance_c/stablecoins_avalanche_c_schema.yml
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,62 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: stablecoins_avalanche_c_balances | ||
|
||
meta: | ||
blockchain: avalanche_c | ||
sector: stablecoin | ||
project: stablecoin | ||
contributors: synthquest | ||
|
||
config: | ||
tags: ['stablecoin', 'balances'] | ||
description: "Balances of stablecoin token holders" | ||
tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- day | ||
- address | ||
- token_address | ||
columns: | ||
- &blockchain | ||
name: blockchain | ||
description: "Blockchain for the token" | ||
- &symbol | ||
name: symbol | ||
description: "Symbol for the token" | ||
- &version | ||
name: version | ||
description: "Version of the token" | ||
- &day | ||
name: day | ||
description: "Date on which the token balance is logged" | ||
- &address | ||
name: address | ||
description: "Address for the token holder" | ||
- &token_symbol | ||
name: token_symbol | ||
description: "Symbol for the token" | ||
- &token_address | ||
name: token_address | ||
description: "Address for the token" | ||
- &token_standard | ||
name: token_standard | ||
description: "Standard for the token" | ||
- &token_id | ||
name: token_id | ||
description: "ID for the token" | ||
- &balance | ||
name: balance | ||
description: "Balance for the user" | ||
- &balance_usd | ||
name: balance_usd | ||
description: "USD value of balance for the user" | ||
- &last_updated | ||
name: last_updated | ||
description: "UTC timestamp when data was last updated" | ||
- &next_update | ||
name: next_update | ||
description: "UTC timestamp when data is next updated" | ||
|
||
|
38 changes: 38 additions & 0 deletions
38
...subprojects/daily_spellbook/models/_sector/stablecoins/base/stablecoins_base_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,38 @@ | ||
{{ | ||
config( | ||
schema = 'stablecoins_base', | ||
alias = 'balances', | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['day', 'address', 'token_address', 'blockchain'], | ||
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')] | ||
) | ||
}} | ||
|
||
with | ||
stablecoin_tokens as ( | ||
select distinct | ||
symbol, | ||
contract_address as token_address | ||
from | ||
{{ source('tokens_base', 'erc20_stablecoins')}} | ||
) | ||
|
||
,balances as ( | ||
{{ | ||
balances_incremental_subset_daily( | ||
blockchain = 'base', | ||
token_list = 'stablecoin_tokens', | ||
start_date = '2023-07-20' | ||
) | ||
}} | ||
) | ||
|
||
select | ||
t.symbol | ||
,b.* | ||
from balances b | ||
left join stablecoin_tokens t | ||
on b.token_address = t.token_address | ||
|
62 changes: 62 additions & 0 deletions
62
dbt_subprojects/daily_spellbook/models/_sector/stablecoins/base/stablecoins_base_schema.yml
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,62 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: stablecoins_base_balances | ||
|
||
meta: | ||
blockchain: base | ||
sector: stablecoin | ||
project: stablecoin | ||
contributors: synthquest | ||
|
||
config: | ||
tags: ['stablecoin', 'balances'] | ||
description: "Balances of stablecoin token holders" | ||
tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- day | ||
- address | ||
- token_address | ||
columns: | ||
- &blockchain | ||
name: blockchain | ||
description: "Blockchain for the token" | ||
- &symbol | ||
name: symbol | ||
description: "Symbol for the token" | ||
- &version | ||
name: version | ||
description: "Version of the token" | ||
- &day | ||
name: day | ||
description: "Date on which the token balance is logged" | ||
- &address | ||
name: address | ||
description: "Address for the token holder" | ||
- &token_symbol | ||
name: token_symbol | ||
description: "Symbol for the token" | ||
- &token_address | ||
name: token_address | ||
description: "Address for the token" | ||
- &token_standard | ||
name: token_standard | ||
description: "Standard for the token" | ||
- &token_id | ||
name: token_id | ||
description: "ID for the token" | ||
- &balance | ||
name: balance | ||
description: "Balance for the user" | ||
- &balance_usd | ||
name: balance_usd | ||
description: "USD value of balance for the user" | ||
- &last_updated | ||
name: last_updated | ||
description: "UTC timestamp when data was last updated" | ||
- &next_update | ||
name: next_update | ||
description: "UTC timestamp when data is next updated" | ||
|
||
|
38 changes: 38 additions & 0 deletions
38
...cts/daily_spellbook/models/_sector/stablecoins/ethereum/stablecoins_ethereum_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,38 @@ | ||
{{ | ||
config( | ||
schema = 'stablecoins_ethereum', | ||
alias = 'balances', | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['day', 'address', 'token_address', 'blockchain'], | ||
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')] | ||
) | ||
}} | ||
|
||
with | ||
stablecoin_tokens as ( | ||
select distinct | ||
symbol, | ||
contract_address as token_address | ||
from | ||
{{ source('tokens_ethereum', 'erc20_stablecoins')}} | ||
) | ||
|
||
,balances as ( | ||
{{ | ||
balances_incremental_subset_daily( | ||
blockchain = 'ethereum', | ||
token_list = 'stablecoin_tokens', | ||
start_date = '2017-11-26' | ||
) | ||
}} | ||
) | ||
|
||
select | ||
t.symbol | ||
,b.* | ||
from balances b | ||
left join stablecoin_tokens t | ||
on b.token_address = t.token_address | ||
|
62 changes: 62 additions & 0 deletions
62
...jects/daily_spellbook/models/_sector/stablecoins/ethereum/stablecoins_ethereum_schema.yml
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,62 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: stablecoins_ethereum_balances | ||
|
||
meta: | ||
blockchain: ethereum | ||
sector: stablecoin | ||
project: stablecoin | ||
contributors: synthquest | ||
|
||
config: | ||
tags: ['stablecoin', 'balances'] | ||
description: "Balances of stablecoin token holders" | ||
tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- day | ||
- address | ||
- token_address | ||
columns: | ||
- &blockchain | ||
name: blockchain | ||
description: "Blockchain for the token" | ||
- &symbol | ||
name: symbol | ||
description: "Symbol for the token" | ||
- &version | ||
name: version | ||
description: "Version of the token" | ||
- &day | ||
name: day | ||
description: "Date on which the token balance is logged" | ||
- &address | ||
name: address | ||
description: "Address for the token holder" | ||
- &token_symbol | ||
name: token_symbol | ||
description: "Symbol for the token" | ||
- &token_address | ||
name: token_address | ||
description: "Address for the token" | ||
- &token_standard | ||
name: token_standard | ||
description: "Standard for the token" | ||
- &token_id | ||
name: token_id | ||
description: "ID for the token" | ||
- &balance | ||
name: balance | ||
description: "Balance for the user" | ||
- &balance_usd | ||
name: balance_usd | ||
description: "USD value of balance for the user" | ||
- &last_updated | ||
name: last_updated | ||
description: "UTC timestamp when data was last updated" | ||
- &next_update | ||
name: next_update | ||
description: "UTC timestamp when data is next updated" | ||
|
||
|
38 changes: 38 additions & 0 deletions
38
...bprojects/daily_spellbook/models/_sector/stablecoins/linea/stablecoins_linea_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,38 @@ | ||
{{ | ||
config( | ||
schema = 'stablecoins_linea', | ||
alias = 'balances', | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['day', 'address', 'token_address', 'blockchain'], | ||
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')] | ||
) | ||
}} | ||
|
||
with | ||
stablecoin_tokens as ( | ||
select distinct | ||
symbol, | ||
contract_address as token_address | ||
from | ||
{{ source('tokens_linea', 'erc20_stablecoins')}} | ||
) | ||
|
||
,balances as ( | ||
{{ | ||
balances_incremental_subset_daily( | ||
blockchain = 'linea', | ||
token_list = 'stablecoin_tokens', | ||
start_date = '2023-07-13' | ||
) | ||
}} | ||
) | ||
|
||
select | ||
t.symbol | ||
,b.* | ||
from balances b | ||
left join stablecoin_tokens t | ||
on b.token_address = t.token_address | ||
|
Oops, something went wrong.