Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added alchemy smart account addresses balances #6862

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{{
config(
schema = 'alchemy'
,alias = 'smart_account_addresses'
,materialized = 'table'
,post_hook='{{ expose_spells(\'["arbitrum","ethereum","bnb","arbitrum","avalanche_c","celo","gnosis","zora","polygon","base","optimism" ]\',
"project",
"alchemy",
\'["sofiat"]\') }}'
)
}}

SELECT
blockchain,
block_time AS evt_block_time,
tx_hash AS evt_tx_hash,
sender AS address
from {{ source ('account_abstraction_erc4337', 'account_deployed') }}
WHERE factory IN (
0x000000e92d78d90000007f0082006fda09bd5f11,
0x15ba39375ee2ab563e8873c8390be6f2e2f50232,
0x62b31a01f937a88f0c5fbda7b8c913eb168e124a,
0x9406cc6185a346906296840746125a0e44976454,
0xcc0d56548ebb386da9c74c24742c08e341004e04,
0xa07b27b3d5362dfa39e58caaba6b1df6af87c400,
0x8b1b401e619f8150b5e67bbb92662daa0fedf1d3,
0x000000000000dd366cc2e4432bb998e41dfd47c7,
0x3fb7476ca9b424cff1156267eca49eb878db0b80,
0x1c5e1a984d19d693613c9c2a6346dc5af73b20d2,
0x7da65f5f89462271dc599a194e647efbce337db9,
0xab784cc3cc0339013bd064c214e71d96beb435d9,
0x5fb69a11142dbcc60affeef6081d5105f93fde27,
0x88fd18233dd8804a175dd6ba96b4720566d55680,
0x00000000f73cc02d061b54217866a2ce9c278661,
0x000000f9ee1842bb72f6bbdd75e6d3d4e3e9594c,
0x0000000000756d3e6464f5efe7e413a0af1c7474,
0x6d757b0e09ac735ce5e8601e65491c618fb0094d,
0xf7663424dd137d51287b199f372bbbdc136f77d0,
0x50585668eaa39bbdb5f6a66cf0d7c0fa25c9c0a7,
0x025bf89d9444314ef9a8fe9bf4f47137be1e0d18,
0xe77f2c7d79b2743d39ad73dc47a8e9c6416ad3f3,
0x089ff8e3e903bf9168e3e028240e27358f209103,
0xc6d91648ba1a4556399f058fefd7eb74890472df,
0x6739ecfdb523095f322f53f458a6f6bb9d4307cf,
0x2bf9454c08bb13dc52a90ec2702454bdd39a0a32,
0x6c7b28b78d59f15f8e273bd13e6554d585348783,
0x213885c2a30bc0e2fd3e42895241488eca969fb4,
0xdba8082d58f8898bf2adadd8e94a741f1e3f2a0c,
0x4e2b2185042faeffc2b5d2e5c4b5c9f58f5eac35,
0x33ddf684dcc6937ffe59d8405aa80c41fb518c5c,
0x00004ec70002a32400f8ae005a26081065620d20,
0xaee9762ce625e0a8f7b184670fb57c37bfe1d0f1,
0x00000055c0b4fa41dde26a74435ff03692292fbd,
0xa39a072e0330f940c10496546125b5e6a3b4b811,
0x92e9512b53ebd703e6fb5cdbb08436c626956ef2,
0x67df23f0c2a43bcc7727e5aa76112f286619ea0e,
0x2ea0fd6f65f791c003eb17dd2bf8e126fbbc7afa,
0x296363719922f3cbdde04f0ab4a46ce9191c4a08,
0x20ff7a4753ae6c2aeeaae9fdbe172f2b2412e9c9,
0x7c2ed23dfd82ba40161b485e165e2801daa64063,
0x387e730ac93355095d4e3458c36a492db4e5968d,
0x5fcd8f0d2585b95ad33ab15e502bcdfe3ec7438a,
0x5de4839a76cf55d0c90e2061ef4386d962e15ae3,
0x34b27be9e5945480b83a618941012e0953a2821f,
0xe9750621f19f90e50f6030da2dab5d59ff413ca7,
0x19b03a419124b77a7659a0fdab7903c6f40183e5,
0xd28ac5e35ec57479d91c85db6a0889e999ff59de,
0x8a8efcdccc48a25bb3b4a8e254cc69873a9e5c4d,
0xc68b2ea1a70bb5ace45e94225acb83d661978fec,
0x4e4946298614fc299b50c947289f4ad0572cb9ce,
0xfef1c57185393f456eaeca363a0d3c12cd8df07b,
0x10aee81389206d9b0e4d7d41d3e7fc6d83bdcf78,
0x750fb9b4677160eb9a9740fd088c536407d34022,
0xae0c37a4fca2ce9a4537f550afa90645874acab6,
0x000000a56aaca3e9a4c479ea6b6cd0dbcb6634f5,
0x000000893a26168158fbeadd9335be5bc96592e2,
0x4a0bb243c3443b7507ae59f077f5bd96cd59a113,
0x23ed703451291a9425d493ffe09cb31f61b3f25a,
0x1754c5d08cb580e77aa5eff071be9019b28b4c4b,
0xc2f576a7bb26d816b2c630d4feca649b26916ea1,
0x52f6aedc6a07c6d66071f2d0e8a22b9a1dca2479,
0xc5933e7f618ed520b251b1fb45d24a37332441b7,
0x05433031f757a32c9c298935c7644d108ba1980c,
0xdfdc32df5649db7f78a3366f0cf4adad04c3f59b,
0x9d07c3502f6b3e181784d8d19653c3f17548c9e8,
0x93ff202cc441341877e0703b26e169a00f64be97,
0xf541edf82b6063603cd10e2b3f4fc2c548cd77be,
0xc71eec16cf9e4925ea27e3dd6719fbd8a4d016e2,
0xcad776fce9c3b3db6724aeb4c7fa2f5f3c088253,
0x832faeeecfe62feeb6703cc17d354e6edcfe8e93,
0x4e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec67
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 2

models:
- name: alchemy_smart_account_addresses

meta:
blockchain: arbitrum, ethereum, bnb, avalanche_c, celo, gnosis, zora, polygon, base, optimism
sector: alchemy
project: alchemy
contributors: sofiat

config:
tags: ['alchemy', 'addresses', 'smart_accounts']
description: "addresses of alchemy smart accounts"
columns:
- &blockchain
name: blockchain
description: "Blockchain for which the address was created"
- &evt_block_time
name: day
description: "Date on which the address was created"
- &tx_hash
name: tx_hash
description: "The txhash for the created address"
- &address
name: address
description: "The address created"
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{{
config(
schema = 'alchemy_ethereum',
alias = 'balances',
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['day', 'address', 'token_address', 'unique_key_id'],
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')]
)
}}

with
alchemy_addresses as (
select
address
from {{ref('alchemy_smart_account_addresses')}}
)

,balances as (
{{
balances_incremental_subset_daily(
blockchain = 'ethereum',
address_list = 'alchemy_addresses',
start_date = '2023-04-13'
)
}}
)

select
*,
coalesce(token_id, uint256 '1') as unique_key_id ---using this to add a unique key to the table as erc20 has no token_id
from balances
where 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 )
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: 2

models:
- name: alchemy_ethereum_balances

meta:
blockchain: ethereum
sector: alchemy
project: alchemy
contributors: sofiat

config:
tags: ['alchemy', 'balances']
description: "Balances of alchemy smart account addresses"
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- day
- address
- token_address
- unique_key_id
columns:
- &blockchain
name: blockchain
description: "Blockchain for 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"
- &unique_key_id
name: unique_key_id
description: " unique key to the table as erc20 has no token_id"
4 changes: 4 additions & 0 deletions sources/_subprojects_outputs/hourly_spellbook/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ sources:
- name: jelly_swap_sei
tables:
- name: pools_metrics_daily

- name: account_abstraction_erc4337
tables:
- name: account_deployed
Loading