-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Safe Balances for Scroll (#7250)
* Update safe_scroll_schema.yml * Create safe_scroll_balances * Rename safe_scroll_balances to safe_scroll_balances.sql --------- Co-authored-by: Huang Geyang <Sukebeta@outlook.com>
- Loading branch information
1 parent
231a014
commit 5e397b7
Showing
2 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
dbt_subprojects/hourly_spellbook/models/_project/safe/scroll/safe_scroll_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,36 @@ | ||
{{ | ||
config( | ||
schema = 'safe_scroll', | ||
alias = 'balances', | ||
partition_by = ['day'], | ||
materialized = 'incremental', | ||
file_format = 'delta', | ||
incremental_strategy = 'merge', | ||
unique_key = ['day', 'address', 'token_address'], | ||
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')] | ||
) | ||
}} | ||
|
||
with safes as ( | ||
select | ||
address, | ||
blockchain | ||
from {{ ref('safe_scroll_safes') }} | ||
where blockchain = 'scroll' | ||
), | ||
|
||
balances as ( | ||
{{ | ||
balances_incremental_subset_daily( | ||
blockchain = 'scroll', | ||
address_list = 'safes', | ||
start_date = '2021-07-01' | ||
) | ||
}} | ||
) | ||
|
||
select * from balances | ||
where token_standard in ('native', 'erc20') | ||
and token_address not in ( | ||
0xd74f5255d557944cf7dd0e45ff521520002d5748, --$9.8B were minted in a hack in 2023, all of which are stored in a Safe. Filtering out. | ||
0xe9689028ede16c2fdfe3d11855d28f8e3fc452a3 ) |
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