mirror of
https://github.com/FlipsideCrypto/blast-models.git
synced 2026-02-06 09:26:44 +00:00
AN-4377/initial-repo-build (#1)
* files * docs * package * remove * comments * macro comments * overview * comment out on run start * remove workflows
This commit is contained in:
parent
2aa0429d5c
commit
604ec8ef8f
18
.gitignore
vendored
Normal file
18
.gitignore
vendored
Normal file
@ -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/
|
||||
110
README.md
110
README.md
@ -1 +1,109 @@
|
||||
# blast-models
|
||||
## Profile Set Up
|
||||
|
||||
#### Use the following within profiles.yml
|
||||
----
|
||||
|
||||
```yml
|
||||
blast:
|
||||
target: dev
|
||||
outputs:
|
||||
dev:
|
||||
type: snowflake
|
||||
account: <ACCOUNT>
|
||||
role: <ROLE>
|
||||
user: <USERNAME>
|
||||
password: <PASSWORD>
|
||||
region: <REGION>
|
||||
database: BLAST_DEV
|
||||
warehouse: <WAREHOUSE>
|
||||
schema: silver
|
||||
threads: 12
|
||||
client_session_keep_alive: False
|
||||
query_tag: <TAG>
|
||||
prod:
|
||||
type: snowflake
|
||||
account: <ACCOUNT>
|
||||
role: <ROLE>
|
||||
user: <USERNAME>
|
||||
password: <PASSWORD>
|
||||
region: <REGION>
|
||||
database: BLAST
|
||||
warehouse: <WAREHOUSE>
|
||||
schema: silver
|
||||
threads: 12
|
||||
client_session_keep_alive: False
|
||||
query_tag: <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'));
|
||||
```
|
||||
0
analysis/.gitkeep
Normal file
0
analysis/.gitkeep
Normal file
0
data/.gitkeep
Normal file
0
data/.gitkeep
Normal file
6
data/github_actions__workflows.csv
Normal file
6
data/github_actions__workflows.csv
Normal file
@ -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 * * * *"
|
||||
|
73
dbt_project.yml
Normal file
73
dbt_project.yml
Normal file
@ -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"]
|
||||
0
macros/.gitkeep
Normal file
0
macros/.gitkeep
Normal file
8
macros/create_sps.sql
Normal file
8
macros/create_sps.sql
Normal file
@ -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 %} #}
|
||||
25
macros/create_udfs.sql
Normal file
25
macros/create_udfs.sql
Normal file
@ -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 %} #}
|
||||
11
macros/custom_naming_macros.sql
Normal file
11
macros/custom_naming_macros.sql
Normal file
@ -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 %}
|
||||
44
macros/dbt/get_merge_sql.sql
Normal file
44
macros/dbt/get_merge_sql.sql
Normal file
@ -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 %}
|
||||
8
macros/dbt/get_tmp_relation_type.sql
Normal file
8
macros/dbt/get_tmp_relation_type.sql
Normal file
@ -0,0 +1,8 @@
|
||||
{% macro dbt_snowflake_get_tmp_relation_type(
|
||||
strategy,
|
||||
unique_key,
|
||||
language
|
||||
) %}
|
||||
-- always table
|
||||
{{ return('table') }}
|
||||
{% endmacro %}
|
||||
10
macros/run_sp_create_prod_clone.sql
Normal file
10
macros/run_sp_create_prod_clone.sql
Normal file
@ -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 %}
|
||||
44
macros/sp_create_prod_clone.sql
Normal file
44
macros/sp_create_prod_clone.sql
Normal file
@ -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 %}
|
||||
4
macros/tags/add_database_or_schema_tags.sql
Normal file
4
macros/tags/add_database_or_schema_tags.sql
Normal file
@ -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 %}
|
||||
127
macros/tags/snowflake_tagging.sql
Normal file
127
macros/tags/snowflake_tagging.sql
Normal file
@ -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 %}
|
||||
103
macros/tests/missing_txs.sql
Normal file
103
macros/tests/missing_txs.sql
Normal file
@ -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 %}
|
||||
78
macros/utils.sql
Normal file
78
macros/utils.sql
Normal file
@ -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 %} #}
|
||||
25
models/bronze/labels/bronze__labels.sql
Normal file
25
models/bronze/labels/bronze__labels.sql
Normal file
@ -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%'
|
||||
5
models/doc_descriptions/L1_fields/batch_size.md
Normal file
5
models/doc_descriptions/L1_fields/batch_size.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_batch_size %}
|
||||
|
||||
Total Blast Txs included within batch.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/L1_fields/blast_max_block.md
Normal file
5
models/doc_descriptions/L1_fields/blast_max_block.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_max_block %}
|
||||
|
||||
The max block on Blast this batch relates to.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/L1_fields/blast_min_block.md
Normal file
5
models/doc_descriptions/L1_fields/blast_min_block.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_min_block %}
|
||||
|
||||
The min block on Blast this batch relates to.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/L1_fields/l1_batch_root.md
Normal file
5
models/doc_descriptions/L1_fields/l1_batch_root.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_batch_root %}
|
||||
|
||||
Root of batch, either for sumbission or state.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/L1_fields/l1_block_number.md
Normal file
5
models/doc_descriptions/L1_fields/l1_block_number.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_l1_block_no %}
|
||||
|
||||
The Ethereum block number that contained the batch.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/L1_fields/l1_block_timestamp.md
Normal file
5
models/doc_descriptions/L1_fields/l1_block_timestamp.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_l1_block_time %}
|
||||
|
||||
The timestamp of the Ethereum block that contained this batch.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/L1_fields/l1_fee_scalar.md
Normal file
5
models/doc_descriptions/L1_fields/l1_fee_scalar.md
Normal file
@ -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 %}
|
||||
5
models/doc_descriptions/L1_fields/l1_gas_price.md
Normal file
5
models/doc_descriptions/L1_fields/l1_gas_price.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_l1_gas_price %}
|
||||
|
||||
The gas price for L1 transactions when the transaction was processed.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/L1_fields/l1_gas_used.md
Normal file
5
models/doc_descriptions/L1_fields/l1_gas_used.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_l1_gas_used %}
|
||||
|
||||
The gas used on L1 to publish the transaction.
|
||||
|
||||
{% enddocs %}
|
||||
@ -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 %}
|
||||
@ -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 %}
|
||||
@ -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 %}
|
||||
@ -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 %}
|
||||
5
models/doc_descriptions/L1_fields/prev_total_elements.md
Normal file
5
models/doc_descriptions/L1_fields/prev_total_elements.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_prev_total_elements %}
|
||||
|
||||
Confirmed blocks prior to this batch.
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs blast_block_header_json %}
|
||||
|
||||
This JSON column contains the block header details.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_blockchain.md
Normal file
5
models/doc_descriptions/blocks/blast_blockchain.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_blockchain %}
|
||||
|
||||
The blockchain on which transactions are being confirmed.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_blocks_hash.md
Normal file
5
models/doc_descriptions/blocks/blast_blocks_hash.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_blocks_hash %}
|
||||
|
||||
The hash of the block header for a given block.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_blocks_nonce.md
Normal file
5
models/doc_descriptions/blocks/blast_blocks_nonce.md
Normal file
@ -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 %}
|
||||
5
models/doc_descriptions/blocks/blast_blocks_table_doc.md
Normal file
5
models/doc_descriptions/blocks/blast_blocks_table_doc.md
Normal file
@ -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 %}
|
||||
5
models/doc_descriptions/blocks/blast_difficulty.md
Normal file
5
models/doc_descriptions/blocks/blast_difficulty.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_difficulty %}
|
||||
|
||||
The effort required to mine the block.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_extra_data.md
Normal file
5
models/doc_descriptions/blocks/blast_extra_data.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_extra_data %}
|
||||
|
||||
Any data included by the validator for a given block.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_gas_limit.md
Normal file
5
models/doc_descriptions/blocks/blast_gas_limit.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_gas_limit %}
|
||||
|
||||
Total gas limit provided by all transactions in the block.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_gas_used.md
Normal file
5
models/doc_descriptions/blocks/blast_gas_used.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_gas_used %}
|
||||
|
||||
Total gas used in the block.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_miner.md
Normal file
5
models/doc_descriptions/blocks/blast_miner.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_miner %}
|
||||
|
||||
Miner who successfully added a given block to the blockchain.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_network.md
Normal file
5
models/doc_descriptions/blocks/blast_network.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_network %}
|
||||
|
||||
The network on the blockchain used by a transaction.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_parent_hash.md
Normal file
5
models/doc_descriptions/blocks/blast_parent_hash.md
Normal file
@ -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 %}
|
||||
5
models/doc_descriptions/blocks/blast_receipts_root.md
Normal file
5
models/doc_descriptions/blocks/blast_receipts_root.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_receipts_root %}
|
||||
|
||||
The root of the state trie.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_sha3_uncles.md
Normal file
5
models/doc_descriptions/blocks/blast_sha3_uncles.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_sha3_uncles %}
|
||||
|
||||
The mechanism which Ethereum Javascript RLP encodes an empty string.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_size.md
Normal file
5
models/doc_descriptions/blocks/blast_size.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_size %}
|
||||
|
||||
Block size, which is determined by a given block's gas limit.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_total_difficulty.md
Normal file
5
models/doc_descriptions/blocks/blast_total_difficulty.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_total_difficulty %}
|
||||
|
||||
Total difficulty of the chain at a given block.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_tx_count.md
Normal file
5
models/doc_descriptions/blocks/blast_tx_count.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_tx_count %}
|
||||
|
||||
Total number of transactions within a block.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/blocks/blast_uncle_blocks.md
Normal file
5
models/doc_descriptions/blocks/blast_uncle_blocks.md
Normal file
@ -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 %}
|
||||
83
models/doc_descriptions/bridge/evm_bridge_activity.md
Normal file
83
models/doc_descriptions/bridge/evm_bridge_activity.md
Normal file
@ -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 %}
|
||||
@ -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 %}
|
||||
@ -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 %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_creation_block %}
|
||||
|
||||
The block number of when this pool was created.
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_creation_time %}
|
||||
|
||||
The block timestamp of when this pool was created.
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_creation_tx %}
|
||||
|
||||
The transaction where this contract was created.
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_factory_address %}
|
||||
|
||||
The address that created or deployed this pool, where available.
|
||||
|
||||
{% enddocs %}
|
||||
@ -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 %}
|
||||
@ -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 %}
|
||||
@ -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 %}
|
||||
@ -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 %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_platform %}
|
||||
|
||||
The protocol or platform that the liquidity pool belongs to or swap occurred on.
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_pool_address %}
|
||||
|
||||
The contract address for the liquidity pool.
|
||||
|
||||
{% enddocs %}
|
||||
@ -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 %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_swaps_amount_in %}
|
||||
|
||||
The amount of tokens put into the swap.
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_swaps_amount_in_unadj %}
|
||||
|
||||
The non-decimal adjusted amount of tokens put into the swap.
|
||||
|
||||
{% enddocs %}
|
||||
@ -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 %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_swaps_amount_out %}
|
||||
|
||||
The amount of tokens taken out of or received from the swap.
|
||||
|
||||
{% enddocs %}
|
||||
@ -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 %}
|
||||
@ -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 %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_swaps_sender %}
|
||||
|
||||
The Router is the Sender in the swap function.
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_swaps_symbol_in %}
|
||||
|
||||
The symbol of the token sent for swap.
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_swaps_symbol_out %}
|
||||
|
||||
The symbol of the token being swapped to.
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_swaps_token_in %}
|
||||
|
||||
The address of the token sent for swap.
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_swaps_token_out %}
|
||||
|
||||
The address of the token being swapped to.
|
||||
|
||||
{% enddocs %}
|
||||
@ -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 %}
|
||||
@ -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 %}
|
||||
@ -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 %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs eth_dex_tokens %}
|
||||
|
||||
This field contains the tokens within the liquidity pool as a JSON objects.
|
||||
|
||||
{% enddocs %}
|
||||
@ -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 %}
|
||||
5
models/doc_descriptions/event_logs/blast_event_index.md
Normal file
5
models/doc_descriptions/event_logs/blast_event_index.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_event_index %}
|
||||
|
||||
Event number within a transaction.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/event_logs/blast_event_inputs.md
Normal file
5
models/doc_descriptions/event_logs/blast_event_inputs.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_event_inputs %}
|
||||
|
||||
The decoded event inputs for a given event.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/event_logs/blast_event_name.md
Normal file
5
models/doc_descriptions/event_logs/blast_event_name.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_event_name %}
|
||||
|
||||
The decoded event name for a given event.
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs blast_event_removed %}
|
||||
|
||||
Whether the event has been removed from the transaction.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/event_logs/blast_event_sig.md
Normal file
5
models/doc_descriptions/event_logs/blast_event_sig.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_origin_sig %}
|
||||
|
||||
The function signature of this transaction.
|
||||
|
||||
{% enddocs %}
|
||||
@ -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 %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs blast_logs_contract_address %}
|
||||
|
||||
The address interacted with for a given event.
|
||||
|
||||
{% enddocs %}
|
||||
@ -0,0 +1,5 @@
|
||||
{% docs blast_logs_contract_name %}
|
||||
|
||||
The name of the contract or token, where possible.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/event_logs/blast_logs_data.md
Normal file
5
models/doc_descriptions/event_logs/blast_logs_data.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_logs_data %}
|
||||
|
||||
The un-decoded event data.
|
||||
|
||||
{% enddocs %}
|
||||
@ -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 %}
|
||||
5
models/doc_descriptions/event_logs/blast_logs_tx_hash.md
Normal file
5
models/doc_descriptions/event_logs/blast_logs_tx_hash.md
Normal file
@ -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 %}
|
||||
5
models/doc_descriptions/event_logs/blast_origin_from.md
Normal file
5
models/doc_descriptions/event_logs/blast_origin_from.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_origin_from %}
|
||||
|
||||
The from address of this transaction.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/event_logs/blast_origin_to.md
Normal file
5
models/doc_descriptions/event_logs/blast_origin_to.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_origin_to %}
|
||||
|
||||
The to address of this transaction.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/event_logs/blast_topics.md
Normal file
5
models/doc_descriptions/event_logs/blast_topics.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_topics %}
|
||||
|
||||
The un-decoded event input topics.
|
||||
|
||||
{% enddocs %}
|
||||
73
models/doc_descriptions/general/__overview__.md
Normal file
73
models/doc_descriptions/general/__overview__.md
Normal file
@ -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 %}
|
||||
5
models/doc_descriptions/general/blast_block_number.md
Normal file
5
models/doc_descriptions/general/blast_block_number.md
Normal file
@ -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 %}
|
||||
5
models/doc_descriptions/general/blast_block_timestamp.md
Normal file
5
models/doc_descriptions/general/blast_block_timestamp.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_block_timestamp %}
|
||||
|
||||
The date and time at which the block was produced.
|
||||
|
||||
{% enddocs %}
|
||||
5
models/doc_descriptions/general/blast_decimals.md
Normal file
5
models/doc_descriptions/general/blast_decimals.md
Normal file
@ -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 %}
|
||||
5
models/doc_descriptions/general/blast_from_address.md
Normal file
5
models/doc_descriptions/general/blast_from_address.md
Normal file
@ -0,0 +1,5 @@
|
||||
{% docs blast_from_address %}
|
||||
|
||||
The sending address of this transaction.
|
||||
|
||||
{% enddocs %}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user