Add/tokenflow-views (#5)

This commit is contained in:
drethereum 2023-01-31 11:17:25 -07:00 committed by GitHub
parent 84248ebde8
commit ed4c973230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 776 additions and 0 deletions

View File

@ -0,0 +1,44 @@
name: dbt_run_dev_refresh
run-name: dbt_run_dev_refresh
on:
workflow_dispatch:
schedule:
# Runs "at 8:00 UTC" (see https://crontab.guru)
- cron: '0 8 * * *'
env:
DBT_PROFILES_DIR: ${{ secrets.DBT_PROFILES_DIR }}
ACCOUNT: "${{ secrets.ACCOUNT }}"
ROLE: "${{ secrets.ROLE }}"
USER: "${{ secrets.USER }}"
PASSWORD: "${{ secrets.PASSWORD }}"
REGION: "${{ secrets.REGION }}"
DATABASE: "${{ secrets.DATABASE }}"
WAREHOUSE: "${{ secrets.WAREHOUSE }}"
SCHEMA: "${{ secrets.SCHEMA }}"
concurrency:
group: ${{ github.workflow }}
jobs:
run_dbt_jobs:
runs-on: ubuntu-latest
environment:
name: workflow_prod
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v1
with:
python-version: "3.7.x"
- name: install dependencies
run: |
pip3 install dbt-snowflake==${{ secrets.DBT_VERSION }} cli_passthrough requests click
dbt deps
- name: Run DBT Jobs
run: |
dbt run-operation run_sp_create_prod_clone

View File

@ -0,0 +1,45 @@
name: dbt_run_scheduled
run-name: dbt_run_scheduled
on:
workflow_dispatch:
schedule:
# Runs "at 08:00 UTC on Monday and Wednesday" (see https://crontab.guru)
# Update schedule for additional models, where applicable
- cron: '0 8 * * 1,3'
env:
DBT_PROFILES_DIR: ${{ secrets.DBT_PROFILES_DIR }}
ACCOUNT: "${{ secrets.ACCOUNT }}"
ROLE: "${{ secrets.ROLE }}"
USER: "${{ secrets.USER }}"
PASSWORD: "${{ secrets.PASSWORD }}"
REGION: "${{ secrets.REGION }}"
DATABASE: "${{ secrets.DATABASE }}"
WAREHOUSE: "${{ secrets.WAREHOUSE }}"
SCHEMA: "${{ secrets.SCHEMA }}"
concurrency:
group: ${{ github.workflow }}
jobs:
run_dbt_jobs:
runs-on: ubuntu-latest
environment:
name: workflow_prod
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v1
with:
python-version: "3.7.x"
- name: install dependencies
run: |
pip3 install dbt-snowflake==${{ secrets.DBT_VERSION }} cli_passthrough requests click
dbt deps
- name: Run DBT Jobs
run: |
dbt run

49
.github/workflows/dbt_test.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: dbt_test
run-name: dbt_test
on:
workflow_dispatch:
branches:
- "main"
# schedule:
# # Runs "at 8:00 UTC" (see https://crontab.guru)
# - cron: '0 8 * * *'
env:
DBT_PROFILES_DIR: ${{ secrets.DBT_PROFILES_DIR }}
ACCOUNT: "${{ secrets.ACCOUNT }}"
ROLE: "${{ secrets.ROLE }}"
USER: "${{ secrets.USER }}"
PASSWORD: "${{ secrets.PASSWORD }}"
REGION: "${{ secrets.REGION }}"
DATABASE: "${{ secrets.DATABASE }}"
WAREHOUSE: "${{ secrets.WAREHOUSE }}"
SCHEMA: "${{ secrets.SCHEMA }}"
concurrency:
group: ${{ github.workflow }}
jobs:
run_dbt_jobs:
runs-on: ubuntu-latest
environment:
name: workflow_prod
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v1
with:
python-version: "3.7.x"
- name: install dependencies
run: |
pip3 install dbt-snowflake==${{ secrets.DBT_VERSION }} cli_passthrough requests click
dbt deps
- name: Run DBT Jobs
run: |
dbt test

View File

@ -0,0 +1,19 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, ETHEREUM'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_eth',
'blocks'
) }}

View File

