diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d99e9bd --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ + +target/ +dbt_modules/ +# newer versions of dbt use this directory instead of dbt_modules for test dependencies +dbt_packages/ +logs/ + +.venv/ +.python-version + +# Visual Studio Code files +*/.vscode +*.code-workspace +.history/ +**/.DS_Store +.vscode/ +.env +dbt-env/ \ No newline at end of file diff --git a/README.md b/README.md index 37f941f..6a46cf4 100644 --- a/README.md +++ b/README.md @@ -1 +1,109 @@ -# blast-models \ No newline at end of file +## Profile Set Up + +#### Use the following within profiles.yml +---- + +```yml +blast: + target: dev + outputs: + dev: + type: snowflake + account: + role: + user: + password: + region: + database: BLAST_DEV + warehouse: + schema: silver + threads: 12 + client_session_keep_alive: False + query_tag: + prod: + type: snowflake + account: + role: + user: + password: + region: + database: BLAST + warehouse: + schema: silver + threads: 12 + client_session_keep_alive: False + query_tag: +``` + +### Variables + +To control the creation of UDF or SP macros with dbt run: +* UPDATE_UDFS_AND_SPS +When True, executes all macros included in the on-run-start hooks within dbt_project.yml on model run as normal +When False, none of the on-run-start macros are executed on model run + +Default values are False + +* Usage: +dbt run --vars '{"UPDATE_UDFS_AND_SPS":True}' -m ... + +To reload records in a curated complete table without a full-refresh, such as `silver_bridge.complete_bridge_activity`: +* HEAL_CURATED_MODEL +Default is an empty array [] +When item is included in var array [], incremental logic will be skipped for that CTE / code block +When item is not included in var array [] or does not match specified item in model, incremental logic will apply +Example set up: `{% if is_incremental() and 'axelar' not in var('HEAL_CURATED_MODEL') %}` + +* Usage: +Single CTE: dbt run --vars '{"HEAL_CURATED_MODEL":"axelar"}' -m ... +Multiple CTEs: dbt run --vars '{"HEAL_CURATED_MODEL":["axelar","across","celer_cbridge"]}' -m ... + + +### Resources: +- Learn more about dbt [in the docs](https://docs.getdbt.com/docs/introduction) +- Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers +- Join the [chat](https://community.getdbt.com/) on Slack for live discussions and support +- Find [dbt events](https://events.getdbt.com) near you +- Check out [the blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices + +## Applying Model Tags + +### Database / Schema level tags + +Database and schema tags are applied via the `add_database_or_schema_tags` macro. These tags are inherited by their downstream objects. To add/modify tags call the appropriate tag set function within the macro. + +``` +{{ set_database_tag_value('SOME_DATABASE_TAG_KEY','SOME_DATABASE_TAG_VALUE') }} +{{ set_schema_tag_value('SOME_SCHEMA_TAG_KEY','SOME_SCHEMA_TAG_VALUE') }} +``` + +### Model tags + +To add/update a model's snowflake tags, add/modify the `meta` model property under `config`. Only table level tags are supported at this time via DBT. + +``` +{{ config( + ..., + meta={ + 'database_tags':{ + 'table': { + 'PURPOSE': 'SOME_PURPOSE' + } + } + }, + ... +) }} +``` + +By default, model tags are pushed to Snowflake on each load. You can disable this by setting the `UPDATE_SNOWFLAKE_TAGS` project variable to `False` during a run. + +``` +dbt run --vars '{"UPDATE_SNOWFLAKE_TAGS":False}' -s models/core/core__fact_blocks.sql +``` + +### Querying for existing tags on a model in snowflake + +``` +select * +from table(blast.information_schema.tag_references('blast.core.fact_blocks', 'table')); +``` \ No newline at end of file diff --git a/analysis/.gitkeep b/analysis/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/.gitkeep b/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/data/github_actions__workflows.csv b/data/github_actions__workflows.csv new file mode 100644 index 0000000..b17ab47 --- /dev/null +++ b/data/github_actions__workflows.csv @@ -0,0 +1,6 @@ +workflow_name,workflow_schedule +dbt_run_scheduled_non_realtime,"22,52 * * * *" +dbt_run_streamline_chainhead,"15,45 * * * *" +dbt_run_streamline_decoder,"0,30 * * * *" +dbt_run_scheduled_curated,"40 * * * *" +dbt_test_tasks,"15 * * * *" \ No newline at end of file diff --git a/dbt_project.yml b/dbt_project.yml new file mode 100644 index 0000000..0c3958e --- /dev/null +++ b/dbt_project.yml @@ -0,0 +1,73 @@ +# Name your project! Project names should contain only lowercase characters +# and underscores. A good package name should reflect your organization's +# name or the intended use of these models +name: "blast_models" +version: "1.0.0" +config-version: 2 + +# This setting configures which "profile" dbt uses for this project. +profile: "blast" + +# These configurations specify where dbt should look for different types of files. +# The `source-paths` config, for example, states that models in this project can be +# found in the "models/" directory. You probably won't need to change these! +model-paths: ["models"] +analysis-paths: ["analysis"] +test-paths: ["tests"] +seed-paths: ["data"] +macro-paths: ["macros"] +snapshot-paths: ["snapshots"] + +target-path: "target" # directory which will store compiled SQL files +clean-targets: # directories to be removed by `dbt clean` + - "target" + - "dbt_modules" + - "dbt_packages" + +tests: + +store_failures: true # all tests + +on-run-start: + # - "{{ create_sps() }}" + # - "{{ create_udfs() }}" + +on-run-end: + - '{{ apply_meta_as_tags(results) }}' + +dispatch: + - macro_namespace: dbt + search_order: + - blast-models + - dbt_snowflake_query_tags + - dbt + +query-comment: + comment: '{{ dbt_snowflake_query_tags.get_query_comment(node) }}' + append: true # Snowflake removes prefixed comments. + +# Configuring models +# Full documentation: https://docs.getdbt.com/docs/configuring-models + +models: + +copy_grants: true + +on_schema_change: "append_new_columns" + +# In this example config, we tell dbt to build all models in the example/ directory +# as tables. These settings can be overridden in the individual model files +# using the `{{ config(...) }}` macro. + +vars: + "dbt_date:time_zone": GMT + STREAMLINE_INVOKE_STREAMS: False + STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES: False + UPDATE_UDFS_AND_SPS: False + UPDATE_SNOWFLAKE_TAGS: True + OBSERV_FULL_TEST: False + WAIT: 0 + HEAL_MODEL: False + HEAL_CURATED_MODEL: [] + START_GHA_TASKS: False + API_INTEGRATION: '{{ var("config")[target.name]["API_INTEGRATION"] if var("config")[target.name] else var("config")["dev"]["API_INTEGRATION"] }}' + EXTERNAL_FUNCTION_URI: '{{ var("config")[target.name]["EXTERNAL_FUNCTION_URI"] if var("config")[target.name] else var("config")["dev"]["EXTERNAL_FUNCTION_URI"] }}' + ROLES: | + ["INTERNAL_DEV"] \ No newline at end of file diff --git a/macros/.gitkeep b/macros/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/macros/create_sps.sql b/macros/create_sps.sql new file mode 100644 index 0000000..fe4a5cf --- /dev/null +++ b/macros/create_sps.sql @@ -0,0 +1,8 @@ +{# {% macro create_sps() %} + {% if var("UPDATE_UDFS_AND_SPS") %} + {% if target.database == 'BLAST' %} + CREATE schema IF NOT EXISTS _internal; + {{ sp_create_prod_clone('_internal') }}; + {% endif %} + {% endif %} +{% endmacro %} #} diff --git a/macros/create_udfs.sql b/macros/create_udfs.sql new file mode 100644 index 0000000..b3dd0e6 --- /dev/null +++ b/macros/create_udfs.sql @@ -0,0 +1,25 @@ +{# {% macro create_udfs() %} + {% if var("UPDATE_UDFS_AND_SPS") %} + {% set sql %} + CREATE schema if NOT EXISTS silver; + {{ create_udtf_get_base_table( + schema = "streamline" + ) }} + + {% endset %} + {% do run_query(sql) %} + {% if target.database != "BLAST_COMMUNITY_DEV" %} + {% set sql %} + {{ create_udf_get_chainhead() }} + {{ create_udf_bulk_json_rpc() }} + {{ create_udf_bulk_get_traces() }} + {{ create_udf_decode_array_string() }} + {{ create_udf_decode_array_object() }} + {{ create_udf_bulk_decode_logs() }} + + {% endset %} + {% do run_query(sql) %} + {% endif %} + {{- fsc_utils.create_udfs() -}} + {% endif %} +{% endmacro %} #} \ No newline at end of file diff --git a/macros/custom_naming_macros.sql b/macros/custom_naming_macros.sql new file mode 100644 index 0000000..0f4a72c --- /dev/null +++ b/macros/custom_naming_macros.sql @@ -0,0 +1,11 @@ +{% macro generate_schema_name(custom_schema_name=none, node=none) -%} + {% set node_name = node.name %} + {% set split_name = node_name.split('__') %} + {{ split_name[0] | trim }} +{%- endmacro %} + +{% macro generate_alias_name(custom_alias_name=none, node=none) -%} + {% set node_name = node.name %} + {% set split_name = node_name.split('__') %} + {{ split_name[1] | trim }} +{%- endmacro %} diff --git a/macros/dbt/get_merge_sql.sql b/macros/dbt/get_merge_sql.sql new file mode 100644 index 0000000..8fefc01 --- /dev/null +++ b/macros/dbt/get_merge_sql.sql @@ -0,0 +1,44 @@ +{% macro get_merge_sql( + target, + source, + unique_key, + dest_columns, + incremental_predicates + ) -%} + {% set predicate_override = "" %} + {% if incremental_predicates [0] == "dynamic_range" %} + -- run some queries to dynamically determine the min + max of this 'input_column' in the new data + {% set input_column = incremental_predicates [1] %} + {% set get_limits_query %} + SELECT + MIN( + {{ input_column }} + ) AS lower_limit, + MAX( + {{ input_column }} + ) AS upper_limit + FROM + {{ source }} + + {% endset %} + {% set limits = run_query(get_limits_query) [0] %} + {% set lower_limit, + upper_limit = limits [0], + limits [1] %} + -- use those calculated min + max values to limit 'target' scan, to only the days with new data + {% set predicate_override %} + dbt_internal_dest.{{ input_column }} BETWEEN '{{ lower_limit }}' + AND '{{ upper_limit }}' {% endset %} + {% endif %} + + {% set predicates = [predicate_override] if predicate_override else incremental_predicates %} + -- standard merge from here + {% set merge_sql = dbt.get_merge_sql( + target, + source, + unique_key, + dest_columns, + predicates + ) %} + {{ return(merge_sql) }} +{% endmacro %} diff --git a/macros/dbt/get_tmp_relation_type.sql b/macros/dbt/get_tmp_relation_type.sql new file mode 100644 index 0000000..3bb7438 --- /dev/null +++ b/macros/dbt/get_tmp_relation_type.sql @@ -0,0 +1,8 @@ +{% macro dbt_snowflake_get_tmp_relation_type( + strategy, + unique_key, + language + ) %} + -- always table + {{ return('table') }} +{% endmacro %} diff --git a/macros/run_sp_create_prod_clone.sql b/macros/run_sp_create_prod_clone.sql new file mode 100644 index 0000000..217feb7 --- /dev/null +++ b/macros/run_sp_create_prod_clone.sql @@ -0,0 +1,10 @@ +{% macro run_sp_create_prod_clone() %} + {% set clone_query %} + call blast._internal.create_prod_clone( + 'blast', + 'blast_dev', + 'internal_dev' + ); +{% endset %} + {% do run_query(clone_query) %} +{% endmacro %} diff --git a/macros/sp_create_prod_clone.sql b/macros/sp_create_prod_clone.sql new file mode 100644 index 0000000..20ee897 --- /dev/null +++ b/macros/sp_create_prod_clone.sql @@ -0,0 +1,44 @@ +{% macro sp_create_prod_clone(target_schema) -%} + +create or replace procedure {{ target_schema }}.create_prod_clone(source_db_name string, destination_db_name string, role_name string) +returns boolean +language javascript +execute as caller +as +$$ + snowflake.execute({sqlText: `BEGIN TRANSACTION;`}); + try { + snowflake.execute({sqlText: `CREATE OR REPLACE DATABASE ${DESTINATION_DB_NAME} CLONE ${SOURCE_DB_NAME}`}); + snowflake.execute({sqlText: `DROP SCHEMA IF EXISTS ${DESTINATION_DB_NAME}._INTERNAL`}); /* this only needs to be in prod */ + + snowflake.execute({sqlText: `GRANT OWNERSHIP ON ALL SCHEMAS IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`}); + snowflake.execute({sqlText: `GRANT OWNERSHIP ON ALL FUNCTIONS IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`}); + snowflake.execute({sqlText: `GRANT OWNERSHIP ON ALL PROCEDURES IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`}); + snowflake.execute({sqlText: `GRANT OWNERSHIP ON ALL VIEWS IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`}); + snowflake.execute({sqlText: `GRANT OWNERSHIP ON ALL STAGES IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`}); + snowflake.execute({sqlText: `GRANT OWNERSHIP ON ALL TABLES IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`}); + snowflake.execute({sqlText: `GRANT OWNERSHIP ON FUTURE FUNCTIONS IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME};`}); + snowflake.execute({sqlText: `GRANT OWNERSHIP ON FUTURE PROCEDURES IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME};`}); + snowflake.execute({sqlText: `GRANT OWNERSHIP ON FUTURE VIEWS IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME};`}); + snowflake.execute({sqlText: `GRANT OWNERSHIP ON FUTURE STAGES IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME};`}); + snowflake.execute({sqlText: `GRANT OWNERSHIP ON FUTURE TABLES IN DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME};`}); + + snowflake.execute({sqlText: `GRANT OWNERSHIP ON DATABASE ${DESTINATION_DB_NAME} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`}) + + var existing_tags = snowflake.execute({sqlText: `SHOW TAGS IN DATABASE ${DESTINATION_DB_NAME};`}); + while (existing_tags.next()) { + var schema = existing_tags.getColumnValue(4); + var tag_name = existing_tags.getColumnValue(2) + snowflake.execute({sqlText: `GRANT OWNERSHIP ON TAG ${DESTINATION_DB_NAME}.${schema}.${tag_name} TO ROLE ${ROLE_NAME} COPY CURRENT GRANTS;`}); + } + + snowflake.execute({sqlText: `COMMIT;`}); + } catch (err) { + snowflake.execute({sqlText: `ROLLBACK;`}); + throw(err); + } + + return true +$$ + +{%- endmacro %} \ No newline at end of file diff --git a/macros/tags/add_database_or_schema_tags.sql b/macros/tags/add_database_or_schema_tags.sql new file mode 100644 index 0000000..c263038 --- /dev/null +++ b/macros/tags/add_database_or_schema_tags.sql @@ -0,0 +1,4 @@ +{% macro add_database_or_schema_tags() %} + {{ set_database_tag_value('BLOCKCHAIN_NAME','BLAST') }} + {{ set_database_tag_value('BLOCKCHAIN_TYPE','EVM, L2') }} +{% endmacro %} \ No newline at end of file diff --git a/macros/tags/snowflake_tagging.sql b/macros/tags/snowflake_tagging.sql new file mode 100644 index 0000000..bc25e69 --- /dev/null +++ b/macros/tags/snowflake_tagging.sql @@ -0,0 +1,127 @@ +{% macro apply_meta_as_tags(results) %} + {% if var("UPDATE_SNOWFLAKE_TAGS") %} + {{ log('apply_meta_as_tags', info=False) }} + {{ log(results, info=False) }} + {% if execute %} + + {%- set tags_by_schema = {} -%} + {% for res in results -%} + {% if res.node.meta.database_tags %} + + {%- set model_database = res.node.database -%} + {%- set model_schema = res.node.schema -%} + {%- set model_schema_full = model_database+'.'+model_schema -%} + {%- set model_alias = res.node.alias -%} + + {% if model_schema_full not in tags_by_schema.keys() %} + {{ log('need to fetch tags for schema '+model_schema_full, info=False) }} + {%- call statement('main', fetch_result=True) -%} + show tags in {{model_database}}.{{model_schema}} + {%- endcall -%} + {%- set _ = tags_by_schema.update({model_schema_full: load_result('main')['table'].columns.get('name').values()|list}) -%} + {{ log('Added tags to cache', info=False) }} + {% else %} + {{ log('already have tag info for schema', info=False) }} + {% endif %} + + {%- set current_tags_in_schema = tags_by_schema[model_schema_full] -%} + {{ log('current_tags_in_schema:', info=False) }} + {{ log(current_tags_in_schema, info=False) }} + {{ log("========== Processing tags for "+model_schema_full+"."+model_alias+" ==========", info=False) }} + + {% set line -%} + node: {{ res.node.unique_id }}; status: {{ res.status }} (message: {{ res.message }}) + node full: {{ res.node}} + meta: {{ res.node.meta}} + materialized: {{ res.node.config.materialized }} + {%- endset %} + {{ log(line, info=False) }} + + {%- call statement('main', fetch_result=True) -%} + select LEVEL,UPPER(TAG_NAME) as TAG_NAME,TAG_VALUE from table(information_schema.tag_references_all_columns('{{model_schema}}.{{model_alias}}', 'table')) + {%- endcall -%} + {%- set existing_tags_for_table = load_result('main')['data'] -%} + {{ log('Existing tags for table:', info=False) }} + {{ log(existing_tags_for_table, info=False) }} + + {{ log('--', info=False) }} + {% for table_tag in res.node.meta.database_tags.table %} + + {{ create_tag_if_missing(current_tags_in_schema,table_tag|upper) }} + {% set desired_tag_value = res.node.meta.database_tags.table[table_tag] %} + + {{set_table_tag_value_if_different(model_schema,model_alias,table_tag,desired_tag_value,existing_tags_for_table)}} + {% endfor %} + {{ log("========== Finished processing tags for "+model_alias+" ==========", info=False) }} + {% endif %} + {% endfor %} + {% endif %} + {% endif %} +{% endmacro %} + + +{% macro create_tag_if_missing(all_tag_names,table_tag) %} + {% if table_tag not in all_tag_names %} + {{ log('Creating missing tag '+table_tag, info=False) }} + {%- call statement('main', fetch_result=True) -%} + create tag if not exists silver.{{table_tag}} + {%- endcall -%} + {{ log(load_result('main').data, info=False) }} + {% else %} + {{ log('Tag already exists: '+table_tag, info=False) }} + {% endif %} +{% endmacro %} + +{% macro set_table_tag_value_if_different(model_schema,table_name,tag_name,desired_tag_value,existing_tags) %} + {{ log('Ensuring tag '+tag_name+' has value '+desired_tag_value+' at table level', info=False) }} + {%- set existing_tag_for_table = existing_tags|selectattr('0','equalto','TABLE')|selectattr('1','equalto',tag_name|upper)|list -%} + {{ log('Filtered tags for table:', info=False) }} + {{ log(existing_tag_for_table[0], info=False) }} + {% if existing_tag_for_table|length > 0 and existing_tag_for_table[0][2]==desired_tag_value %} + {{ log('Correct tag value already exists', info=False) }} + {% else %} + {{ log('Setting tag value for '+tag_name+' to value '+desired_tag_value, info=False) }} + {%- call statement('main', fetch_result=True) -%} + alter table {{model_schema}}.{{table_name}} set tag {{tag_name}} = '{{desired_tag_value}}' + {%- endcall -%} + {{ log(load_result('main').data, info=False) }} + {% endif %} +{% endmacro %} + +{% macro set_column_tag_value_if_different(table_name,column_name,tag_name,desired_tag_value,existing_tags) %} + {{ log('Ensuring tag '+tag_name+' has value '+desired_tag_value+' at column level', info=False) }} + {%- set existing_tag_for_column = existing_tags|selectattr('0','equalto','COLUMN')|selectattr('1','equalto',tag_name|upper)|list -%} + {{ log('Filtered tags for column:', info=False) }} + {{ log(existing_tag_for_column[0], info=False) }} + {% if existing_tag_for_column|length > 0 and existing_tag_for_column[0][2]==desired_tag_value %} + {{ log('Correct tag value already exists', info=False) }} + {% else %} + {{ log('Setting tag value for '+tag_name+' to value '+desired_tag_value, info=False) }} + {%- call statement('main', fetch_result=True) -%} + alter table {{table_name}} modify column {{column_name}} set tag {{tag_name}} = '{{desired_tag_value}}' + {%- endcall -%} + {{ log(load_result('main').data, info=False) }} + {% endif %} +{% endmacro %} + +{% macro set_database_tag_value(tag_name,tag_value) %} + {% set query %} + create tag if not exists silver.{{tag_name}} + {% endset %} + {% do run_query(query) %} + {% set query %} + alter database {{target.database}} set tag {{target.database}}.silver.{{tag_name}} = '{{tag_value}}' + {% endset %} + {% do run_query(query) %} +{% endmacro %} + +{% macro set_schema_tag_value(target_schema,tag_name,tag_value) %} + {% set query %} + create tag if not exists silver.{{tag_name}} + {% endset %} + {% do run_query(query) %} + {% set query %} + alter schema {{target.database}}.{{target_schema}} set tag {{target.database}}.silver.{{tag_name}} = '{{tag_value}}' + {% endset %} + {% do run_query(query) %} +{% endmacro %} \ No newline at end of file diff --git a/macros/tests/missing_txs.sql b/macros/tests/missing_txs.sql new file mode 100644 index 0000000..293fb1b --- /dev/null +++ b/macros/tests/missing_txs.sql @@ -0,0 +1,103 @@ +{% macro missing_txs( + model + ) %} + WITH txs_base AS ( + SELECT + block_number AS base_block_number, + tx_hash AS base_tx_hash + FROM + {{ ref('test_silver__transactions_full') }} + ), + model_name AS ( + SELECT + block_number AS model_block_number, + tx_hash AS model_tx_hash + FROM + {{ model }} + ) +SELECT + base_block_number, + base_tx_hash, + model_block_number, + model_tx_hash +FROM + txs_base + LEFT JOIN model_name + ON base_block_number = model_block_number + AND base_tx_hash = model_tx_hash +WHERE + ( + model_tx_hash IS NULL + OR model_block_number IS NULL + ) +{% endmacro %} + +{% macro recent_missing_txs( + model + ) %} + WITH txs_base AS ( + SELECT + block_number AS base_block_number, + tx_hash AS base_tx_hash + FROM + {{ ref('test_silver__transactions_recent') }} + ), + model_name AS ( + SELECT + block_number AS model_block_number, + tx_hash AS model_tx_hash + FROM + {{ model }} + ) +SELECT + base_block_number, + base_tx_hash, + model_block_number, + model_tx_hash +FROM + txs_base + LEFT JOIN model_name + ON base_block_number = model_block_number + AND base_tx_hash = model_tx_hash +WHERE + model_tx_hash IS NULL + OR model_block_number IS NULL +{% endmacro %} + +{% macro missing_confirmed_txs( + model1, + model2 + ) %} + WITH txs_base AS ( + SELECT + block_number AS base_block_number, + block_hash AS base_block_hash, + tx_hash AS base_tx_hash + FROM + {{ model1 }} + ), + model_name AS ( + SELECT + block_number AS model_block_number, + block_hash AS model_block_hash, + tx_hash AS model_tx_hash + FROM + {{ model2 }} + ) +SELECT + DISTINCT base_block_number AS block_number +FROM + txs_base + LEFT JOIN model_name + ON base_block_number = model_block_number + AND base_tx_hash = model_tx_hash + AND base_block_hash = model_block_hash +WHERE + model_tx_hash IS NULL + AND model_block_number <= ( + SELECT + MAX(base_block_number) + FROM + txs_base + ) +{% endmacro %} diff --git a/macros/utils.sql b/macros/utils.sql new file mode 100644 index 0000000..a75daac --- /dev/null +++ b/macros/utils.sql @@ -0,0 +1,78 @@ +{# {% macro if_data_call_function( + func, + target + ) %} + {% if var( + "STREAMLINE_INVOKE_STREAMS" + ) %} + {% if execute %} + {{ log( + "Running macro `if_data_call_function`: Calling udf " ~ func ~ " on " ~ target, + True + ) }} + {% endif %} + SELECT + {{ func }} + WHERE + EXISTS( + SELECT + 1 + FROM + {{ target }} + LIMIT + 1 + ) + {% else %} + {% if execute %} + {{ log( + "Running macro `if_data_call_function`: NOOP", + False + ) }} + {% endif %} + SELECT + NULL + {% endif %} +{% endmacro %} + +{% macro if_data_call_wait() %} + {% if var( + "STREAMLINE_INVOKE_STREAMS" + ) %} + {% set query %} + SELECT + 1 + WHERE + EXISTS( + SELECT + 1 + FROM + {{ model.schema ~ "." ~ model.alias }} + LIMIT + 1 + ) {% endset %} + {% if execute %} + {% set results = run_query( + query + ) %} + {% if results %} + {{ log( + "Waiting...", + info = True + ) }} + + {% set wait_query %} + SELECT + system$wait( + {{ var( + "WAIT", + 600 + ) }} + ) {% endset %} + {% do run_query(wait_query) %} + {% else %} + SELECT + NULL; + {% endif %} + {% endif %} + {% endif %} +{% endmacro %} #} diff --git a/models/bronze/labels/bronze__labels.sql b/models/bronze/labels/bronze__labels.sql new file mode 100644 index 0000000..5a60adb --- /dev/null +++ b/models/bronze/labels/bronze__labels.sql @@ -0,0 +1,25 @@ +{{ config( + materialized = 'view' +) }} + +SELECT + system_created_at, + insert_date, + blockchain, + address, + creator, + label_type, + label_subtype, + address_name, + project_name, + _is_deleted, + modified_timestamp, + labels_combined_id +FROM + {{ source( + 'silver_crosschain', + 'labels_combined' + ) }} +WHERE + blockchain = 'blast' + AND address LIKE '0x%' diff --git a/models/doc_descriptions/L1_fields/batch_size.md b/models/doc_descriptions/L1_fields/batch_size.md new file mode 100644 index 0000000..68bde6f --- /dev/null +++ b/models/doc_descriptions/L1_fields/batch_size.md @@ -0,0 +1,5 @@ +{% docs blast_batch_size %} + +Total Blast Txs included within batch. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/L1_fields/blast_max_block.md b/models/doc_descriptions/L1_fields/blast_max_block.md new file mode 100644 index 0000000..fae9323 --- /dev/null +++ b/models/doc_descriptions/L1_fields/blast_max_block.md @@ -0,0 +1,5 @@ +{% docs blast_max_block %} + +The max block on Blast this batch relates to. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/L1_fields/blast_min_block.md b/models/doc_descriptions/L1_fields/blast_min_block.md new file mode 100644 index 0000000..bf30506 --- /dev/null +++ b/models/doc_descriptions/L1_fields/blast_min_block.md @@ -0,0 +1,5 @@ +{% docs blast_min_block %} + +The min block on Blast this batch relates to. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/L1_fields/l1_batch_root.md b/models/doc_descriptions/L1_fields/l1_batch_root.md new file mode 100644 index 0000000..f800973 --- /dev/null +++ b/models/doc_descriptions/L1_fields/l1_batch_root.md @@ -0,0 +1,5 @@ +{% docs blast_batch_root %} + +Root of batch, either for sumbission or state. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/L1_fields/l1_block_number.md b/models/doc_descriptions/L1_fields/l1_block_number.md new file mode 100644 index 0000000..40d5755 --- /dev/null +++ b/models/doc_descriptions/L1_fields/l1_block_number.md @@ -0,0 +1,5 @@ +{% docs blast_l1_block_no %} + +The Ethereum block number that contained the batch. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/L1_fields/l1_block_timestamp.md b/models/doc_descriptions/L1_fields/l1_block_timestamp.md new file mode 100644 index 0000000..7d8f2e9 --- /dev/null +++ b/models/doc_descriptions/L1_fields/l1_block_timestamp.md @@ -0,0 +1,5 @@ +{% docs blast_l1_block_time %} + +The timestamp of the Ethereum block that contained this batch. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/L1_fields/l1_fee_scalar.md b/models/doc_descriptions/L1_fields/l1_fee_scalar.md new file mode 100644 index 0000000..a471435 --- /dev/null +++ b/models/doc_descriptions/L1_fields/l1_fee_scalar.md @@ -0,0 +1,5 @@ +{% docs blast_l1_fee_scalar %} + +This value covers the change in L1 gas price between the time the transaction is submitted and when it is published. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/L1_fields/l1_gas_price.md b/models/doc_descriptions/L1_fields/l1_gas_price.md new file mode 100644 index 0000000..113c67c --- /dev/null +++ b/models/doc_descriptions/L1_fields/l1_gas_price.md @@ -0,0 +1,5 @@ +{% docs blast_l1_gas_price %} + +The gas price for L1 transactions when the transaction was processed. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/L1_fields/l1_gas_used.md b/models/doc_descriptions/L1_fields/l1_gas_used.md new file mode 100644 index 0000000..a8876bc --- /dev/null +++ b/models/doc_descriptions/L1_fields/l1_gas_used.md @@ -0,0 +1,5 @@ +{% docs blast_l1_gas_used %} + +The gas used on L1 to publish the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/L1_fields/l1_state_root_batch_index.md b/models/doc_descriptions/L1_fields/l1_state_root_batch_index.md new file mode 100644 index 0000000..5a77dbc --- /dev/null +++ b/models/doc_descriptions/L1_fields/l1_state_root_batch_index.md @@ -0,0 +1,5 @@ +{% docs blast_l1_state_batch %} + +The batch index of when this block was included in the Ethereum state root. This column will be deprecated 8/7 and will be consolidated into a array column consisting of all L1 submission details. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/L1_fields/l1_state_root_tx_hash.md b/models/doc_descriptions/L1_fields/l1_state_root_tx_hash.md new file mode 100644 index 0000000..a28a188 --- /dev/null +++ b/models/doc_descriptions/L1_fields/l1_state_root_tx_hash.md @@ -0,0 +1,5 @@ +{% docs blast_l1_state_tx_hash %} + +The L1 tx hash of when this block was included in the Ethereum state root. This column will be deprecated 8/7 and will be consolidated into a array column consisting of all L1 submission details. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/L1_fields/l1_submission_batch_index.md b/models/doc_descriptions/L1_fields/l1_submission_batch_index.md new file mode 100644 index 0000000..b309850 --- /dev/null +++ b/models/doc_descriptions/L1_fields/l1_submission_batch_index.md @@ -0,0 +1,5 @@ +{% docs blast_l1_sub_batch %} + +The batch index of when this block was submitted to L1. This column will be deprecated 8/7 and will be consolidated into a array column consisting of all L1 submission details. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/L1_fields/l1_submission_tx_hash.md b/models/doc_descriptions/L1_fields/l1_submission_tx_hash.md new file mode 100644 index 0000000..ec610b0 --- /dev/null +++ b/models/doc_descriptions/L1_fields/l1_submission_tx_hash.md @@ -0,0 +1,5 @@ +{% docs blast_l1_sub_tx_hash %} + +The L1 tx hash of when this block was submitted to L1. This column will be deprecated 8/7 and will be consolidated into a array column consisting of all L1 submission details. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/L1_fields/prev_total_elements.md b/models/doc_descriptions/L1_fields/prev_total_elements.md new file mode 100644 index 0000000..1490e77 --- /dev/null +++ b/models/doc_descriptions/L1_fields/prev_total_elements.md @@ -0,0 +1,5 @@ +{% docs blast_prev_total_elements %} + +Confirmed blocks prior to this batch. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_block_header_json.md b/models/doc_descriptions/blocks/blast_block_header_json.md new file mode 100644 index 0000000..a75aa6c --- /dev/null +++ b/models/doc_descriptions/blocks/blast_block_header_json.md @@ -0,0 +1,5 @@ +{% docs blast_block_header_json %} + +This JSON column contains the block header details. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_blockchain.md b/models/doc_descriptions/blocks/blast_blockchain.md new file mode 100644 index 0000000..c6ae149 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_blockchain.md @@ -0,0 +1,5 @@ +{% docs blast_blockchain %} + +The blockchain on which transactions are being confirmed. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_blocks_hash.md b/models/doc_descriptions/blocks/blast_blocks_hash.md new file mode 100644 index 0000000..025b697 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_blocks_hash.md @@ -0,0 +1,5 @@ +{% docs blast_blocks_hash %} + +The hash of the block header for a given block. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_blocks_nonce.md b/models/doc_descriptions/blocks/blast_blocks_nonce.md new file mode 100644 index 0000000..86d13a1 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_blocks_nonce.md @@ -0,0 +1,5 @@ +{% docs blast_blocks_nonce %} + +Block nonce is a value used during mining to demonstrate proof of work for a given block. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_blocks_table_doc.md b/models/doc_descriptions/blocks/blast_blocks_table_doc.md new file mode 100644 index 0000000..e118c67 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_blocks_table_doc.md @@ -0,0 +1,5 @@ +{% docs blast_blocks_table_doc %} + +This table contains block level data for the Blast Blockchain. This table can be used to analyze trends at a block level, for example gas fees vs. total transactions over time. For more information on EVM transactions, please see [Etherscan Resources](https://etherscan.io/directory/Learning_Resources/Ethereum) or [The Ethereum Organization](https://ethereum.org/en/developers/docs/blocks/) + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_difficulty.md b/models/doc_descriptions/blocks/blast_difficulty.md new file mode 100644 index 0000000..3410357 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_difficulty.md @@ -0,0 +1,5 @@ +{% docs blast_difficulty %} + +The effort required to mine the block. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_extra_data.md b/models/doc_descriptions/blocks/blast_extra_data.md new file mode 100644 index 0000000..828f407 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_extra_data.md @@ -0,0 +1,5 @@ +{% docs blast_extra_data %} + +Any data included by the validator for a given block. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_gas_limit.md b/models/doc_descriptions/blocks/blast_gas_limit.md new file mode 100644 index 0000000..7e429c7 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_gas_limit.md @@ -0,0 +1,5 @@ +{% docs blast_gas_limit %} + +Total gas limit provided by all transactions in the block. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_gas_used.md b/models/doc_descriptions/blocks/blast_gas_used.md new file mode 100644 index 0000000..bd57726 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_gas_used.md @@ -0,0 +1,5 @@ +{% docs blast_gas_used %} + +Total gas used in the block. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_miner.md b/models/doc_descriptions/blocks/blast_miner.md new file mode 100644 index 0000000..336ee97 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_miner.md @@ -0,0 +1,5 @@ +{% docs blast_miner %} + +Miner who successfully added a given block to the blockchain. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_network.md b/models/doc_descriptions/blocks/blast_network.md new file mode 100644 index 0000000..b5b04b4 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_network.md @@ -0,0 +1,5 @@ +{% docs blast_network %} + +The network on the blockchain used by a transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_parent_hash.md b/models/doc_descriptions/blocks/blast_parent_hash.md new file mode 100644 index 0000000..4e6e22c --- /dev/null +++ b/models/doc_descriptions/blocks/blast_parent_hash.md @@ -0,0 +1,5 @@ +{% docs blast_parent_hash %} + +The hash of the block from which a given block is generated. Also known as the parent block. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_receipts_root.md b/models/doc_descriptions/blocks/blast_receipts_root.md new file mode 100644 index 0000000..8995fb8 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_receipts_root.md @@ -0,0 +1,5 @@ +{% docs blast_receipts_root %} + +The root of the state trie. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_sha3_uncles.md b/models/doc_descriptions/blocks/blast_sha3_uncles.md new file mode 100644 index 0000000..d987f4d --- /dev/null +++ b/models/doc_descriptions/blocks/blast_sha3_uncles.md @@ -0,0 +1,5 @@ +{% docs blast_sha3_uncles %} + +The mechanism which Ethereum Javascript RLP encodes an empty string. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_size.md b/models/doc_descriptions/blocks/blast_size.md new file mode 100644 index 0000000..9592074 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_size.md @@ -0,0 +1,5 @@ +{% docs blast_size %} + +Block size, which is determined by a given block's gas limit. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_total_difficulty.md b/models/doc_descriptions/blocks/blast_total_difficulty.md new file mode 100644 index 0000000..0a85872 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_total_difficulty.md @@ -0,0 +1,5 @@ +{% docs blast_total_difficulty %} + +Total difficulty of the chain at a given block. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_tx_count.md b/models/doc_descriptions/blocks/blast_tx_count.md new file mode 100644 index 0000000..6651118 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_tx_count.md @@ -0,0 +1,5 @@ +{% docs blast_tx_count %} + +Total number of transactions within a block. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/blast_uncle_blocks.md b/models/doc_descriptions/blocks/blast_uncle_blocks.md new file mode 100644 index 0000000..7704b35 --- /dev/null +++ b/models/doc_descriptions/blocks/blast_uncle_blocks.md @@ -0,0 +1,5 @@ +{% docs blast_uncle_blocks %} + +Uncle blocks occur when two blocks are mined and broadcasted at the same time, with the same block number. The block validated across the most nodes will be added to the primary chain, and the other one becomes an uncle block. Miners do receive rewards for uncle blocks. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/bridge/evm_bridge_activity.md b/models/doc_descriptions/bridge/evm_bridge_activity.md new file mode 100644 index 0000000..4462b99 --- /dev/null +++ b/models/doc_descriptions/bridge/evm_bridge_activity.md @@ -0,0 +1,83 @@ +{% docs evm_bridge_table_doc %} + +A convenience table that aggregates bridge activity from event_logs, traces and transfers, including bridge deposits and transfers sent from the following protocols: ACROSS, AXELAR, CELER, CBRIDGE, DLN, DEBRIDGE, HOP, MESON, STARGATE, SYMBIOSIS, SYNAPSE, WORMHOLE along with other helpful columns, including an amount USD where available. Note, this table only includes records for the protocols listed above with live, onchain bridge activity and may not represent the complete bridging picture. + +{% enddocs %} + +{% docs evm_bridge_platform %} + +The platform or protocol from which the bridge transaction or event originates. + +{% enddocs %} + +{% docs evm_bridge_origin_from %} + +The from address where the transaction originated from. This may be an EOA or contract address, however in most cases this is the user that initiated the bridge deposit or transfer. + +{% enddocs %} + +{% docs evm_bridge_sender %} + +The address that initiated the bridge deposit or transfer. This address is the sender of the tokens/assets being bridged to the destination chain. This may be an EOA or contract address. + +{% enddocs %} + +{% docs evm_bridge_receiver %} + +The designated address set to receive the deposit or transfer. This may be an EOA or contract address. + +{% enddocs %} + +{% docs evm_bridge_destination_chain_receiver %} + +The designated address set to receive the bridged tokens on the target chain after the completion of the bridge transaction. For non-evm chains, the hex address is decoded/encoded to match the data format of the destination chain, where possible. This may be an EOA or contract address. + +{% enddocs %} + +{% docs evm_bridge_destination_chain %} + +The name of the blockchain network to which the assets are being bridged. It could be any EVM compatible chain or other blockchain networks that the bridging protocol supports. + +{% enddocs %} + +{% docs evm_bridge_destination_chain_id %} + +The numeric identifier associated with the destination blockchain network. This is specific to the chain and helps in uniquely identifying it. + +{% enddocs %} + +{% docs evm_bridge_address %} + +The address of the contract responsible for handling the bridge deposit or transfer. This contract mediates the transfer and ensures that assets are sent and received appropriately. + +{% enddocs %} + +{% docs evm_bridge_token_address %} + +The address associated with the token that is being bridged. It provides a unique identifier for the token within its origin blockchain. + +{% enddocs %} + +{% docs evm_bridge_token_symbol %} + +The symbol representing the token being bridged. This provides a shorthand representation of the token. + +{% enddocs %} + +{% docs evm_bridge_amount_unadj %} + +The raw, non-decimal adjusted amount of tokens involved in the bridge transaction. + +{% enddocs %} + +{% docs evm_bridge_amount %} + +The decimal adjusted amount of tokens involved in the bridge transaction, where available. + +{% enddocs %} + +{% docs evm_bridge_amount_usd %} + +The value of the bridged tokens in USD at the time of the bridge transaction, where available. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/complete_lending/complete_lending_column_docs.md b/models/doc_descriptions/complete_lending/complete_lending_column_docs.md new file mode 100644 index 0000000..47abca4 --- /dev/null +++ b/models/doc_descriptions/complete_lending/complete_lending_column_docs.md @@ -0,0 +1,381 @@ +{% docs complete_lending_borrow_rate_mode %} + +The rate mode the user is swapping from. Stable: 1, Variable: 2. Borrowers can switch between the stable and variable rate at any time. Stable rates act as a fixed rate in the short-term, but can be re-balanced in the long-term in response to changes in market conditions. The variable rate is the rate based on the offer and demand. The stable rate, as its name indicates, will remain pretty stable and its the best option to plan how much interest you will have to pay. The variable rate will change over time and could be the optimal rate depending on market conditions. + +{% enddocs %} + +{% docs complete_lending_borrow_rate_stable %} + +The stable interest rate for borrowing assets. + +{% enddocs %} + +{% docs complete_lending_borrow_rate_variable %} + +The variable interest rate for borrowing assets. + +{% enddocs %} + +{% docs complete_lending_collateral_complete_lending_token %} + +The interest bearing token that's burned when a liquidation occurs. + +{% enddocs %} + +{% docs complete_lending_collateral_asset %} + +The asset provided as collateral, which can be liquidated. + +{% enddocs %} + +{% docs complete_lending_data_provider %} + +The protocol data provider contract address. + +{% enddocs %} + +{% docs complete_lending_debt_complete_lending_token %} + +The interest bearing token representing the debt. + +{% enddocs %} + +{% docs complete_lending_debt_asset %} + +The debt asset, which the user borrowed. + +{% enddocs %} + +{% docs complete_lending_debt_to_cover_amount %} + +The amount of debt the user must cover. + +{% enddocs %} + +{% docs complete_lending_debt_to_cover_amount_usd %} + +The amount of debt the user must cover, valued in USD. + +{% enddocs %} + +{% docs complete_lending_depositor_address %} + +The depositor's address. + +{% enddocs %} + +{% docs complete_lending_end_voting_period %} + +The block number in which the voting period ends. + +{% enddocs %} + +{% docs complete_lending_flashloan_amount %} + +The amount of assets flash loaned. + +{% enddocs %} + +{% docs complete_lending_flashloan_amount_usd %} + +The value of the flash loan amount, in USD. + +{% enddocs %} + +{% docs complete_lending_governance_contract %} + +The governance contract address. + +{% enddocs %} + +{% docs complete_lending_initiator_address %} + +The address that initiated the flash loan. + +{% enddocs %} + +{% docs complete_lending_issued_tokens %} + +The amount of tokens that the user is depositing. + +{% enddocs %} + +{% docs complete_lending_lending_pool_contract %} + +The address of the lending pool. + +{% enddocs %} + +{% docs complete_lending_liquidated_amount %} + +The amount of asset liquidated. + +{% enddocs %} + +{% docs complete_lending_liquidated_amount_usd %} + +The value of the liquidated asset, in USD. + +{% enddocs %} + +{% docs complete_lending_liquidator %} + +The address that initiated the liquidation call. + +{% enddocs %} + +{% docs complete_lending_market %} + +The asset contract for the applicable market. + +{% enddocs %} + +{% docs complete_lending_payer %} + +The address that initiated the repayment. + +{% enddocs %} + +{% docs complete_lending_premium_amount %} + +The flash loan fee, changeable via the normal governance process, decimal adjusted. + +{% enddocs %} + +{% docs complete_lending_premium_amount_usd %} + +The flash loan fee, valued in USD. + +{% enddocs %} + +{% docs complete_lending_proposal_id %} + +The unique ID representing a proposal. + +{% enddocs %} + +{% docs complete_lending_proposal_tx %} + +The transaction confirming a proposal submission. + +{% enddocs %} + +{% docs complete_lending_proposer %} + +The user's address that submitted the proposal. + +{% enddocs %} + +{% docs complete_lending_repayed_tokens %} + +The amount of tokens repaid. + +{% enddocs %} + +{% docs complete_lending_repayed_usd %} + +The value of repaid tokens, in USD. + +{% enddocs %} + +{% docs complete_lending_stable_debt_token_address %} + +Debt tokens are interest-accruing tokens that are minted and burned on borrow and repay, representing a debt to the protocol with a stable interest rate. + +{% enddocs %} + +{% docs complete_lending_start_voting_period %} + +The block number in which the voting period begins. + +{% enddocs %} + +{% docs complete_lending_status %} + +The proposal's status. + +{% enddocs %} + +{% docs complete_lending_supplied_usd %} + +The value of the asset in USD that the user is depositing. + +{% enddocs %} + +{% docs complete_lending_supply_rate %} + +The interest rate for supplying assets to the protocol. + +{% enddocs %} + +{% docs complete_lending_support %} + +A value indicating their vote (For: true, Against: false). + +{% enddocs %} + +{% docs complete_lending_target_address %} + +The address receiving the flash loan. + +{% enddocs %} + +{% docs complete_lending_targets %} + +List of the targeted addresses by proposal transactions. + +{% enddocs %} + +{% docs complete_lending_token %} + +The interest bearing token contract. + +{% enddocs %} + +{% docs complete_lending_total_liquidity_token %} + +The total supply of liquidity tokens. + +{% enddocs %} + +{% docs complete_lending_total_liquidity_usd %} + +The total value of liquidity tokens, in USD. + +{% enddocs %} + +{% docs complete_lending_total_stable_debt_token %} + +The total supply of debt tokens, representing a debt to the protocol with a stable interest rate. + +{% enddocs %} + +{% docs complete_lending_total_stable_debt_usd %} + +The total USD value of debt tokens, representing a debt to the protocol with a stable interest rate. +{% enddocs %} + +{% docs complete_lending_total_variable_debt_token %} + +The total supply of debt tokens, representing a debt to the protocol with a variable interest rate. + +{% enddocs %} + +{% docs complete_lending_total_variable_debt_usd %} + +The total USD value of debt tokens, representing a debt to the protocol with a variable interest rate. +{% enddocs %} + +{% docs complete_lending_utilization_rate %} + +The percentage of assets loaned out. + +{% enddocs %} + +{% docs complete_lending_variable_debt_token_address %} + +Debt tokens are interest-accruing tokens that are minted and burned on borrow and repay, representing a debt to the protocol with a variable interest rate. + +{% enddocs %} + +{% docs complete_lending_version %} + +The contract version. Example: Aave AMM, Aave v1, Aave v2 + +{% enddocs %} + +{% docs complete_lending_withdrawn_tokens %} + +The amount of tokens withdrawn. + +{% enddocs %} + +{% docs complete_lending_withdrawn_usd %} + +The value of withdrawn tokens, in USD. + +{% enddocs %} + +{% docs complete_lending_platform %} + +The specific protocol where lending event occurred. + +{% enddocs %} + +{% docs complete_lending_protocol_token %} + +The protocol's specific lending asset token, ie cWBTC or aETHUni. + +{% enddocs %} + +{% docs complete_lending_borrower %} + +Address that initiated the borrow event. + +{% enddocs %} + +{% docs complete_lending_amount %} + +The decimal adjusted amount of tokens involved in the lending transaction, where available. + +{% enddocs %} + +{% docs complete_lending_amount_usd %} + +The value of the tokens in USD at the time of the lending transaction, where available. + +{% enddocs %} + +{% docs complete_lending_token_address %} + +The address of the token associated with the lending action. + +{% enddocs %} + +{% docs complete_lending_token_symbol %} + +The symbol of the token associated with the lending action. + +{% enddocs %} + +{% docs complete_lending_depositor %} + +Address that initiated a deposit event. + +{% enddocs %} + +{% docs complete_lending_amount_unadj %} + +The non-decimal adjusted amount of tokens involved in the lending transaction. + +{% enddocs %} + +{% docs complete_lending_premium_amount_unadj %} + +The flash loan fee, changeable via the normal governance process, non-decimal adjusted. + +{% enddocs %} + +{% docs complete_lending_flashloan_amount_unadj %} + +The amount of assets flash loaned, non-decimal adjusted. + +{% enddocs %} + +{% docs complete_lending_flashloan_token %} + +The flashloaned token address. + +{% enddocs %} + +{% docs complete_lending_flashloan_token_symbol %} + +The flashloaned token symbol + +{% enddocs %} + +{% docs borrower %} + +Its the address of the user who is Borrowing or repaying the loan, depending on the action. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/complete_lending/complete_lending_table_docs.md b/models/doc_descriptions/complete_lending/complete_lending_table_docs.md new file mode 100644 index 0000000..66c1ee8 --- /dev/null +++ b/models/doc_descriptions/complete_lending/complete_lending_table_docs.md @@ -0,0 +1,36 @@ +{% docs complete_lending_borrows_table_doc %} + +This table contains transactions where users borrowed assets across AAVE, COMPOUND, SILO, DFORCE, RADIANT, and LODESTAR protocols. In order to borrow assets, a user must first deposit their preferred asset and amount as collateral. + + +{% enddocs %} + +{% docs complete_lending_deposits_table_doc %} + +This table contains deposit transactions across AAVE, COMPOUND, SILO, DFORCE, RADIANT, and LODESTAR protocols. A user deposits their preferred asset and amount. After depositing, users earn passive income based on the market borrowing demand. Additionally, depositing allows users to borrow by using their deposited assets as a collateral. Any interest earned by depositing funds helps offset the interest rate accumulated by borrowing. + +{% enddocs %} + +{% docs complete_lending_flashloans_table_doc %} + +This table contains flash loan transactions across AAVE and RADIANT protocols. Flash loans are a feature designed for developers, due to the technical knowledge required to execute one. Flash Loans allow you to borrow any available amount of assets without providing any collateral, as long as the liquidity is returned to the protocol within one block transaction. + +{% enddocs %} + +{% docs complete_lending_liquidations_table_doc %} + +This table contains transactions in which a borrower's collateral asset is liquidated across AAVE, COMPOUND, SILO, DFORCE, RADIANT, and LODESTAR protocols. Liquidations occur when a borrower's health factor goes below 1 due to their collateral value not properly covering their loan/debt value. This might happen when the collateral decreases in value or the borrowed debt increases in value against each other. This collateral vs loan value ratio is shown in the health factor. In a liquidation, up to 50% of a borrower's debt is repaid and that value + liquidation fee is taken from the collateral available, so after a liquidation the amount liquidated from one's debt is repaid. + +{% enddocs %} + +{% docs complete_lending_repayments_table_doc %} + +This table contains transactions in which a borrower repays their loan (debt) across the AAVE, COMPOUND, SILO, DFORCE, RADIANT, and LODESTAR protocols. Loans are repaid in the same asset borrowed, plus accrued interest. Borrowers can pay back their loan based on the USD price as they can borrow any of the available stable coins (USDC, DAI, USDT, etc.). + +{% enddocs %} + +{% docs complete_lending_withdraws_table_doc %} + +This table contains transactions in which a user withdraws liquidity across the AAVE, COMPOUND, SILO, DFORCE, RADIANT, and LODESTAR protocols. Users need to make sure there is enough liquidity (not borrowed) in order to withdraw, if this is not the case, users need to wait for more liquidity from depositors or borrowers repaying. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_creation_block.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_creation_block.md new file mode 100644 index 0000000..96d5c47 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_creation_block.md @@ -0,0 +1,5 @@ +{% docs eth_dex_creation_block %} + +The block number of when this pool was created. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_creation_time.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_creation_time.md new file mode 100644 index 0000000..31935bf --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_creation_time.md @@ -0,0 +1,5 @@ +{% docs eth_dex_creation_time %} + +The block timestamp of when this pool was created. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_creation_tx.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_creation_tx.md new file mode 100644 index 0000000..fec40c0 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_creation_tx.md @@ -0,0 +1,5 @@ +{% docs eth_dex_creation_tx %} + +The transaction where this contract was created. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_factory_address.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_factory_address.md new file mode 100644 index 0000000..db5ad7d --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_factory_address.md @@ -0,0 +1,5 @@ +{% docs eth_dex_factory_address %} + +The address that created or deployed this pool, where available. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_decimals.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_decimals.md new file mode 100644 index 0000000..6a786ea --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_decimals.md @@ -0,0 +1,15 @@ +{% docs eth_dex_lp_decimals %} + +The # of decimals for the token included in the liquidity pool, as a JSON object, where available. + +Query example to access the key:value pairing within the object: +SELECT + DISTINCT pool_address AS unique_pools, + tokens :token0 :: STRING AS token0, + symbols: token0 :: STRING AS token0_symbol, + decimals: token0 :: STRING AS token0_decimal +FROM blast.defi.dim_dex_liquidity_pools +WHERE token0_decimal = 6 +; + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_symbols.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_symbols.md new file mode 100644 index 0000000..2b652c2 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_symbols.md @@ -0,0 +1,15 @@ +{% docs eth_dex_lp_symbols %} + +The symbol for the token included in the liquidity pool, as a JSON object, where available. + +Query example to access the key:value pairing within the object: +SELECT + DISTINCT pool_address AS unique_pools, + tokens :token0 :: STRING AS token0, + symbols: token0 :: STRING AS token0_symbol, + decimals: token0 :: STRING AS token0_decimal +FROM blast.defi.dim_dex_liquidity_pools +WHERE token0_symbol = 'WETH' +; + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_table_doc.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_table_doc.md new file mode 100644 index 0000000..744757f --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_table_doc.md @@ -0,0 +1,5 @@ +{% docs eth_dex_lp_table_doc %} + +This table contains details on decentralized exchange (DEX) liquidity pools (LP) on the base blockchain, including the tokens, symbols and decimals within each pool alongside the following protocols: SUSHI, UNISWAP, BALANCER, SWAPBASED, BASESWAP, DACKIE, WOOFI, AERODROME, CURVE, and MAVERICK. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_tokens.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_tokens.md new file mode 100644 index 0000000..948c6a7 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_tokens.md @@ -0,0 +1,15 @@ +{% docs eth_dex_lp_tokens %} + +The address for the token included in the liquidity pool, as a JSON object. + +Query example to access the key:value pairing within the object: +SELECT + DISTINCT pool_address AS unique_pools, + tokens :token0 :: STRING AS token0, + symbols: token0 :: STRING AS token0_symbol, + decimals: token0 :: STRING AS token0_decimal +FROM blast.defi.dim_dex_liquidity_pools +WHERE token0 = '0x4200000000000000000000000000000000000006' +; + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_platform.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_platform.md new file mode 100644 index 0000000..f641107 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_platform.md @@ -0,0 +1,5 @@ +{% docs eth_dex_platform %} + +The protocol or platform that the liquidity pool belongs to or swap occurred on. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_pool_address.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_pool_address.md new file mode 100644 index 0000000..1d4192d --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_pool_address.md @@ -0,0 +1,5 @@ +{% docs eth_dex_pool_address %} + +The contract address for the liquidity pool. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_pool_name.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_pool_name.md new file mode 100644 index 0000000..2fc289a --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_pool_name.md @@ -0,0 +1,5 @@ +{% docs eth_dex_pool_name %} + +The name of the liquidity pool, where available. In some cases, the pool name is a concatenation of symbols or token addresses. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_in.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_in.md new file mode 100644 index 0000000..8b1cf24 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_in.md @@ -0,0 +1,5 @@ +{% docs eth_dex_swaps_amount_in %} + +The amount of tokens put into the swap. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_in_unadj.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_in_unadj.md new file mode 100644 index 0000000..0f82b78 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_in_unadj.md @@ -0,0 +1,5 @@ +{% docs eth_dex_swaps_amount_in_unadj %} + +The non-decimal adjusted amount of tokens put into the swap. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_in_usd.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_in_usd.md new file mode 100644 index 0000000..4633819 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_in_usd.md @@ -0,0 +1,5 @@ +{% docs eth_dex_swaps_amount_in_usd %} + +The amount of tokens put into the swap converted to USD using the price of the token. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_out.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_out.md new file mode 100644 index 0000000..34aab5e --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_out.md @@ -0,0 +1,5 @@ +{% docs eth_dex_swaps_amount_out %} + +The amount of tokens taken out of or received from the swap. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_out_unadj.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_out_unadj.md new file mode 100644 index 0000000..0b22557 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_out_unadj.md @@ -0,0 +1,5 @@ +{% docs eth_dex_swaps_amount_out_unadj %} + +The non-decimal adjusted amount of tokens taken out of or received from the swap. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_out_usd.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_out_usd.md new file mode 100644 index 0000000..32e5470 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_out_usd.md @@ -0,0 +1,5 @@ +{% docs eth_dex_swaps_amount_out_usd %} + +The amount of tokens taken out of or received from the swap converted to USD using the price of the token. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_sender.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_sender.md new file mode 100644 index 0000000..03a3abf --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_sender.md @@ -0,0 +1,5 @@ +{% docs eth_dex_swaps_sender %} + +The Router is the Sender in the swap function. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_symbol_in.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_symbol_in.md new file mode 100644 index 0000000..0f931bc --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_symbol_in.md @@ -0,0 +1,5 @@ +{% docs eth_dex_swaps_symbol_in %} + +The symbol of the token sent for swap. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_symbol_out.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_symbol_out.md new file mode 100644 index 0000000..d440b24 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_symbol_out.md @@ -0,0 +1,5 @@ +{% docs eth_dex_swaps_symbol_out %} + +The symbol of the token being swapped to. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_token_In.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_token_In.md new file mode 100644 index 0000000..a55bca2 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_token_In.md @@ -0,0 +1,5 @@ +{% docs eth_dex_swaps_token_in %} + +The address of the token sent for swap. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_token_out.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_token_out.md new file mode 100644 index 0000000..4695dc9 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_token_out.md @@ -0,0 +1,5 @@ +{% docs eth_dex_swaps_token_out %} + +The address of the token being swapped to. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_tx_to.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_tx_to.md new file mode 100644 index 0000000..89e354c --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_tx_to.md @@ -0,0 +1,5 @@ +{% docs eth_dex_swaps_tx_to %} + +The tx_to is the address who receives the swapped token. This corresponds to the "to" field in the swap function. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_token0.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_token0.md new file mode 100644 index 0000000..76758f8 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_token0.md @@ -0,0 +1,5 @@ +{% docs eth_dex_token0 %} + +Token 0 is the first token in the pair, and will show up first within the event logs for relevant transactions. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_token1.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_token1.md new file mode 100644 index 0000000..40ec8c4 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_token1.md @@ -0,0 +1,5 @@ +{% docs eth_dex_token1 %} + +Token 1 is the second token in the pair, and will show up second within the event logs for relevant transactions. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_tokens.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_tokens.md new file mode 100644 index 0000000..11dd78f --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_tokens.md @@ -0,0 +1,5 @@ +{% docs eth_dex_tokens %} + +This field contains the tokens within the liquidity pool as a JSON objects. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/dex - (imported from layer 1)/eth_ez_dex_swaps_table_doc.md b/models/doc_descriptions/dex - (imported from layer 1)/eth_ez_dex_swaps_table_doc.md new file mode 100644 index 0000000..74f3406 --- /dev/null +++ b/models/doc_descriptions/dex - (imported from layer 1)/eth_ez_dex_swaps_table_doc.md @@ -0,0 +1,6 @@ +{% docs eth_ez_dex_swaps_table_doc %} + +This table currently contains swap events from the ```fact_event_logs``` table for SUSHI, UNISWAP, BALANCER, SWAPBASED, BASESWAP, DACKIE, WOOFI, AERODROME, CURVE, MAVERICK, and VOODOO. along with other helpful columns including an amount USD where possible. Other dexes coming soon! +Note: A rule has been put in place to null out the amount_USD if that number is too divergent between amount_in_USD and amount_out_usd. This can happen for swaps of less liquid tokens during very high fluctuation of price. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_event_index.md b/models/doc_descriptions/event_logs/blast_event_index.md new file mode 100644 index 0000000..02c05e2 --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_event_index.md @@ -0,0 +1,5 @@ +{% docs blast_event_index %} + +Event number within a transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_event_inputs.md b/models/doc_descriptions/event_logs/blast_event_inputs.md new file mode 100644 index 0000000..2d88a04 --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_event_inputs.md @@ -0,0 +1,5 @@ +{% docs blast_event_inputs %} + +The decoded event inputs for a given event. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_event_name.md b/models/doc_descriptions/event_logs/blast_event_name.md new file mode 100644 index 0000000..b572cc1 --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_event_name.md @@ -0,0 +1,5 @@ +{% docs blast_event_name %} + +The decoded event name for a given event. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_event_removed.md b/models/doc_descriptions/event_logs/blast_event_removed.md new file mode 100644 index 0000000..de05e7b --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_event_removed.md @@ -0,0 +1,5 @@ +{% docs blast_event_removed %} + +Whether the event has been removed from the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_event_sig.md b/models/doc_descriptions/event_logs/blast_event_sig.md new file mode 100644 index 0000000..35cba34 --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_event_sig.md @@ -0,0 +1,5 @@ +{% docs blast_origin_sig %} + +The function signature of this transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_log_id_events.md b/models/doc_descriptions/event_logs/blast_log_id_events.md new file mode 100644 index 0000000..65b23d1 --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_log_id_events.md @@ -0,0 +1,5 @@ +{% docs blast_log_id_events %} + +This is the primary key for this table. This is a concatenation of the transaction hash and the event index at which the event occurred. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_logs_contract_address.md b/models/doc_descriptions/event_logs/blast_logs_contract_address.md new file mode 100644 index 0000000..a8fdf4b --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_logs_contract_address.md @@ -0,0 +1,5 @@ +{% docs blast_logs_contract_address %} + +The address interacted with for a given event. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_logs_contract_name.md b/models/doc_descriptions/event_logs/blast_logs_contract_name.md new file mode 100644 index 0000000..3d04822 --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_logs_contract_name.md @@ -0,0 +1,5 @@ +{% docs blast_logs_contract_name %} + +The name of the contract or token, where possible. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_logs_data.md b/models/doc_descriptions/event_logs/blast_logs_data.md new file mode 100644 index 0000000..5cf7ce3 --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_logs_data.md @@ -0,0 +1,5 @@ +{% docs blast_logs_data %} + +The un-decoded event data. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_logs_table_doc.md b/models/doc_descriptions/event_logs/blast_logs_table_doc.md new file mode 100644 index 0000000..29f8aa0 --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_logs_table_doc.md @@ -0,0 +1,5 @@ +{% docs blast_logs_table_doc %} + +This table contains flattened event logs from transactions on the Blast Blockchain. Transactions may have multiple events, which are denoted by the event index for a transaction hash. Therefore, this table is unique on the combination of transaction hash and event index. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_logs_tx_hash.md b/models/doc_descriptions/event_logs/blast_logs_tx_hash.md new file mode 100644 index 0000000..6d97b59 --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_logs_tx_hash.md @@ -0,0 +1,5 @@ +{% docs blast_logs_tx_hash %} + +Transaction hash is a unique 66-character identifier that is generated when a transaction is executed. This field will not be unique in this table, as a given transaction can include multiple events. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_origin_from.md b/models/doc_descriptions/event_logs/blast_origin_from.md new file mode 100644 index 0000000..0ee7ff1 --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_origin_from.md @@ -0,0 +1,5 @@ +{% docs blast_origin_from %} + +The from address of this transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_origin_to.md b/models/doc_descriptions/event_logs/blast_origin_to.md new file mode 100644 index 0000000..e12e1fe --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_origin_to.md @@ -0,0 +1,5 @@ +{% docs blast_origin_to %} + +The to address of this transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/blast_topics.md b/models/doc_descriptions/event_logs/blast_topics.md new file mode 100644 index 0000000..f0ecf95 --- /dev/null +++ b/models/doc_descriptions/event_logs/blast_topics.md @@ -0,0 +1,5 @@ +{% docs blast_topics %} + +The un-decoded event input topics. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/general/__overview__.md b/models/doc_descriptions/general/__overview__.md new file mode 100644 index 0000000..ca22721 --- /dev/null +++ b/models/doc_descriptions/general/__overview__.md @@ -0,0 +1,73 @@ +{% docs __overview__ %} + +# Welcome to the Flipside Crypto Blast Models Documentation! + +## **What does this documentation cover?** +The documentation included here details the design of the Blast tables and views available via [Flipside Crypto.](https://flipsidecrypto.xyz/) For more information on how these models are built, please see [the github repository.](https://github.com/FlipsideCrypto/blast-models) + +## **How do I use these docs?** +The easiest way to navigate this documentation is to use the Quick Links below. These links will take you to the documentation for each table, which contains a description, a list of the columns, and other helpful information. + +If you are experienced with dbt docs, feel free to use the sidebar to navigate the documentation, as well as explore the relationships between tables and the logic building them. + +There is more information on how to use dbt docs in the last section of this document. + +## **Quick Links to Table Documentation** + +**Click on the links below to jump to the documentation for each schema.** + +### Core Tables + +**Fact Tables:** +- [fact_blocks](https://flipsidecrypto.github.io/blast-models/#!/model/model.blast_models.core__fact_blocks) +- [fact_transactions](https://flipsidecrypto.github.io/blast-models/#!/model/model.blast_models.core__fact_transactions) +- [fact_event_logs](https://flipsidecrypto.github.io/blast-models/#!/model/model.blast_models.core__fact_event_logs) +- [fact_traces](https://flipsidecrypto.github.io/blast-models/#!/model/model.blast_models.core__fact_traces) + +## **Helpful User-Defined Functions (UDFs)** + +UDFs are custom functions built by the Flipside team that can be used in your queries to make your life easier. + +Please visit [LiveQuery Functions Overview](https://flipsidecrypto.github.io/livequery-models/#!/overview) for a full list of helpful UDFs. + +## **Data Model Overview** + +The Blast models are built a few different ways, but the core fact tables are built using three layers of sql models: **bronze, silver, and gold (or core).** + +- Bronze: Data is loaded in from the source as a view +- Silver: All necessary parsing, filtering, de-duping, and other transformations are done here +- Gold (or core): Final views and tables that are available publicly + +The dimension tables are sourced from a variety of on-chain and off-chain sources. + +Convenience views (denoted ez_) are a combination of different fact and dimension tables. These views are built to make it easier to query the data. + +## **Using dbt docs** +### Navigation + +You can use the ```Project``` and ```Database``` navigation tabs on the left side of the window to explore the models in the project. + +### Database Tab + +This view shows relations (tables and views) grouped into database schemas. Note that ephemeral models are *not* shown in this interface, as they do not exist in the database. + +### Graph Exploration + +You can click the blue icon on the bottom-right corner of the page to view the lineage graph of your models. + +On model pages, you'll see the immediate parents and children of the model you're exploring. By clicking the Expand button at the top-right of this lineage pane, you'll be able to see all of the models that are used to build, or are built from, the model you're exploring. + +Once expanded, you'll be able to use the ```--models``` and ```--exclude``` model selection syntax to filter the models in the graph. For more information on model selection, check out the [dbt docs](https://docs.getdbt.com/docs/model-selection-syntax). + +Note that you can also right-click on models to interactively filter and explore the graph. + + +### **More information** +- [Flipside](https://flipsidecrypto.xyz/) +- [Velocity](https://app.flipsidecrypto.com/velocity?nav=Discover) +- [Tutorials](https://docs.flipsidecrypto.com/our-data/tutorials) +- [Github](https://github.com/FlipsideCrypto/blast-models) +- [What is dbt?](https://docs.getdbt.com/docs/introduction) + + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/general/blast_block_number.md b/models/doc_descriptions/general/blast_block_number.md new file mode 100644 index 0000000..736ad26 --- /dev/null +++ b/models/doc_descriptions/general/blast_block_number.md @@ -0,0 +1,5 @@ +{% docs blast_block_number %} + +Also known as block height. The block number, which indicates the length of the blockchain, increases after the addition of each new block. + +{% enddocs %} diff --git a/models/doc_descriptions/general/blast_block_timestamp.md b/models/doc_descriptions/general/blast_block_timestamp.md new file mode 100644 index 0000000..973270b --- /dev/null +++ b/models/doc_descriptions/general/blast_block_timestamp.md @@ -0,0 +1,5 @@ +{% docs blast_block_timestamp %} + +The date and time at which the block was produced. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/general/blast_decimals.md b/models/doc_descriptions/general/blast_decimals.md new file mode 100644 index 0000000..622492e --- /dev/null +++ b/models/doc_descriptions/general/blast_decimals.md @@ -0,0 +1,5 @@ +{% docs blast_decimals %} + +The number of decimal places this contract needs adjusted where token values exist. For example, use the decimal field to correctly transform raw amounts in ```fact_token_transfers```. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/general/blast_from_address.md b/models/doc_descriptions/general/blast_from_address.md new file mode 100644 index 0000000..b88d172 --- /dev/null +++ b/models/doc_descriptions/general/blast_from_address.md @@ -0,0 +1,5 @@ +{% docs blast_from_address %} + +The sending address of this transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/general/blast_ingested_at.md b/models/doc_descriptions/general/blast_ingested_at.md new file mode 100644 index 0000000..5ca8f7f --- /dev/null +++ b/models/doc_descriptions/general/blast_ingested_at.md @@ -0,0 +1,5 @@ +{% docs blast_ingested_at %} + +Internal column. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/general/blast_symbol.md b/models/doc_descriptions/general/blast_symbol.md new file mode 100644 index 0000000..27c409c --- /dev/null +++ b/models/doc_descriptions/general/blast_symbol.md @@ -0,0 +1,5 @@ +{% docs blast_symbol %} + +The symbol belonging to the address of the token + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/general/blast_to_address.md b/models/doc_descriptions/general/blast_to_address.md new file mode 100644 index 0000000..2ef84e3 --- /dev/null +++ b/models/doc_descriptions/general/blast_to_address.md @@ -0,0 +1,5 @@ +{% docs blast_to_address %} + +The receiving address of this transaction. This can be a contract address. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/general/deprecation.md b/models/doc_descriptions/general/deprecation.md new file mode 100644 index 0000000..004e578 --- /dev/null +++ b/models/doc_descriptions/general/deprecation.md @@ -0,0 +1,11 @@ +{% docs internal_column %} + +Deprecated. This column is no longer used. Please remove from your query by Jan. 31 2024. + +{% enddocs %} + +{% docs amount_deprecation %} + +This column is being deprecated for standardization purposes on Jan. 31 2024. Please use the equivalent column without the native asset prefix. For example, use `amount` instead of `eth_amount`. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/general/export_columns.md b/models/doc_descriptions/general/export_columns.md new file mode 100644 index 0000000..848af44 --- /dev/null +++ b/models/doc_descriptions/general/export_columns.md @@ -0,0 +1,19 @@ +{% docs pk %} + +The unique identifier for each row in the table. + +{% enddocs %} + +{% docs inserted_timestamp %} + +The utc timestamp at which the row was inserted into the table. + +{% enddocs %} + +{% docs modified_timestamp %} + +The utc timestamp at which the row was last modified. + +{% enddocs %} + + diff --git a/models/doc_descriptions/general/precise_amounts.md b/models/doc_descriptions/general/precise_amounts.md new file mode 100644 index 0000000..96a815c --- /dev/null +++ b/models/doc_descriptions/general/precise_amounts.md @@ -0,0 +1,17 @@ +{% docs precise_amount_unadjusted %} + +The precise, unadjusted amount of the transaction. This is returned as a string to avoid precision loss. + +{% enddocs %} + +{% docs precise_amount_adjusted %} + +The precise, adjusted amount of the transaction. This is returned as a string to avoid precision loss. + +{% enddocs %} + +{% docs tx_fee_precise %} + +The precise amount of the transaction fee. This is returned as a string to avoid precision loss. + +{% enddocs %} diff --git a/models/doc_descriptions/labels/blast_label.md b/models/doc_descriptions/labels/blast_label.md new file mode 100644 index 0000000..2b419b6 --- /dev/null +++ b/models/doc_descriptions/labels/blast_label.md @@ -0,0 +1,5 @@ +{% docs blast_project_name %} + +The name of the project for this address. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/labels/blast_label_address.md b/models/doc_descriptions/labels/blast_label_address.md new file mode 100644 index 0000000..bb756f2 --- /dev/null +++ b/models/doc_descriptions/labels/blast_label_address.md @@ -0,0 +1,5 @@ +{% docs blast_label_address %} + +Address that the label is for. This is the field that should be used to join other tables with labels. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/labels/blast_label_address_name.md b/models/doc_descriptions/labels/blast_label_address_name.md new file mode 100644 index 0000000..c8baa0f --- /dev/null +++ b/models/doc_descriptions/labels/blast_label_address_name.md @@ -0,0 +1,5 @@ +{% docs blast_label_address_name %} + +The most granular label for this address. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/labels/blast_label_blockchain.md b/models/doc_descriptions/labels/blast_label_blockchain.md new file mode 100644 index 0000000..0ddcd11 --- /dev/null +++ b/models/doc_descriptions/labels/blast_label_blockchain.md @@ -0,0 +1,5 @@ +{% docs blast_label_blockchain %} + +The name of the blockchain. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/labels/blast_label_creator.md b/models/doc_descriptions/labels/blast_label_creator.md new file mode 100644 index 0000000..de764d3 --- /dev/null +++ b/models/doc_descriptions/labels/blast_label_creator.md @@ -0,0 +1,5 @@ +{% docs blast_label_creator %} + +The name of the creator of the label. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/labels/blast_label_subtype.md b/models/doc_descriptions/labels/blast_label_subtype.md new file mode 100644 index 0000000..9ca90c4 --- /dev/null +++ b/models/doc_descriptions/labels/blast_label_subtype.md @@ -0,0 +1,5 @@ +{% docs blast_label_subtype %} + +A sub-category nested within label type providing further detail. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/labels/blast_label_type.md b/models/doc_descriptions/labels/blast_label_type.md new file mode 100644 index 0000000..b6950e7 --- /dev/null +++ b/models/doc_descriptions/labels/blast_label_type.md @@ -0,0 +1,5 @@ +{% docs blast_label_type %} + +A high-level category describing the addresses main function or ownership. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/labels/blast_labels_table_doc.md b/models/doc_descriptions/labels/blast_labels_table_doc.md new file mode 100644 index 0000000..1728ebd --- /dev/null +++ b/models/doc_descriptions/labels/blast_labels_table_doc.md @@ -0,0 +1,5 @@ +{% docs blast_labels_table %} + +This table contains labels for addresses on the Blast Blockchain. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/labels/table_dim_labels.md b/models/doc_descriptions/labels/table_dim_labels.md new file mode 100644 index 0000000..10e72c4 --- /dev/null +++ b/models/doc_descriptions/labels/table_dim_labels.md @@ -0,0 +1,5 @@ +{% docs table_dim_labels %} + +The labels table is a store of one-to-one address identifiers, or an address name. Labels are broken out into a "type" (such as cex, dex, dapp, games, etc.) and a "subtype" (ex: contract_deployer, hot_wallet, token_contract, etc.) in order to help classify each address name into similar groups. Our labels are sourced from many different places, but can primarily be grouped into two categories: automatic and manual. Automatic labels are continuously labeled based on certain criteria, such as a known contract deploying another contract, behavior based algorithms for finding deposit wallets, and consistent data pulls of custom protocol APIs. Manual labels are done periodically to find addresses that cannot be found programmatically such as finding new protocol addresses, centralized exchange hot wallets, or trending addresses. Labels can also be added by our community by using our add-a-label tool (https://science.flipsidecrypto.xyz/add-a-label/) or on-chain with near (https://near.social/lord1.near/widget/Form) and are reviewed by our labels team. A label can be removed by our labels team if it is found to be incorrect or no longer relevant; this generally will only happen for mislabeled deposit wallets. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_aggregator_name.md b/models/doc_descriptions/nft/nft_aggregator_name.md new file mode 100644 index 0000000..6a1b73a --- /dev/null +++ b/models/doc_descriptions/nft/nft_aggregator_name.md @@ -0,0 +1,5 @@ +{% docs nft_aggregator_name%} + +The name of the aggregator platform where the sale took place. If the sale did not take place via an aggregator platform, then the value will be null. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_block_no.md b/models/doc_descriptions/nft/nft_block_no.md new file mode 100644 index 0000000..5f56a54 --- /dev/null +++ b/models/doc_descriptions/nft/nft_block_no.md @@ -0,0 +1,5 @@ +{% docs nft_block_no %} + +The block number at which the NFT event occurred. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_blocktime.md b/models/doc_descriptions/nft/nft_blocktime.md new file mode 100644 index 0000000..1080238 --- /dev/null +++ b/models/doc_descriptions/nft/nft_blocktime.md @@ -0,0 +1,5 @@ +{% docs nft_blocktime %} + +The block timestamp at which the NFT event occurred. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_buyer_address.md b/models/doc_descriptions/nft/nft_buyer_address.md new file mode 100644 index 0000000..eeb9c3d --- /dev/null +++ b/models/doc_descriptions/nft/nft_buyer_address.md @@ -0,0 +1,5 @@ +{% docs nft_buyer_address %} + +The address of the buyer of the NFT in the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_creator_fee.md b/models/doc_descriptions/nft/nft_creator_fee.md new file mode 100644 index 0000000..27fa2f8 --- /dev/null +++ b/models/doc_descriptions/nft/nft_creator_fee.md @@ -0,0 +1,5 @@ +{% docs nft_creator_fee %} + +The decimal adjusted amount of fees paid to the NFT collection as royalty payments for this NFT event in the transaction's currency. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_creator_fee_usd.md b/models/doc_descriptions/nft/nft_creator_fee_usd.md new file mode 100644 index 0000000..22c9396 --- /dev/null +++ b/models/doc_descriptions/nft/nft_creator_fee_usd.md @@ -0,0 +1,5 @@ +{% docs nft_creator_fee_usd %} + +The amount of fees paid to the NFT collection as royalty payments for this NFT event in US dollars. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_currency_address.md b/models/doc_descriptions/nft/nft_currency_address.md new file mode 100644 index 0000000..a853435 --- /dev/null +++ b/models/doc_descriptions/nft/nft_currency_address.md @@ -0,0 +1,5 @@ +{% docs nft_currency_address %} + +The token contract address for this NFT event. This will be `ETH` for native ETH transactions. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_currency_symbol.md b/models/doc_descriptions/nft/nft_currency_symbol.md new file mode 100644 index 0000000..3dd3c73 --- /dev/null +++ b/models/doc_descriptions/nft/nft_currency_symbol.md @@ -0,0 +1,5 @@ +{% docs nft_currency_symbol %} + +The token symbol for this NFT event. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_erc1155_value.md b/models/doc_descriptions/nft/nft_erc1155_value.md new file mode 100644 index 0000000..580ba06 --- /dev/null +++ b/models/doc_descriptions/nft/nft_erc1155_value.md @@ -0,0 +1,5 @@ +{% docs nft_erc1155_value %} + +If the NFT is an ERC-1155 contract, this field may be one or greater, representing the number of tokens. If it is not an ERC-1155 token, this value will be null. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_event_index.md b/models/doc_descriptions/nft/nft_event_index.md new file mode 100644 index 0000000..0d5fc39 --- /dev/null +++ b/models/doc_descriptions/nft/nft_event_index.md @@ -0,0 +1,5 @@ +{% docs nft_event_index %} + +Event number within a transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_event_type.md b/models/doc_descriptions/nft/nft_event_type.md new file mode 100644 index 0000000..82f5d8c --- /dev/null +++ b/models/doc_descriptions/nft/nft_event_type.md @@ -0,0 +1,5 @@ +{% docs nft_event_type %} + +The type of NFT event in this transaction, either `sale`, `bid_won` or `redeem`. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_events_table_doc.md b/models/doc_descriptions/nft/nft_events_table_doc.md new file mode 100644 index 0000000..81847cb --- /dev/null +++ b/models/doc_descriptions/nft/nft_events_table_doc.md @@ -0,0 +1,5 @@ +{% docs nft_events_table_doc %} + +This table contains NFT sales on the Blast blockchain. More NFT marketplaces will be added over time. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_from_address.md b/models/doc_descriptions/nft/nft_from_address.md new file mode 100644 index 0000000..a1d3c41 --- /dev/null +++ b/models/doc_descriptions/nft/nft_from_address.md @@ -0,0 +1,5 @@ +{% docs nft_from_address %} + +The sending address of the NFT in the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_intra_event_index.md b/models/doc_descriptions/nft/nft_intra_event_index.md new file mode 100644 index 0000000..4ce24fc --- /dev/null +++ b/models/doc_descriptions/nft/nft_intra_event_index.md @@ -0,0 +1,5 @@ +{% docs nft_intra_event_index %} + +The order of events within a single event index. This is primarily used for ERC1155 NFT batch transfer events. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_metadata.md b/models/doc_descriptions/nft/nft_metadata.md new file mode 100644 index 0000000..3d01653 --- /dev/null +++ b/models/doc_descriptions/nft/nft_metadata.md @@ -0,0 +1,5 @@ +{% docs nft_metadata %} + +The token metadata for this NFT. This may be blank for many NFTs. We are working to expand this field. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_mint_count.md b/models/doc_descriptions/nft/nft_mint_count.md new file mode 100644 index 0000000..a84c6bb --- /dev/null +++ b/models/doc_descriptions/nft/nft_mint_count.md @@ -0,0 +1,5 @@ +{% docs nft_mint_count %} + +The number of NFTs minted in this event. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_mint_doc.md b/models/doc_descriptions/nft/nft_mint_doc.md new file mode 100644 index 0000000..e868385 --- /dev/null +++ b/models/doc_descriptions/nft/nft_mint_doc.md @@ -0,0 +1,5 @@ +{% docs nft_mint_doc %} + +This table contains NFT mint events, defined as an NFT transfers from a burn address to an address, on the Blast blockchain. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_mint_price.md b/models/doc_descriptions/nft/nft_mint_price.md new file mode 100644 index 0000000..f9a8c47 --- /dev/null +++ b/models/doc_descriptions/nft/nft_mint_price.md @@ -0,0 +1,5 @@ +{% docs nft_mint_price %} + +The price paid in ETH to mint the NFT(s). + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_mint_price_usd.md b/models/doc_descriptions/nft/nft_mint_price_usd.md new file mode 100644 index 0000000..7e8bf17 --- /dev/null +++ b/models/doc_descriptions/nft/nft_mint_price_usd.md @@ -0,0 +1,5 @@ +{% docs nft_mint_price_usd %} + +The price paid in US dollars to mint the NFT(s). + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_mints_symbol.md b/models/doc_descriptions/nft/nft_mints_symbol.md new file mode 100644 index 0000000..688ae3d --- /dev/null +++ b/models/doc_descriptions/nft/nft_mints_symbol.md @@ -0,0 +1,5 @@ +{% docs nft_mints_symbol %} + +The symbol of the token supplied to mint the NFT, if applicable. This field may not handle all edge cases. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_mints_token_address.md b/models/doc_descriptions/nft/nft_mints_token_address.md new file mode 100644 index 0000000..84d1946 --- /dev/null +++ b/models/doc_descriptions/nft/nft_mints_token_address.md @@ -0,0 +1,5 @@ +{% docs nft_mints_token_address %} + +The contract address of the token supplied to mint the NFT, if applicable. This field may not handle all edge cases. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_mints_token_price.md b/models/doc_descriptions/nft/nft_mints_token_price.md new file mode 100644 index 0000000..03942a4 --- /dev/null +++ b/models/doc_descriptions/nft/nft_mints_token_price.md @@ -0,0 +1,5 @@ +{% docs nft_mints_token_price %} + +The decimal adjusted amount of tokens supplied within the same transaction to mint the NFT. This field may not handle all edge cases. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_mints_token_price_usd.md b/models/doc_descriptions/nft/nft_mints_token_price_usd.md new file mode 100644 index 0000000..9e500f7 --- /dev/null +++ b/models/doc_descriptions/nft/nft_mints_token_price_usd.md @@ -0,0 +1,5 @@ +{% docs nft_mints_token_price_usd %} + +The amount of tokens supplied in US dollars within the same transaction to mint the NFT. This field may not handle all edge cases. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_nft_address.md b/models/doc_descriptions/nft/nft_nft_address.md new file mode 100644 index 0000000..b064027 --- /dev/null +++ b/models/doc_descriptions/nft/nft_nft_address.md @@ -0,0 +1,5 @@ +{% docs nft_nft_address %} + +The contract address of the NFT. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_nft_from_address.md b/models/doc_descriptions/nft/nft_nft_from_address.md new file mode 100644 index 0000000..b5e039f --- /dev/null +++ b/models/doc_descriptions/nft/nft_nft_from_address.md @@ -0,0 +1,5 @@ +{% docs nft_nft_from_address %} + +The address of the nft sender for this event. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_nft_to_address.md b/models/doc_descriptions/nft/nft_nft_to_address.md new file mode 100644 index 0000000..4d6e121 --- /dev/null +++ b/models/doc_descriptions/nft/nft_nft_to_address.md @@ -0,0 +1,5 @@ +{% docs nft_nft_to_address %} + +The address of the nft receiver for this event. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_origin_from.md b/models/doc_descriptions/nft/nft_origin_from.md new file mode 100644 index 0000000..252828b --- /dev/null +++ b/models/doc_descriptions/nft/nft_origin_from.md @@ -0,0 +1,5 @@ +{% docs nft_origin_from %} + +The from address of this transaction. In most cases, this is the NFT buyer. However, for some more complex transactions, it may not be the NFT buyer. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_origin_sig.md b/models/doc_descriptions/nft/nft_origin_sig.md new file mode 100644 index 0000000..02b4ce6 --- /dev/null +++ b/models/doc_descriptions/nft/nft_origin_sig.md @@ -0,0 +1,5 @@ +{% docs nft_origin_sig %} + +The function signature of this transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_origin_to.md b/models/doc_descriptions/nft/nft_origin_to.md new file mode 100644 index 0000000..316a2b6 --- /dev/null +++ b/models/doc_descriptions/nft/nft_origin_to.md @@ -0,0 +1,5 @@ +{% docs nft_origin_to %} + +The to address of this transaction. In most cases, this is the exchange contract. However, for some more complex NFT events, such as aggregate buys with tools such as Gem and Genie, this may not be the exchange address. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_platform_address.md b/models/doc_descriptions/nft/nft_platform_address.md new file mode 100644 index 0000000..aa0f059 --- /dev/null +++ b/models/doc_descriptions/nft/nft_platform_address.md @@ -0,0 +1,5 @@ +{% docs nft_platform_address %} + +The address of the exchange used for the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_platform_exchange_version.md b/models/doc_descriptions/nft/nft_platform_exchange_version.md new file mode 100644 index 0000000..18be47c --- /dev/null +++ b/models/doc_descriptions/nft/nft_platform_exchange_version.md @@ -0,0 +1,5 @@ +{% docs nft_platform_exchange_version %} + +The version of the exchange contract used for the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_platform_fee.md b/models/doc_descriptions/nft/nft_platform_fee.md new file mode 100644 index 0000000..6497c53 --- /dev/null +++ b/models/doc_descriptions/nft/nft_platform_fee.md @@ -0,0 +1,5 @@ +{% docs nft_platform_fee %} + +The decimal adjusted amount of fees paid to the platform for this NFT event in the transaction's currency. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_platform_fee_usd.md b/models/doc_descriptions/nft/nft_platform_fee_usd.md new file mode 100644 index 0000000..552cbfd --- /dev/null +++ b/models/doc_descriptions/nft/nft_platform_fee_usd.md @@ -0,0 +1,5 @@ +{% docs nft_platform_fee_usd %} + +The amount of fees paid to the platform for this NFT event in US dollars. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_platform_name.md b/models/doc_descriptions/nft/nft_platform_name.md new file mode 100644 index 0000000..05c78e1 --- /dev/null +++ b/models/doc_descriptions/nft/nft_platform_name.md @@ -0,0 +1,5 @@ +{% docs nft_platform_name %} + +The name of the exchange used for the trade. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_price.md b/models/doc_descriptions/nft/nft_price.md new file mode 100644 index 0000000..1dccd76 --- /dev/null +++ b/models/doc_descriptions/nft/nft_price.md @@ -0,0 +1,5 @@ +{% docs nft_price %} + +The amount of the NFT event in the currency in which the transaction occurred, decimal adjusted where possible. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_price_usd.md b/models/doc_descriptions/nft/nft_price_usd.md new file mode 100644 index 0000000..2dc1df1 --- /dev/null +++ b/models/doc_descriptions/nft/nft_price_usd.md @@ -0,0 +1,5 @@ +{% docs nft_price_usd %} + +The amount of the NFT event in US dollars. This will be 0 for tokens without a decimal adjustment or hourly price. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_project_name.md b/models/doc_descriptions/nft/nft_project_name.md new file mode 100644 index 0000000..2ddcf23 --- /dev/null +++ b/models/doc_descriptions/nft/nft_project_name.md @@ -0,0 +1,5 @@ +{% docs nft_project_name %} + +The name of the NFT project. This field, along with metadata, will be filled in over time. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_seller_address.md b/models/doc_descriptions/nft/nft_seller_address.md new file mode 100644 index 0000000..198294c --- /dev/null +++ b/models/doc_descriptions/nft/nft_seller_address.md @@ -0,0 +1,5 @@ +{% docs nft_seller_address %} + +The address of the seller of the NFT in the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_to_address.md b/models/doc_descriptions/nft/nft_to_address.md new file mode 100644 index 0000000..547c383 --- /dev/null +++ b/models/doc_descriptions/nft/nft_to_address.md @@ -0,0 +1,5 @@ +{% docs nft_to_address %} + +The receiving address of the NFT in the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_tokenid.md b/models/doc_descriptions/nft/nft_tokenid.md new file mode 100644 index 0000000..6d2e48b --- /dev/null +++ b/models/doc_descriptions/nft/nft_tokenid.md @@ -0,0 +1,5 @@ +{% docs nft_tokenid %} + +The token ID for this NFT contract. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_total_fees.md b/models/doc_descriptions/nft/nft_total_fees.md new file mode 100644 index 0000000..7ec60c9 --- /dev/null +++ b/models/doc_descriptions/nft/nft_total_fees.md @@ -0,0 +1,5 @@ +{% docs nft_total_fees %} + +The total amount of fees paid relating to the NFT purchase in the transaction currency. This includes royalty payments to creators and platform fees. Please note, this does not include the gas fee. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_total_fees_usd.md b/models/doc_descriptions/nft/nft_total_fees_usd.md new file mode 100644 index 0000000..e37b719 --- /dev/null +++ b/models/doc_descriptions/nft/nft_total_fees_usd.md @@ -0,0 +1,5 @@ +{% docs nft_total_fees_usd %} + +The total amount of fees paid relating to the NFT purchase in US dollars. This includes royalty payments to creators and platform fees. Please note, this does not include the gas fee. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_transfer_doc.md b/models/doc_descriptions/nft/nft_transfer_doc.md new file mode 100644 index 0000000..1eb8338 --- /dev/null +++ b/models/doc_descriptions/nft/nft_transfer_doc.md @@ -0,0 +1,5 @@ +{% docs nft_transfer_doc %} + +This table contains NFT transfer events on the Bl blockchain. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_tx_fee.md b/models/doc_descriptions/nft/nft_tx_fee.md new file mode 100644 index 0000000..c5161cc --- /dev/null +++ b/models/doc_descriptions/nft/nft_tx_fee.md @@ -0,0 +1,5 @@ +{% docs nft_tx_fee %} + +The gas fee for this transaction in ETH. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_tx_fee_usd.md b/models/doc_descriptions/nft/nft_tx_fee_usd.md new file mode 100644 index 0000000..24ea662 --- /dev/null +++ b/models/doc_descriptions/nft/nft_tx_fee_usd.md @@ -0,0 +1,5 @@ +{% docs nft_tx_fee_usd %} + +The gas fee for this transaction in US dollars. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/nft/nft_tx_hash.md b/models/doc_descriptions/nft/nft_tx_hash.md new file mode 100644 index 0000000..10e7762 --- /dev/null +++ b/models/doc_descriptions/nft/nft_tx_hash.md @@ -0,0 +1,5 @@ +{% docs nft_tx_hash %} + +The transaction hash for the NFT event. This is not necessarily unique in this table as a transaction may contain multiple NFT events. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_block_no.md b/models/doc_descriptions/traces/blast_traces_block_no.md new file mode 100644 index 0000000..756ae7f --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_block_no.md @@ -0,0 +1,5 @@ +{% docs blast_traces_block_no %} + +The block number of this transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_blocktime.md b/models/doc_descriptions/traces/blast_traces_blocktime.md new file mode 100644 index 0000000..f3251da --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_blocktime.md @@ -0,0 +1,5 @@ +{% docs blast_traces_blocktime %} + +The block timestamp of this transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_call_data.md b/models/doc_descriptions/traces/blast_traces_call_data.md new file mode 100644 index 0000000..3ce6bfd --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_call_data.md @@ -0,0 +1,5 @@ +{% docs blast_traces_call_data %} + +The raw JSON data for this trace. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_from.md b/models/doc_descriptions/traces/blast_traces_from.md new file mode 100644 index 0000000..e5a92db --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_from.md @@ -0,0 +1,5 @@ +{% docs blast_traces_from %} + +The sending address of this trace. This is not necessarily the from address of the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_gas.md b/models/doc_descriptions/traces/blast_traces_gas.md new file mode 100644 index 0000000..f15dbd0 --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_gas.md @@ -0,0 +1,5 @@ +{% docs blast_traces_gas %} + +The gas supplied for this trace. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_gas_used.md b/models/doc_descriptions/traces/blast_traces_gas_used.md new file mode 100644 index 0000000..dff6823 --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_gas_used.md @@ -0,0 +1,5 @@ +{% docs blast_traces_gas_used %} + +The gas used for this trace. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_identifier.md b/models/doc_descriptions/traces/blast_traces_identifier.md new file mode 100644 index 0000000..e12e6ae --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_identifier.md @@ -0,0 +1,5 @@ +{% docs blast_traces_identifier %} + +This field represents the position and type of the trace within the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_index.md b/models/doc_descriptions/traces/blast_traces_index.md new file mode 100644 index 0000000..efdc3f3 --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_index.md @@ -0,0 +1,5 @@ +{% docs blast_trace_index %} + +The index of the trace within the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_input.md b/models/doc_descriptions/traces/blast_traces_input.md new file mode 100644 index 0000000..83e4b02 --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_input.md @@ -0,0 +1,5 @@ +{% docs blast_traces_input %} + +The input data for this trace. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_output.md b/models/doc_descriptions/traces/blast_traces_output.md new file mode 100644 index 0000000..b23f549 --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_output.md @@ -0,0 +1,5 @@ +{% docs blast_traces_output %} + +The output data for this trace. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_sub.md b/models/doc_descriptions/traces/blast_traces_sub.md new file mode 100644 index 0000000..3b54cfd --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_sub.md @@ -0,0 +1,5 @@ +{% docs blast_traces_sub %} + +The amount of nested sub traces for this trace. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_table_doc.md b/models/doc_descriptions/traces/blast_traces_table_doc.md new file mode 100644 index 0000000..1d4d2f2 --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_table_doc.md @@ -0,0 +1,5 @@ +{% docs blast_traces_table_doc %} + +This table contains flattened trace data for internal contract calls on the Blast Blockchain. Hex encoded fields can be decoded to integers by using `utils.udf_hex_to_int()`. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_to.md b/models/doc_descriptions/traces/blast_traces_to.md new file mode 100644 index 0000000..fcd01b7 --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_to.md @@ -0,0 +1,5 @@ +{% docs blast_traces_to %} + +The receiving address of this trace. This is not necessarily the to address of the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_tx_hash.md b/models/doc_descriptions/traces/blast_traces_tx_hash.md new file mode 100644 index 0000000..b317c95 --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_tx_hash.md @@ -0,0 +1,5 @@ +{% docs blast_traces_tx_hash %} + +The transaction hash for the trace. Please note, this is not necessarily unique in this table as transactions frequently have multiple traces. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_type.md b/models/doc_descriptions/traces/blast_traces_type.md new file mode 100644 index 0000000..515468a --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_type.md @@ -0,0 +1,5 @@ +{% docs blast_traces_type %} + +The type of internal transaction. Common trace types are `CALL`, `DELEGATECALL`, and `STATICCALL`. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/blast_traces_value.md b/models/doc_descriptions/traces/blast_traces_value.md new file mode 100644 index 0000000..8572fb0 --- /dev/null +++ b/models/doc_descriptions/traces/blast_traces_value.md @@ -0,0 +1,5 @@ +{% docs blast_traces_value %} + +The amount of ETH transferred in this trace. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_cumulative_gas_used.md b/models/doc_descriptions/transactions/blast_cumulative_gas_used.md new file mode 100644 index 0000000..1b11e8b --- /dev/null +++ b/models/doc_descriptions/transactions/blast_cumulative_gas_used.md @@ -0,0 +1,5 @@ +{% docs blast_cumulative_gas_used %} + +The total amount of gas used when this transaction was executed in the block. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_tx_block_hash.md b/models/doc_descriptions/transactions/blast_tx_block_hash.md new file mode 100644 index 0000000..f96bad3 --- /dev/null +++ b/models/doc_descriptions/transactions/blast_tx_block_hash.md @@ -0,0 +1,5 @@ +{% docs blast_tx_block_hash %} + +Block hash is a unique 66-character identifier that is generate when a block is produced. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_tx_fee.md b/models/doc_descriptions/transactions/blast_tx_fee.md new file mode 100644 index 0000000..e6d8462 --- /dev/null +++ b/models/doc_descriptions/transactions/blast_tx_fee.md @@ -0,0 +1,5 @@ +{% docs blast_tx_fee %} + +Amount paid to validate the transaction in ETH. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_tx_gas_limit.md b/models/doc_descriptions/transactions/blast_tx_gas_limit.md new file mode 100644 index 0000000..bab865f --- /dev/null +++ b/models/doc_descriptions/transactions/blast_tx_gas_limit.md @@ -0,0 +1,5 @@ +{% docs blast_tx_gas_limit %} + +Maximum amount of gas allocated for the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_tx_gas_price.md b/models/doc_descriptions/transactions/blast_tx_gas_price.md new file mode 100644 index 0000000..f69fefb --- /dev/null +++ b/models/doc_descriptions/transactions/blast_tx_gas_price.md @@ -0,0 +1,5 @@ +{% docs blast_tx_gas_price %} + +Cost per unit of gas in Gwei. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_tx_gas_used.md b/models/doc_descriptions/transactions/blast_tx_gas_used.md new file mode 100644 index 0000000..e0e1824 --- /dev/null +++ b/models/doc_descriptions/transactions/blast_tx_gas_used.md @@ -0,0 +1,5 @@ +{% docs blast_tx_gas_used %} + +Gas used by transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_tx_hash.md b/models/doc_descriptions/transactions/blast_tx_hash.md new file mode 100644 index 0000000..fdf8e05 --- /dev/null +++ b/models/doc_descriptions/transactions/blast_tx_hash.md @@ -0,0 +1,5 @@ +{% docs blast_tx_hash %} + +Transaction hash is a unique 66-character identifier that is generated when a transaction is executed. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_tx_input_data.md b/models/doc_descriptions/transactions/blast_tx_input_data.md new file mode 100644 index 0000000..9412094 --- /dev/null +++ b/models/doc_descriptions/transactions/blast_tx_input_data.md @@ -0,0 +1,5 @@ +{% docs blast_tx_input_data %} + +This column contains additional data for this transaction, and is commonly used as part of a contract interaction or as a message to the recipient. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_tx_json.md b/models/doc_descriptions/transactions/blast_tx_json.md new file mode 100644 index 0000000..5175696 --- /dev/null +++ b/models/doc_descriptions/transactions/blast_tx_json.md @@ -0,0 +1,5 @@ +{% docs blast_tx_json %} + +This JSON column contains the transaction details, including event logs. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_tx_nonce.md b/models/doc_descriptions/transactions/blast_tx_nonce.md new file mode 100644 index 0000000..b0ad5ca --- /dev/null +++ b/models/doc_descriptions/transactions/blast_tx_nonce.md @@ -0,0 +1,5 @@ +{% docs blast_tx_nonce %} + +The number of transactions sent from a given address. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_tx_origin_sig.md b/models/doc_descriptions/transactions/blast_tx_origin_sig.md new file mode 100644 index 0000000..ac57d5c --- /dev/null +++ b/models/doc_descriptions/transactions/blast_tx_origin_sig.md @@ -0,0 +1,5 @@ +{% docs blast_tx_origin_sig %} + +The function signature of the contract call. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_tx_position.md b/models/doc_descriptions/transactions/blast_tx_position.md new file mode 100644 index 0000000..bd7c2d8 --- /dev/null +++ b/models/doc_descriptions/transactions/blast_tx_position.md @@ -0,0 +1,5 @@ +{% docs blast_tx_position %} + +The position of the transaction within the block. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_tx_status.md b/models/doc_descriptions/transactions/blast_tx_status.md new file mode 100644 index 0000000..a217ffd --- /dev/null +++ b/models/doc_descriptions/transactions/blast_tx_status.md @@ -0,0 +1,5 @@ +{% docs blast_tx_status %} + +Status of the transaction. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_tx_table_doc.md b/models/doc_descriptions/transactions/blast_tx_table_doc.md new file mode 100644 index 0000000..c71b782 --- /dev/null +++ b/models/doc_descriptions/transactions/blast_tx_table_doc.md @@ -0,0 +1,5 @@ +{% docs blast_tx_table_doc %} + +This table contains transaction level data for the Blast Blockchain. Each transaction will have a unique transaction hash, along with transactions fees and a ETH value transferred when applicable. Transactions may be native ETH transfers or interactions with contract addresses. For more information, please see [The Ethereum Organization - Transactions](https://ethereum.org/en/developers/docs/transactions/) + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/blast_value.md b/models/doc_descriptions/transactions/blast_value.md new file mode 100644 index 0000000..5f4a2d9 --- /dev/null +++ b/models/doc_descriptions/transactions/blast_value.md @@ -0,0 +1,5 @@ +{% docs blast_value %} + +The value transacted in ETH. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_eth_amount.md b/models/doc_descriptions/transfers/blast_eth_amount.md new file mode 100644 index 0000000..92664c6 --- /dev/null +++ b/models/doc_descriptions/transfers/blast_eth_amount.md @@ -0,0 +1,5 @@ +{% docs blast_eth_amount %} + +ETH value transferred. + +{% enddocs %} diff --git a/models/doc_descriptions/transfers/blast_eth_amount_usd.md b/models/doc_descriptions/transfers/blast_eth_amount_usd.md new file mode 100644 index 0000000..8870991 --- /dev/null +++ b/models/doc_descriptions/transfers/blast_eth_amount_usd.md @@ -0,0 +1,6 @@ + +{% docs blast_eth_amount_usd %} + +ETH value transferred, in USD. + +{% enddocs %} diff --git a/models/doc_descriptions/transfers/blast_ez_eth_transfers_table_doc.md b/models/doc_descriptions/transfers/blast_ez_eth_transfers_table_doc.md new file mode 100644 index 0000000..1951223 --- /dev/null +++ b/models/doc_descriptions/transfers/blast_ez_eth_transfers_table_doc.md @@ -0,0 +1,5 @@ +{% docs blast_ez_eth_transfers_table_doc %} + +This table contains all native ETH transfers, including equivalent USD amounts. The origin addresses correspond to the to and from addresses from the `fact_transactions` table. The `identifier` and `tx_hash` columns relate this table back to `fact_traces`, which contains more details on the transfers. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_ez_transfer_table_doc.md b/models/doc_descriptions/transfers/blast_ez_transfer_table_doc.md new file mode 100644 index 0000000..acb3e43 --- /dev/null +++ b/models/doc_descriptions/transfers/blast_ez_transfer_table_doc.md @@ -0,0 +1,5 @@ +{% docs blast_ez_transfers_table_doc %} + +This table will contain all events in the ```fact_token_transfers table```, along with joined columns such as token price, symbol, and decimals where possible that allow for easier analysis of token transfer events. Please note Native ETH transfers are not included here. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_log_id_transfers.md b/models/doc_descriptions/transfers/blast_log_id_transfers.md new file mode 100644 index 0000000..49708ca --- /dev/null +++ b/models/doc_descriptions/transfers/blast_log_id_transfers.md @@ -0,0 +1,5 @@ +{% docs blast_log_id_transfers %} + +This is the primary key for this table. This is a concatenation of the transaction hash and the event index at which the transfer event occurred. This field can be used to find more details on the event within the ```fact_event_logs``` table. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_origin_from.md b/models/doc_descriptions/transfers/blast_origin_from.md new file mode 100644 index 0000000..e8ad974 --- /dev/null +++ b/models/doc_descriptions/transfers/blast_origin_from.md @@ -0,0 +1,5 @@ +{% docs blast_eth_origin_from %} + +The from address at the transaction level. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_origin_to.md b/models/doc_descriptions/transfers/blast_origin_to.md new file mode 100644 index 0000000..868ff60 --- /dev/null +++ b/models/doc_descriptions/transfers/blast_origin_to.md @@ -0,0 +1,5 @@ +{% docs blast_eth_origin_to %} + +The to address at the transaction level. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_transfer_amount.md b/models/doc_descriptions/transfers/blast_transfer_amount.md new file mode 100644 index 0000000..bd79740 --- /dev/null +++ b/models/doc_descriptions/transfers/blast_transfer_amount.md @@ -0,0 +1,11 @@ +{% docs blast_transfer_amount %} + +The decimal transformed amount for this token. Tokens without a decimal adjustment will be nulled out here. + +{% enddocs %} + +{% docs blast_transfer_amount_precise %} + +The decimal transformed amount for this token returned as a string to preserve precision. Tokens without a decimal adjustment will be nulled out here. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_transfer_amount_usd.md b/models/doc_descriptions/transfers/blast_transfer_amount_usd.md new file mode 100644 index 0000000..fb9799d --- /dev/null +++ b/models/doc_descriptions/transfers/blast_transfer_amount_usd.md @@ -0,0 +1,5 @@ +{% docs blast_transfer_amount_usd %} + +The amount in US dollars for this transfer at the time of the transfer. Tokens without a decimal adjustment or price will be nulled out here. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_transfer_contract_address.md b/models/doc_descriptions/transfers/blast_transfer_contract_address.md new file mode 100644 index 0000000..c15541c --- /dev/null +++ b/models/doc_descriptions/transfers/blast_transfer_contract_address.md @@ -0,0 +1,5 @@ +{% docs blast_transfer_contract_address %} + +Contract address of the token being transferred. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_transfer_from_address.md b/models/doc_descriptions/transfers/blast_transfer_from_address.md new file mode 100644 index 0000000..62292bc --- /dev/null +++ b/models/doc_descriptions/transfers/blast_transfer_from_address.md @@ -0,0 +1,5 @@ +{% docs blast_transfer_from_address %} + +The sending address of this transfer. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_transfer_has_decimal.md b/models/doc_descriptions/transfers/blast_transfer_has_decimal.md new file mode 100644 index 0000000..94c34eb --- /dev/null +++ b/models/doc_descriptions/transfers/blast_transfer_has_decimal.md @@ -0,0 +1,5 @@ +{% docs blast_transfer_has_decimal %} + +Whether or not our contracts model contains the necessary decimal adjustment for this token. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_transfer_has_price.md b/models/doc_descriptions/transfers/blast_transfer_has_price.md new file mode 100644 index 0000000..57a8bf1 --- /dev/null +++ b/models/doc_descriptions/transfers/blast_transfer_has_price.md @@ -0,0 +1,5 @@ +{% docs blast_transfer_has_price %} + +Whether or not our prices model contains this hourly token price. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_transfer_raw_amount.md b/models/doc_descriptions/transfers/blast_transfer_raw_amount.md new file mode 100644 index 0000000..3fe5a3b --- /dev/null +++ b/models/doc_descriptions/transfers/blast_transfer_raw_amount.md @@ -0,0 +1,11 @@ +{% docs blast_transfer_raw_amount %} + +The amount of tokens transferred. This value is not decimal adjusted. + +{% enddocs %} + +{% docs blast_transfer_raw_amount_precise %} + +The amount of tokens transferred returned as a string to preserve precision. This value is not decimal adjusted. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_transfer_table_doc.md b/models/doc_descriptions/transfers/blast_transfer_table_doc.md new file mode 100644 index 0000000..32ff924 --- /dev/null +++ b/models/doc_descriptions/transfers/blast_transfer_table_doc.md @@ -0,0 +1,5 @@ +{% docs blast_transfer_table_doc %} + +This table contains events on the Blast Blockchain with an event name of 'Transfer'. The contract address is the token transferred, and the raw amount field is the amount of tokens transferred. Please note this amount is not decimal adjusted. This table will not contain transfers of native ETH. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_transfer_to_address.md b/models/doc_descriptions/transfers/blast_transfer_to_address.md new file mode 100644 index 0000000..a69aee3 --- /dev/null +++ b/models/doc_descriptions/transfers/blast_transfer_to_address.md @@ -0,0 +1,5 @@ +{% docs blast_transfer_to_address %} + +The receiving address of this transfer. This can be a contract address. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_transfer_token_price.md b/models/doc_descriptions/transfers/blast_transfer_token_price.md new file mode 100644 index 0000000..7828b97 --- /dev/null +++ b/models/doc_descriptions/transfers/blast_transfer_token_price.md @@ -0,0 +1,5 @@ +{% docs blast_transfer_token_price %} + +The price, if available, for this token at the transfer time. + +{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/blast_transfer_tx_hash.md b/models/doc_descriptions/transfers/blast_transfer_tx_hash.md new file mode 100644 index 0000000..5efd34b --- /dev/null +++ b/models/doc_descriptions/transfers/blast_transfer_tx_hash.md @@ -0,0 +1,5 @@ +{% docs blast_transfer_tx_hash %} + +Transaction hash is a unique 66-character identifier that is generated when a transaction is executed. This will not be unique in this table as a transaction could include multiple transfer events. + +{% enddocs %} \ No newline at end of file diff --git a/models/github_actions/github_actions__current_task_status.sql b/models/github_actions/github_actions__current_task_status.sql new file mode 100644 index 0000000..577a226 --- /dev/null +++ b/models/github_actions/github_actions__current_task_status.sql @@ -0,0 +1,6 @@ +{{ config( + materialized = 'view', + tags = ['gha_tasks'] +) }} + +{{ fsc_utils.gha_task_current_status_view() }} \ No newline at end of file diff --git a/models/github_actions/github_actions__current_task_status.yml b/models/github_actions/github_actions__current_task_status.yml new file mode 100644 index 0000000..7923144 --- /dev/null +++ b/models/github_actions/github_actions__current_task_status.yml @@ -0,0 +1,16 @@ +version: 2 +models: + - name: github_actions__current_task_status + columns: + - name: PIPELINE_ACTIVE + tests: + - dbt_expectations.expect_column_values_to_be_in_set: + value_set: + - TRUE + - name: SUCCESSES + tests: + - dbt_expectations.expect_column_values_to_be_in_set: + value_set: + - 2 + config: + severity: warn \ No newline at end of file diff --git a/models/github_actions/github_actions__task_history.sql b/models/github_actions/github_actions__task_history.sql new file mode 100644 index 0000000..9c35ce7 --- /dev/null +++ b/models/github_actions/github_actions__task_history.sql @@ -0,0 +1,5 @@ +{{ config( + materialized = 'view' +) }} + +{{ fsc_utils.gha_task_history_view() }} \ No newline at end of file diff --git a/models/github_actions/github_actions__task_performance.sql b/models/github_actions/github_actions__task_performance.sql new file mode 100644 index 0000000..117ded5 --- /dev/null +++ b/models/github_actions/github_actions__task_performance.sql @@ -0,0 +1,5 @@ +{{ config( + materialized = 'view' +) }} + +{{ fsc_utils.gha_task_performance_view() }} \ No newline at end of file diff --git a/models/github_actions/github_actions__task_schedule.sql b/models/github_actions/github_actions__task_schedule.sql new file mode 100644 index 0000000..ff95a44 --- /dev/null +++ b/models/github_actions/github_actions__task_schedule.sql @@ -0,0 +1,5 @@ +{{ config( + materialized = 'view' +) }} + +{{ fsc_utils.gha_task_schedule_view() }} \ No newline at end of file diff --git a/models/github_actions/github_actions__tasks.sql b/models/github_actions/github_actions__tasks.sql new file mode 100644 index 0000000..feab82a --- /dev/null +++ b/models/github_actions/github_actions__tasks.sql @@ -0,0 +1,5 @@ +{{ config( + materialized = 'view' +) }} + +{{ fsc_utils.gha_tasks_view() }} \ No newline at end of file diff --git a/models/silver/core/silver__blocks.sql b/models/silver/core/silver__blocks.sql new file mode 100644 index 0000000..8b99e56 --- /dev/null +++ b/models/silver/core/silver__blocks.sql @@ -0,0 +1,77 @@ +{# -- depends_on: {{ ref('bronze__streamline_blocks') }} +{{ config( + materialized = 'incremental', + unique_key = "block_number", + cluster_by = "block_timestamp::date", + tags = ['core','non_realtime'], + merge_exclude_columns = ["inserted_timestamp"], + full_refresh = false +) }} + +SELECT + block_number, + utils.udf_hex_to_int( + DATA :baseFeePerGas :: STRING + ) :: INT AS base_fee_per_gas, + utils.udf_hex_to_int( + DATA :difficulty :: STRING + ) :: INT AS difficulty, + DATA :extraData :: STRING AS extra_data, + utils.udf_hex_to_int( + DATA :gasLimit :: STRING + ) :: INT AS gas_limit, + utils.udf_hex_to_int( + DATA :gasUsed :: STRING + ) :: INT AS gas_used, + DATA :hash :: STRING AS HASH, + DATA :logsBloom :: STRING AS logs_bloom, + DATA :miner :: STRING AS miner, + DATA :mixHash :: STRING AS mixHash, + utils.udf_hex_to_int( + DATA :nonce :: STRING + ) :: INT AS nonce, + utils.udf_hex_to_int( + DATA :number :: STRING + ) :: INT AS NUMBER, + DATA :parentHash :: STRING AS parent_hash, + DATA :receiptsRoot :: STRING AS receipts_root, + DATA :sha3Uncles :: STRING AS sha3_uncles, + utils.udf_hex_to_int( + DATA :size :: STRING + ) :: INT AS SIZE, + DATA :stateRoot :: STRING AS state_root, + utils.udf_hex_to_int( + DATA :timestamp :: STRING + ) :: TIMESTAMP AS block_timestamp, + utils.udf_hex_to_int( + DATA :totalDifficulty :: STRING + ) :: INT AS total_difficulty, + DATA :transactionsRoot :: STRING AS transactions_root, + DATA :uncles AS uncles, + DATA :withdrawals AS withdrawals, + DATA :withdrawalsRoot :: STRING AS withdrawals_root, + _inserted_timestamp, + {{ dbt_utils.generate_surrogate_key( + ['block_number'] + ) }} AS blocks_id, + SYSDATE() AS inserted_timestamp, + SYSDATE() AS modified_timestamp, + '{{ invocation_id }}' AS _invocation_id +FROM + +{% if is_incremental() %} +{{ ref('bronze__streamline_blocks') }} +WHERE + _inserted_timestamp >= ( + SELECT + MAX(_inserted_timestamp) _inserted_timestamp + FROM + {{ this }} + ) +{% else %} + {{ ref('bronze__streamline_FR_blocks') }} +{% endif %} + +qualify(ROW_NUMBER() over (PARTITION BY block_number +ORDER BY + _inserted_timestamp DESC)) = 1 #} diff --git a/models/silver/core/silver__logs.sql b/models/silver/core/silver__logs.sql new file mode 100644 index 0000000..2d61529 --- /dev/null +++ b/models/silver/core/silver__logs.sql @@ -0,0 +1,189 @@ +{# {{ config( + materialized = 'incremental', + incremental_strategy = 'delete+insert', + unique_key = "block_number", + cluster_by = "block_timestamp::date, _inserted_timestamp::date", + post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION", + tags = ['core','non_realtime'], + full_refresh = false +) }} + +WITH base AS ( + + SELECT + block_number, + tx_hash, + from_address AS origin_from_address, + to_address AS origin_to_address, + tx_status, + logs, + _inserted_timestamp + FROM + {{ ref('silver__receipts') }} + WHERE + ARRAY_SIZE(logs) > 0 + +{% if is_incremental() %} +AND _INSERTED_TIMESTAMP >= ( + SELECT + MAX(_INSERTED_TIMESTAMP) _INSERTED_TIMESTAMP + FROM + {{ this }} +) +{% endif %} +), +flat_logs AS ( + SELECT + block_number, + tx_hash, + origin_from_address, + origin_to_address, + tx_status, + VALUE :address :: STRING AS contract_address, + VALUE :blockHash :: STRING AS block_hash, + VALUE :data :: STRING AS DATA, + utils.udf_hex_to_int( + VALUE :logIndex :: STRING + ) :: INT AS event_index, + VALUE :removed :: BOOLEAN AS event_removed, + VALUE :topics AS topics, + _inserted_timestamp + FROM + base, + LATERAL FLATTEN( + input => logs + ) +), +new_records AS ( + SELECT + l.block_number, + txs.block_timestamp, + l.tx_hash, + l.origin_from_address, + l.origin_to_address, + txs.origin_function_signature, + l.tx_status, + l.contract_address, + l.block_hash, + l.data, + l.event_index, + l.event_removed, + l.topics, + l._inserted_timestamp, + CASE + WHEN txs.block_timestamp IS NULL + OR txs.origin_function_signature IS NULL THEN TRUE + ELSE FALSE + END AS is_pending, + CONCAT( + l.tx_hash :: STRING, + '-', + l.event_index :: STRING + ) AS _log_id + FROM + flat_logs l + LEFT OUTER JOIN {{ ref('silver__transactions') }} + txs + ON l.block_number = txs.block_number + AND l.tx_hash = txs.tx_hash + +{% if is_incremental() %} +AND txs._INSERTED_TIMESTAMP >= ( + SELECT + MAX(_inserted_timestamp) :: DATE - 1 + FROM + {{ this }} +) +{% endif %} +) + +{% if is_incremental() %}, +missing_data AS ( + SELECT + t.block_number, + txs.block_timestamp, + t.tx_hash, + t.origin_from_address, + t.origin_to_address, + txs.origin_function_signature, + t.tx_status, + t.contract_address, + t.block_hash, + t.data, + t.event_index, + t.event_removed, + t.topics, + GREATEST( + t._inserted_timestamp, + txs._inserted_timestamp + ) AS _inserted_timestamp, + _log_id, + FALSE AS is_pending + FROM + {{ this }} + t + INNER JOIN {{ ref('silver__transactions') }} + txs USING ( + block_number, + tx_hash + ) + WHERE + t.is_pending +) +{% endif %}, +FINAL AS ( + SELECT + block_number, + block_timestamp, + tx_hash, + origin_from_address, + origin_to_address, + origin_function_signature, + tx_status, + contract_address, + block_hash, + DATA, + event_index, + event_removed, + topics, + _inserted_timestamp, + _log_id, + is_pending + FROM + new_records + +{% if is_incremental() %} +UNION +SELECT + block_number, + block_timestamp, + tx_hash, + origin_from_address, + origin_to_address, + origin_function_signature, + tx_status, + contract_address, + block_hash, + DATA, + event_index, + event_removed, + topics, + _inserted_timestamp, + _log_id, + is_pending +FROM + missing_data +{% endif %} +) +SELECT + *, + {{ dbt_utils.generate_surrogate_key( + ['tx_hash', 'event_index'] + ) }} AS logs_id, + SYSDATE() AS inserted_timestamp, + SYSDATE() AS modified_timestamp, + '{{ invocation_id }}' AS _invocation_id +FROM + FINAL qualify(ROW_NUMBER() over (PARTITION BY block_number, event_index +ORDER BY + _inserted_timestamp DESC, is_pending ASC)) = 1 #} diff --git a/models/silver/core/silver__receipts.sql b/models/silver/core/silver__receipts.sql new file mode 100644 index 0000000..ed512fa --- /dev/null +++ b/models/silver/core/silver__receipts.sql @@ -0,0 +1,130 @@ +{# -- depends_on: {{ ref('bronze__streamline_receipts') }} +{{ config( + materialized = 'incremental', + incremental_strategy = 'delete+insert', + unique_key = "block_number", + cluster_by = "ROUND(block_number, -3)", + post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(tx_hash)", + tags = ['core','non_realtime'], + full_refresh = false +) }} + +WITH base AS ( + + SELECT + block_number, + DATA, + _inserted_timestamp + FROM + +{% if is_incremental() %} +{{ ref('bronze__streamline_receipts') }} +WHERE + _inserted_timestamp >= ( + SELECT + MAX(_inserted_timestamp) _inserted_timestamp + FROM + {{ this }} + ) + AND IS_OBJECT(DATA) +{% else %} + {{ ref('bronze__streamline_FR_receipts') }} +WHERE + IS_OBJECT(DATA) +{% endif %} +), +FINAL AS ( + SELECT + block_number, + DATA :blockHash :: STRING AS block_hash, + utils.udf_hex_to_int( + DATA :blockNumber :: STRING + ) :: INT AS blockNumber, + DATA :contractAddress :: STRING AS contractAddress, + utils.udf_hex_to_int( + DATA :cumulativeGasUsed :: STRING + ) :: INT AS cumulative_gas_used, + utils.udf_hex_to_int( + DATA :effectiveGasPrice :: STRING + ) :: INT / pow( + 10, + 9 + ) AS effective_gas_price, + DATA :from :: STRING AS from_address, + COALESCE( + utils.udf_hex_to_int( + DATA :gasUsed :: STRING + ) :: INT, + 0 + ) AS gas_used, + COALESCE( + utils.udf_hex_to_int( + DATA :l1Fee :: STRING + ) :: FLOAT, + 0 + ) AS l1_fee, + COALESCE( + ( + DATA :l1FeeScalar :: STRING + ) :: FLOAT, + 0 + ) AS l1_fee_scalar, + COALESCE( + utils.udf_hex_to_int( + DATA :l1GasUsed :: STRING + ) :: FLOAT, + 0 + ) AS l1_gas_used, + COALESCE( + utils.udf_hex_to_int( + DATA :l1GasPrice :: STRING + ) :: FLOAT, + 0 + ) AS l1_gas_price, + DATA :logs AS logs, + DATA :logsBloom :: STRING AS logs_bloom, + utils.udf_hex_to_int( + DATA :status :: STRING + ) :: INT AS status, + CASE + WHEN status = 1 THEN TRUE + ELSE FALSE + END AS tx_success, + CASE + WHEN status = 1 THEN 'SUCCESS' + ELSE 'FAIL' + END AS tx_status, + DATA :to :: STRING AS to_address1, + CASE + WHEN to_address1 = '' THEN NULL + ELSE to_address1 + END AS to_address, + DATA :transactionHash :: STRING AS tx_hash, + CASE + WHEN block_number <> blockNumber THEN NULL + ELSE utils.udf_hex_to_int( + DATA :transactionIndex :: STRING + ) :: INT + END AS POSITION, + utils.udf_hex_to_int( + DATA :type :: STRING + ) :: INT AS TYPE, + _inserted_timestamp, + utils.udf_hex_to_int( + DATA :depositNonce :: STRING + ) :: INT AS deposit_nonce, + utils.udf_hex_to_int( + DATA: depositReceiptVersion :: STRING + ) :: INT AS deposit_receipt_version + FROM + base +) +SELECT + * +FROM + FINAL +WHERE + tx_hash IS NOT NULL + AND POSITION IS NOT NULL qualify(ROW_NUMBER() over (PARTITION BY block_number, POSITION +ORDER BY + _inserted_timestamp DESC)) = 1 #} diff --git a/models/silver/core/silver__traces.sql b/models/silver/core/silver__traces.sql new file mode 100644 index 0000000..089a6ad --- /dev/null +++ b/models/silver/core/silver__traces.sql @@ -0,0 +1,418 @@ +{# -- depends_on: {{ ref('bronze__streamline_traces') }} +{{ config ( + materialized = "incremental", + incremental_strategy = 'delete+insert', + unique_key = "block_number", + cluster_by = "block_timestamp::date, _inserted_timestamp::date", + post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION", + full_refresh = false, + tags = ['core','non_realtime'] +) }} + +WITH bronze_traces AS ( + + SELECT + block_number, + VALUE :array_index :: INT AS tx_position, + DATA :result AS full_traces, + _inserted_timestamp + FROM + +{% if is_incremental() %} +{{ ref('bronze__streamline_traces') }} +WHERE + _inserted_timestamp >= ( + SELECT + MAX(_inserted_timestamp) _inserted_timestamp + FROM + {{ this }} + ) + AND DATA :result IS NOT NULL +{% else %} + {{ ref('bronze__streamline_FR_traces') }} +WHERE + _partition_by_block_id <= 2300000 + AND DATA :result IS NOT NULL +{% endif %} + +qualify(ROW_NUMBER() over (PARTITION BY block_number, tx_position +ORDER BY + _inserted_timestamp DESC)) = 1 +), +flatten_traces AS ( + SELECT + block_number, + tx_position, + IFF( + path IN ( + 'result', + 'result.value', + 'result.type', + 'result.to', + 'result.input', + 'result.gasUsed', + 'result.gas', + 'result.from', + 'result.output', + 'result.error', + 'result.revertReason', + 'gasUsed', + 'gas', + 'type', + 'to', + 'from', + 'value', + 'input', + 'error', + 'output', + 'revertReason' + ), + 'ORIGIN', + REGEXP_REPLACE(REGEXP_REPLACE(path, '[^0-9]+', '_'), '^_|_$', '') + ) AS trace_address, + _inserted_timestamp, + OBJECT_AGG( + key, + VALUE + ) AS trace_json, + CASE + WHEN trace_address = 'ORIGIN' THEN NULL + WHEN POSITION( + '_' IN trace_address + ) = 0 THEN 'ORIGIN' + ELSE REGEXP_REPLACE( + trace_address, + '_[0-9]+$', + '', + 1, + 1 + ) + END AS parent_trace_address, + SPLIT( + trace_address, + '_' + ) AS str_array + FROM + bronze_traces txs, + TABLE( + FLATTEN( + input => PARSE_JSON( + txs.full_traces + ), + recursive => TRUE + ) + ) f + WHERE + f.index IS NULL + AND f.key != 'calls' + AND f.path != 'result' + GROUP BY + block_number, + tx_position, + trace_address, + _inserted_timestamp +), +sub_traces AS ( + SELECT + block_number, + tx_position, + parent_trace_address, + COUNT(*) AS sub_traces + FROM + flatten_traces + GROUP BY + block_number, + tx_position, + parent_trace_address +), +num_array AS ( + SELECT + block_number, + tx_position, + trace_address, + ARRAY_AGG(flat_value) AS num_array + FROM + ( + SELECT + block_number, + tx_position, + trace_address, + IFF( + VALUE :: STRING = 'ORIGIN', + -1, + VALUE :: INT + ) AS flat_value + FROM + flatten_traces, + LATERAL FLATTEN ( + input => str_array + ) + ) + GROUP BY + block_number, + tx_position, + trace_address +), +cleaned_traces AS ( + SELECT + b.block_number, + b.tx_position, + b.trace_address, + IFNULL( + sub_traces, + 0 + ) AS sub_traces, + num_array, + ROW_NUMBER() over ( + PARTITION BY b.block_number, + b.tx_position + ORDER BY + num_array ASC + ) - 1 AS trace_index, + trace_json, + b._inserted_timestamp + FROM + flatten_traces b + LEFT JOIN sub_traces s + ON b.block_number = s.block_number + AND b.tx_position = s.tx_position + AND b.trace_address = s.parent_trace_address + JOIN num_array n + ON b.block_number = n.block_number + AND b.tx_position = n.tx_position + AND b.trace_address = n.trace_address +), +final_traces AS ( + SELECT + tx_position, + trace_index, + block_number, + trace_address, + trace_json :error :: STRING AS error_reason, + trace_json :from :: STRING AS from_address, + trace_json :to :: STRING AS to_address, + IFNULL( + utils.udf_hex_to_int( + trace_json :value :: STRING + ), + '0' + ) AS eth_value_precise_raw, + utils.udf_decimal_adjust( + eth_value_precise_raw, + 18 + ) AS eth_value_precise, + eth_value_precise :: FLOAT AS eth_value, + utils.udf_hex_to_int( + trace_json :gas :: STRING + ) :: INT AS gas, + utils.udf_hex_to_int( + trace_json :gasUsed :: STRING + ) :: INT AS gas_used, + trace_json :input :: STRING AS input, + trace_json :output :: STRING AS output, + trace_json :type :: STRING AS TYPE, + concat_ws( + '_', + TYPE, + trace_address + ) AS identifier, + concat_ws( + '-', + block_number, + tx_position, + identifier + ) AS _call_id, + _inserted_timestamp, + trace_json AS DATA, + sub_traces + FROM + cleaned_traces +), +new_records AS ( + SELECT + f.block_number, + t.tx_hash, + t.block_timestamp, + t.tx_status, + f.tx_position, + f.trace_index, + f.from_address, + f.to_address, + f.eth_value_precise_raw, + f.eth_value_precise, + f.eth_value, + f.gas, + f.gas_used, + f.input, + f.output, + f.type, + f.identifier, + f.sub_traces, + f.error_reason, + IFF( + f.error_reason IS NULL, + 'SUCCESS', + 'FAIL' + ) AS trace_status, + f.data, + IFF( + t.tx_hash IS NULL + OR t.block_timestamp IS NULL + OR t.tx_status IS NULL, + TRUE, + FALSE + ) AS is_pending, + f._call_id, + f._inserted_timestamp + FROM + final_traces f + LEFT OUTER JOIN {{ ref('silver__transactions') }} + t + ON f.tx_position = t.position + AND f.block_number = t.block_number + +{% if is_incremental() %} +AND t._INSERTED_TIMESTAMP >= ( + SELECT + DATEADD('hour', -24, MAX(_inserted_timestamp)) + FROM + {{ this }}) + {% endif %} +) + +{% if is_incremental() %}, +missing_data AS ( + SELECT + t.block_number, + txs.tx_hash, + txs.block_timestamp, + txs.tx_status, + t.tx_position, + t.trace_index, + t.from_address, + t.to_address, + t.eth_value_precise_raw, + t.eth_value_precise, + t.eth_value, + t.gas, + t.gas_used, + t.input, + t.output, + t.type, + t.identifier, + t.sub_traces, + t.error_reason, + t.trace_status, + t.data, + FALSE AS is_pending, + t._call_id, + GREATEST( + t._inserted_timestamp, + txs._inserted_timestamp + ) AS _inserted_timestamp + FROM + {{ this }} + t + INNER JOIN {{ ref('silver__transactions') }} + txs + ON t.tx_position = txs.position + AND t.block_number = txs.block_number + WHERE + t.is_pending +) +{% endif %}, +FINAL AS ( + SELECT + block_number, + tx_hash, + block_timestamp, + tx_status, + tx_position, + trace_index, + from_address, + to_address, + eth_value_precise_raw, + eth_value_precise, + eth_value, + gas, + gas_used, + input, + output, + TYPE, + identifier, + sub_traces, + error_reason, + trace_status, + DATA, + is_pending, + _call_id, + _inserted_timestamp + FROM + new_records + +{% if is_incremental() %} +UNION +SELECT + block_number, + tx_hash, + block_timestamp, + tx_status, + tx_position, + trace_index, + from_address, + to_address, + eth_value_precise_raw, + eth_value_precise, + eth_value, + gas, + gas_used, + input, + output, + TYPE, + identifier, + sub_traces, + error_reason, + trace_status, + DATA, + is_pending, + _call_id, + _inserted_timestamp +FROM + missing_data +{% endif %} +) +SELECT + block_number, + tx_hash, + block_timestamp, + tx_status, + tx_position, + trace_index, + from_address, + to_address, + eth_value_precise, + eth_value, + gas, + gas_used, + input, + output, + TYPE, + identifier, + sub_traces, + error_reason, + trace_status, + DATA, + is_pending, + _call_id, + _inserted_timestamp, + eth_value_precise_raw, + {{ dbt_utils.generate_surrogate_key( + ['tx_hash', 'trace_index'] + ) }} AS traces_id, + SYSDATE() AS inserted_timestamp, + SYSDATE() AS modified_timestamp, + '{{ invocation_id }}' AS _invocation_id +FROM + FINAL qualify(ROW_NUMBER() over(PARTITION BY block_number, tx_position, trace_index +ORDER BY + _inserted_timestamp DESC, is_pending ASC)) = 1 #} diff --git a/models/silver/core/silver__transactions.sql b/models/silver/core/silver__transactions.sql new file mode 100644 index 0000000..231ae62 --- /dev/null +++ b/models/silver/core/silver__transactions.sql @@ -0,0 +1,418 @@ +{# -- depends_on: {{ ref('bronze__streamline_transactions') }} +{{ config( + materialized = 'incremental', + incremental_strategy = 'delete+insert', + unique_key = "block_number", + cluster_by = "block_timestamp::date, _inserted_timestamp::date", + post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION", + tags = ['core','non_realtime'] +) }} + +WITH base AS ( + + SELECT + block_number, + DATA, + _inserted_timestamp + FROM + +{% if is_incremental() %} +{{ ref('bronze__streamline_transactions') }} +WHERE + _inserted_timestamp >= ( + SELECT + MAX(_inserted_timestamp) _inserted_timestamp + FROM + {{ this }} + ) + AND IS_OBJECT(DATA) +{% else %} + {{ ref('bronze__streamline_FR_transactions') }} +WHERE + IS_OBJECT(DATA) +{% endif %} +), +base_tx AS ( + SELECT + A.block_number AS block_number, + A.data :blockHash :: STRING AS block_hash, + TRY_TO_NUMBER( + utils.udf_hex_to_int( + A.data :blockNumber :: STRING + ) + ) AS blockNumber, + TRY_TO_NUMBER( + utils.udf_hex_to_int( + A.data :chainId :: STRING + ) + ) AS chain_id, + A.data :from :: STRING AS from_address, + TRY_TO_NUMBER( + utils.udf_hex_to_int( + A.data :gas :: STRING + ) + ) AS gas, + COALESCE( + TRY_TO_NUMBER( + utils.udf_hex_to_int( + A.data :gasPrice :: STRING + ) + ) / pow( + 10, + 9 + ), + 0 + ) AS gas_price, + A.data :hash :: STRING AS tx_hash, + A.data :input :: STRING AS input_data, + SUBSTR( + input_data, + 1, + 10 + ) AS origin_function_signature, + TRY_TO_NUMBER( + utils.udf_hex_to_int( + A.data :maxFeePerGas :: STRING + ) + ) / pow( + 10, + 9 + ) AS max_fee_per_gas, + TRY_TO_NUMBER( + utils.udf_hex_to_int( + A.data :maxPriorityFeePerGas :: STRING + ) + ) / pow( + 10, + 9 + ) AS max_priority_fee_per_gas, + TRY_TO_NUMBER( + utils.udf_hex_to_int( + A.data :nonce :: STRING + ) + ) AS nonce, + A.data :r :: STRING AS r, + A.data :s :: STRING AS s, + A.data :to :: STRING AS to_address1, + CASE + WHEN to_address1 = '' THEN NULL + ELSE to_address1 + END AS to_address, + TRY_TO_NUMBER( + utils.udf_hex_to_int( + A.data :transactionIndex :: STRING + ) + ) AS POSITION, + A.data :type :: STRING AS TYPE, + A.data :v :: STRING AS v, + utils.udf_hex_to_int( + A.data :value :: STRING + ) AS value_precise_raw, + utils.udf_decimal_adjust( + value_precise_raw, + 18 + ) AS value_precise, + value_precise :: FLOAT AS VALUE, + A._INSERTED_TIMESTAMP, + A.data AS DATA + FROM + base A +), +new_records AS ( + SELECT + t.block_number, + t.block_hash, + t.chain_id, + t.from_address, + t.gas, + t.gas_price, + t.tx_hash, + t.input_data, + t.origin_function_signature, + t.max_fee_per_gas, + t.max_priority_fee_per_gas, + t.nonce, + t.r, + t.s, + t.to_address, + t.position, + t.type, + t.v, + t.value_precise_raw, + t.value_precise, + t.value, + block_timestamp, + CASE + WHEN block_timestamp IS NULL + OR tx_status IS NULL THEN TRUE + ELSE FALSE + END AS is_pending, + r.gas_used, + r.l1_fee, + r.l1_fee_scalar, + r.l1_gas_used, + r.l1_gas_price, + utils.udf_decimal_adjust( + ( + r.gas_used * utils.udf_hex_to_int( + t.data :gasPrice :: STRING + ) :: bigint + ) + FLOOR( + r.l1_gas_price * r.l1_gas_used * r.l1_fee_scalar + ), + 18 + ) AS tx_fee_precise, + COALESCE( + tx_fee_precise :: FLOAT, + 0 + ) AS tx_fee, + tx_success, + tx_status, + cumulative_gas_used, + effective_gas_price, + r.type AS tx_type, + t._inserted_timestamp, + t.data, + r.deposit_nonce, + r.deposit_receipt_version + FROM + base_tx t + LEFT OUTER JOIN {{ ref('silver__blocks') }} + b + ON t.block_number = b.block_number + LEFT OUTER JOIN {{ ref('silver__receipts') }} + r + ON t.block_number = r.block_number + AND t.tx_hash = r.tx_hash + +{% if is_incremental() %} +AND r._INSERTED_TIMESTAMP >= ( + SELECT + MAX(_inserted_timestamp) :: DATE - 1 + FROM + {{ this }} +) +{% endif %} +) + +{% if is_incremental() %}, +missing_data AS ( + SELECT + t.block_number, + t.block_hash, + t.chain_id, + t.from_address, + t.gas, + t.gas_price, + t.tx_hash, + t.input_data, + t.origin_function_signature, + t.max_fee_per_gas, + t.max_priority_fee_per_gas, + t.nonce, + t.r, + t.s, + t.to_address, + t.position, + t.type, + t.v, + t.value_precise_raw, + t.value_precise, + t.value, + b.block_timestamp, + FALSE AS is_pending, + r.gas_used, + r.tx_success, + r.tx_status, + r.cumulative_gas_used, + r.effective_gas_price, + r.l1_fee, + r.l1_fee_scalar, + r.l1_gas_used, + r.l1_gas_price, + utils.udf_decimal_adjust( + ( + r.gas_used * utils.udf_hex_to_int( + t.data :gasPrice :: STRING + ) :: bigint + ) + FLOOR( + r.l1_gas_price * r.l1_gas_used * r.l1_fee_scalar + ), + 18 + ) AS tx_fee_precise_heal, + COALESCE( + tx_fee_precise_heal :: FLOAT, + 0 + ) AS tx_fee, + r.type AS tx_type, + GREATEST( + t._inserted_timestamp, + b._inserted_timestamp, + r._inserted_timestamp + ) AS _inserted_timestamp, + t.data, + r.deposit_nonce, + r.deposit_receipt_version + FROM + {{ this }} + t + INNER JOIN {{ ref('silver__blocks') }} + b + ON t.block_number = b.block_number + INNER JOIN {{ ref('silver__receipts') }} + r + ON t.tx_hash = r.tx_hash + AND t.block_number = r.block_number + WHERE + t.is_pending +) +{% endif %}, +FINAL AS ( + SELECT + block_number, + block_hash, + chain_id, + from_address, + gas, + gas_price, + tx_hash, + input_data, + origin_function_signature, + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + r, + s, + to_address, + POSITION, + TYPE, + v, + VALUE, + value_precise_raw, + value_precise, + block_timestamp, + is_pending, + gas_used, + tx_success, + tx_status, + cumulative_gas_used, + effective_gas_price, + l1_fee, + l1_fee_scalar, + l1_gas_used, + l1_gas_price, + tx_fee, + tx_fee_precise, + tx_type, + _inserted_timestamp, + DATA, + deposit_nonce, + deposit_receipt_version + FROM + new_records + +{% if is_incremental() %} +UNION +SELECT + block_number, + block_hash, + chain_id, + from_address, + gas, + gas_price, + tx_hash, + input_data, + origin_function_signature, + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + r, + s, + to_address, + POSITION, + TYPE, + v, + VALUE, + value_precise_raw, + value_precise, + block_timestamp, + is_pending, + gas_used, + tx_success, + tx_status, + cumulative_gas_used, + effective_gas_price, + l1_fee, + l1_fee_scalar, + l1_gas_used, + l1_gas_price, + tx_fee, + tx_fee_precise_heal AS tx_fee_precise, + tx_type, + _inserted_timestamp, + DATA, + deposit_nonce, + deposit_receipt_version +FROM + missing_data +{% endif %} +) +SELECT + block_number, + block_hash, + chain_id, + from_address, + gas, + gas_price, + tx_hash, + input_data, + origin_function_signature, + max_fee_per_gas, + max_priority_fee_per_gas, + nonce, + r, + s, + to_address, + POSITION, + TYPE, + v, + VALUE, + value_precise_raw, + value_precise, + block_timestamp, + is_pending, + gas_used, + tx_success, + tx_status, + cumulative_gas_used, + effective_gas_price, + utils.udf_decimal_adjust( + l1_fee, + 18 + ) AS l1_fee_precise, + l1_fee_precise :: FLOAT AS l1_fee, + l1_fee_scalar, + l1_gas_used, + l1_gas_price / pow( + 10, + 9 + ) AS l1_gas_price, + tx_fee, + tx_fee_precise, + tx_type, + _inserted_timestamp, + DATA, + {{ dbt_utils.generate_surrogate_key( + ['tx_hash'] + ) }} AS transactions_id, + SYSDATE() AS inserted_timestamp, + SYSDATE() AS modified_timestamp, + '{{ invocation_id }}' AS _invocation_id, + deposit_nonce, + deposit_receipt_version +FROM + FINAL +WHERE + block_hash IS NOT NULL qualify(ROW_NUMBER() over (PARTITION BY block_number, POSITION +ORDER BY + _inserted_timestamp DESC, is_pending ASC)) = 1 #} diff --git a/models/silver/core/silver__tx_count.sql b/models/silver/core/silver__tx_count.sql new file mode 100644 index 0000000..26ea46b --- /dev/null +++ b/models/silver/core/silver__tx_count.sql @@ -0,0 +1,38 @@ +{# {{ config( + materialized = 'incremental', + unique_key = "block_number", + merge_exclude_columns = ["inserted_timestamp"], + tags = ['non_realtime'] +) }} + +WITH base AS ( + + SELECT + block_number, + MIN(_inserted_timestamp) AS _inserted_timestamp, + COUNT(*) AS tx_count + FROM + {{ ref('silver__transactions') }} + +{% if is_incremental() %} +WHERE + _inserted_timestamp >= ( + SELECT + MAX(_inserted_timestamp) _inserted_timestamp + FROM + {{ this }} + ) +{% endif %} +GROUP BY + block_number +) +SELECT + *, + {{ dbt_utils.generate_surrogate_key( + ['block_number'] + ) }} AS tx_count_id, + SYSDATE() AS inserted_timestamp, + SYSDATE() AS modified_timestamp, + '{{ invocation_id }}' AS _invocation_id +FROM + base #} diff --git a/models/silver/labels/silver__labels.sql b/models/silver/labels/silver__labels.sql new file mode 100644 index 0000000..55a5fa5 --- /dev/null +++ b/models/silver/labels/silver__labels.sql @@ -0,0 +1,40 @@ +{{ config( + materialized = 'incremental', + unique_key = ['address', 'blockchain'], + incremental_strategy = 'merge', + merge_exclude_columns = ["inserted_timestamp"], + cluster_by = 'modified_timestamp::DATE', + post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(address); DELETE FROM {{ this }} WHERE _is_deleted = TRUE;", + tags = ['non_realtime'] +) }} + +SELECT + system_created_at, + insert_date, + blockchain, + address, + creator, + label_type, + label_subtype, + address_name, + project_name, + _is_deleted, + labels_combined_id, + SYSDATE() AS inserted_timestamp, + SYSDATE() AS modified_timestamp, + '{{ invocation_id }}' AS _invocation_id +FROM + {{ ref('bronze__labels') }} +WHERE + 1 = 1 + +{% if is_incremental() %} +AND modified_timestamp >= ( + SELECT + MAX( + modified_timestamp + ) + FROM + {{ this }} +) +{% endif %} diff --git a/models/silver/utilities/silver__number_sequence.sql b/models/silver/utilities/silver__number_sequence.sql new file mode 100644 index 0000000..6d79dd5 --- /dev/null +++ b/models/silver/utilities/silver__number_sequence.sql @@ -0,0 +1,13 @@ +{{ config( + materialized = 'table', + cluster_by = 'round(_id,-3)', + post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION" +) }} + +SELECT + ROW_NUMBER() over ( + ORDER BY + SEQ4() + ) - 1 :: INT AS _id +FROM + TABLE(GENERATOR(rowcount => 100000000)) diff --git a/models/sources.yml b/models/sources.yml new file mode 100644 index 0000000..db9480a --- /dev/null +++ b/models/sources.yml @@ -0,0 +1,76 @@ +version: 2 + +sources: + - name: ethereum + database: ethereum + schema: core + tables: + - name: fact_hourly_token_prices + - name: ez_hourly_token_prices + - name: bronze_streamline + database: streamline + schema: | + {{ "BLAST_DEV" if var("STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES", False) else "BLAST" }} + tables: + - name: receipts + - name: blocks + - name: transactions + - name: debug_traceBlockByNumber + - name: decoded_logs + - name: confirm_blocks + - name: udfs_streamline + database: udfs + schema: streamline + tables: + - name: node_mapping + - name: crosschain + database: "{{ 'crosschain' if target.database == 'BLAST' else 'crosschain_dev' }}" + schema: core + tables: + - name: dim_labels + - name: ez_hourly_token_prices + - name: silver_crosschain + database: "{{ 'crosschain' if target.database == 'BLAST' else 'crosschain_dev' }}" + schema: silver + tables: + - name: apis_keys + - name: asset_metadata_coin_gecko + - name: asset_metadata_coin_market_cap + - name: hourly_prices_coin_gecko + - name: hourly_prices_coin_market_cap + - name: token_prices_priority_hourly + - name: token_prices_all_providers_hourly + - name: asset_metadata_priority + - name: asset_metadata_all_providers + - name: near_address_encoded + - name: labels_combined + - name: crosschain_public + database: crosschain + schema: bronze_public + tables: + - name: user_abis + - name: streamline_crosschain + database: streamline + schema: crosschain + tables: + - name: node_mapping + - name: blast_silver + database: blast + schema: silver + tables: + - name: verified_abis + - name: blast_bronze_api + database: blast + schema: bronze_api + tables: + - name: contract_abis + - name: github_actions + database: blast + schema: github_actions + tables: + - name: workflows + - name: external_gold_defillama + database: external + schema: defillama + tables: + - name: dim_chains diff --git a/package-lock.yml b/package-lock.yml new file mode 100644 index 0000000..175a0f9 --- /dev/null +++ b/package-lock.yml @@ -0,0 +1,16 @@ +packages: +- package: calogica/dbt_expectations + version: 0.8.2 +- package: dbt-labs/dbt_external_tables + version: 0.8.2 +- package: dbt-labs/dbt_utils + version: 1.0.0 +- git: https://github.com/FlipsideCrypto/fsc-utils.git + revision: bdc9dd02079c9f3a58c39dd45a44988cb1deb1bd +- package: get-select/dbt_snowflake_query_tags + version: 2.3.3 +- package: calogica/dbt_date + version: 0.7.2 +- git: https://github.com/FlipsideCrypto/livequery-models.git + revision: bca494102fbd2d621d32746e9a7fe780678044f8 +sha1_hash: 09ade33483dfac0a83369b80cfd88bb6f9b52a92 diff --git a/packages.yml b/packages.yml new file mode 100644 index 0000000..78af77d --- /dev/null +++ b/packages.yml @@ -0,0 +1,11 @@ +packages: + - package: calogica/dbt_expectations + version: 0.8.2 + - package: dbt-labs/dbt_external_tables + version: 0.8.2 + - package: dbt-labs/dbt_utils + version: 1.0.0 + - git: https://github.com/FlipsideCrypto/fsc-utils.git + revision: v1.15.1 + - package: get-select/dbt_snowflake_query_tags + version: [">=2.0.0", "<3.0.0"] \ No newline at end of file diff --git a/profiles.yml b/profiles.yml new file mode 100644 index 0000000..f5aa873 --- /dev/null +++ b/profiles.yml @@ -0,0 +1,31 @@ +blast: + target: prod + outputs: + dev: + type: snowflake + account: "{{ env_var('ACCOUNT') }}" + role: "{{ env_var('ROLE') }}" + user: "{{ env_var('USER') }}" + password: "{{ env_var('PASSWORD') }}" + region: "{{ env_var('REGION') }}" + database: "{{ env_var('DATABASE') }}" + warehouse: "{{ env_var('WAREHOUSE') }}" + schema: SILVER + threads: 4 + client_session_keep_alive: False + query_tag: blast_curator + prod: + type: snowflake + account: "{{ env_var('ACCOUNT') }}" + role: "{{ env_var('ROLE') }}" + user: "{{ env_var('USER') }}" + password: "{{ env_var('PASSWORD') }}" + region: "{{ env_var('REGION') }}" + database: "{{ env_var('DATABASE') }}" + warehouse: "{{ env_var('WAREHOUSE') }}" + schema: SILVER + threads: 4 + client_session_keep_alive: False + query_tag: blast_curator + config: + send_anonymous_usage_stats: False \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5921743 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +dbt-snowflake>=1.7,<1.8 \ No newline at end of file diff --git a/snapshots/.gitkeep b/snapshots/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/.gitkeep b/tests/.gitkeep new file mode 100644 index 0000000..e69de29