Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b6be3b8
STREAM-1051 added ez_native_transfers live view deployment macro
ShahNewazKhan Oct 9, 2024
d50042e
STREAM-1051 add deploy eth_sepolia make directive
ShahNewazKhan Oct 9, 2024
f4ed98e
rm Makefile
ShahNewazKhan Oct 9, 2024
f825fad
update evm live views tf
jensenity Oct 10, 2024
3b37b90
[STREAM-1050] fix macros for bronze & silver
jensenity Oct 10, 2024
00764d7
[STREAM-1050] fix alias in macros
jensenity Oct 10, 2024
c965d5e
[STREAM-1052] add live view fact blocks
jensenity Oct 11, 2024
ee208b8
[STREAM-1049] fix tx's source table error
jensenity Oct 11, 2024
f4b9680
[STREAM-1052] update generator to get 1000 rows/blocks per call
jensenity Oct 11, 2024
c9699bb
[STREAM-1052] fix typo
jensenity Oct 11, 2024
7d3b476
[STREAM-1052] rename table functions
jensenity Oct 11, 2024
abc1bfb
[STREAM-1052] fix min heights
jensenity Oct 11, 2024
f05c5ae
[STREAM-1055] add demo plotcard app to show latest block number with …
jensenity Oct 11, 2024
5bc156e
[STREAM-1061] Add EVM Decoded Logs udtf
jensenity Oct 14, 2024
5f956ce
STREAM-1051 add ez_native_transfers sql
ShahNewazKhan Oct 15, 2024
6657352
STREAM-1051 Rename UDTF args
ShahNewazKhan Oct 15, 2024
e980409
STREAM-1062 add fact_traces UDTF
ShahNewazKhan Oct 15, 2024
b1dc0f8
STREAM-1062 fix tf_fact_traces signature to match return column aliases
ShahNewazKhan Oct 16, 2024
06e8fe8
STREAM-1053 Add fact_transactions UDTF
ShahNewazKhan Oct 16, 2024
baf6d7d
STREAM-1049 Secrets interpolate fact_blocks macros
ShahNewazKhan Oct 16, 2024
678d9d2
STREAM-1049 Add secrets interpoation for fact_logs & fact_decoded_eve…
ShahNewazKhan Oct 17, 2024
5196c3e
STREAM-1049 Added secrets interpolation to fact_traces, fact_transact…
ShahNewazKhan Oct 17, 2024
ad8d989
add discrepent columns between gold and livequery
jensenity Oct 17, 2024
914ab56
fix cols
jensenity Oct 17, 2024
ffc0e50
remove contract_name
jensenity Oct 17, 2024
166834a
STREAM-1053 Refactor fact_transactions to use reusable LiveView CTE's
ShahNewazKhan Oct 17, 2024
212f49e
STREAM-1053 Fix refactored reusable CTE column references
ShahNewazKhan Oct 17, 2024
6f19eb0
remove ez_token_transfers_id from signature
jensenity Oct 17, 2024
2fb84f1
STREAM-1049 Pin view columns for mapping_tables
ShahNewazKhan Oct 17, 2024
87b8eda
STREAM-1062 Refactor fact_traces UDTF SQL | Add evm_live_view_bronze_…
ShahNewazKhan Oct 17, 2024
cf31340
STREAM-1051 Refactor ez_native_transfers to use reusable CTE macros
ShahNewazKhan Oct 17, 2024
75520af
rename fact logs to fact event logs
jensenity Oct 18, 2024
b37d7ba
[STREAM-1065] Add ez decoded event logs
jensenity Oct 18, 2024
1dd3541
remove wave apps folder
jensenity Oct 18, 2024
57ee368
[STREAM-1068] Add fact token balances
jensenity Oct 24, 2024
4684077
[STREAM-1068] update logic on balance
jensenity Oct 25, 2024
95aa3a7
[STREAM-1069] Add fact eth balance livequery
jensenity Oct 27, 2024
cc79aca
[STREAM-1070] add fact decode traces livequery
jensenity Nov 4, 2024
30e9964
revert requirements
jensenity Nov 4, 2024
dfc5d61
Fix typo in README.md and update macro in evm_live_views.sql to fix `…
Triangulum9r Nov 5, 2024
ea9b4ca
fix typo in readme.md
ShahNewazKhan Nov 6, 2024
d381ce8
add batch calls in bronze blocks and logs
jensenity Nov 6, 2024
14f52fc
update evm_live_view_target_blocks macro to accept batch_size parameter
Triangulum9r Nov 6, 2024
eb94d0f
refactor evm_live_view_bronze_blocks macro to include blockchain and …
Triangulum9r Nov 6, 2024
1d85053
refactor evm_live_views.sql to improve batch processing and remove un…
Triangulum9r Nov 6, 2024
7e1ff90
add batch call to debug trace call
jensenity Nov 7, 2024
8580a67
fix missing alias
jensenity Nov 7, 2024
f417a2d
add batch trace, eth balance & token balance
jensenity Nov 7, 2024
da8e648
fix bug in duplicate rows
jensenity Nov 12, 2024
c65d739
revert changes in join logic
jensenity Nov 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ dbt-env/
.env
.*
# KEEP
!.github/
!.github/

# Ignore Python bytecode files
*.pyc
__pycache__/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ When False, none of the on-run-start macros are executed on model run
Default values are False

* Usage:
`dbt run --var '{"UPDATE_UDFS_AND_SPS":True}' -m ...`
`dbt run --vars '{"UPDATE_UDFS_AND_SPS":True}' -m ...`

Dropping and creating udfs can also be done without running a model:

Expand Down
14 changes: 13 additions & 1 deletion macros/core/utils.yaml.sql
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@
RETURNS NULL ON NULL INPUT
sql: evm/decode/log

- name: {{ schema }}.udf_evm_decode_trace
signature:
- [abi, OBJECT]
- [data, OBJECT]
return_type: ARRAY
func_type: EXTERNAL
api_integration: '{{ var("API_INTEGRATION") }}'
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
sql: evm/decode/trace

- name: {{ schema }}.udf_base58_to_hex
signature:
- [base58, STRING]
Expand Down Expand Up @@ -294,4 +306,4 @@
sql: |
{{ create_udf_binary_to_int() | indent(4) }}

{% endmacro %}
{% endmacro %}
174 changes: 167 additions & 7 deletions macros/evm/evm.yaml.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
COMMENT = $$Returns the native asset balance at the latest block for a given address.$$
sql: |
{{ evm_latest_native_balance_string(schema, blockchain, network) | indent(4) -}}

- name: {{ schema -}}.tf_latest_native_balance
signature:
- [wallets, ARRAY, An array of addresses string to get the balance of at the latest block]
Expand All @@ -41,7 +41,7 @@
- name: {{ schema -}}.tf_latest_token_balance
signature:
- [wallet, STRING, The address to get the balance of at the latest block]
- [token, STRING, The address of the token to get the balance of]
- [token, STRING, The address of the token to get the balance of]
return_type:
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
options: |
Expand All @@ -55,7 +55,7 @@
- name: {{ schema -}}.tf_latest_token_balance
signature:
- [wallet, STRING, The address to get the balance of at the latest block]
- [tokens, ARRAY, An array of address strings of the tokens to get the balance of]
- [tokens, ARRAY, An array of address strings of the tokens to get the balance of]
return_type:
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
options: |
Expand Down Expand Up @@ -83,7 +83,7 @@
- name: {{ schema -}}.tf_latest_token_balance
signature:
- [wallets, ARRAY, An array of addresses string to get the balance of at the latest block]
- [tokens, ARRAY, An array of address strings of the tokens to get the balance of]
- [tokens, ARRAY, An array of address strings of the tokens to get the balance of]
return_type:
- "TABLE(status STRING, blockchain STRING, network STRING, wallet_address STRING, token_address STRING, symbol STRING, raw_balance STRING, balance FLOAT)"
options: |
Expand Down Expand Up @@ -281,7 +281,7 @@
COMMENT = $$Returns the latest events emitted by a contract within the last `lookback` blocks. *Please note there are RPC limitations on this method.*$$
sql: |
{{ evm_latest_contract_events_si(schema, blockchain, network) | indent(4) -}}

- name: {{ schema -}}.tf_latest_contract_events
signature:
- [addresses, ARRAY, The addresses of the contracts to get the events of]
Expand Down Expand Up @@ -362,8 +362,168 @@
COMMENT = $$Returns the latest decoded events emitted by multiple contracts within the last `lookback` blocks. Submit missing ABIs [here](https://science.flipsidecrypto.xyz/abi-requestor/). *Please note there are RPC limitations on this method.* $$
sql: |
{{ evm_latest_contract_events_decoded_ai(schema, blockchain, network) | indent(4) -}}

- name: {{ schema -}}.tf_fact_blocks
signature:
- [block_height, INTEGER, The start block height to get the blocks from]
- [to_latest, BOOLEAN, Whether to continue fetching blocks until the latest block or not]
return_type:
- "TABLE(block_number INTEGER, block_timestamp TIMESTAMP_NTZ, network STRING, blockchain STRING, tx_count INTEGER, difficulty INTEGER, total_difficulty INTEGER, extra_data STRING, gas_limit INTEGER, gas_used INTEGER, hash STRING, parent_hash STRING, miner STRING, nonce INTEGER, receipts_root STRING, sha3_uncles STRING, size INTEGER, uncle_blocks VARIANT, block_header_json OBJECT, excess_blob_gas INTEGER, blob_gas_used INTEGER, fact_blocks_id STRING, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ, withdrawals VARIANT, withdrawals_root STRING)"
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
VOLATILE
COMMENT = $$Returns the block data for a given block height. If to_latest is true, it will continue fetching blocks until the latest block. Otherwise, it will fetch blocks until the block height is reached.$$
sql: |
{{ evm_live_view_fact_blocks(schema, blockchain, network) | indent(4) -}}

- name: {{ schema -}}.tf_fact_event_logs
signature:
- [block_height, INTEGER, The start block height to get the logs from]
- [to_latest, BOOLEAN, Whether to continue fetching logs until the latest block or not]
return_type:
- "TABLE(block_number INTEGER, block_timestamp TIMESTAMP_NTZ, tx_hash STRING, origin_function_signature STRING, origin_from_address STRING, origin_to_address STRING, event_index INTEGER, contract_address STRING, topics VARIANT, data STRING, event_removed BOOLEAN, tx_status STRING, _log_id STRING, fact_event_logs_id STRING, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ)"
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
VOLATILE
COMMENT = $$Returns the logs for a given block height. If to_latest is true, it will continue fetching logs until the latest block. Otherwise, it will fetch logs until the block height is reached.$$
sql: |
{{ evm_live_view_fact_event_logs(schema, blockchain, network) | indent(4) -}}

- name: {{ schema -}}.tf_fact_decoded_event_logs
signature:
- [block_height, INTEGER, The start block height to get the logs from]
- [to_latest, BOOLEAN, Whether to continue fetching logs until the latest block or not]
return_type:
- "TABLE(block_number INTEGER, block_timestamp TIMESTAMP_NTZ, tx_hash STRING, event_index INTEGER, contract_address STRING, event_name STRING, decoded_log OBJECT, full_decoded_log VARIANT, fact_decoded_event_logs_id STRING, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ)"
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
VOLATILE
COMMENT = $$Returns the decoded event logs data for a given block height. If to_latest is true, it will continue fetching blocks until the latest block. Otherwise, it will fetch blocks until the block height is reached.$$
sql: |
{{ evm_live_view_fact_decoded_event_logs(schema, blockchain, network) | indent(4) -}}

- name: {{ schema -}}.tf_fact_decoded_traces
signature:
- [block_height, INTEGER, The start block height to get the logs from]
- [to_latest, BOOLEAN, Whether to continue fetching logs until the latest block or not]
return_type:
- "TABLE(block_number INTEGER, tx_hash STRING, block_timestamp TIMESTAMP_NTZ, tx_status STRING, tx_position INTEGER, trace_index INTEGER, from_address STRING, to_address STRING, VALUE FLOAT, value_precise_raw STRING, value_precise STRING, gas INTEGER, gas_used INTEGER, TYPE STRING, identifier STRING, sub_traces INTEGER, error_reason STRING, trace_status STRING, input STRING, output STRING, function_name STRING, decoded_input_data VARIANT, decoded_output_data VARIANT, fact_decoded_traces_id STRING, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ)"
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
VOLATILE
COMMENT = $$Returns the decoded traces data for a given block height. If to_latest is true,
it will continue fetching blocks until the latest block. Otherwise,
it will fetch blocks until the block height is reached.$$
sql: |
{{ evm_live_view_fact_decoded_traces(schema,
blockchain, network) | indent(4) -}}

- name: {{ schema -}}.tf_fact_traces
signature:
- [block_height, INTEGER, The start block height to get the transfers from]
- [to_latest, BOOLEAN, Whether to continue fetching transfers until the latest block or not]
return_type:
- "TABLE(tx_hash STRING, block_number NUMBER, block_timestamp TIMESTAMP_NTZ(9), from_address STRING, to_address STRING, value FLOAT, value_precise_raw STRING, value_precise STRING, gas NUMBER, gas_used NUMBER, input STRING, output STRING, TYPE STRING, identifier STRING, DATA OBJECT, tx_status STRING, sub_traces NUMBER, trace_status STRING, error_reason STRING, trace_index NUMBER, fact_traces_id STRING, inserted_timestamp TIMESTAMP_NTZ(9), modified_timestamp TIMESTAMP_NTZ(9))"
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
VOLATILE
COMMENT = $$Returns the traces for a given block height. If to_latest is true, it will continue fetching traces until the latest block. Otherwise, it will fetch traces until the block height is reached.$$
sql: |
{{ evm_live_view_fact_traces(schema, blockchain, network) | indent(4) -}}

- name: {{ schema -}}.tf_fact_transactions
signature:
- [block_height, INTEGER, The start block height to get the transfers from]
- [to_latest, BOOLEAN, Whether to continue fetching transfers until the latest block or not]
return_type:
- "TABLE(block_number NUMBER, block_timestamp TIMESTAMP_NTZ, block_hash STRING, tx_hash STRING, nonce NUMBER, POSITION NUMBER, origin_function_signature STRING, from_address STRING, to_address STRING, VALUE FLOAT, value_precise_raw STRING, value_precise STRING, tx_fee FLOAT, tx_fee_precise STRING, gas_price FLOAT, gas_limit NUMBER, gas_used NUMBER, cumulative_gas_used NUMBER, input_data STRING, status STRING, effective_gas_price FLOAT, max_fee_per_gas FLOAT, max_priority_fee_per_gas FLOAT, r STRING, s STRING, v STRING, tx_type NUMBER, chain_id NUMBER, blob_versioned_hashes ARRAY, max_fee_per_blob_gas NUMBER, blob_gas_used NUMBER, blob_gas_price NUMBER, fact_transactions_id STRING, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ)"
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
VOLATILE
COMMENT = $$Returns the transactions for a given block height. If to_latest is true, it will continue fetching transactions until the latest block. Otherwise, it will fetch transactions until the block height is reached.$$
sql: |
{{ evm_live_view_fact_transactions(schema, blockchain, network) | indent(4) -}}

- name: {{ schema -}}.tf_fact_token_balances
signature:
- [block_height, INTEGER, The start block height to get the transfers from]
- [to_latest, BOOLEAN, Whether to continue fetching transfers until the latest block or not]
return_type:
- "TABLE(block_number NUMBER, block_timestamp TIMESTAMP_NTZ, address STRING, contract_address STRING, balance NUMBER(38,0), fact_token_balances_id STRING, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ)"
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
VOLATILE
COMMENT = $$Returns the token balances for a given block height. If to_latest is true, it will continue fetching transactions until the latest block. Otherwise, it will fetch transactions until the block height is reached.$$
sql: |
{{ evm_live_view_fact_token_balances(schema, blockchain, network) | indent(4) -}}

- name: {{ schema -}}.tf_fact_eth_balances
signature:
- [block_height, INTEGER, The start block height to get the transfers from]
- [to_latest, BOOLEAN, Whether to continue fetching transfers until the latest block or not]
return_type:
- "TABLE(block_number NUMBER, block_timestamp TIMESTAMP_NTZ, address STRING, balance NUMBER(38,0), fact_eth_balances_id STRING, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ)"
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
VOLATILE
COMMENT = $$Returns the eth balances for a given block height. If to_latest is true, it will continue fetching transactions until the latest block. Otherwise, it will fetch transactions until the block height is reached.$$
sql: |
{{ evm_live_view_fact_eth_balances(schema, blockchain, network) | indent(4) -}}


- name: {{ schema -}}.tf_ez_decoded_event_logs
signature:
- [block_height, INTEGER, The start block height to get the logs from]
- [to_latest, BOOLEAN, Whether to continue fetching logs until the latest block or not]
return_type:
- "TABLE(block_number INTEGER, block_timestamp TIMESTAMP_NTZ, tx_hash STRING, event_index INTEGER, contract_address STRING, contract_name STRING, event_name STRING, decoded_log OBJECT, full_decoded_log VARIANT, origin_function_signature STRING, origin_from_address STRING, origin_to_address STRING, topics VARIANT, data STRING, event_removed BOOLEAN, tx_status STRING, ez_decoded_event_logs_id STRING, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ)"
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
VOLATILE
COMMENT = $$Returns the ez decoded event logs data for a given block height. If to_latest is true, it will continue fetching blocks until the latest block. Otherwise, it will fetch blocks until the block height is reached.$$
sql: |
{{ evm_live_view_ez_decoded_event_logs(schema, blockchain, network) | indent(4) -}}

- name: {{ schema -}}.tf_ez_native_transfers
signature:
- [block_height, INTEGER, The start block height to get the transfers from]
- [to_latest, BOOLEAN, Whether to continue fetching transfers until the latest block or not]
return_type:
- "TABLE(tx_hash STRING, block_number NUMBER(38,0), block_timestamp TIMESTAMP_NTZ(9), tx_position NUMBER(38,0), trace_index NUMBER(19,0), identifier STRING, origin_from_address STRING, origin_to_address STRING, origin_function_signature STRING, from_address STRING, to_address STRING, amount FLOAT, amount_precise_raw STRING, amount_precise STRING, amount_usd FLOAT, ez_native_transfers_id STRING, inserted_timestamp TIMESTAMP_NTZ(9), modified_timestamp TIMESTAMP_NTZ(9))"
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
VOLATILE
COMMENT = $$Returns the native transfers for a given block height. If to_latest is true, it will continue fetching transfers until the latest block. Otherwise, it will fetch transfers until the block height is reached.$$
sql: |
{{ evm_live_view_ez_native_transfers(schema, blockchain, network) | indent(4) -}}

- name: {{ schema -}}.tf_ez_token_transfers
signature:
- [block_height, INTEGER, The start block height to get the transfers from]
- [to_latest, BOOLEAN, Whether to continue fetching transfers until the latest block or not]
return_type:
- "TABLE(block_number INTEGER, block_timestamp TIMESTAMP_NTZ, tx_hash STRING, event_index INTEGER, origin_function_signature STRING, origin_from_address STRING, origin_to_address STRING, contract_address STRING, from_address STRING, to_address STRING, raw_amount_precise STRING, raw_amount FLOAT, amount_precise FLOAT, amount FLOAT, amount_usd FLOAT, decimals INTEGER, symbol STRING, token_price FLOAT, has_decimal STRING, has_price STRING, _log_id STRING, ez_token_transfers_id STRING, _inserted_timestamp TIMESTAMP_NTZ, inserted_timestamp TIMESTAMP_NTZ, modified_timestamp TIMESTAMP_NTZ)"
options: |
NOT NULL
RETURNS NULL ON NULL INPUT
VOLATILE
COMMENT = $$Returns the token transfers for a given block height. If to_latest is true, it will continue fetching transfers until the latest block. Otherwise, it will fetch transfers until the block height is reached.$$
sql: |
{{ evm_live_view_ez_token_transfers(schema, blockchain, network) | indent(4) -}}

{%- endmacro -%}


{% macro config_eth_high_level_abstractions(blockchain, network) -%}
{#
This macro is used to generate high level abstractions for Ethereum mainnet only.
Expand Down Expand Up @@ -393,7 +553,7 @@
NOT NULL
RETURNS NULL ON NULL INPUT
VOLATILE
COMMENT = $$Returns the decoded events emitted by a contract from a specific block to the latest block. Submit missing ABIs [here](https://science.flipsidecrypto.xyz/abi-requestor/).$$
COMMENT = $$Returns the decoded events emitted by a contract from a specific block to the latest block. Submit missing ABIs [here](https://science.flipsidecrypto.xyz/abi-requestor/).$$
sql: |
{{ evm_contract_events_decoded(schema, blockchain, network) | indent(4) -}}
{%- endmacro -%}
{%- endmacro -%}
Loading