@ -0,0 +1,17 @@
version: 2
models:
- name: tokenflow_eth__blocks
description: This table contains block level data for the Ethereum blockchain, sourced from Token Flow. For more information on Ethereum, please see [The Ethereum Organization](https://ethereum.org/en/developers/docs/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: BASE_FEE_PER_GAS
- name: BLOCK
- name: BLOCK_HASH
- name: CANONICAL
- name: GAS_LIMIT
- name: GAS_USED
- name: LOAD_ID
- name: MINER
- name: PARENT_HASH
- name: TIMESTAMP
- name: TX_COUNT

View File

@ -0,0 +1,19 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, ETHEREUM'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_eth',
'calls'
) }}

View File

@ -0,0 +1,29 @@
version: 2
models:
- name: tokenflow_eth__calls
description: This table contains call level data for the Ethereum blockchain, sourced from Token Flow. For more information on Ethereum, please see [The Ethereum Organization](https://ethereum.org/en/developers/docs/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: BLOCK
- name: BLOCK_HASH
- name: CALL_DATA
- name: CALL_GAS
- name: CALL_ID
- name: CALL_TYPE
- name: CALL_VALUE
- name: CANONICAL
- name: CREATED_ADDRESS
- name: EXCEPTION_ERROR
- name: FROM_ADDRESS
- name: GAS_REFUND
- name: GAS_USED
- name: LOAD_ID
- name: MEMORY_WORD_COUNT
- name: ORDER_INDEX
- name: RETURN_VALUE
- name: REVERT_REASON
- name: STATUS
- name: SUCCESS
- name: TIMESTAMP
- name: TO_ADDRESS
- name: TX_HASH

View File

@ -0,0 +1,19 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, ETHEREUM'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_eth',
'events'
) }}

View File

@ -0,0 +1,22 @@
version: 2
models:
- name: tokenflow_eth__events
description: This table contains event level data for the Ethereum blockchain, sourced from Token Flow. For more information on Ethereum, please see [The Ethereum Organization](https://ethereum.org/en/developers/docs/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: BLOCK
- name: BLOCK_HASH
- name: CALL_ID
- name: CANONICAL
- name: CONTRACT
- name: LOAD_ID
- name: LOG_DATA
- name: LOG_INDEX
- name: ORDER_INDEX
- name: STATUS
- name: TIMESTAMP
- name: TOPIC0
- name: TOPIC1
- name: TOPIC2
- name: TOPIC3
- name: TX_HASH

View File

@ -0,0 +1,19 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, ETHEREUM'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_eth',
'state_diffs'
) }}

View File

@ -0,0 +1,20 @@
version: 2
models:
- name: tokenflow_eth__state_diffs
description: This table contains state level data for the Ethereum blockchain, sourced from Token Flow. For more information on Ethereum, please see [The Ethereum Organization](https://ethereum.org/en/developers/docs/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: ADDRESS
- name: BLOCK
- name: BLOCK_HASH
- name: CALL_ID
- name: CANONICAL
- name: CURR_VALUE
- name: LOAD_ID
- name: ORDER_INDEX
- name: PREV_VALUE
- name: REASON
- name: STATE_FIELD
- name: STATUS
- name: TIMESTAMP
- name: TX_HASH

View File

@ -0,0 +1,19 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, ETHEREUM'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_eth',
'storage_diffs'
) }}

View File

@ -0,0 +1,19 @@
version: 2
models:
- name: tokenflow_eth__storage_diffs
description: This table contains storage level data for the Ethereum blockchain, sourced from Token Flow. For more information on Ethereum, please see [The Ethereum Organization](https://ethereum.org/en/developers/docs/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: BLOCK
- name: BLOCK_HASH
- name: CALL_ID
- name: CANONICAL
- name: CONTRACT
- name: CURR_VALUE
- name: LOAD_ID
- name: LOCATION
- name: ORDER_INDEX
- name: PREV_VALUE
- name: STATUS
- name: TIMESTAMP
- name: TX_HASH

View File

@ -0,0 +1,19 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, ETHEREUM'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_eth',
'storage_reads'
) }}

View File

@ -0,0 +1,18 @@
version: 2
models:
- name: tokenflow_eth__storage_reads
description: This table contains storage level data for the Ethereum blockchain, sourced from Token Flow. For more information on Ethereum, please see [The Ethereum Organization](https://ethereum.org/en/developers/docs/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: BLOCK
- name: BLOCK_HASH
- name: CALL_ID
- name: CANONICAL
- name: CONTRACT
- name: LOAD_ID
- name: LOCATION
- name: ORDER_INDEX
- name: STATUS
- name: TIMESTAMP
- name: TX_HASH
- name: VALUE

View File

@ -0,0 +1,19 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, ETHEREUM'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_eth',
'transactions'
) }}

View File

@ -0,0 +1,30 @@
version: 2
models:
- name: tokenflow_eth__transactions
description: This table contains transaction level data for the Ethereum blockchain, sourced from Token Flow. For more information on Ethereum, please see [The Ethereum Organization](https://ethereum.org/en/developers/docs/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: BLOCK
- name: BLOCK_HASH
- name: CALL_DATA
- name: CANONICAL
- name: CHAIN_ID
- name: CREATED_ADDRESS
- name: EXCEPTION_ERROR
- name: FROM_ADDRESS
- name: GAS_LIMIT
- name: GAS_PRICE
- name: GAS_REFUND
- name: GAS_USED
- name: LOAD_ID
- name: MAX_FEE_PER_GAS
- name: MAX_PRIORITY_FEE_PER_GAS
- name: RETURN_VALUE
- name: REVERT_REASON
- name: STATUS
- name: TIMESTAMP
- name: TO_ADDRESS
- name: TX_HASH
- name: TX_INDEX
- name: TX_VALUE
- name: TYPE

View File

@ -0,0 +1,20 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, STARKNET',
'PURPOSE': 'DECODED'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_starknet_decoded',
'blocks'
) }}

View File

@ -0,0 +1,17 @@
version: 2
models:
- name: tokenflow_starknet__decoded_blocks
description: This table contains decoded block level data for the Starknet blockchain, sourced from Token Flow. For more information on Starknet, please see [Starknet Resources](https://starknet.io/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: BLOCK_HASH
- name: BLOCK_NUMBER
- name: CHAIN_ID
- name: GAS_PRICE
- name: LOAD_ID
- name: PARENT_HASH
- name: SEQUENCER
- name: STATE_ROOT
- name: TIMESTAMP
- name: TX_COUNT

View File

@ -0,0 +1,20 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, STARKNET',
'PURPOSE': 'DECODED'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_starknet_decoded',
'events'
) }}

View File

@ -0,0 +1,19 @@
version: 2
models:
- name: tokenflow_starknet__decoded_events
description: This table contains decoded event level data for the Starknet blockchain, sourced from Token Flow. For more information on Starknet, please see [Starknet Resources](https://starknet.io/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: BLOCK_NUMBER
- name: CHAIN_ID
- name: CLASS_HASH
- name: CONTRACT
- name: EVENT_ID
- name: EVENT_ORDER
- name: KEYS
- name: LOAD_ID
- name: NAME
- name: PARAMETERS
- name: TIMESTAMP
- name: TRACE_ID
- name: TX_HASH

View File

@ -0,0 +1,20 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, STARKNET',
'PURPOSE': 'DECODED'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_starknet_decoded',
'messages'
) }}

View File

@ -0,0 +1,18 @@
version: 2
models:
- name: tokenflow_starknet__decoded_messages
description: This table contains decoded message level data for the Starknet blockchain, sourced from Token Flow. For more information on Starknet, please see [Starknet Resources](https://starknet.io/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: BLOCK_NUMBER
- name: CHAIN_ID
- name: CLASS_HASH
- name: FROM_ADDRESS
- name: LOAD_ID
- name: MESSAGE_ID
- name: MESSAGE_ORDER
- name: PAYLOAD
- name: TIMESTAMP
- name: TO_ADDRESS
- name: TRACE_ID
- name: TX_HASH

View File

@ -0,0 +1,20 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, STARKNET',
'PURPOSE': 'DECODED'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_starknet_decoded',
'traces'
) }}

View File

@ -0,0 +1,24 @@
version: 2
models:
- name: tokenflow_starknet__decoded_traces
description: This table contains decoded trace level data for the Starknet blockchain, sourced from Token Flow. For more information on Starknet, please see [Starknet Resources](https://starknet.io/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: BLOCK_NUMBER
- name: CALLER
- name: CHAIN_ID
- name: CLASS_HASH
- name: CONTRACT
- name: ENTRY_POINT_SELECTOR
- name: ENTRY_POINT_TYPE
- name: EXECUTION_RESOURCES
- name: FUNCTION
- name: INPUTS
- name: INVOCATION_TYPE
- name: LOAD_ID
- name: OUTPUTS
- name: TIMESTAMP
- name: TRACE_ID
- name: TRACE_PATH
- name: TRACE_TYPE
- name: TX_HASH

View File

@ -0,0 +1,20 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, STARKNET',
'PURPOSE': 'DECODED'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_starknet_decoded',
'transactions'
) }}

View File

@ -0,0 +1,26 @@
version: 2
models:
- name: tokenflow_starknet__decoded_transactions
description: This table contains decoded transaction level data for the Starknet blockchain, sourced from Token Flow. For more information on Starknet, please see [Starknet Resources](https://starknet.io/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: ACTUAL_FEE
- name: BLOCK_NUMBER
- name: CHAIN_ID
- name: CLASS_HASH
- name: CONTRACT
- name: ENTRY_POINT_SELECTOR
- name: ENTRY_POINT_TYPE
- name: ERROR
- name: EXECUTION_RESOURCES
- name: FUNCTION
- name: INPUTS
- name: L1_MESSAGE_NONCE
- name: LOAD_ID
- name: MAX_FEE
- name: OUTPUTS
- name: SIGNATURE
- name: TIMESTAMP
- name: TX_HASH
- name: TX_INDEX
- name: TYPE

View File

@ -0,0 +1,20 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, STARKNET',
'PURPOSE': 'L1'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_starknet_l1_data',
'blocks'
) }}

View File

@ -0,0 +1,13 @@
version: 2
models:
- name: tokenflow_starknet__l1_data_blocks
description: This table contains raw block level data for the Starknet blockchain, sourced from Token Flow. For more information on Starknet, please see [Starknet Resources](https://starknet.io/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: BLOCK_NUMBER
- name: CHAIN_ID
- name: CONTRACTS_COUNT
- name: DIFFS_COUNT
- name: FACT
- name: L1_TRANSACTION
- name: LOAD_ID

View File

@ -0,0 +1,20 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, STARKNET',
'PURPOSE': 'L1'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_starknet_l1_data',
'contracts'
) }}

View File

@ -0,0 +1,12 @@
version: 2
models:
- name: tokenflow_starknet__l1_data_contracts
description: This table contains raw contract level data for the Starknet blockchain, sourced from Token Flow. For more information on Starknet, please see [Starknet Resources](https://starknet.io/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: ADDRESS
- name: BLOCK_NUMBER
- name: CHAIN_ID
- name: CLASS_HASH
- name: CONSTRUCTOR_ARGS
- name: LOAD_ID

View File

@ -0,0 +1,20 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, STARKNET',
'PURPOSE': 'L1'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_starknet_l1_data',
'messages'
) }}

View File

@ -0,0 +1,15 @@
version: 2
models:
- name: tokenflow_starknet__l1_data_messages
description: This table contains raw message level data for the Starknet blockchain, sourced from Token Flow. For more information on Starknet, please see [Starknet Resources](https://starknet.io/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: BLOCK_NUMBER
- name: CHAIN_ID
- name: FEE
- name: L1_ADDRESS
- name: L2_ADDRESS
- name: LOAD_ID
- name: NONCE
- name: PAYLOAD
- name: SELECTOR

View File

@ -0,0 +1,20 @@
{{ config(
materialized = 'view',
tags = ['tokenflow'],
meta={
'database_tags':{
'table': {
'PROTOCOL': 'TOKENFLOW, STARKNET',
'PURPOSE': 'L1'
}
}
}
) }}
SELECT
*
FROM
{{ source(
'tokenflow_starknet_l1_data',
'storage_diffs'
) }}

View File

@ -0,0 +1,12 @@
version: 2
models:
- name: tokenflow_starknet__l1_data_storage_diffs
description: This table contains raw storage level data for the Starknet blockchain, sourced from Token Flow. For more information on Starknet, please see [Starknet Resources](https://starknet.io/). For more information on Token Flow, please see [Token Flow Resources](https://docs.tokenflow.live/).
columns:
- name: BLOCK_NUMBER
- name: CHAIN_ID
- name: CONTRACT
- name: LOAD_ID
- name: SLOT
- name: VALUE

View File

@ -18,4 +18,18 @@ sources:
- name: messages
- name: traces
- name: transactions
- name: tokenflow_eth
database: flipside_prod_db
schema: tokenflow_eth
tables:
- name: blocks
- name: calls
- name: events
- name: state_diffs
- name: storage_diffs
- name: storage_reads
- name: tokens_allowance_diffs
- name: tokens_balance_diffs
- name: tokens_metadata
- name: transactions