diff --git a/.github/workflows/dbt_alter_all_gha_tasks.yml b/.github/workflows/dbt_alter_all_gha_tasks.yml new file mode 100644 index 0000000..086327d --- /dev/null +++ b/.github/workflows/dbt_alter_all_gha_tasks.yml @@ -0,0 +1,27 @@ +name: dbt_alter_all_gha_tasks +run-name: dbt_alter_all_gha_tasks + +on: + workflow_dispatch: + branches: + - "main" + inputs: + task_action: + type: choice + description: Action to perform on all tasks + required: true + options: + - RESUME + - SUSPEND + default: RESUME + +concurrency: + group: ${{ github.workflow }} + +jobs: + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template_alter_all_gha_tasks.yml@pre-release/v4-beta + with: + task_action: ${{ inputs.task_action }} + target: prod + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_alter_gha_task.yml b/.github/workflows/dbt_alter_gha_task.yml deleted file mode 100644 index 0d4008e..0000000 --- a/.github/workflows/dbt_alter_gha_task.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: dbt_alter_gha_task -run-name: dbt_alter_gha_task - -on: - workflow_dispatch: - branches: - - "main" - inputs: - workflow_name: - type: string - description: Name of the workflow to perform the action on, no .yml extension - required: true - task_action: - type: choice - description: Action to perform - required: true - options: - - SUSPEND - - RESUME - default: SUSPEND - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.SCHEMA }}" - -concurrency: - group: ${{ github.workflow }} - -jobs: - called_workflow_template: - uses: FlipsideCrypto/analytics-workflow-templates/.github/workflows/dbt_alter_gha_tasks.yml@AN-4374/upgrade-dbt-1.7 - with: - workflow_name: | - ${{ inputs.workflow_name }} - task_action: | - ${{ inputs.task_action }} - environment: workflow_prod - secrets: inherit - - notify-failure: - needs: [called_workflow_template] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/dbt_alter_gha_tasks.yml b/.github/workflows/dbt_alter_gha_tasks.yml new file mode 100644 index 0000000..be92ee5 --- /dev/null +++ b/.github/workflows/dbt_alter_gha_tasks.yml @@ -0,0 +1,32 @@ +name: dbt_alter_gha_tasks +run-name: dbt_alter_gha_tasks + +on: + workflow_dispatch: + branches: + - "main" + inputs: + workflow_name: + type: string + description: Name of the workflow to perform the action on, no .yml extension + required: true + task_action: + type: choice + description: Action to perform + required: true + options: + - SUSPEND + - RESUME + default: SUSPEND + +concurrency: + group: ${{ github.workflow }} + +jobs: + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template_alter_gha_tasks.yml@pre-release/v4-beta + with: + workflow_name: ${{ inputs.workflow_name }} + task_action: ${{ inputs.task_action }} + target: prod + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_deploy_new_workflows.yml b/.github/workflows/dbt_deploy_new_workflows.yml new file mode 100644 index 0000000..a9a877d --- /dev/null +++ b/.github/workflows/dbt_deploy_new_workflows.yml @@ -0,0 +1,19 @@ +name: dbt_deploy_new_workflows +run-name: dbt_deploy_new_workflows + +on: + workflow_dispatch: + branches: + - "main" + +concurrency: + group: ${{ github.workflow }} + +jobs: + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + command_name: Deploy New Github Actions + command: | + make deploy_new_gha_tasks DBT_TARGET=prod + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_docs_update.yml b/.github/workflows/dbt_docs_update.yml index b4b38c9..10ec0ba 100644 --- a/.github/workflows/dbt_docs_update.yml +++ b/.github/workflows/dbt_docs_update.yml @@ -5,75 +5,10 @@ on: branches: - "main" -env: - USE_VARS: "${{ vars.USE_VARS }}" - DBT_PROFILES_DIR: "${{ vars.DBT_PROFILES_DIR }}" - DBT_VERSION: "${{ vars.DBT_VERSION }}" - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.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@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - - name: refresh ddl for datashare - run: | - cnt=$(dbt ls -m fsc_utils.datashare._datashare___create_gold | wc -l ); if [ $cnt -eq 1 ]; then dbt run -m fsc_utils.datashare._datashare___create_gold; fi; - - name: checkout docs branch - run: | - git checkout -B docs origin/main - - name: generate dbt docs - run: dbt docs generate -t prod - - - name: move files to docs directory - run: | - mkdir -p ./docs - cp target/{catalog.json,manifest.json,index.html} docs/ - - name: clean up target directory - run: dbt clean - - - name: check for changes - run: git status - - - name: stage changed files - run: git add . - - - name: commit changed files - run: | - git config user.email "abc@xyz" - git config user.name "github-actions" - git commit -am "Auto-update docs" - - name: push changes to docs - run: | - git push -f --set-upstream origin docs - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template_docs_update.yml@pre-release/v4-beta + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_integration_test.yml b/.github/workflows/dbt_integration_test.yml index f46d574..e625bc6 100644 --- a/.github/workflows/dbt_integration_test.yml +++ b/.github/workflows/dbt_integration_test.yml @@ -3,38 +3,20 @@ run-name: ${{ github.event.inputs.branch }} on: workflow_dispatch: + branches: + - "main" inputs: environment: - required: true type: string + required: true concurrency: ${{ github.workflow }} jobs: - prepare_vars: - runs-on: ubuntu-latest - environment: - name: ${{ inputs.environment }} - outputs: - warehouse: ${{ steps.set_outputs.outputs.warehouse }} - steps: - - name: Set warehouse output - id: set_outputs - run: | - echo "warehouse=${{ vars.WAREHOUSE }}" >> $GITHUB_OUTPUT called_workflow_template: - needs: prepare_vars - uses: FlipsideCrypto/analytics-workflow-templates/.github/workflows/dbt.yml@main + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template_integration_test.yml@pre-release/v4-beta with: - command: > + target: ${{ inputs.environment }} + command: | dbt test --selector 'integration_tests' - environment: ${{ inputs.environment }} - warehouse: ${{ needs.prepare_vars.outputs.warehouse }} secrets: inherit - - notify-failure: - needs: [called_workflow_template] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/dbt_run_abi_refresh.yml b/.github/workflows/dbt_run_abi_refresh.yml deleted file mode 100644 index bd10d4a..0000000 --- a/.github/workflows/dbt_run_abi_refresh.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: dbt_run_abi_refresh -run-name: dbt_run_abi_refresh - -on: - workflow_dispatch: - schedule: - # Runs “At minute 0 past every 12th hour.” (see https://crontab.guru) - - cron: "0 */12 * * *" - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.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@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - - name: Update ABI models - run: | - dbt run -m "gnosis_models,tag:abis" - - - name: Kick off decoded logs history, if there are new ABIs from users - run: | - dbt run-operation run_decoded_logs_history - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/dbt_run_adhoc.yml b/.github/workflows/dbt_run_adhoc.yml index b4e2a4b..30a3481 100644 --- a/.github/workflows/dbt_run_adhoc.yml +++ b/.github/workflows/dbt_run_adhoc.yml @@ -1,13 +1,13 @@ name: dbt_run_adhoc -run-name: dbt_run_adhoc +run-name: ${{ inputs.dbt_command }} on: workflow_dispatch: branches: - "main" inputs: - environment: - type: choice + target: + type: choice description: DBT Run Environment required: true options: @@ -15,9 +15,9 @@ on: - prod default: dev warehouse: - type: choice + type: choice description: Snowflake warehouse - required: true + required: true options: - DBT - DBT_CLOUD @@ -26,49 +26,18 @@ on: default: DBT dbt_command: type: string - description: "DBT Run Command" + description: 'DBT Run Command' required: true - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ inputs.warehouse }}" - SCHEMA: "${{ vars.SCHEMA }}" - + concurrency: group: ${{ github.workflow }} jobs: - run_dbt_jobs: - runs-on: ubuntu-latest - environment: - name: workflow_${{ inputs.environment }} - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - name: Run DBT Jobs - run: | - ${{ inputs.dbt_command }} - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + warehouse: ${{ inputs.warehouse }} + target: ${{ inputs.target }} + command_name: Run DBT Command + command: ${{ inputs.dbt_command }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_run_dev_refresh.yml b/.github/workflows/dbt_run_dev_refresh.yml index 4180e21..938995c 100644 --- a/.github/workflows/dbt_run_dev_refresh.yml +++ b/.github/workflows/dbt_run_dev_refresh.yml @@ -3,80 +3,13 @@ run-name: dbt_run_dev_refresh on: workflow_dispatch: - schedule: - # Runs "at 6:30 UTC" (see https://crontab.guru) - - cron: "30 6 * * 1" - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.SCHEMA }}" + branches: + - "main" concurrency: group: ${{ github.workflow }} jobs: - run_dbt_jobs_refresh: - runs-on: ubuntu-latest - environment: - name: workflow_prod - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - name: Run DBT Jobs - run: | - dbt run-operation run_sp_create_prod_clone - - notify-failure: - needs: [run_dbt_jobs_refresh] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - - run_dbt_jobs_udfs: - runs-on: ubuntu-latest - needs: run_dbt_jobs_refresh - environment: - name: workflow_dev - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - name: Run Recreate UDFs - run: | - dbt run-operation fsc_utils.create_evm_streamline_udfs --vars '{"UPDATE_UDFS_AND_SPS":True}' -t dev - dbt run -s livequery_models.deploy.core._live --vars '{"UPDATE_UDFS_AND_SPS":True}' -t dev - - notify-failure2: - needs: [run_dbt_jobs_udfs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template_dev_refresh.yml@pre-release/v4-beta + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_run_full_observability.yml b/.github/workflows/dbt_run_full_observability.yml index cff1da6..ebfc154 100644 --- a/.github/workflows/dbt_run_full_observability.yml +++ b/.github/workflows/dbt_run_full_observability.yml @@ -3,50 +3,21 @@ run-name: dbt_run_full_observability on: workflow_dispatch: - schedule: - # Runs “At 18:00 on day-of-month 1.” (see https://crontab.guru) - - cron: "0 18 1 * *" - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.SCHEMA }}" - + branches: + - "main" + concurrency: group: ${{ github.workflow }} jobs: - run_dbt_jobs: - runs-on: ubuntu-latest - environment: - name: workflow_prod_2xl + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + warehouse: DBT_EMERGENCY + command_name: Run Observability Models + command: | + dbt run --threads 2 --vars '{"MAIN_OBSERV_FULL_TEST_ENABLED":True}' -m "fsc_evm,tag:observability" + secrets: inherit + - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - name: Run DBT Jobs - run: | - dbt run --threads 2 --vars '{"OBSERV_FULL_TEST":True}' -m "gnosis_models,tag:observability" - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/dbt_run_heal_models.yml b/.github/workflows/dbt_run_heal_models.yml index dde14ef..6eaf50f 100644 --- a/.github/workflows/dbt_run_heal_models.yml +++ b/.github/workflows/dbt_run_heal_models.yml @@ -3,50 +3,17 @@ run-name: dbt_run_heal_models on: workflow_dispatch: - schedule: - # Runs at 04:55 on Wednesday (see https://crontab.guru) - - cron: "55 4 * * 3" - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.SCHEMA }}" - + branches: + - "main" + 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@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - name: Run DBT Jobs - run: | - dbt run -m "gnosis_models,tag:heal" --vars '{"HEAL_MODEL":True}' - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + command_name: Run Heal Models + command: | + dbt run -m "$PROJECT_NAME,tag:heal" --vars '{"HEAL_MODEL":True}' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_run_operation_reorg.yml b/.github/workflows/dbt_run_operation_reorg.yml deleted file mode 100644 index d9a6ca7..0000000 --- a/.github/workflows/dbt_run_operation_reorg.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: dbt_run_operation_reorg -run-name: dbt_run_operation_reorg - -on: - workflow_dispatch: - schedule: - # Runs at minute 40 every Monday (see https://crontab.guru) - - cron: "40 0 * * 1" - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.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@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - - name: List reorg models - id: list_models - run: | - reorg_model_list=$(dbt list --select "gnosis_models,tag:reorg" --resource-type model --output name | grep '__' | awk -F'.' '{print $NF}' | tr '\n' ',' | sed 's/,$//') - echo "model_list=$reorg_model_list" >> $GITHUB_OUTPUT - - - name: Execute block_reorg macro - run: | - dbt run-operation fsc_utils.block_reorg --args "{reorg_model_list: '${{ steps.list_models.outputs.model_list }}', hours: '169'}" && awk '/SQL status/ {print; next} /DELETE FROM/{getline; print} /\/\* {/ {print}' logs/dbt.log - - - name: Execute decoded_logs_cleanup macro - run: | - dbt run-operation decoded_logs_cleanup - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/dbt_run_scheduled_abis.yml b/.github/workflows/dbt_run_scheduled_abis.yml new file mode 100644 index 0000000..2eb8581 --- /dev/null +++ b/.github/workflows/dbt_run_scheduled_abis.yml @@ -0,0 +1,22 @@ +name: dbt_run_scheduled_abis +run-name: dbt_run_scheduled_abis + +on: + workflow_dispatch: + branches: + - "main" + +concurrency: + group: ${{ github.workflow }} + +jobs: + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + command_name: Run ABI Models + command: | + dbt run -m "fsc_evm,tag:silver,tag:abis" "fsc_evm,tag:gold,tag:abis" + command_name_2: Kick off decoded logs history, if there are new user submitted ABIs + command_2: | + dbt run-operation fsc_evm.run_decoded_logs_history + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_run_scheduled_curated.yml b/.github/workflows/dbt_run_scheduled_curated.yml index 2f12de2..61d9d16 100644 --- a/.github/workflows/dbt_run_scheduled_curated.yml +++ b/.github/workflows/dbt_run_scheduled_curated.yml @@ -6,46 +6,14 @@ on: branches: - "main" -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.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@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - name: Run DBT Jobs - run: | - dbt run -m "gnosis_models,tag:curated" - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + command_name: Run Curated Models + command: | + dbt run -m "$PROJECT_NAME,tag:curated" "fsc_evm,tag:curated" + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_run_scheduled_decoder.yml b/.github/workflows/dbt_run_scheduled_decoder.yml new file mode 100644 index 0000000..a0b7a2b --- /dev/null +++ b/.github/workflows/dbt_run_scheduled_decoder.yml @@ -0,0 +1,19 @@ +name: dbt_run_scheduled_decoder +run-name: dbt_run_scheduled_decoder + +on: + workflow_dispatch: + branches: + - "main" + +concurrency: + group: ${{ github.workflow }} + +jobs: + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + command_name: Run Decoder Models + command: | + dbt run -m "fsc_evm,tag:bronze,tag:decoded_logs" "fsc_evm,tag:silver,tag:decoded_logs" "fsc_evm,tag:gold,tag:decoded_logs" + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_run_scheduled_main.yml b/.github/workflows/dbt_run_scheduled_main.yml new file mode 100644 index 0000000..253ad79 --- /dev/null +++ b/.github/workflows/dbt_run_scheduled_main.yml @@ -0,0 +1,19 @@ +name: dbt_run_scheduled_main +run-name: dbt_run_scheduled_main + +on: + workflow_dispatch: + branches: + - "main" + +concurrency: + group: ${{ github.workflow }} + +jobs: + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + command_name: Run Main Models + command: | + dbt run -m "fsc_evm,tag:bronze,tag:core" "fsc_evm,tag:silver,tag:core" "fsc_evm,tag:gold,tag:core" "fsc_evm,tag:silver,tag:prices" "fsc_evm,tag:gold,tag:prices" "fsc_evm,tag:silver,tag:labels" "fsc_evm,tag:gold,tag:labels" "fsc_evm,tag:streamline,tag:decoded_logs,tag:realtime" "fsc_evm,tag:streamline,tag:decoded_logs,tag:complete" "fsc_evm,tag:streamline,tag:abis,tag:realtime" "fsc_evm,tag:streamline,tag:abis,tag:complete" --vars '{"STREAMLINE_INVOKE_STREAMS":True}' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_run_scheduled_non_realtime.yml b/.github/workflows/dbt_run_scheduled_non_realtime.yml deleted file mode 100644 index f5c6d10..0000000 --- a/.github/workflows/dbt_run_scheduled_non_realtime.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: dbt_run_scheduled_non_realtime -run-name: dbt_run_scheduled_non_realtime - -on: - workflow_dispatch: - branches: - - "main" - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.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@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - name: Run DBT Jobs - run: | - dbt run --vars '{"STREAMLINE_INVOKE_STREAMS":True}' -m "gnosis_models,tag:non_realtime" "gnosis_models,tag:streamline_decoded_logs_complete" "gnosis_models,tag:streamline_decoded_logs_realtime" - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/dbt_run_scheduled_scores.yml b/.github/workflows/dbt_run_scheduled_scores.yml new file mode 100644 index 0000000..5c2f0f9 --- /dev/null +++ b/.github/workflows/dbt_run_scheduled_scores.yml @@ -0,0 +1,20 @@ + +name: dbt_run_scheduled_scores +run-name: dbt_run_scheduled_scores + +on: + workflow_dispatch: + branches: + - "main" + +concurrency: + group: ${{ github.workflow }} + +jobs: + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + command_name: Run Scores Models + command: | + dbt run -m "fsc_evm,tag:scores" + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_run_streamline_chainhead.yml b/.github/workflows/dbt_run_streamline_chainhead.yml index b3fa3fd..efa0176 100644 --- a/.github/workflows/dbt_run_streamline_chainhead.yml +++ b/.github/workflows/dbt_run_streamline_chainhead.yml @@ -6,50 +6,15 @@ on: branches: - "main" -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.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@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - name: Run DBT Jobs - run: | - dbt run --vars '{"STREAMLINE_INVOKE_STREAMS":True}' -m "gnosis_models,tag:streamline_core_complete" "gnosis_models,tag:streamline_core_realtime" "gnosis_models,tag:streamline_core_complete_receipts" "gnosis_models,tag:streamline_core_realtime_receipts" "gnosis_models,tag:streamline_core_complete_confirm_blocks" "gnosis_models,tag:streamline_core_realtime_confirm_blocks" - - - name: Run Chainhead Tests - run: | - dbt test -m "gnosis_models,tag:chainhead" - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + command_name: Run Chainhead Models + command: | + dbt run --vars '{"STREAMLINE_INVOKE_STREAMS":True}' -m "fsc_evm,tag:chainhead" "fsc_evm,tag:streamline,tag:core,tag:complete" "fsc_evm,tag:streamline,tag:core,tag:realtime" --exclude "fsc_evm,tag:receipts_by_hash" + dbt test -m "fsc_evm,tag:chainhead" + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_run_streamline_decoded_logs_history.yml b/.github/workflows/dbt_run_streamline_decoded_logs_history.yml deleted file mode 100644 index dd0ed27..0000000 --- a/.github/workflows/dbt_run_streamline_decoded_logs_history.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: dbt_run_streamline_decoded_logs_history -run-name: dbt_run_streamline_decoded_logs_history - -on: - workflow_dispatch: - branches: - - "main" - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.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@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - - name: Update complete table - run: | - dbt run -m "gnosis_models,tag:streamline_decoded_logs_complete" - - - name: Decode historical logs - run: | - dbt run-operation decoded_logs_history --vars '{"STREAMLINE_INVOKE_STREAMS":True}' - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/dbt_run_streamline_decoder.yml b/.github/workflows/dbt_run_streamline_decoder.yml deleted file mode 100644 index 965968f..0000000 --- a/.github/workflows/dbt_run_streamline_decoder.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: dbt_run_streamline_decoder -run-name: dbt_run_streamline_decoder - -on: - workflow_dispatch: - branches: - - "main" - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.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@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - name: Run DBT Jobs - run: | - dbt run -m "gnosis_models,tag:decoded_logs" - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/dbt_run_streamline_decoder_history.yml b/.github/workflows/dbt_run_streamline_decoder_history.yml new file mode 100644 index 0000000..b736c9c --- /dev/null +++ b/.github/workflows/dbt_run_streamline_decoder_history.yml @@ -0,0 +1,22 @@ +name: dbt_run_streamline_decoder_history +run-name: dbt_run_streamline_decoder_history + +on: + workflow_dispatch: + branches: + - "main" + +concurrency: + group: ${{ github.workflow }} + +jobs: + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + command_name: Run Decoder Complete + command: | + dbt run -m "fsc_evm,tag:streamline,tag:decoded_logs,tag:complete" + command_name_2: Run Streamline Decoder History + command_2: | + dbt run-operation fsc_evm.decoded_logs_history --vars '{"STREAMLINE_INVOKE_STREAMS":True}' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_run_streamline_history.yml b/.github/workflows/dbt_run_streamline_history.yml new file mode 100644 index 0000000..08dfbc6 --- /dev/null +++ b/.github/workflows/dbt_run_streamline_history.yml @@ -0,0 +1,19 @@ +name: dbt_run_streamline_history +run-name: dbt_run_streamline_history + +on: + workflow_dispatch: + branches: + - "main" + +concurrency: + group: ${{ github.workflow }} + +jobs: + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + command_name: Run History Models + command: | + dbt run --vars '{"STREAMLINE_INVOKE_STREAMS":True}' -m "fsc_evm,tag:streamline,tag:core,tag:complete" "fsc_evm,tag:streamline,tag:core,tag:history" --exclude "fsc_evm,tag:receipts_by_hash" + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_run_streamline_history_adhoc.yml b/.github/workflows/dbt_run_streamline_history_adhoc.yml deleted file mode 100644 index f8c35fc..0000000 --- a/.github/workflows/dbt_run_streamline_history_adhoc.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: dbt_run_streamline_history_adhoc -run-name: dbt_run_streamline_history_adhoc - -on: - workflow_dispatch: - branches: - - "main" - inputs: - environment: - type: choice - description: DBT Run Environment - required: true - options: - - dev - - prod - - prod_backfill - default: dev - warehouse: - type: choice - description: Snowflake warehouse - required: true - options: - - DBT - - DBT_CLOUD - - DBT_EMERGENCY - default: DBT - dbt_command: - type: choice - description: "DBT Run Command" - required: true - options: - - dbt run --vars '{"STREAMLINE_INVOKE_STREAMS":True}' -m "gnosis_models,tag:streamline_core_complete" "gnosis_models,tag:streamline_core_history" "gnosis_models,tag:streamline_core_complete_receipts" "gnosis_models,tag:streamline_core_history_receipts" "gnosis_models,tag:streamline_core_complete_confirm_blocks" "gnosis_models,tag:streamline_core_history_confirm_blocks" - - dbt run --threads 8 --vars '{"STREAMLINE_INVOKE_STREAMS":True,"WAIT":120}' -m "gnosis_models,tag:streamline_decoded_logs_complete" "gnosis_models,tag:streamline_decoded_logs_history" - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ inputs.warehouse }}" - SCHEMA: "${{ vars.SCHEMA }}" - -concurrency: - group: ${{ github.workflow }} - -jobs: - run_dbt_jobs: - runs-on: ubuntu-latest - environment: - name: workflow_${{ inputs.environment }} - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - name: Run DBT Jobs - run: | - ${{ inputs.dbt_command }} - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/dbt_test_daily.yml b/.github/workflows/dbt_test_daily.yml index 730e13a..eaa9635 100644 --- a/.github/workflows/dbt_test_daily.yml +++ b/.github/workflows/dbt_test_daily.yml @@ -1,52 +1,23 @@ -name: dbt_test_daily +name: dbt_test_daily run-name: dbt_test_daily on: workflow_dispatch: - schedule: - # Runs "at 9:00 UTC" (see https://crontab.guru) - - cron: "0 9 * * *" - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.SCHEMA }}" - + branches: + - "main" + concurrency: group: ${{ github.workflow }} jobs: - run_dbt_jobs: - runs-on: ubuntu-latest - environment: - name: workflow_test - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - name: Run DBT Jobs - run: | - dbt test --exclude "gnosis_models,tag:full_test" "gnosis_models,tag:recent_test" "gnosis_models,tag:gha_tasks" livequery_models - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + target: test + command_name: Build Daily Testing Views + command: | + dbt run -m "fsc_evm,tag:daily_test" + command_name_2: Run Daily Tests (all tests excluding full, recent and misc. others) + command_2: | + dbt test --exclude "fsc_evm,tag:full_test" "fsc_evm,tag:recent_test" "fsc_evm,tag:gha_tasks" livequery_models + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_test_intraday.yml b/.github/workflows/dbt_test_intraday.yml index 1ffc27b..4823fcd 100644 --- a/.github/workflows/dbt_test_intraday.yml +++ b/.github/workflows/dbt_test_intraday.yml @@ -5,48 +5,17 @@ on: workflow_dispatch: branches: - "main" - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.SCHEMA }}" - + concurrency: group: ${{ github.workflow }} jobs: - run_dbt_jobs: - runs-on: ubuntu-latest - environment: - name: workflow_test - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - name: Run DBT Jobs - run: | - dbt run -m "gnosis_models,tag:observability" - dbt test -m "gnosis_models,tag:recent_test" - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + target: test + command_name: Run Observability & Recent Tests + command: | + dbt run -m "fsc_evm,tag:observability" + dbt test -m "fsc_evm,tag:recent_test" + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/dbt_test_monthly.yml b/.github/workflows/dbt_test_monthly.yml index e0e0971..cf47c45 100644 --- a/.github/workflows/dbt_test_monthly.yml +++ b/.github/workflows/dbt_test_monthly.yml @@ -3,50 +3,21 @@ run-name: dbt_test_monthly on: workflow_dispatch: - schedule: - # Runs “At 18:00 on the 28th of the month.” (see https://crontab.guru) - - cron: "0 18 28 * *" - -env: - DBT_PROFILES_DIR: ./ - - ACCOUNT: "${{ vars.ACCOUNT }}" - ROLE: "${{ vars.ROLE }}" - USER: "${{ vars.USER }}" - PASSWORD: "${{ secrets.PASSWORD }}" - REGION: "${{ vars.REGION }}" - DATABASE: "${{ vars.DATABASE }}" - WAREHOUSE: "${{ vars.WAREHOUSE }}" - SCHEMA: "${{ vars.SCHEMA }}" - + branches: + - "main" + concurrency: group: ${{ github.workflow }} jobs: - run_dbt_jobs: - runs-on: ubuntu-latest - environment: - name: workflow_test - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: "pip" - - - name: install dependencies - run: | - pip install -r requirements.txt - dbt deps - - name: Run DBT Jobs - run: | - dbt test -m "gnosis_models,tag:full_test" - - notify-failure: - needs: [run_dbt_jobs] - if: failure() - uses: ./.github/workflows/slack_notify.yml - secrets: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + called_workflow_template: + uses: FlipsideCrypto/fsc-evm/.github/workflows/dbt_run_template.yml@pre-release/v4-beta + with: + warehouse: DBT_EMERGENCY + command_name: Build Full Testing Views + command: | + dbt run -m "fsc_evm,tag:full_test" + command_name_2: Run Full Tests + command_2: | + dbt test -m "fsc_evm,tag:full_test" + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/slack_notify.yml b/.github/workflows/slack_notify.yml deleted file mode 100644 index 2dc6d14..0000000 --- a/.github/workflows/slack_notify.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Slack Notification -on: - workflow_call: - secrets: - SLACK_WEBHOOK_URL: - required: true - -jobs: - notify: - runs-on: ubuntu-latest - environment: workflow_prod - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: Install dependencies - run: pip install requests - - - name: Send Slack notification - run: python python/slack_alert.py - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.gitignore b/.gitignore index a399424..c8ac4dc 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,4 @@ logs/ .vscode/ dbt-env/ -package-lock.yml \ No newline at end of file +/package-lock.yml \ No newline at end of file diff --git a/.user.yml b/.user.yml deleted file mode 100644 index 40bbba7..0000000 --- a/.user.yml +++ /dev/null @@ -1 +0,0 @@ -id: 95f7b44b-3137-49d7-8ed2-1034b9c4d4af diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..92ccf34 --- /dev/null +++ b/Makefile @@ -0,0 +1,109 @@ +DBT_TARGET ?= dev +RECEIPTS_BY_HASH_ENABLED ?= false + +cleanup_time: + @set -e; \ + rm -f package-lock.yml && dbt clean && dbt deps + +deploy_gha_workflows_table: + @set -e; \ + echo "Collecting workflow names..." ; \ + WORKFLOW_VALUES="" ; \ + for file in $$(find .github/workflows -name "*.yml" -type f); do \ + filename=$$(basename "$$file" .yml) ; \ + if [ -z "$$WORKFLOW_VALUES" ]; then \ + WORKFLOW_VALUES="('$$filename')" ; \ + else \ + WORKFLOW_VALUES="$$WORKFLOW_VALUES,('$$filename')" ; \ + fi ; \ + done ; \ + echo "Found workflows: $$WORKFLOW_VALUES" ; \ + dbt run-operation create_workflow_table --args "{\"workflow_values\": \"$$WORKFLOW_VALUES\"}" -t $(DBT_TARGET) + +deploy_gha_tasks: + @set -e; \ + make deploy_gha_workflows_table DBT_TARGET=$(DBT_TARGET); \ + dbt run -s livequery_models.deploy.marketplace.github --vars '{"UPDATE_UDFS_AND_SPS":True}' -t $(DBT_TARGET); \ + dbt run -m "fsc_evm,tag:gha_tasks" --full-refresh -t $(DBT_TARGET); \ + dbt run-operation fsc_evm.create_gha_tasks --vars '{"RESUME_GHA_TASKS":True}' -t $(DBT_TARGET) + +deploy_new_gha_tasks: + @set -e; \ + make deploy_gha_workflows_table DBT_TARGET=$(DBT_TARGET); \ + dbt run -m "fsc_evm,tag:gha_tasks" --full-refresh -t $(DBT_TARGET); \ + dbt run-operation fsc_evm.create_gha_tasks --vars '{"RESUME_GHA_TASKS":True}' -t $(DBT_TARGET) + +deploy_livequery: + @set -e; \ + dbt run-operation fsc_evm.drop_livequery_schemas --vars '{"UPDATE_UDFS_AND_SPS": true}' -t $(DBT_TARGET); \ + dbt run -m livequery_models.deploy.core --vars '{"UPDATE_UDFS_AND_SPS": true}' -t $(DBT_TARGET); \ + dbt run-operation fsc_evm.livequery_grants --vars '{"UPDATE_UDFS_AND_SPS": true}' -t $(DBT_TARGET) + +deploy_chain_phase_1: + @set -e; \ + dbt run -m livequery_models.deploy.core --vars '{"UPDATE_UDFS_AND_SPS": true}' -t $(DBT_TARGET); \ + dbt run-operation fsc_evm.livequery_grants --vars '{"UPDATE_UDFS_AND_SPS": true}' -t $(DBT_TARGET); \ + dbt run-operation fsc_evm.create_evm_streamline_udfs --vars '{"UPDATE_UDFS_AND_SPS": true}' -t $(DBT_TARGET); \ + dbt run-operation fsc_evm.call_sample_rpc_node -t $(DBT_TARGET); \ + if [ "$(DBT_TARGET)" != "prod" ]; then \ + if [ "$(RECEIPTS_BY_HASH_ENABLED)" = "true" ]; then \ + dbt run -m "fsc_evm,tag:phase_1" --exclude "fsc_evm,tag:receipts" --full-refresh --vars '{"STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES":true, "MAIN_SL_NEW_BUILD_ENABLED": true, "GLOBAL_STREAMLINE_FR_ENABLED": true}' -t $(DBT_TARGET); \ + dbt test -m "fsc_evm,tag:chainhead"; \ + dbt run -m "fsc_evm,tag:streamline,tag:core,tag:complete" "fsc_evm,tag:streamline,tag:core,tag:realtime" --exclude "fsc_evm,tag:receipts" "fsc_evm,tag:confirm_blocks" --vars '{"MAIN_SL_NEW_BUILD_ENABLED": true, "STREAMLINE_INVOKE_STREAMS":True, "MAIN_SL_TESTING_LIMIT": 500}' -t $(DBT_TARGET); \ + else \ + dbt run -m "fsc_evm,tag:phase_1" --exclude "fsc_evm,tag:receipts_by_hash" --full-refresh --vars '{"STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES":true, "MAIN_SL_NEW_BUILD_ENABLED": true, "GLOBAL_STREAMLINE_FR_ENABLED": true}' -t $(DBT_TARGET); \ + dbt test -m "fsc_evm,tag:chainhead"; \ + dbt run -m "fsc_evm,tag:streamline,tag:core,tag:complete" "fsc_evm,tag:streamline,tag:core,tag:realtime" --exclude "fsc_evm,tag:receipts_by_hash" "fsc_evm,tag:confirm_blocks" --vars '{"MAIN_SL_NEW_BUILD_ENABLED": true, "STREAMLINE_INVOKE_STREAMS":True, "MAIN_SL_TESTING_LIMIT": 500}' -t $(DBT_TARGET); \ + fi; \ + else \ + if [ "$(RECEIPTS_BY_HASH_ENABLED)" = "true" ]; then \ + dbt run -m "fsc_evm,tag:phase_1" --exclude "fsc_evm,tag:receipts" --full-refresh --vars '{"MAIN_SL_NEW_BUILD_ENABLED": true, "GLOBAL_STREAMLINE_FR_ENABLED": true}' -t $(DBT_TARGET); \ + dbt test -m "fsc_evm,tag:chainhead"; \ + dbt run -m "fsc_evm,tag:streamline,tag:core,tag:complete" "fsc_evm,tag:streamline,tag:core,tag:realtime" --exclude "fsc_evm,tag:receipts" "fsc_evm,tag:confirm_blocks" --vars '{"MAIN_SL_NEW_BUILD_ENABLED": true, "STREAMLINE_INVOKE_STREAMS":True}' -t $(DBT_TARGET); \ + else \ + dbt run -m "fsc_evm,tag:phase_1" --exclude "fsc_evm,tag:receipts_by_hash" --full-refresh --vars '{"MAIN_SL_NEW_BUILD_ENABLED": true, "GLOBAL_STREAMLINE_FR_ENABLED": true}' -t $(DBT_TARGET); \ + dbt test -m "fsc_evm,tag:chainhead"; \ + dbt run -m "fsc_evm,tag:streamline,tag:core,tag:complete" "fsc_evm,tag:streamline,tag:core,tag:realtime" --exclude "fsc_evm,tag:receipts_by_hash" "fsc_evm,tag:confirm_blocks" --vars '{"MAIN_SL_NEW_BUILD_ENABLED": true, "STREAMLINE_INVOKE_STREAMS":True}' -t $(DBT_TARGET); \ + fi; \ + fi; \ + echo "# wait ~10 minutes"; \ + echo "# run deploy_chain_phase_2" + +deploy_chain_phase_2: + @set -e; \ + if [ "$(DBT_TARGET)" != "prod" ]; then \ + dbt run -m "fsc_evm,tag:phase_2" --full-refresh --vars '{"STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES":true, "GLOBAL_STREAMLINE_FR_ENABLED": true, "GLOBAL_BRONZE_FR_ENABLED": true, "GLOBAL_SILVER_FR_ENABLED": true, "GLOBAL_GOLD_FR_ENABLED": true, "GLOBAL_NEW_BUILD_ENABLED": true}' -t $(DBT_TARGET); \ + dbt run -m "fsc_evm,tag:streamline,tag:abis,tag:realtime" "fsc_evm,tag:streamline,tag:abis,tag:complete" --vars '{"STREAMLINE_INVOKE_STREAMS":True, "DECODER_SL_NEW_BUILD_ENABLED": true}' -t $(DBT_TARGET); \ + else \ + dbt run -m "fsc_evm,tag:phase_2" --full-refresh --vars '{"GLOBAL_STREAMLINE_FR_ENABLED": true, "GLOBAL_BRONZE_FR_ENABLED": true, "GLOBAL_SILVER_FR_ENABLED": true, "GLOBAL_GOLD_FR_ENABLED": true, "GLOBAL_NEW_BUILD_ENABLED": true}' -t $(DBT_TARGET); \ + dbt run -m "fsc_evm,tag:streamline,tag:abis,tag:realtime" "fsc_evm,tag:streamline,tag:abis,tag:complete" --vars '{"STREAMLINE_INVOKE_STREAMS":True, "DECODER_SL_NEW_BUILD_ENABLED": true}' -t $(DBT_TARGET); \ + fi; \ + echo "# wait ~10 minutes"; \ + echo "# run deploy_chain_phase_3" + +deploy_chain_phase_3: + @set -e; \ + if [ "$(DBT_TARGET)" != "prod" ]; then \ + dbt run -m "fsc_evm,tag:phase_2" --vars '{"STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES":true}' -t $(DBT_TARGET); \ + dbt run -m "fsc_evm,tag:phase_3" --full-refresh --vars '{"STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES":true, "GLOBAL_STREAMLINE_FR_ENABLED": true, "GLOBAL_SILVER_FR_ENABLED": true, "GLOBAL_GOLD_FR_ENABLED": true, "GLOBAL_NEW_BUILD_ENABLED": true}' -t $(DBT_TARGET); \ + dbt run -m "fsc_evm,tag:silver,tag:abis" "fsc_evm,tag:streamline,tag:decoded_logs,tag:realtime" "fsc_evm,tag:streamline,tag:decoded_logs,tag:complete" --vars '{"STREAMLINE_INVOKE_STREAMS":True, "DECODER_SL_TESTING_LIMIT": 500}' -t $(DBT_TARGET); \ + else \ + dbt run -m "fsc_evm,tag:phase_2" -t $(DBT_TARGET); \ + dbt run -m "fsc_evm,tag:phase_3" --full-refresh --vars '{"GLOBAL_STREAMLINE_FR_ENABLED": true, "GLOBAL_SILVER_FR_ENABLED": true, "GLOBAL_GOLD_FR_ENABLED": true, "GLOBAL_NEW_BUILD_ENABLED": true}' -t $(DBT_TARGET); \ + dbt run -m "fsc_evm,tag:silver,tag:abis" "fsc_evm,tag:streamline,tag:decoded_logs,tag:realtime" "fsc_evm,tag:streamline,tag:decoded_logs,tag:complete" --vars '{"STREAMLINE_INVOKE_STREAMS":True}' -t $(DBT_TARGET); \ + fi; \ + echo "# wait ~10 minutes"; \ + echo "# run deploy_chain_phase_4" + +deploy_chain_phase_4: + @set -e; \ + if [ "$(DBT_TARGET)" != "prod" ]; then \ + dbt run -m "fsc_evm,tag:phase_3" --vars '{"STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES":true}' -t $(DBT_TARGET); \ + dbt run -m "fsc_evm,tag:phase_4" --full-refresh -t $(DBT_TARGET); \ + else \ + dbt run -m "fsc_evm,tag:phase_3" -t $(DBT_TARGET); \ + dbt run -m "fsc_evm,tag:phase_4" --full-refresh -t $(DBT_TARGET); \ + make deploy_gha_tasks DBT_TARGET=$(DBT_TARGET); \ + fi; \ + +.PHONY: cleanup_time deploy_gha_workflows_table deploy_gha_tasks deploy_new_gha_tasks deploy_livequery deploy_chain_phase_1 deploy_chain_phase_2 deploy_chain_phase_3 deploy_chain_phase_4 \ No newline at end of file diff --git a/data/github_actions__workflows.csv b/data/github_actions__workflows.csv deleted file mode 100644 index 61d5cce..0000000 --- a/data/github_actions__workflows.csv +++ /dev/null @@ -1,7 +0,0 @@ -workflow_name,workflow_schedule -dbt_run_scheduled_non_realtime,"12 * * * *" -dbt_run_streamline_chainhead,"25,55 * * * *" -dbt_run_streamline_decoder,"30 * * * *" -dbt_run_scheduled_curated,"40 */6 * * *" -dbt_run_streamline_decoded_logs_history,"25 17 * * 6" -dbt_test_intraday,"45 */4 * * *" \ No newline at end of file diff --git a/dbt_project.yml b/dbt_project.yml index 4339ea8..0297aec 100644 --- a/dbt_project.yml +++ b/dbt_project.yml @@ -17,6 +17,8 @@ test-paths: ["tests"] seed-paths: ["data"] macro-paths: ["macros"] snapshot-paths: ["snapshots"] +docs-paths: + ["dbt_packages/fsc_evm/doc_descriptions", "models/doc_descriptions", "models"] target-path: "target" # directory which will store compiled SQL files clean-targets: # directories to be removed by `dbt clean` @@ -30,7 +32,6 @@ tests: on-run-start: - "{{ create_sps() }}" - "{{ create_udfs() }}" - # - "{{ db_comment() }}" on-run-end: - '{{ apply_meta_as_tags(results) }}' @@ -50,8 +51,59 @@ query-comment: # Full documentation: https://docs.getdbt.com/docs/configuring-models models: - +copy_grants: true - +on_schema_change: "append_new_columns" + gnosis_models: # replace with the name of the chain + +copy_grants: true + +persist_docs: + relation: true + columns: true + +on_schema_change: "append_new_columns" + livequery_models: + +materialized: ephemeral + fsc_evm: + +enabled: false # disable fsc_evm package by default + +copy_grants: true + +persist_docs: + relation: true + columns: true + +on_schema_change: "append_new_columns" + main_package: + +enabled: false # disable top level package by default, enabled subpackages as needed + admin: + +enabled: true + core: + +enabled: true # enable subpackages, as needed + bronze: + +enabled: false + token_reads: + +enabled: true + github_actions: + +enabled: true + labels: + +enabled: true + observability: + +enabled: true + prices: + +enabled: true + utils: + +enabled: true + decoder_package: + +enabled: false + abis: + +enabled: true + decoded_logs: + +enabled: false + gold: + +enabled: true + silver: + +enabled: true + streamline: + +enabled: true + curated_package: + +enabled: false + stats: + +enabled: true + scores_package: + +enabled: false # 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 @@ -63,11 +115,8 @@ vars: UPDATE_SNOWFLAKE_TAGS: True STREAMLINE_INVOKE_STREAMS: False STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES: False - WAIT: 0 - OBSERV_FULL_TEST: False HEAL_MODEL: False HEAL_MODELS: [] - START_GHA_TASKS: False #### STREAMLINE 2.0 BEGIN #### @@ -92,58 +141,4 @@ vars: - INTERNAL_DEV - DBT_CLOUD_GNOSIS -#### STREAMLINE 2.0 END #### - -#### FSC_EVM BEGIN #### -# Visit https://github.com/FlipsideCrypto/fsc-evm/wiki for more information on required and optional variables - - ### GLOBAL VARIABLES BEGIN ### - ## REQUIRED - GLOBAL_PROD_DB_NAME: 'gnosis' - GLOBAL_NODE_SECRET_PATH: 'Vault/prod/gnosis/quicknode/mainnet' - GLOBAL_NODE_URL: '{service}/{Authentication}' - GLOBAL_BLOCKS_PER_HOUR: 1200 - GLOBAL_USES_STREAMLINE_V1: True - GLOBAL_USES_SINGLE_FLIGHT_METHOD: True - - ### GLOBAL VARIABLES END ### - - ### MAIN_PACKAGE VARIABLES BEGIN ### - - ### CORE ### - ## REQUIRED - - ## OPTIONAL - # GOLD_FULL_REFRESH: True - # SILVER_FULL_REFRESH: True - # BRONZE_FULL_REFRESH: True - - # BLOCKS_COMPLETE_FULL_REFRESH: True - # CONFIRM_BLOCKS_COMPLETE_FULL_REFRESH: True - # TRACES_COMPLETE_FULL_REFRESH: True - # RECEIPTS_COMPLETE_FULL_REFRESH: True - # TRANSACTIONS_COMPLETE_FULL_REFRESH: True - - BLOCKS_TRANSACTIONS_REALTIME_SQL_LIMIT: 10000 - BLOCKS_TRANSACTIONS_HISTORY_SQL_LIMIT: 10000 - RECEIPTS_REALTIME_SQL_LIMIT: 10000 - RECEIPTS_HISTORY_SQL_LIMIT: 10000 - TRACES_REALTIME_SQL_LIMIT: 10000 - TRACES_HISTORY_SQL_LIMIT: 10000 - - ### MAIN_PACKAGE VARIABLES END ### - - ### DECODER_PACKAGE VARIABLES BEGIN ### - - ## REQUIRED - - ## OPTIONAL - - # DECODED_LOGS_COMPLETE_FULL_REFRESH: True - - # DECODED_LOGS_REALTIME_TESTING_LIMIT: 3 - # DECODED_LOGS_HISTORY_SQL_LIMIT: 1 #limit per monthly range - - ### DECODER_PACKAGE VARIABLES END ### - -#### FSC_EVM END #### \ No newline at end of file +#### STREAMLINE 2.0 END #### \ No newline at end of file diff --git a/macros/create_udfs.sql b/macros/create_udfs.sql index 71deba6..b243608 100644 --- a/macros/create_udfs.sql +++ b/macros/create_udfs.sql @@ -1,24 +1,9 @@ {% macro create_udfs() %} - {% if var("UPDATE_UDFS_AND_SPS") %} + {% if var("UPDATE_UDFS_AND_SPS", false) %} {% set sql %} CREATE schema if NOT EXISTS silver; - {{ create_udtf_get_base_table( - schema = "streamline" - ) }} - {% endset %} {% do run_query(sql) %} - {% if target.database != "GNOSIS_COMMUNITY_DEV" %} - {% set sql %} - {{ create_udf_get_chainhead() }} - {{ create_udf_bulk_json_rpc() }} - {{ 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/decoded_logs_cleanup.sql b/macros/decoded_logs_cleanup.sql deleted file mode 100644 index e99efcd..0000000 --- a/macros/decoded_logs_cleanup.sql +++ /dev/null @@ -1,23 +0,0 @@ -{% macro decoded_logs_cleanup() %} - {% set sql %} -DELETE FROM - {{ ref('silver__decoded_logs') }} - d -WHERE - _inserted_timestamp > DATEADD('hour', -48, SYSDATE()) - AND NOT EXISTS ( - SELECT - 1 - FROM - {{ ref('silver__logs') }} - l - WHERE - d.block_number = l.block_number - AND d.tx_hash = l.tx_hash - AND d.event_index = l.event_index - AND d.contract_address = l.contract_address - AND d.topics [0] :: STRING = l.topics [0] :: STRING - ); -{% endset %} - {% do run_query(sql) %} -{% endmacro %} diff --git a/macros/decoder/decoded_logs_history.sql b/macros/decoder/decoded_logs_history.sql deleted file mode 100644 index 4fe2282..0000000 --- a/macros/decoder/decoded_logs_history.sql +++ /dev/null @@ -1,124 +0,0 @@ -{% macro decoded_logs_history(backfill_mode=false) %} - - {%- set params = { - "sql_limit": var("DECODED_LOGS_HISTORY_SQL_LIMIT", 8000000), - "producer_batch_size": var("DECODED_LOGS_HISTORY_PRODUCER_BATCH_SIZE", 400000), - "worker_batch_size": var("DECODED_LOGS_HISTORY_WORKER_BATCH_SIZE", 100000) - } -%} - - {% set wait_time = var("DECODED_LOGS_HISTORY_WAIT_TIME", 60) %} - {% set find_months_query %} - SELECT - DISTINCT date_trunc('month', block_timestamp)::date as month - FROM {{ ref('core__fact_blocks') }} - ORDER BY month ASC - {% endset %} - {% set results = run_query(find_months_query) %} - - {% if execute %} - {% set months = results.columns[0].values() %} - - {% for month in months %} - {% set view_name = 'decoded_logs_history_' ~ month.strftime('%Y_%m') %} - - {% set create_view_query %} - create or replace view streamline.{{view_name}} as ( - WITH target_blocks AS ( - SELECT - block_number - FROM {{ ref('core__fact_blocks') }} - WHERE date_trunc('month', block_timestamp) = '{{month}}'::timestamp - ), - new_abis AS ( - SELECT - abi, - parent_contract_address, - event_signature, - start_block, - end_block - FROM {{ ref('silver__complete_event_abis') }} - {% if not backfill_mode %} - WHERE inserted_timestamp > dateadd('day', -30, sysdate()) - {% endif %} - ), - existing_logs_to_exclude AS ( - SELECT _log_id - FROM {{ ref('streamline__decoded_logs_complete') }} l - INNER JOIN target_blocks b using (block_number) - ), - candidate_logs AS ( - SELECT - l.block_number, - l.tx_hash, - l.event_index, - l.contract_address, - l.topics, - l.data, - concat(l.tx_hash::string, '-', l.event_index::string) as _log_id - FROM target_blocks b - INNER JOIN {{ ref('core__fact_event_logs') }} l using (block_number) - WHERE l.tx_status = 'SUCCESS' and date_trunc('month', l.block_timestamp) = '{{month}}'::timestamp - ) - SELECT - l.block_number, - l._log_id, - A.abi, - OBJECT_CONSTRUCT( - 'topics', l.topics, - 'data', l.data, - 'address', l.contract_address - ) AS data - FROM candidate_logs l - INNER JOIN new_abis A - ON A.parent_contract_address = l.contract_address - AND A.event_signature = l.topics[0]::STRING - AND l.block_number BETWEEN A.start_block AND A.end_block - WHERE NOT EXISTS ( - SELECT 1 - FROM existing_logs_to_exclude e - WHERE e._log_id = l._log_id - ) - LIMIT {{ params.sql_limit }} - ) - {% endset %} - {# Create the view #} - {% do run_query(create_view_query) %} - {{ log("Created view for month " ~ month.strftime('%Y-%m'), info=True) }} - {% if var("STREAMLINE_INVOKE_STREAMS", false) %} - {# Check if rows exist first #} - {% set check_rows_query %} - SELECT EXISTS(SELECT 1 FROM streamline.{{view_name}} LIMIT 1) - {% endset %} - - {% set results = run_query(check_rows_query) %} - {% set has_rows = results.columns[0].values()[0] %} - - {% if has_rows %} - {# Invoke streamline, if rows exist to decode #} - {% set decode_query %} - SELECT - streamline.udf_bulk_decode_logs_v2( - PARSE_JSON( - $${ "external_table": "decoded_logs", - "producer_batch_size": {{ params.producer_batch_size }}, - "sql_limit": {{ params.sql_limit }}, - "sql_source": "{{view_name}}", - "worker_batch_size": {{ params.worker_batch_size }} }$$ - ) - ); - {% endset %} - - {% do run_query(decode_query) %} - {{ log("Triggered decoding for month " ~ month.strftime('%Y-%m'), info=True) }} - {# Call wait since we actually did some decoding #} - {% do run_query("call system$wait(" ~ wait_time ~ ")") %} - {{ log("Completed wait after decoding for month " ~ month.strftime('%Y-%m'), info=True) }} - {% else %} - {{ log("No rows to decode for month " ~ month.strftime('%Y-%m'), info=True) }} - {% endif %} - {% endif %} - - {% endfor %} - {% endif %} - -{% endmacro %} \ No newline at end of file diff --git a/macros/decoder/run_decoded_logs_history.sql b/macros/decoder/run_decoded_logs_history.sql deleted file mode 100644 index 3954afb..0000000 --- a/macros/decoder/run_decoded_logs_history.sql +++ /dev/null @@ -1,29 +0,0 @@ -{% macro run_decoded_logs_history() %} - -{% set blockchain = var('GLOBAL_PROD_DB_NAME','').lower() %} - -{% set check_for_new_user_abis_query %} - select 1 - from {{ ref('silver__user_verified_abis') }} - where _inserted_timestamp::date = sysdate()::date - and dayname(sysdate()) <> 'Sat' -{% endset %} -{% set results = run_query(check_for_new_user_abis_query) %} -{% if execute %} - {% set new_user_abis = results.columns[0].values()[0] %} - - {% if new_user_abis %} - {% set invoke_workflow_query %} - SELECT - github_actions.workflow_dispatches( - 'FlipsideCrypto', - '{{ blockchain }}' || '-models', - 'dbt_run_streamline_decoded_logs_history.yml', - NULL - ) - {% endset %} - - {% do run_query(invoke_workflow_query) %} - {% endif %} -{% endif %} -{% endmacro %} \ No newline at end of file diff --git a/macros/fsc_evm_temp/decoder_package/streamline_external_table_queries_decoder.sql b/macros/fsc_evm_temp/decoder_package/streamline_external_table_queries_decoder.sql deleted file mode 100644 index 318a3da..0000000 --- a/macros/fsc_evm_temp/decoder_package/streamline_external_table_queries_decoder.sql +++ /dev/null @@ -1,101 +0,0 @@ -{% macro streamline_external_table_query_decoder( - source_name, - source_version - ) %} - - {% if source_version != '' %} - {% set source_version = '_' ~ source_version.lower() %} - {% endif %} - - WITH meta AS ( - SELECT - job_created_time AS _inserted_timestamp, - file_name, - CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 6), '_', 1) AS INTEGER) AS _partition_by_block_number, - TO_DATE( - concat_ws('-', SPLIT_PART(file_name, '/', 3), SPLIT_PART(file_name, '/', 4), SPLIT_PART(file_name, '/', 5)) - ) AS _partition_by_created_date - FROM - TABLE( - information_schema.external_table_file_registration_history( - start_time => DATEADD('day', -3, CURRENT_TIMESTAMP()), - table_name => '{{ source( "bronze_streamline", source_name ~ source_version) }}') - ) A - ) - SELECT - block_number, - id :: STRING AS id, - DATA, - metadata, - b.file_name, - _inserted_timestamp, - s._partition_by_block_number AS _partition_by_block_number, - s._partition_by_created_date AS _partition_by_created_date - FROM - {{ source( - "bronze_streamline", - source_name ~ source_version - ) }} - s - JOIN meta b - ON b.file_name = metadata$filename - AND b._partition_by_block_number = s._partition_by_block_number - AND b._partition_by_created_date = s._partition_by_created_date - WHERE - b._partition_by_block_number = s._partition_by_block_number - AND b._partition_by_created_date = s._partition_by_created_date - AND s._partition_by_created_date >= DATEADD('day', -2, CURRENT_TIMESTAMP()) - AND DATA :error IS NULL - AND DATA IS NOT NULL -{% endmacro %} - - -{% macro streamline_external_table_query_decoder_fr( - source_name, - source_version - ) %} - - {% if source_version != '' %} - {% set source_version = '_' ~ source_version.lower() %} - {% endif %} - - WITH meta AS ( - SELECT - registered_on AS _inserted_timestamp, - file_name, - CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 6), '_', 1) AS INTEGER) AS _partition_by_block_number, - TO_DATE( - concat_ws('-', SPLIT_PART(file_name, '/', 3), SPLIT_PART(file_name, '/', 4), SPLIT_PART(file_name, '/', 5)) - ) AS _partition_by_created_date - FROM - TABLE( - information_schema.external_table_files( - table_name => '{{ source( "bronze_streamline", source_name ~ source_version) }}' - ) - ) A - ) -SELECT - block_number, - id :: STRING AS id, - DATA, - metadata, - b.file_name, - _inserted_timestamp, - s._partition_by_block_number AS _partition_by_block_number, - s._partition_by_created_date AS _partition_by_created_date -FROM - {{ source( - "bronze_streamline", - source_name ~ source_version - ) }} - s - JOIN meta b - ON b.file_name = metadata$filename - AND b._partition_by_block_number = s._partition_by_block_number - AND b._partition_by_created_date = s._partition_by_created_date -WHERE - b._partition_by_block_number = s._partition_by_block_number - AND b._partition_by_created_date = s._partition_by_created_date - AND DATA :error IS NULL - AND DATA IS NOT NULL -{% endmacro %} diff --git a/macros/fsc_evm_temp/main_package/bronze/streamline_external_table_queries.sql b/macros/fsc_evm_temp/main_package/bronze/streamline_external_table_queries.sql deleted file mode 100644 index 7d9460e..0000000 --- a/macros/fsc_evm_temp/main_package/bronze/streamline_external_table_queries.sql +++ /dev/null @@ -1,141 +0,0 @@ -{% macro streamline_external_table_query( - source_name, - source_version, - partition_function, - balances, - block_number, - uses_receipts_by_hash - ) %} - - {% if source_version != '' %} - {% set source_version = '_' ~ source_version.lower() %} - {% endif %} - - WITH meta AS ( - SELECT - job_created_time AS _inserted_timestamp, - file_name, - {{ partition_function }} AS partition_key - FROM - TABLE( - information_schema.external_table_file_registration_history( - start_time => DATEADD('day', -3, CURRENT_TIMESTAMP()), - table_name => '{{ source( "bronze_streamline", source_name ~ source_version) }}') - ) A - ) - SELECT - s.*, - b.file_name, - b._inserted_timestamp - - {% if balances %}, - r.block_timestamp :: TIMESTAMP AS block_timestamp - {% endif %} - - {% if block_number %}, - COALESCE( - s.value :"BLOCK_NUMBER" :: STRING, - s.metadata :request :"data" :id :: STRING, - PARSE_JSON( - s.metadata :request :"data" - ) :id :: STRING - ) :: INT AS block_number - {% endif %} - {% if uses_receipts_by_hash %}, - s.value :"TX_HASH" :: STRING AS tx_hash - {% endif %} - FROM - {{ source( - "bronze_streamline", - source_name ~ source_version - ) }} - s - JOIN meta b - ON b.file_name = metadata$filename - AND b.partition_key = s.partition_key - - {% if balances %} - JOIN {{ ref('_block_ranges') }} - r - ON r.block_number = COALESCE( - s.value :"BLOCK_NUMBER" :: INT, - s.value :"block_number" :: INT - ) - {% endif %} - WHERE - b.partition_key = s.partition_key - AND DATA :error :code IS NULL - AND DATA IS NOT NULL -{% endmacro %} - -{% macro streamline_external_table_query_fr( - source_name, - source_version, - partition_function, - partition_join_key, - balances, - block_number, - uses_receipts_by_hash - ) %} - - {% if source_version != '' %} - {% set source_version = '_' ~ source_version.lower() %} - {% endif %} - - WITH meta AS ( - SELECT - registered_on AS _inserted_timestamp, - file_name, - {{ partition_function }} AS partition_key - FROM - TABLE( - information_schema.external_table_files( - table_name => '{{ source( "bronze_streamline", source_name ~ source_version) }}' - ) - ) A - ) -SELECT - s.*, - b.file_name, - b._inserted_timestamp - - {% if balances %}, - r.block_timestamp :: TIMESTAMP AS block_timestamp -{% endif %} - -{% if block_number %}, - COALESCE( - s.value :"BLOCK_NUMBER" :: STRING, - s.value :"block_number" :: STRING, - s.metadata :request :"data" :id :: STRING, - PARSE_JSON( - s.metadata :request :"data" - ) :id :: STRING - ) :: INT AS block_number -{% endif %} -{% if uses_receipts_by_hash %}, - s.value :"TX_HASH" :: STRING AS tx_hash -{% endif %} -FROM - {{ source( - "bronze_streamline", - source_name ~ source_version - ) }} - s - JOIN meta b - ON b.file_name = metadata$filename - AND b.partition_key = s.{{ partition_join_key }} - - {% if balances %} - JOIN {{ ref('_block_ranges') }} - r - ON r.block_number = COALESCE( - s.value :"BLOCK_NUMBER" :: INT, - s.value :"block_number" :: INT - ) - {% endif %} -WHERE - b.partition_key = s.{{ partition_join_key }} - AND DATA :error :code IS NULL - AND DATA IS NOT NULL -{% endmacro %} diff --git a/macros/fsc_evm_temp/main_package/logging/bronze.sql b/macros/fsc_evm_temp/main_package/logging/bronze.sql deleted file mode 100644 index b367deb..0000000 --- a/macros/fsc_evm_temp/main_package/logging/bronze.sql +++ /dev/null @@ -1,36 +0,0 @@ -{% macro log_bronze_details(source_name, source_version, model_type, partition_function, partition_join_key, block_number, uses_receipts_by_hash) %} - -{% if source_version != '' %} - {% set source_version = '_' ~ source_version.lower() %} -{% endif %} -{% if model_type != '' %} - {% set model_type = '_' ~ model_type %} -{% endif %} - -{%- if flags.WHICH == 'compile' and execute -%} - - {{ log("=== Current Variable Settings ===", info=True) }} - {{ log(source_name ~ model_type ~ '_PARTITION_FUNCTION: ' ~ partition_function, info=True) }} - {{ log(source_name ~ model_type ~ '_PARTITION_JOIN_KEY: ' ~ partition_join_key, info=True) }} - {{ log(source_name ~ model_type ~ '_BLOCK_NUMBER: ' ~ block_number, info=True) }} - {% if uses_receipts_by_hash %} - {{ log("USES_RECEIPTS_BY_HASH: " ~ uses_receipts_by_hash, info=True) }} - {% endif %} - - {{ log("", info=True) }} - {{ log("=== Source Details ===", info=True) }} - {{ log("Source: " ~ source('bronze_streamline', source_name.lower() ~ source_version.lower()), info=True) }} - {{ log("", info=True) }} - - {% set config_log = '\n' %} - {% set config_log = config_log ~ '\n=== DBT Model Config ===\n'%} - {% set config_log = config_log ~ '\n{{ config (\n' %} - {% set config_log = config_log ~ ' materialized = "' ~ config.get('materialized') ~ '",\n' %} - {% set config_log = config_log ~ ' tags = ' ~ config.get('tags') | tojson ~ '\n' %} - {% set config_log = config_log ~ ') }}\n' %} - {{ log(config_log, info=True) }} - {{ log("", info=True) }} - -{%- endif -%} - -{% endmacro %} \ No newline at end of file diff --git a/macros/fsc_evm_temp/main_package/logging/complete.sql b/macros/fsc_evm_temp/main_package/logging/complete.sql deleted file mode 100644 index 3637b41..0000000 --- a/macros/fsc_evm_temp/main_package/logging/complete.sql +++ /dev/null @@ -1,29 +0,0 @@ -{% macro log_complete_details(post_hook, full_refresh_type, uses_receipts_by_hash) %} - -{%- if flags.WHICH == 'compile' and execute -%} - - {% if uses_receipts_by_hash %} - - {{ log("=== Current Variable Settings ===", info=True) }} - {{ log("USES_RECEIPTS_BY_HASH: " ~ uses_receipts_by_hash, info=True) }} - - {% endif %} - - {% set config_log = '\n' %} - {% set config_log = config_log ~ '\n=== DBT Model Config ===\n'%} - {% set config_log = config_log ~ '\n{{ config (\n' %} - {% set config_log = config_log ~ ' materialized = "' ~ config.get('materialized') ~ '",\n' %} - {% set config_log = config_log ~ ' unique_key = "' ~ config.get('unique_key') ~ '",\n' %} - {% set config_log = config_log ~ ' cluster_by = "' ~ config.get('cluster_by') ~ '",\n' %} - {% set config_log = config_log ~ ' merge_update_columns = ' ~ config.get('merge_update_columns') | tojson ~ ',\n' %} - {% set config_log = config_log ~ ' post_hook = "' ~ post_hook ~ '",\n' %} - {% set config_log = config_log ~ ' incremental_predicates = ' ~ config.get('incremental_predicates') | tojson ~ ',\n' %} - {% set config_log = config_log ~ ' full_refresh = ' ~ full_refresh_type ~ ',\n' %} - {% set config_log = config_log ~ ' tags = ' ~ config.get('tags') | tojson ~ '\n' %} - {% set config_log = config_log ~ ') }}\n' %} - {{ log(config_log, info=True) }} - {{ log("", info=True) }} - -{%- endif -%} - -{% endmacro %} \ No newline at end of file diff --git a/macros/fsc_evm_temp/main_package/logging/logging.sql b/macros/fsc_evm_temp/main_package/logging/logging.sql deleted file mode 100644 index f368685..0000000 --- a/macros/fsc_evm_temp/main_package/logging/logging.sql +++ /dev/null @@ -1,36 +0,0 @@ -{% macro log_model_details(vars=false, params=false) %} - -{%- if execute -%} -/* -DBT Model Config: -{{ model.config | tojson(indent=2) }} -*/ - -{% if vars is not false %} - -{% if var('LOG_MODEL_DETAILS', false) %} -{{ log( vars | tojson(indent=2), info=True) }} -{% endif %} -/* -Variables: -{{ vars | tojson(indent=2) }} -*/ -{% endif %} - -{% if params is not false %} - -{% if var('LOG_MODEL_DETAILS', false) %} -{{ log( params | tojson(indent=2), info=True) }} -{% endif %} -/* -Parameters: -{{ params | tojson(indent=2) }} -*/ -{% endif %} - -/* -Raw Code: -{{ model.raw_code }} -*/ -{%- endif -%} -{% endmacro %} \ No newline at end of file diff --git a/macros/fsc_evm_temp/main_package/logging/requests.sql b/macros/fsc_evm_temp/main_package/logging/requests.sql deleted file mode 100644 index 85cbbda..0000000 --- a/macros/fsc_evm_temp/main_package/logging/requests.sql +++ /dev/null @@ -1,55 +0,0 @@ -{% macro log_streamline_details(model_name, model_type, node_url, model_quantum_state, sql_limit, testing_limit, order_by_clause, new_build, streamline_params, uses_receipts_by_hash, method, method_params, min_block=0) %} - -{%- if flags.WHICH == 'compile' and execute -%} - - {{ log("=== Current Variable Settings ===", info=True) }} - {{ log("START_UP_BLOCK: " ~ min_block, info=True) }} - {{ log("", info=True) }} - - {{ log("=== API Details ===", info=True) }} - - {{ log("NODE_URL: " ~ node_url, info=True) }} - {{ log("NODE_SECRET_PATH: " ~ var('GLOBAL_NODE_SECRET_PATH'), info=True) }} - {{ log("", info=True) }} - - {{ log("=== Current Variable Settings ===", info=True) }} - - {{ log((model_name ~ '_' ~ model_type ~ '_model_quantum_state').upper() ~ ': ' ~ model_quantum_state, info=True) }} - {{ log((model_name ~ '_' ~ model_type ~ '_sql_limit').upper() ~ ': ' ~ sql_limit, info=True) }} - {{ log((model_name ~ '_' ~ model_type ~ '_testing_limit').upper() ~ ': ' ~ testing_limit, info=True) }} - {{ log((model_name ~ '_' ~ model_type ~ '_order_by_clause').upper() ~ ': ' ~ order_by_clause, info=True) }} - {{ log((model_name ~ '_' ~ model_type ~ '_new_build').upper() ~ ': ' ~ new_build, info=True) }} - {{ log('USES_RECEIPTS_BY_HASH' ~ ': ' ~ uses_receipts_by_hash, info=True) }} - {{ log("", info=True) }} - - {{ log("=== RPC Details ===", info=True) }} - - {{ log(model_name ~ ": {", info=True) }} - {{ log(" method: '" ~ method ~ "',", info=True) }} - {{ log(" method_params: " ~ method_params, info=True) }} - {{ log("}", info=True) }} - {{ log("", info=True) }} - - {% set params_str = streamline_params | tojson %} - {% set params_formatted = params_str | replace('{', '{\n ') | replace('}', '\n }') | replace(', ', ',\n ') %} - - {# Clean up the method_params formatting #} - {% set params_formatted = params_formatted | replace('"method_params": "', '"method_params": "') | replace('\\n', ' ') | replace('\\u0027', "'") %} - - {% set config_log = '\n' %} - {% set config_log = config_log ~ '\n=== DBT Model Config ===\n'%} - {% set config_log = config_log ~ '\n{{ config (\n' %} - {% set config_log = config_log ~ ' materialized = "' ~ config.get('materialized') ~ '",\n' %} - {% set config_log = config_log ~ ' post_hook = fsc_utils.if_data_call_function_v2(\n' %} - {% set config_log = config_log ~ ' func = "streamline.udf_bulk_rest_api_v2",\n' %} - {% set config_log = config_log ~ ' target = "' ~ this.schema ~ '.' ~ this.identifier ~ '",\n' %} - {% set config_log = config_log ~ ' params = ' ~ params_formatted ~ '\n' %} - {% set config_log = config_log ~ ' ),\n' %} - {% set config_log = config_log ~ ' tags = ' ~ config.get('tags') | tojson ~ '\n' %} - {% set config_log = config_log ~ ') }}\n' %} - {{ log(config_log, info=True) }} - {{ log("", info=True) }} - -{%- endif -%} - -{% endmacro %} \ No newline at end of file diff --git a/macros/fsc_evm_temp/main_package/streamline/set_default_variables.sql b/macros/fsc_evm_temp/main_package/streamline/set_default_variables.sql deleted file mode 100644 index 598c3b9..0000000 --- a/macros/fsc_evm_temp/main_package/streamline/set_default_variables.sql +++ /dev/null @@ -1,47 +0,0 @@ -{% macro set_default_variables_streamline(model_name, model_type) %} - -{%- set node_url = var('GLOBAL_NODE_URL', '{Service}/{Authentication}') -%} -{%- set node_secret_path = var('GLOBAL_NODE_SECRET_PATH', '') -%} -{%- set model_quantum_state = var((model_name ~ '_' ~ model_type ~ '_quantum_state').upper(), 'streamline') -%} -{%- set testing_limit = var((model_name ~ '_' ~ model_type ~ '_testing_limit').upper(), none) -%} -{%- set new_build = var((model_name ~ '_' ~ model_type ~ '_new_build').upper(), false) -%} -{%- set default_order = 'ORDER BY partition_key DESC, block_number DESC' if model_type.lower() == 'realtime' - else 'ORDER BY partition_key ASC, block_number ASC' -%} -{%- set order_by_clause = var((model_name ~ '_' ~ model_type ~ '_order_by_clause').upper(), default_order) -%} -{%- set uses_receipts_by_hash = var('GLOBAL_USES_RECEIPTS_BY_HASH', false) -%} - -{%- set variables = { - 'node_url': node_url, - 'node_secret_path': node_secret_path, - 'model_quantum_state': model_quantum_state, - 'testing_limit': testing_limit, - 'new_build': new_build, - 'order_by_clause': order_by_clause, - 'uses_receipts_by_hash': uses_receipts_by_hash -} -%} - -{{ return(variables) }} - -{% endmacro %} - -{% macro set_default_variables_bronze(source_name, model_type) %} - -{%- set partition_function = var(source_name ~ model_type ~ '_PARTITION_FUNCTION', - "CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 4), '_', 1) AS INTEGER)") --%} -{%- set partition_join_key = var(source_name ~ model_type ~ '_PARTITION_JOIN_KEY', 'partition_key') -%} -{%- set block_number = var(source_name ~ model_type ~ '_BLOCK_NUMBER', true) -%} -{%- set balances = var(source_name ~ model_type ~ '_BALANCES', false) -%} -{%- set uses_receipts_by_hash = var('GLOBAL_USES_RECEIPTS_BY_HASH', false) -%} - -{%- set variables = { - 'partition_function': partition_function, - 'partition_join_key': partition_join_key, - 'block_number': block_number, - 'balances': balances, - 'uses_receipts_by_hash': uses_receipts_by_hash -} -%} - -{{ return(variables) }} - -{% endmacro %} \ No newline at end of file diff --git a/macros/fsc_evm_temp/main_package/streamline/set_streamline_parameters.sql b/macros/fsc_evm_temp/main_package/streamline/set_streamline_parameters.sql deleted file mode 100644 index 9c7262f..0000000 --- a/macros/fsc_evm_temp/main_package/streamline/set_streamline_parameters.sql +++ /dev/null @@ -1,57 +0,0 @@ -{% macro set_streamline_parameters(model_name, model_type, multiplier=1) %} - -{%- set rpc_config_details = { - "blocks_transactions": { - "method": 'eth_getBlockByNumber', - "method_params": 'ARRAY_CONSTRUCT(utils.udf_int_to_hex(block_number), TRUE)', - "exploded_key": ['result', 'result.transactions'] - }, - "receipts_by_hash": { - "method": 'eth_getTransactionReceipt', - "method_params": 'ARRAY_CONSTRUCT(tx_hash)' - }, - "receipts": { - "method": 'eth_getBlockReceipts', - "method_params": 'ARRAY_CONSTRUCT(utils.udf_int_to_hex(block_number))', - "exploded_key": ['result'], - "lambdas": 2 - - }, - "traces": { - "method": 'debug_traceBlockByNumber', - "method_params": "ARRAY_CONSTRUCT(utils.udf_int_to_hex(block_number), OBJECT_CONSTRUCT('tracer', 'callTracer', 'timeout', '120s'))", - "exploded_key": ['result'], - "lambdas": 2 - }, - "confirm_blocks": { - "method": 'eth_getBlockByNumber', - "method_params": 'ARRAY_CONSTRUCT(utils.udf_int_to_hex(block_number), FALSE)' - } -} -%} - -{%- set rpc_config = rpc_config_details[model_name.lower()] -%} - -{%- set params = { - "external_table": var((model_name ~ '_' ~ model_type ~ '_external_table').upper(), model_name.lower()), - "sql_limit": var((model_name ~ '_' ~ model_type ~ '_sql_limit').upper(), 2 * var('GLOBAL_BLOCKS_PER_HOUR',0) * multiplier), - "producer_batch_size": var((model_name ~ '_' ~ model_type ~ '_producer_batch_size').upper(), 2 * var('GLOBAL_BLOCKS_PER_HOUR',0) * multiplier), - "worker_batch_size": var( - (model_name ~ '_' ~ model_type ~ '_worker_batch_size').upper(), - (2 * var('GLOBAL_BLOCKS_PER_HOUR',0) * multiplier) // (rpc_config.get('lambdas', 1)) - ), - "sql_source": (model_name ~ '_' ~ model_type).lower(), - "method": rpc_config['method'], - "method_params": rpc_config['method_params'] -} -%} - -{%- if rpc_config.get('exploded_key') is not none -%} - {%- do params.update({"exploded_key": tojson(rpc_config['exploded_key'])}) -%} -{%- endif -%} - -{%- if rpc_config.get('lambdas') is not none -%} - {%- do params.update({"lambdas": rpc_config['lambdas']}) -%} -{%- endif -%} - -{{ return(params) }} - -{% endmacro %} \ No newline at end of file diff --git a/macros/streamline/api_integrations.sql b/macros/streamline/api_integrations.sql deleted file mode 100644 index e47a9cb..0000000 --- a/macros/streamline/api_integrations.sql +++ /dev/null @@ -1,21 +0,0 @@ -{% macro create_aws_gnosis_api() %} - {{ log( - "Creating integration for target:" ~ target - ) }} - - {% if target.name == "prod" %} - {% set sql %} - CREATE api integration IF NOT EXISTS aws_gnosis_api api_provider = aws_api_gateway api_aws_role_arn = 'arn:aws:iam::490041342817:role/gnosis-api-prod-rolesnowflakeudfsAF733095-1S5YHE2BPGRAE' api_allowed_prefixes = ( - 'https://abjc1ljs1d.execute-api.us-east-1.amazonaws.com/prod/' - ) enabled = TRUE; -{% endset %} - {% do run_query(sql) %} - {% elif target.name == "dev" %} - {% set sql %} - CREATE api integration IF NOT EXISTS aws_gnosis_api_dev api_provider = aws_api_gateway api_aws_role_arn = 'arn:aws:iam::490041342817:role/gnosis-api-dev-rolesnowflakeudfsAF733095-KZU75JVH7RGG' api_allowed_prefixes = ( - 'https://fp4z9mbqa3.execute-api.us-east-1.amazonaws.com/dev/' - ) enabled = TRUE; -{% endset %} - {% do run_query(sql) %} - {% endif %} -{% endmacro %} diff --git a/macros/streamline/get_base_table_udtf.sql b/macros/streamline/get_base_table_udtf.sql deleted file mode 100644 index a488d14..0000000 --- a/macros/streamline/get_base_table_udtf.sql +++ /dev/null @@ -1,24 +0,0 @@ -{% macro create_udtf_get_base_table(schema) %} -create or replace function {{ schema }}.udtf_get_base_table(max_height integer) -returns table (height number) -as -$$ - with base as ( - select - row_number() over ( - order by - seq4() - ) as id - from - table(generator(rowcount => 100000000)) - ) -select - id as height -from - base -where - id <= max_height -$$ -; - -{% endmacro %} \ No newline at end of file diff --git a/macros/streamline/streamline_udfs.sql b/macros/streamline/streamline_udfs.sql deleted file mode 100644 index 398d10c..0000000 --- a/macros/streamline/streamline_udfs.sql +++ /dev/null @@ -1,56 +0,0 @@ -{% macro create_udf_get_chainhead() %} - CREATE - OR REPLACE EXTERNAL FUNCTION streamline.udf_get_chainhead() returns variant api_integration = - {% if target.name == "prod" %} - aws_gnosis_api AS 'https://abjc1ljs1d.execute-api.us-east-1.amazonaws.com/prod/get_chainhead' - {% else %} - aws_gnosis_api_dev AS 'https://fp4z9mbqa3.execute-api.us-east-1.amazonaws.com/dev/get_chainhead' - {%- endif %}; -{% endmacro %} - -{% macro create_udf_bulk_json_rpc() %} - CREATE - OR REPLACE EXTERNAL FUNCTION streamline.udf_bulk_json_rpc( - json variant - ) returns text api_integration = {% if target.name == "prod" %} - aws_gnosis_api AS 'https://abjc1ljs1d.execute-api.us-east-1.amazonaws.com/prod/udf_bulk_json_rpc' - {% else %} - aws_gnosis_api_dev AS 'https://fp4z9mbqa3.execute-api.us-east-1.amazonaws.com/dev/udf_bulk_json_rpc' - {%- endif %}; -{% endmacro %} - -{% macro create_udf_decode_array_string() %} - CREATE - OR REPLACE EXTERNAL FUNCTION streamline.udf_decode( - abi ARRAY, - DATA STRING - ) returns ARRAY api_integration = {% if target.name == "prod" %} - aws_gnosis_api AS 'https://abjc1ljs1d.execute-api.us-east-1.amazonaws.com/prod/decode_function' - {% else %} - aws_gnosis_api_dev AS 'https://fp4z9mbqa3.execute-api.us-east-1.amazonaws.com/dev/decode_function' - {%- endif %}; -{% endmacro %} - -{% macro create_udf_decode_array_object() %} - CREATE - OR REPLACE EXTERNAL FUNCTION streamline.udf_decode( - abi ARRAY, - DATA OBJECT - ) returns ARRAY api_integration = {% if target.name == "prod" %} - aws_gnosis_api AS 'https://abjc1ljs1d.execute-api.us-east-1.amazonaws.com/prod/decode_log' - {% else %} - aws_gnosis_api_dev AS 'https://fp4z9mbqa3.execute-api.us-east-1.amazonaws.com/dev/decode_log' - {%- endif %}; -{% endmacro %} - - -{% macro create_udf_bulk_decode_logs() %} - CREATE - OR REPLACE EXTERNAL FUNCTION streamline.udf_bulk_decode_logs( - json OBJECT - ) returns ARRAY api_integration = {% if target.name == "prod" %} - aws_gnosis_api AS 'https://abjc1ljs1d.execute-api.us-east-1.amazonaws.com/prod/bulk_decode_logs' - {% else %} - aws_gnosis_api_dev AS'https://fp4z9mbqa3.execute-api.us-east-1.amazonaws.com/dev/bulk_decode_logs' - {%- endif %}; -{% endmacro %} diff --git a/macros/tests/missing_decoding.sql b/macros/tests/missing_decoding.sql deleted file mode 100644 index 4e6e845..0000000 --- a/macros/tests/missing_decoding.sql +++ /dev/null @@ -1,25 +0,0 @@ -{% test missing_decoded_logs(model) %} -SELECT - l.block_number, - CONCAT( - l.tx_hash, - '-', - l.event_index - ) AS _log_id -FROM - {{ ref('core__fact_event_logs') }} - l - LEFT JOIN {{ model }} - d - ON l.block_number = d.block_number - AND CONCAT( - l.tx_hash, - '-', - l.event_index - ) = d._log_id -WHERE - l.contract_address = LOWER('0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d') -- WXDAI - AND l.topics [0] :: STRING = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' -- Transfer - AND l.block_timestamp BETWEEN DATEADD('hour', -48, SYSDATE()) - AND DATEADD('hour', -6, SYSDATE()) - AND d._log_id IS NULL {% endtest %} diff --git a/macros/tests/missing_txs.sql b/macros/tests/missing_txs.sql deleted file mode 100644 index 6395b9b..0000000 --- a/macros/tests/missing_txs.sql +++ /dev/null @@ -1,117 +0,0 @@ -{% 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, - threshold - ) %} - 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 }} - ), - FINAL AS ( - 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 - ) -SELECT - * -FROM - FINAL -WHERE - ( - SELECT - COUNT(*) >= {{ threshold }} - FROM - FINAL - ) -{% 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 deleted file mode 100644 index 0b800b8..0000000 --- a/macros/utils.sql +++ /dev/null @@ -1,78 +0,0 @@ -{% 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/doc_descriptions/general/__overview__.md b/models/__overview__.md similarity index 80% rename from models/doc_descriptions/general/__overview__.md rename to models/__overview__.md index ebdef98..4917a97 100644 --- a/models/doc_descriptions/general/__overview__.md +++ b/models/__overview__.md @@ -16,28 +16,33 @@ There is more information on how to use dbt docs in the last section of this doc **Click on the links below to jump to the documentation for each schema.** -### Core Tables (gnosis.core) +### Core Tables -**Dimension Tables:** -- [dim_labels](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.core__dim_labels) -- [dim_contracts](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.core__dim_contracts) +**Dimensional Tables** +- [dim_contracts](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.core__dim_contracts) +- [dim_contract_abis](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.core__dim_contract_abis) +- [dim_labels](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.core__dim_labels) **Fact Tables:** -- [fact_blocks](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.core__fact_blocks) -- [fact_event_logs](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.core__fact_event_logs) -- [fact_decoded_event_logs](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.core__fact_decoded_event_logs) -- [fact_token_transfers](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.core__fact_token_transfers) -- [fact_traces](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.core__fact_traces) -- [fact_transactions](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.core__fact_transactions) +- [fact_blocks](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.core__fact_blocks) +- [fact_transactions](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.core__fact_transactions) +- [fact_event_logs](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.core__fact_event_logs) +- [fact_traces](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.core__fact_traces) **Convenience Tables:** -- [ez_native_transfers](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.core__ez_native_transfers) -- [ez_token_transfers](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.core__ez_token_transfers) -- [ez_decoded_event_logs](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.core__ez_decoded_event_logs) +- [ez_decoded_event_logs](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.core__ez_decoded_event_logs) +- [ez_native_transfers](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.core__ez_native_transfers) +- [ez_token_transfers](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.core__ez_token_transfers) + +### Price Tables (gnosis.price) +- [dim_asset_metadata](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.price__dim_asset_metadata) +- [fact_prices_ohlc_hourly](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.price__fact_prices_ohlc_hourly) +- [ez_asset_metadata](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.price__ez_asset_metadata) +- [ez_prices_hourly](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.price__ez_prices_hourly) ### DeFi Tables (gnosis.defi) -- [ez_dex_swaps](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.defi__ez_dex_swaps) - [ez_bridge_activity](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.defi__ez_bridge_activity) +- [ez_dex_swaps](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.defi__ez_dex_swaps) - [dim_dex_liquidity_pools](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.defi__dim_dex_liquidity_pools) - [ez_lending_borrows](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.defi__ez_lending_borrows) - [ez_lending_deposits](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.defi__ez_lending_deposits) @@ -46,17 +51,13 @@ There is more information on how to use dbt docs in the last section of this doc - [ez_lending_repayments](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.defi__ez_lending_repayments) - [ez_lending_withdraws](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.defi__ez_lending_withdraws) -### Price Tables (gnosis.price) -- [dim_asset_metadata](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.price__dim_asset_metadata) -- [fact_prices_ohlc_hourly](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.price__fact_prices_ohlc_hourly) -- [ez_asset_metadata](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.price__ez_asset_metadata) -- [ez_prices_hourly](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.price__ez_prices_hourly) +### Flipside Partner Tables (gnosis.partner_name) ### NFT Tables (gnosis.nft) -- [ez_nft_transfers](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.nft__ez_nft_transfers) +- [ez_nft_transfers](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.nft__ez_nft_transfers) ### Stats Tables (gnosis.stats) -- [ez_core_metrics_hourly](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.gnosis_models.stats__ez_core_metrics_hourly) +- [ez_core_metrics_hourly](https://flipsidecrypto.github.io/gnosis-models/#!/model/model.fsc_evm.stats__ez_core_metrics_hourly) ## **Helpful User-Defined Functions (UDFs)** @@ -76,6 +77,8 @@ The dimension tables are sourced from a variety of on-chain and off-chain source 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. +NOTE: Gnosis is currently operating in it's Testnet phase. Flipside will provide Mainnet data tables once Gnosis Mainnet is deployed. + ## **Using dbt docs** ### Navigation @@ -83,7 +86,7 @@ You can use the ```Project``` and ```Database``` navigation tabs on the left sid ### 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. +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 datagnosis. ### Graph Exploration @@ -97,10 +100,11 @@ Note that you can also right-click on models to interactively filter and explore ### **More information** -- [Flipside](https://flipsidecrypto.xyz) +- [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/gnosis-models) -- [Query Editor Shortcuts](https://docs.flipsidecrypto.com/velocity/query-editor-shortcuts) - [What is dbt?](https://docs.getdbt.com/docs/introduction) -{% enddocs %} + +{% enddocs %} \ No newline at end of file diff --git a/models/bronze/api_udf/_retry_abis.sql b/models/bronze/api_udf/_retry_abis.sql deleted file mode 100644 index b67af1c..0000000 --- a/models/bronze/api_udf/_retry_abis.sql +++ /dev/null @@ -1,87 +0,0 @@ -{{ config ( - materialized = "ephemeral" -) }} - -WITH retry AS ( - - SELECT - contract_address, - GREATEST( - latest_call_block, - latest_event_block - ) AS block_number, - total_interaction_count - FROM - {{ ref("silver__relevant_contracts") }} - r - LEFT JOIN {{ source( - 'gnosis_silver', - 'verified_abis' - ) }} - v USING (contract_address) - WHERE - r.total_interaction_count >= 250 -- high interaction count - AND GREATEST( - max_inserted_timestamp_logs, - max_inserted_timestamp_traces - ) >= CURRENT_DATE - INTERVAL '30 days' -- recent activity - AND v.contract_address IS NULL -- no verified abi - AND r.contract_address NOT IN ( - SELECT - contract_address - FROM - {{ source( - 'gnosis_bronze_api', - 'contract_abis' - ) }} - WHERE - _inserted_timestamp >= CURRENT_DATE - INTERVAL '30 days' -- this won't let us retry the same contract within 30 days - AND abi_data :data :result :: STRING <> 'Max rate limit reached' - ) - ORDER BY - total_interaction_count DESC - LIMIT - 25 -), FINAL AS ( - SELECT - proxy_address AS contract_address, - start_block AS block_number - FROM - {{ ref("silver__proxies") }} - p - JOIN retry r USING (contract_address) - LEFT JOIN {{ source( - 'gnosis_silver', - 'verified_abis' - ) }} - v - ON v.contract_address = p.proxy_address - WHERE - v.contract_address IS NULL - AND p.contract_address NOT IN ( - SELECT - contract_address - FROM - {{ source( - 'gnosis_bronze_api', - 'contract_abis' - ) }} - WHERE - _inserted_timestamp >= CURRENT_DATE - INTERVAL '30 days' -- this won't let us retry the same contract within 30 days - AND abi_data :data :result :: STRING <> 'Max rate limit reached' - ) - UNION ALL - SELECT - contract_address, - block_number - FROM - retry -) -SELECT - * -FROM - FINAL qualify ROW_NUMBER() over ( - PARTITION BY contract_address - ORDER BY - block_number DESC - ) = 1 diff --git a/models/bronze/api_udf/bronze_api__contract_abis.sql b/models/bronze/api_udf/bronze_api__contract_abis.sql deleted file mode 100644 index baae164..0000000 --- a/models/bronze/api_udf/bronze_api__contract_abis.sql +++ /dev/null @@ -1,68 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = "contract_address", - full_refresh = false, - tags = ['non_realtime'] -) }} - -WITH base AS ( - - SELECT - contract_address - FROM - {{ ref('silver__relevant_contracts') }} - WHERE - total_interaction_count >= 100 - -{% if is_incremental() %} -and contract_address not in ( -SELECT - contract_address -FROM - {{ this }} - WHERE - abi_data :data :result :: STRING <> 'Max rate limit reached' -) -{% endif %} -order by total_interaction_count desc -LIMIT - 400 -), all_contracts AS ( - SELECT - contract_address - FROM - base - UNION - SELECT - contract_address - FROM - {{ ref('_retry_abis') }} -), -row_nos AS ( - SELECT - contract_address, - ROW_NUMBER() over ( - ORDER BY - contract_address - ) AS row_no - FROM - all_contracts -), -batched AS ({% for item in range(501) %} -SELECT - rn.contract_address, live.udf_api('GET', CONCAT('https://api.gnosisscan.io/api?module=contract&action=getabi&address=', contract_address, '&apikey={key}'),{ 'User-Agent': 'FlipsideStreamline' },{}, 'Vault/prod/block_explorers/gnosis_scan') AS abi_data, SYSDATE() AS _inserted_timestamp -FROM - row_nos rn -WHERE - row_no = {{ item }} - - {% if not loop.last %} - UNION ALL - {% endif %} -{% endfor %}) -SELECT - contract_address, - abi_data, - _inserted_timestamp -FROM - batched diff --git a/models/bronze/api_udf/bronze_api__contract_abis.yml b/models/bronze/api_udf/bronze_api__contract_abis.yml deleted file mode 100644 index 9216204..0000000 --- a/models/bronze/api_udf/bronze_api__contract_abis.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: 2 -models: - - name: bronze_api__contract_abis - - columns: - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ - - name: CONTRACT_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - VARCHAR - - dbt_expectations.expect_column_values_to_match_regex: - regex: "^(0x)[0-9a-fA-F]{40}$" \ No newline at end of file diff --git a/models/bronze/api_udf/bronze_api__token_reads.sql b/models/bronze/api_udf/bronze_api__token_reads.sql deleted file mode 100644 index 667a8df..0000000 --- a/models/bronze/api_udf/bronze_api__token_reads.sql +++ /dev/null @@ -1,130 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = "contract_address", - full_refresh = false, - tags = ['non_realtime'] -) }} - -WITH base AS ( - - SELECT - contract_address, - latest_event_block AS latest_block - FROM - {{ ref('silver__relevant_contracts') }} - WHERE - total_event_count >= 25 - -{% if is_incremental() %} -AND contract_address NOT IN ( - SELECT - contract_address - FROM - {{ this }} -) -{% endif %} -ORDER BY - total_event_count DESC -LIMIT - 500 -), function_sigs AS ( - SELECT - '0x313ce567' AS function_sig, - 'decimals' AS function_name - UNION - SELECT - '0x06fdde03', - 'name' - UNION - SELECT - '0x95d89b41', - 'symbol' -), -all_reads AS ( - SELECT - * - FROM - base - JOIN function_sigs - ON 1 = 1 -), -ready_reads AS ( - SELECT - contract_address, - latest_block, - function_sig, - RPAD( - function_sig, - 64, - '0' - ) AS input, - utils.udf_json_rpc_call( - 'eth_call', - [{'to': contract_address, 'from': null, 'data': input}, utils.udf_int_to_hex(latest_block)], - concat_ws( - '-', - contract_address, - input, - latest_block - ) - ) AS rpc_request - FROM - all_reads -), -batch_reads AS ( - SELECT - ARRAY_AGG(rpc_request) AS batch_rpc_request - FROM - ready_reads -), -node_call AS ( - SELECT - *, - live.udf_api( - 'POST', - CONCAT( - '{service}', - '/', - '{Authentication}' - ),{}, - batch_rpc_request, - 'Vault/prod/gnosis/quicknode/mainnet' - ) AS response - FROM - batch_reads - WHERE - EXISTS ( - SELECT - 1 - FROM - ready_reads - LIMIT - 1 - ) -), flat_responses AS ( - SELECT - VALUE :id :: STRING AS call_id, - VALUE :result :: STRING AS read_result - FROM - node_call, - LATERAL FLATTEN ( - input => response :data - ) -) -SELECT - SPLIT_PART( - call_id, - '-', - 1 - ) AS contract_address, - SPLIT_PART( - call_id, - '-', - 3 - ) AS block_number, - LEFT(SPLIT_PART(call_id, '-', 2), 10) AS function_sig, - NULL AS function_input, - read_result, - SYSDATE() :: TIMESTAMP AS _inserted_timestamp -FROM - flat_responses diff --git a/models/bronze/api_udf/bronze_api__token_reads.yml b/models/bronze/api_udf/bronze_api__token_reads.yml deleted file mode 100644 index 49a7446..0000000 --- a/models/bronze/api_udf/bronze_api__token_reads.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: 2 -models: - - name: bronze_api__token_reads - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - CONTRACT_ADDRESS - - FUNCTION_SIG - columns: - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ \ No newline at end of file diff --git a/models/bronze/labels/bronze__labels.sql b/models/bronze/labels/bronze__labels.sql deleted file mode 100644 index cc847df..0000000 --- a/models/bronze/labels/bronze__labels.sql +++ /dev/null @@ -1,25 +0,0 @@ -{{ 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( - 'crosschain_silver', - 'labels_combined' - ) }} -WHERE - blockchain = 'gnosis' - AND address LIKE '0x%' diff --git a/models/bronze/prices/bronze__complete_native_asset_metadata.sql b/models/bronze/prices/bronze__complete_native_asset_metadata.sql deleted file mode 100644 index 7a92620..0000000 --- a/models/bronze/prices/bronze__complete_native_asset_metadata.sql +++ /dev/null @@ -1,29 +0,0 @@ -{{ config ( - materialized = 'view' -) }} - -SELECT - asset_id, - symbol, - NAME, - decimals, - blockchain, - is_deprecated, - provider, - source, - _inserted_timestamp, - inserted_timestamp, - modified_timestamp, - complete_native_asset_metadata_id, - _invocation_id -FROM - {{ source( - 'crosschain_silver', - 'complete_native_asset_metadata' - ) }} -WHERE - blockchain = 'gnosis' - AND symbol IN ( - 'GNO', - 'XDAI' - ) diff --git a/models/bronze/prices/bronze__complete_native_prices.sql b/models/bronze/prices/bronze__complete_native_prices.sql deleted file mode 100644 index 1ae8042..0000000 --- a/models/bronze/prices/bronze__complete_native_prices.sql +++ /dev/null @@ -1,32 +0,0 @@ -{{ config ( - materialized = 'view' -) }} - -SELECT - HOUR, - asset_id, - symbol, - NAME, - decimals, - price, - blockchain, - is_imputed, - is_deprecated, - provider, - source, - _inserted_timestamp, - inserted_timestamp, - modified_timestamp, - complete_native_prices_id, - _invocation_id -FROM - {{ source( - 'crosschain_silver', - 'complete_native_prices' - ) }} -WHERE - blockchain = 'gnosis' - AND symbol IN ( - 'GNO', - 'XDAI' - ) diff --git a/models/bronze/prices/bronze__complete_provider_asset_metadata.sql b/models/bronze/prices/bronze__complete_provider_asset_metadata.sql deleted file mode 100644 index a65ad0e..0000000 --- a/models/bronze/prices/bronze__complete_provider_asset_metadata.sql +++ /dev/null @@ -1,28 +0,0 @@ -{{ config ( - materialized = 'view' -) }} - -SELECT - asset_id, - token_address, - NAME, - symbol, - platform, - platform_id, - provider, - source, - _inserted_timestamp, - inserted_timestamp, - modified_timestamp, - complete_provider_asset_metadata_id, - _invocation_id -FROM - {{ source( - 'crosschain_silver', - 'complete_provider_asset_metadata' - ) }} -WHERE - platform IN ( - 'Gnosis', - 'Gnosis Chain' - ) -- platforms specific to Gnosis diff --git a/models/bronze/prices/bronze__complete_provider_prices.sql b/models/bronze/prices/bronze__complete_provider_prices.sql deleted file mode 100644 index 28ed566..0000000 --- a/models/bronze/prices/bronze__complete_provider_prices.sql +++ /dev/null @@ -1,24 +0,0 @@ -{{ config ( - materialized = 'view' -) }} - -SELECT - asset_id, - recorded_hour, - OPEN, - high, - low, - CLOSE, - provider, - source, - _inserted_timestamp, - inserted_timestamp, - modified_timestamp, - complete_provider_prices_id, - _invocation_id -FROM - {{ source( - 'crosschain_silver', - 'complete_provider_prices' - ) }} --- prices for all ids \ No newline at end of file diff --git a/models/bronze/prices/bronze__complete_token_asset_metadata.sql b/models/bronze/prices/bronze__complete_token_asset_metadata.sql deleted file mode 100644 index 9c4f487..0000000 --- a/models/bronze/prices/bronze__complete_token_asset_metadata.sql +++ /dev/null @@ -1,28 +0,0 @@ -{{ config ( - materialized = 'view' -) }} - -SELECT - token_address, - asset_id, - symbol, - NAME, - decimals, - blockchain, - blockchain_name, - blockchain_id, - is_deprecated, - provider, - source, - _inserted_timestamp, - inserted_timestamp, - modified_timestamp, - complete_token_asset_metadata_id, - _invocation_id -FROM - {{ source( - 'crosschain_silver', - 'complete_token_asset_metadata' - ) }} -WHERE - blockchain = 'gnosis' \ No newline at end of file diff --git a/models/bronze/prices/bronze__complete_token_prices.sql b/models/bronze/prices/bronze__complete_token_prices.sql deleted file mode 100644 index a3a8e72..0000000 --- a/models/bronze/prices/bronze__complete_token_prices.sql +++ /dev/null @@ -1,31 +0,0 @@ -{{ config ( - materialized = 'view' -) }} - -SELECT - HOUR, - token_address, - asset_id, - symbol, - NAME, - decimals, - price, - blockchain, - blockchain_name, - blockchain_id, - is_imputed, - is_deprecated, - provider, - source, - _inserted_timestamp, - inserted_timestamp, - modified_timestamp, - complete_token_prices_id, - _invocation_id -FROM - {{ source( - 'crosschain_silver', - 'complete_token_prices' - ) }} -WHERE - blockchain = 'gnosis' diff --git a/models/doc_descriptions/Borrowing/Borrow_symbol.md b/models/doc_descriptions/Borrowing/Borrow_symbol.md deleted file mode 100644 index f3b404c..0000000 --- a/models/doc_descriptions/Borrowing/Borrow_symbol.md +++ /dev/null @@ -1,4 +0,0 @@ -{% docs borrow_symbol %} - -The symbol of the asset/collateral that is paid or received, depending on the action -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Borrowing/action.md b/models/doc_descriptions/Borrowing/action.md deleted file mode 100644 index d9b1b40..0000000 --- a/models/doc_descriptions/Borrowing/action.md +++ /dev/null @@ -1,9 +0,0 @@ -{% docs borrow_action %} - -The action that the user is taking. - Borrow: user is borrowing an asset - Repay: user is repaying the asset that they have borrowed in a previous loan - Add collateral: user is depositing collateral for their loan. This happens some times in the same transaction as the borrowing transaction and some times in a separate transaction. - Remove collateral: user is withdrawing collateral. This happens some times in the same transaction as the borrowing transaction and some times in a separate transaction. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Borrowing/amount.md b/models/doc_descriptions/Borrowing/amount.md deleted file mode 100644 index 16b2cbe..0000000 --- a/models/doc_descriptions/Borrowing/amount.md +++ /dev/null @@ -1,9 +0,0 @@ -{% docs borrow_amount %} - -The meaning depends on the action: -Borrow: The amount of the asset that the user is borrowing or -Repay: The amount of the asset that the user is repaying -Add collateral: The amount of collateral that the user is depositing -Remove collateral: The amount of collateral that the user is withdrawing - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Borrowing/amount_usd.md b/models/doc_descriptions/Borrowing/amount_usd.md deleted file mode 100644 index feac2c9..0000000 --- a/models/doc_descriptions/Borrowing/amount_usd.md +++ /dev/null @@ -1,8 +0,0 @@ -{% docs borrow_amount_usd %} - -The meaning depends on the action: -Borrow: The amount of the asset in USD that the user is borrowing or -Repay: The amount of the asset in USD that the user is repaying -Add collateral: The amount of collateral in USD that the user is depositing -Remove collateral: The amount of collateral in USD that the user is withdrawing -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Borrowing/asset.md b/models/doc_descriptions/Borrowing/asset.md deleted file mode 100644 index 236f8b1..0000000 --- a/models/doc_descriptions/Borrowing/asset.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs borrow_asset %} - -The address of the asset/collateral token that is being borrowed/repayed/deposited etc. depending on the action - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Borrowing/collateral_address.md b/models/doc_descriptions/Borrowing/collateral_address.md deleted file mode 100644 index f582e43..0000000 --- a/models/doc_descriptions/Borrowing/collateral_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs collateral_address %} - -The address of the asset that is used for collateral when borrowing funds. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Borrowing/collateral_symbol.md b/models/doc_descriptions/Borrowing/collateral_symbol.md deleted file mode 100644 index 745bb56..0000000 --- a/models/doc_descriptions/Borrowing/collateral_symbol.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs collateral_symbol %} - -The symbol of the asset that is used for collateral when borrowing funds. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Lending/Depositor.md b/models/doc_descriptions/Lending/Depositor.md deleted file mode 100644 index 4de0533..0000000 --- a/models/doc_descriptions/Lending/Depositor.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs lending_depositor %} - -Its the address of the user who is depositing for lending or withdrawing, depending on the action. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Lending/Lending_asset_address.md b/models/doc_descriptions/Lending/Lending_asset_address.md deleted file mode 100644 index 02a020f..0000000 --- a/models/doc_descriptions/Lending/Lending_asset_address.md +++ /dev/null @@ -1,4 +0,0 @@ -{% docs lending_asset_address %} - -The address of the asset in the token pair. This asset is either deposited or withdrawn for lending purposes. -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Lending/Lending_pool_address.md b/models/doc_descriptions/Lending/Lending_pool_address.md deleted file mode 100644 index ad26555..0000000 --- a/models/doc_descriptions/Lending/Lending_pool_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs lending_pool_address %} - -The address of the lending pool. For sushi this will be the address of the kashi pair. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Lending/Lending_symbol.md b/models/doc_descriptions/Lending/Lending_symbol.md deleted file mode 100644 index e0ad325..0000000 --- a/models/doc_descriptions/Lending/Lending_symbol.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs lending_symbol %} - -The symbol of the asset that is lent or withdrawn, depending on the action - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Lending/action.md b/models/doc_descriptions/Lending/action.md deleted file mode 100644 index e4751e8..0000000 --- a/models/doc_descriptions/Lending/action.md +++ /dev/null @@ -1,7 +0,0 @@ -{% docs lending_action %} - -The action that the user is taking. - Deposit: user is depositing funds to be used for lending - Withdraw: user has changed their mind and are no longer willing to lend, so they withdraw their asset - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Lending/amount.md b/models/doc_descriptions/Lending/amount.md deleted file mode 100644 index 04e910c..0000000 --- a/models/doc_descriptions/Lending/amount.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs lending_amount %} - -The amount of the asset that the user is depositing or withdrawing, depending on the action. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Lending/amount_usd.md b/models/doc_descriptions/Lending/amount_usd.md deleted file mode 100644 index ba05220..0000000 --- a/models/doc_descriptions/Lending/amount_usd.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs lending_amount_usd %} - -The amount of the asset that the user is depositing or withdrawing, depending on the action. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Lending/asset.md b/models/doc_descriptions/Lending/asset.md deleted file mode 100644 index 05dc210..0000000 --- a/models/doc_descriptions/Lending/asset.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs lending_asset %} - -The address of the asset (token) that is being deposited/withdrawn, depending on the action - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Lending/borrower_is_a_contract.md b/models/doc_descriptions/Lending/borrower_is_a_contract.md deleted file mode 100644 index 998338f..0000000 --- a/models/doc_descriptions/Lending/borrower_is_a_contract.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs lending_borrower_is_a_contract %} - -If the depositor of collateral is a contract then its a Yes, if the depositor of collateral is a normal address it is a No. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Lending/lender_is_a_contract.md b/models/doc_descriptions/Lending/lender_is_a_contract.md deleted file mode 100644 index f4c063e..0000000 --- a/models/doc_descriptions/Lending/lender_is_a_contract.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs lending_lender_is_a_contract %} - -If the depositor is a contract then its a Yes, if the depositor is a normal address it is a No. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Lending/lending_pool.md b/models/doc_descriptions/Lending/lending_pool.md deleted file mode 100644 index 9a39ba3..0000000 --- a/models/doc_descriptions/Lending/lending_pool.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs lending_lending_pool %} - -The name of the lending pool. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Lending/origin_from_address.md b/models/doc_descriptions/Lending/origin_from_address.md deleted file mode 100644 index 83d1741..0000000 --- a/models/doc_descriptions/Lending/origin_from_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs lending_origin_from_address %} - -The address of the user who initiates the transaction. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/Lending/origin_to_address.md b/models/doc_descriptions/Lending/origin_to_address.md deleted file mode 100644 index c46b186..0000000 --- a/models/doc_descriptions/Lending/origin_to_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs lending_origin_to_address %} - -The person who initiates the depositing transaction has to interact with this address. This address belongs to the lending platform or directs the transaction there. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/gno_block_header_json.md b/models/doc_descriptions/blocks/gno_block_header_json.md deleted file mode 100644 index 7e0c3b2..0000000 --- a/models/doc_descriptions/blocks/gno_block_header_json.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_blockchain.md b/models/doc_descriptions/blocks/gno_blockchain.md deleted file mode 100644 index 1fd44a8..0000000 --- a/models/doc_descriptions/blocks/gno_blockchain.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_blockchain %} - -The blockchain on which transactions are being confirmed. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/gno_blocks_hash.md b/models/doc_descriptions/blocks/gno_blocks_hash.md deleted file mode 100644 index 111173d..0000000 --- a/models/doc_descriptions/blocks/gno_blocks_hash.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_blocks_nonce.md b/models/doc_descriptions/blocks/gno_blocks_nonce.md deleted file mode 100644 index 6af4db1..0000000 --- a/models/doc_descriptions/blocks/gno_blocks_nonce.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_blocks_table_doc.md b/models/doc_descriptions/blocks/gno_blocks_table_doc.md deleted file mode 100644 index d5d0821..0000000 --- a/models/doc_descriptions/blocks/gno_blocks_table_doc.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_blocks_table_doc %} - -This table contains block level data for the Gnosis 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/gno_difficulty.md b/models/doc_descriptions/blocks/gno_difficulty.md deleted file mode 100644 index 242a867..0000000 --- a/models/doc_descriptions/blocks/gno_difficulty.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_difficulty %} - -The effort required to mine the block. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/gno_extra_data.md b/models/doc_descriptions/blocks/gno_extra_data.md deleted file mode 100644 index dc9d115..0000000 --- a/models/doc_descriptions/blocks/gno_extra_data.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_gas_limit.md b/models/doc_descriptions/blocks/gno_gas_limit.md deleted file mode 100644 index 823b43c..0000000 --- a/models/doc_descriptions/blocks/gno_gas_limit.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_gas_used.md b/models/doc_descriptions/blocks/gno_gas_used.md deleted file mode 100644 index 010d27e..0000000 --- a/models/doc_descriptions/blocks/gno_gas_used.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_gas_used %} - -Total gas used in the block. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/gno_miner.md b/models/doc_descriptions/blocks/gno_miner.md deleted file mode 100644 index 2d54130..0000000 --- a/models/doc_descriptions/blocks/gno_miner.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_network.md b/models/doc_descriptions/blocks/gno_network.md deleted file mode 100644 index 6688afd..0000000 --- a/models/doc_descriptions/blocks/gno_network.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_network %} - -The network on the blockchain used by a transaction. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/gno_parent_hash.md b/models/doc_descriptions/blocks/gno_parent_hash.md deleted file mode 100644 index bc24cb2..0000000 --- a/models/doc_descriptions/blocks/gno_parent_hash.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_receipts_root.md b/models/doc_descriptions/blocks/gno_receipts_root.md deleted file mode 100644 index 78f5282..0000000 --- a/models/doc_descriptions/blocks/gno_receipts_root.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_receipts_root %} - -The root of the state trie. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/gno_sha3_uncles.md b/models/doc_descriptions/blocks/gno_sha3_uncles.md deleted file mode 100644 index 9068db6..0000000 --- a/models/doc_descriptions/blocks/gno_sha3_uncles.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_size.md b/models/doc_descriptions/blocks/gno_size.md deleted file mode 100644 index 0ce04eb..0000000 --- a/models/doc_descriptions/blocks/gno_size.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_total_difficulty.md b/models/doc_descriptions/blocks/gno_total_difficulty.md deleted file mode 100644 index 67e403c..0000000 --- a/models/doc_descriptions/blocks/gno_total_difficulty.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_tx_count.md b/models/doc_descriptions/blocks/gno_tx_count.md deleted file mode 100644 index 71c51d5..0000000 --- a/models/doc_descriptions/blocks/gno_tx_count.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_tx_count %} - -Total number of transactions within a block. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/blocks/gno_uncle_blocks.md b/models/doc_descriptions/blocks/gno_uncle_blocks.md deleted file mode 100644 index fedc82b..0000000 --- a/models/doc_descriptions/blocks/gno_uncle_blocks.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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 deleted file mode 100644 index 3107dfc..0000000 --- a/models/doc_descriptions/bridge/evm_bridge_activity.md +++ /dev/null @@ -1,83 +0,0 @@ -{% 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: CELER, HOP, MESON 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 deleted file mode 100644 index 47abca4..0000000 --- a/models/doc_descriptions/complete_lending/complete_lending_column_docs.md +++ /dev/null @@ -1,381 +0,0 @@ -{% 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 deleted file mode 100644 index c24bf4d..0000000 --- a/models/doc_descriptions/complete_lending/complete_lending_table_docs.md +++ /dev/null @@ -1,36 +0,0 @@ -{% docs complete_lending_borrows_table_doc %} - -This table contains transactions where users borrowed assets across AAVE, REALT, SPARK, and AGAVE 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, REALT, SPARK, and AGAVE 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, SPARK, and AGAVE 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, REALT, SPARK, and AGAVE 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, REALT, SPARK, and AGAVE 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, REALT, SPARK, and AGAVE 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 deleted file mode 100644 index 96d5c47..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_creation_block.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 31935bf..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_creation_time.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index fec40c0..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_creation_tx.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index db5ad7d..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_factory_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index faf0f7b..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_decimals.md +++ /dev/null @@ -1,15 +0,0 @@ -{% 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 gnosis.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 deleted file mode 100644 index a987b3f..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_symbols.md +++ /dev/null @@ -1,15 +0,0 @@ -{% 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 gnosis.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 deleted file mode 100644 index 37e5d7d..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_table_doc.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs eth_dex_lp_table_doc %} - -This table contains details on decentralized exchange (DEX) liquidity pools (LP) on the Gnosis blockchain, including the tokens, symbols and decimals within each pool alongside the following protocols: CURVE, BALANCER, SUSHI, HONEYSWAP, and SWAPR. - -{% 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 deleted file mode 100644 index e316c5e..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_lp_tokens.md +++ /dev/null @@ -1,15 +0,0 @@ -{% 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 gnosis.defi.dim_dex_liquidity_pools -WHERE token0 = '0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1' -; - -{% 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 deleted file mode 100644 index f641107..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_platform.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 1d4192d..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_pool_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 2fc289a..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_pool_name.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 8b1cf24..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_in.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 0f82b78..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_in_unadj.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index bfa46fd..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_in_usd.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs eth_dex_swaps_amount_in_usd %} - -The value of the swapped tokens in USD at the time of the transaction, where available. If there is a variance of 75% or greater in USD swap values or one side of the swap's USD value is NULL, then both amount_in_usd and amount_out_usd will be set to NULL. This avoids falsely overstating USD swap volumes for low-liquidity token pairings or incorrectly reported prices. To get USD values in these scenarios anyway, please re-join the `price.ez_prices_hourly` table. Note, this logic does not apply for the chain's Native asset. - -{% 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 deleted file mode 100644 index 34aab5e..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_out.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 0b22557..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_out_unadj.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 3b52837..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_amount_out_usd.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs eth_dex_swaps_amount_out_usd %} - -The value of the swapped tokens in USD at the time of the transaction, where available. If there is a variance of 75% or greater in USD swap values or one side of the swap's USD value is NULL, then both amount_in_usd and amount_out_usd will be set to NULL. This avoids falsely overstating USD swap volumes for low-liquidity token pairings or incorrectly reported prices. To get USD values in these scenarios anyway, please re-join the `price.ez_prices_hourly` table. Note, this logic does not apply for the chain's Native asset. - -{% 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 deleted file mode 100644 index b7e9d57..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_sender.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 0f931bc..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_symbol_in.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index d440b24..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_symbol_out.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index a55bca2..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_token_In.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 4695dc9..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_token_out.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 89e354c..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_swaps_tx_to.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 76758f8..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_token0.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 40ec8c4..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_token1.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 11dd78f..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_dex_tokens.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 4dd1fbc..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/eth_ez_dex_swaps_table_doc.md +++ /dev/null @@ -1,6 +0,0 @@ -{% docs eth_ez_dex_swaps_table_doc %} - -This table currently contains swap events from the ```fact_event_logs``` table for CURVE, BALANCER, SUSHI, HONEYSWAP, and SWAPR 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/dex - (imported from layer 1)/gno_sushi__ez_swaps.md b/models/doc_descriptions/dex - (imported from layer 1)/gno_sushi__ez_swaps.md deleted file mode 100644 index 74ad067..0000000 --- a/models/doc_descriptions/dex - (imported from layer 1)/gno_sushi__ez_swaps.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_sushi__ez_swaps %} - -This table currently contains swap events from the ```logs``` table for SushiSwap on gnosis chain, along with other helpful columns including an amount USD where possible. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/gno_event_index.md b/models/doc_descriptions/event_logs/gno_event_index.md deleted file mode 100644 index 2d1c09d..0000000 --- a/models/doc_descriptions/event_logs/gno_event_index.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_event_index %} - -Event number within a transaction. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/gno_event_inputs.md b/models/doc_descriptions/event_logs/gno_event_inputs.md deleted file mode 100644 index 1ea4ad7..0000000 --- a/models/doc_descriptions/event_logs/gno_event_inputs.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_event_name.md b/models/doc_descriptions/event_logs/gno_event_name.md deleted file mode 100644 index 88f1f90..0000000 --- a/models/doc_descriptions/event_logs/gno_event_name.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_event_removed.md b/models/doc_descriptions/event_logs/gno_event_removed.md deleted file mode 100644 index 4adacc1..0000000 --- a/models/doc_descriptions/event_logs/gno_event_removed.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_event_sig.md b/models/doc_descriptions/event_logs/gno_event_sig.md deleted file mode 100644 index f932639..0000000 --- a/models/doc_descriptions/event_logs/gno_event_sig.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_origin_sig %} - -The function signature of this transaction. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/gno_log_id_events.md b/models/doc_descriptions/event_logs/gno_log_id_events.md deleted file mode 100644 index f0fb731..0000000 --- a/models/doc_descriptions/event_logs/gno_log_id_events.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_logs_contract_address.md b/models/doc_descriptions/event_logs/gno_logs_contract_address.md deleted file mode 100644 index 2665cb7..0000000 --- a/models/doc_descriptions/event_logs/gno_logs_contract_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_logs_contract_name.md b/models/doc_descriptions/event_logs/gno_logs_contract_name.md deleted file mode 100644 index ea7c0df..0000000 --- a/models/doc_descriptions/event_logs/gno_logs_contract_name.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_logs_data.md b/models/doc_descriptions/event_logs/gno_logs_data.md deleted file mode 100644 index 38d704c..0000000 --- a/models/doc_descriptions/event_logs/gno_logs_data.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_logs_data %} - -The un-decoded event data. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/gno_logs_table_doc.md b/models/doc_descriptions/event_logs/gno_logs_table_doc.md deleted file mode 100644 index 5459a57..0000000 --- a/models/doc_descriptions/event_logs/gno_logs_table_doc.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_logs_table_doc %} - -This table contains flattened event logs from transactions on the Gnosis 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. Please see `fact_decoded_event_logs` or `ez_decoded_event_logs` for the decoded event logs. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/gno_logs_tx_hash.md b/models/doc_descriptions/event_logs/gno_logs_tx_hash.md deleted file mode 100644 index 37078a2..0000000 --- a/models/doc_descriptions/event_logs/gno_logs_tx_hash.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_origin_from.md b/models/doc_descriptions/event_logs/gno_origin_from.md deleted file mode 100644 index fa75807..0000000 --- a/models/doc_descriptions/event_logs/gno_origin_from.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_origin_from %} - -The from address of this transaction. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/gno_origin_to.md b/models/doc_descriptions/event_logs/gno_origin_to.md deleted file mode 100644 index ce6e9d9..0000000 --- a/models/doc_descriptions/event_logs/gno_origin_to.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_origin_to %} - -The to address of this transaction. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/event_logs/gno_topics.md b/models/doc_descriptions/event_logs/gno_topics.md deleted file mode 100644 index 09a6fbc..0000000 --- a/models/doc_descriptions/event_logs/gno_topics.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_topics %} - -The un-decoded event input topics. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/fsc_evm/blocks.md b/models/doc_descriptions/fsc_evm/blocks.md deleted file mode 100644 index 2f2f846..0000000 --- a/models/doc_descriptions/fsc_evm/blocks.md +++ /dev/null @@ -1,143 +0,0 @@ -{% docs evm_blocks_table_doc %} - -This table contains block level data for this EVM 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, please see [Etherscan Resources](https://etherscan.io/directory/Learning_Resources/Ethereum) or [The Ethereum Organization](https://ethereum.org/en/developers/docs/blocks/) - -{% enddocs %} - -{% docs evm_block_header_json %} - -This JSON column contains the block header details. - -{% enddocs %} - -{% docs evm_blockchain %} - -The blockchain on which transactions are being confirmed. - -{% enddocs %} - -{% docs evm_blocks_hash %} - -The hash of the block header for a given block. - -{% enddocs %} - -{% docs evm_blocks_nonce %} - -Block nonce is a value used during mining to demonstrate proof of work for a given block. - -{% enddocs %} - -{% docs evm_difficulty %} - -The effort required to mine the block. - -{% enddocs %} - -{% docs evm_extra_data %} - -Any data included by the miner for a given block. - -{% enddocs %} - -{% docs evm_gas_limit %} - -Total gas limit provided by all transactions in the block. - -{% enddocs %} - -{% docs evm_gas_used %} - -Total gas used in the block. - -{% enddocs %} - -{% docs evm_network %} - -The network on the blockchain used by a transaction. - -{% enddocs %} - -{% docs evm_parent_hash %} - -The hash of the block from which a given block is generated. Also known as the parent block. - -{% enddocs %} - -{% docs evm_receipts_root %} - -The root of the state trie. - -{% enddocs %} - -{% docs evm_sha3_uncles %} - -The mechanism which Ethereum Javascript RLP encodes an empty string. - -{% enddocs %} - -{% docs evm_size %} - -Block size, which is determined by a given block's gas limit. - -{% enddocs %} - -{% docs evm_total_difficulty %} - -Total difficulty of the chain at a given block. - -{% enddocs %} - -{% docs evm_tx_count %} - -Total number of transactions within a block. - -{% enddocs %} - -{% docs evm_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 %} - -{% docs evm_miner %} - -The address of the beneficiary to whom the mining rewards were given - -{% enddocs %} - -{% docs evm_state_root %} - -The root of the final state trie of the block - -{% enddocs %} - -{% docs evm_transactions_root %} - -The root of the transaction trie of the block - -{% enddocs %} - -{% docs evm_logs_bloom %} - -The bloom filter for the logs of the block. - -{% enddocs %} - -{% docs evm_mix_hash %} - -A string of a 256-bit hash encoded as a hexadecimal - -{% enddocs %} - -{% docs evm_base_fee_per_gas %} - -A string of the base fee encoded in hexadecimal format. Please note that this response field will not be included in a block requested before the EIP-1559 upgrade - -{% enddocs %} - -{% docs evm_withdrawals_root %} - -The root of the withdrawals trie. - -{% enddocs %} diff --git a/models/doc_descriptions/fsc_evm/complete_general.md b/models/doc_descriptions/fsc_evm/complete_general.md deleted file mode 100644 index 77e2b35..0000000 --- a/models/doc_descriptions/fsc_evm/complete_general.md +++ /dev/null @@ -1,65 +0,0 @@ -{% docs evm_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 %} - -{% docs evm_block_timestamp %} - -The date and time at which the block was produced. - -{% enddocs %} - -{% docs evm_from_address %} - -The sending address of this transaction. - -{% enddocs %} - -{% docs evm_ingested_at %} - -Internal column. - -{% enddocs %} - -{% docs evm_to_address %} - -The receiving address of this transaction. This can be a contract address. - -{% enddocs %} - -{% docs evm_pk %} - -The unique identifier for each row in the table. - -{% enddocs %} - -{% docs evm_inserted_timestamp %} - -The UTC timestamp at which the row was inserted into the table. - -{% enddocs %} - -{% docs evm_modified_timestamp %} - -The UTC timestamp at which the row was last modified. - -{% enddocs %} - -{% docs evm_precise_amount_unadjusted %} - -The precise, unadjusted amount of the transaction. This is returned as a string to avoid precision loss. - -{% enddocs %} - -{% docs evm_precise_amount_adjusted %} - -The precise, adjusted amount of the transaction. This is returned as a string to avoid precision loss. - -{% enddocs %} - -{% docs evm_value_hex %} - -The value of the transaction in hexadecimal format. - -{% enddocs %} diff --git a/models/doc_descriptions/fsc_evm/event_logs.md b/models/doc_descriptions/fsc_evm/event_logs.md deleted file mode 100644 index 8880f5c..0000000 --- a/models/doc_descriptions/fsc_evm/event_logs.md +++ /dev/null @@ -1,83 +0,0 @@ -{% docs evm_logs_table_doc %} - -This table contains flattened event logs from transactions on this EVM 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. Please see `fact_decoded_event_logs` or `ez_decoded_event_logs` for the decoded event logs. - -{% enddocs %} - -{% docs evm_event_index %} - -Event number within a transaction. - -{% enddocs %} - -{% docs evm_event_inputs %} - -The decoded event inputs for a given event. - -{% enddocs %} - -{% docs evm_event_removed %} - -Whether the event has been removed from the transaction. - -{% enddocs %} - -{% docs evm_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. This field can be used within other event based tables such as `fact_transfers` & `ez_token_transfers`. - -{% enddocs %} - -{% docs evm_logs_contract_address %} - -The address interacted with for a given event. - -{% enddocs %} - -{% docs evm_logs_contract_name %} - -The name of the contract or token, where possible. - -{% enddocs %} - -{% docs evm_logs_data %} - -The un-decoded event data. - -{% enddocs %} - -{% docs evm_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 %} - -{% docs evm_topics %} - -The un-decoded event input topics. - -{% enddocs %} - -{% docs evm_topic_0 %} - -The first topic of the event, which is a unique identifier for the event. - -{% enddocs %} - -{% docs evm_topic_1 %} - -The second topic of the event, if applicable. - -{% enddocs %} - -{% docs evm_topic_2 %} - -The third topic of the event, if applicable. - -{% enddocs %} - -{% docs evm_topic_3 %} - -The fourth topic of the event, if applicable. - -{% enddocs %} diff --git a/models/doc_descriptions/fsc_evm/evm_deprecations.md b/models/doc_descriptions/fsc_evm/evm_deprecations.md deleted file mode 100644 index 331f1c2..0000000 --- a/models/doc_descriptions/fsc_evm/evm_deprecations.md +++ /dev/null @@ -1,203 +0,0 @@ -{% docs evm_column_deprecation_notice %} - -This column is being deprecated for standardization purposes. Please update your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_hash %} - -This column is being deprecated for standardization purposes. Please update your queries to use the `block_hash` column instead by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_block_hash %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_position %} - -This column is being deprecated for standardization purposes. Please update your queries to use the `tx_position` column instead by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_tx_status %} - -This column is being deprecated for standardization purposes. Please update your queries to use the `tx_succeeded` column instead by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_chain_id %} - -This column is being removed for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_identifier %} - -This column is being deprecated for standardization purposes. Please update your queries to use the `trace_address` column instead by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_trace_status %} - -This column is being deprecated for standardization purposes. Please update your queries to use the `trace_succeeded` column instead by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_log_id %} - -This column is being removed for standardization purposes. Please remove or update your queries with `CONCAT(tx_hash, '_', event_index)` to reconstruct `_log_id` by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_inserted_timestamp %} - -This column is being removed for standardization purposes. Please update your queries to use the `modified_timestamp` column instead by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_blockchain %} - -This column is being removed for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_block_header_json %} - -This column is being removed for standardization purposes and will be replaced with new columns associated with the keys extracted from this json. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_table_deprecation_notice %} - -This table is being deprecated for standardization purposes. Please update your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_table_deprecation_notice_fact_decoded_event_logs %} - -This table is being deprecated for standardization purposes. Please update your queries to use `ez_decoded_event_logs` instead by March 10, 2025. - -{% enddocs %} - -{% docs evm_table_deprecation_notice_fact_decoded_traces %} - -This table is being deprecated for standardization purposes. Please update your queries to use `ez_decoded_traces` instead by March 10, 2025. - -{% enddocs %} - -{% docs evm_table_deprecation_notice_fact_token_transfers %} - -This table is being deprecated for standardization purposes. Please update your queries to use `ez_token_transfers` instead by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_l1_state_root_tx_hash %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_l1_state_root_batch_index %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_l1_submission_tx_hash %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_l1_submission_batch_index %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_l1_submission_details %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_data %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_deposit_nonce %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_deposit_receipt_version %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_token_price %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_has_decimal %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{% docs evm_column_deprecation_notice_has_price %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{%docs evm_column_deprecation_notice_tokenid %} - -This column is being deprecated for standardization purposes. Please update your queries to use the `token_id` column instead by March 10, 2025. - -{% enddocs %} - -{%docs evm_column_deprecation_notice_erc1155_value %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{%docs evm_column_deprecation_notice_nft_address %} - -This column is being deprecated for standardization purposes. Please update your queries to use the `contract_address` column instead by March 10, 2025. - -{% enddocs %} - -{%docs evm_column_deprecation_notice_project_name %} - -This column is being deprecated for standardization purposes. Please update your queries to use the `name` column instead by March 10, 2025. - -{% enddocs %} - -{%docs evm_column_deprecation_notice_event_type %} - -This column is being deprecated for standardization purposes. Please remove from your queries by March 10, 2025. - -{% enddocs %} - -{%docs evm_column_deprecation_notice_nft_from_address %} - -This column is being deprecated for standardization purposes. Please update your queries to use the `from_address` column instead by March 10, 2025. - -{% enddocs %} - -{%docs evm_column_deprecation_notice_nft_to_address %} - -This column is being deprecated for standardization purposes. Please update your queries to use the `to_address` column instead by March 10, 2025. - -{% enddocs %} diff --git a/models/doc_descriptions/fsc_evm/nft.md b/models/doc_descriptions/fsc_evm/nft.md deleted file mode 100644 index dba8714..0000000 --- a/models/doc_descriptions/fsc_evm/nft.md +++ /dev/null @@ -1,587 +0,0 @@ -{% docs evm_nft_events_table_doc %} - -This table contains NFT sales on this EVM blockchain. More NFT marketplaces will be added over time. - -{% enddocs %} - -{% docs evm_ez_nft_sales_table_doc %} - -This table contains NFT sale events from various marketplaces. - -{% enddocs %} - -{% docs evm_ez_nft_mint_table_doc %} - -This table contains NFT mint events, defined as NFT transfers from a burn address to an address, on this EVM blockchain. - -{% enddocs %} - -{% docs evm_ez_nft_transfer_table_doc %} - -This table contains NFT transfer events on this EVM blockchain. - -{% enddocs %} - -{% docs evm_lending_repayments_table_doc %} - -This table contains repayment events for loans backed by collateralized NFTs on this EVM blockchain. Events in this table can be a full repayment either by the borrower to get their collateral back or by a new lender to repay the borrower's previous loan. The latter is labeled as refinance where the same borrower takes on a new loan from a new lender and repays the past loan. The NFT collateral is still locked in this scenario. - -{% enddocs %} - -{% docs evm_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 %} - -{% docs evm_nft_amount %} - -The total amount, specified by the mint token address, used as payment to mint the specified number of NFTs corresponding to this token id. - -{% enddocs %} - -{% docs evm_nft_amount_usd %} - -The USD value of amount. - -{% enddocs %} - -{% docs evm_nft_block_no %} - -The block number at which the NFT event occurred. - -{% enddocs %} - -{% docs evm_nft_blocktime %} - -The block timestamp at which the NFT event occurred. - -{% enddocs %} - -{% docs evm_nft_buyer_address %} - -The address of the buyer of the NFT in the transaction. - -{% enddocs %} - -{% docs evm_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 %} - -{% docs evm_nft_creator_fee_usd %} - -The amount of fees paid to the NFT collection as royalty payments for this NFT event in US dollars. - -{% enddocs %} - -{% docs evm_nft_currency_address %} - -The token contract address for this NFT event. This will be the native asset for native transactions. - -{% enddocs %} - -{% docs evm_nft_currency_symbol %} - -The token symbol for this NFT event. - -{% enddocs %} - -{% docs evm_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 %} - -{% docs evm_nft_event_index %} - -The event number within a transaction. - -{% enddocs %} - -{% docs evm_nft_event_type %} - -The type of NFT event in this transaction, either sale, bid_won, redeem, or mint. - -{% enddocs %} - -{% docs evm_nft_from_address %} - -The sending address of the NFT in the transaction. - -{% enddocs %} - -{% docs evm_nft_intra_event_index %} - -The order of events within a single event index. This is primarily used for ERC1155 NFT batch transfer events. - -{% enddocs %} - -{% docs evm_nft_metadata %} - -The token metadata for this NFT. This may be blank for many NFTs. We are working to expand this field. - -{% enddocs %} - -{% docs evm_nft_mint_count %} - -The number of NFTs minted in this event. - -{% enddocs %} - -{% docs evm_nft_mint_price %} - -The price paid in the native asset to mint the NFT(s). - -{% enddocs %} - -{% docs evm_nft_mint_price_usd %} - -The price paid in US dollars to mint the NFT(s). - -{% enddocs %} - -{% docs evm_nft_mints_symbol %} - -The symbol of the token supplied to mint the NFT, if applicable. This field may not handle all edge cases. - -{% enddocs %} - -{% docs evm_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 %} - -{% docs evm_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 %} - -{% docs evm_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 %} - -{% docs evm_nft_nft_address %} - -The contract address of the NFT. - -{% enddocs %} - -{% docs evm_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 %} - -{% docs evm_nft_origin_sig %} - -The function signature of this transaction. - -{% enddocs %} - -{% docs evm_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, this may not be the exchange address. - -{% enddocs %} - -{% docs evm_nft_platform_address %} - -The address of the exchange used for the transaction. - -{% enddocs %} - -{% docs evm_nft_platform_exchange_version %} - -The version of the exchange contract used for the transaction. - -{% enddocs %} - -{% docs evm_nft_platform_fee %} - -The decimal adjusted amount of fees paid to the platform for this NFT event in the transaction's currency. There are cases where there are fees paid to multiple marketplaces. In those cases, the fee in the platform_fee column will only reflect the platform fee related to the platform exchange contract. - -{% enddocs %} - -{% docs evm_nft_platform_fee_usd %} - -The amount of fees paid to the platform for this NFT event in US dollars. There are cases where there are fees paid to multiple marketplaces. In those cases, the fee in the platform_fee column will only reflect the platform fee related to the platform exchange contract. - -{% enddocs %} - -{% docs evm_nft_platform_name %} - -The name of the exchange used for the trade. - -{% enddocs %} - -{% docs evm_nft_price %} - -The total price of the NFT, in the currency in which the transaction occurred and decimal adjusted where possible. Please note that the price of the NFT, after subtracting total fees, may not represent the net amount paid to the seller in all cases. You may refer to the platform fee description for more info. - -{% enddocs %} - -{% docs evm_nft_price_usd %} - -The total price of the NFT in US dollars. This will be 0 for tokens without a decimal adjustment or hourly price. Please note that the price of the NFT, after subtracting total fees, may not represent the net amount paid to the seller in all cases. You may refer to the platform fee description for more info. - -{% enddocs %} - -{% docs evm_nft_project_name %} - -The name of the NFT project. This field, along with metadata, will be filled in over time. - -{% enddocs %} - -{% docs evm_nft_seller_address %} - -The address of the seller of the NFT in the transaction. - -{% enddocs %} - -{% docs evm_nft_to_address %} - -The receiving address of the NFT in the transaction. - -{% enddocs %} - -{% docs evm_nft_tokenid %} - -The token ID for this NFT contract. - -{% enddocs %} - -{% docs evm_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 %} - -{% docs evm_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 %} - -{% docs evm_nft_tx_fee %} - -The gas fee for this transaction in the native asset. - -{% enddocs %} - -{% docs evm_nft_tx_fee_usd %} - -The gas fee for this transaction in US dollars. - -{% enddocs %} - -{% docs evm_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 %} - -{% docs evm_nft_lending_liquidations_table_doc %} - -This table contains liquidation events for loans backed by collateralized NFTs on this EVM blockchain. This typically means the lender of the loan closes the loan and receives the NFT collateral. - -{% enddocs %} - -{% docs evm_platform_address %} - -The contract address of the platform's lending contract. - -{% enddocs %} - -{% docs evm_platform_name %} - -The name of the platform. - -{% enddocs %} - -{% docs evm_platform_exchange_version %} - -The version of the platform's lending contract. - -{% enddocs %} - -{% docs evm_loanid %} - -The ID associated with the loan, often times tied to the borrower's address and collateral. This ID can be used as a unique identifier when tracking active loans. However, note that refinances can happen while still maintaining the same loanId. For some platforms, loanids of previously paid loans are reused hence they can't be reliably used as a unique identifier without appropriate timestamp filters. Instead, use the unique_loan_id column. - -{% enddocs %} - -{% docs evm_unique_loan_id %} - -The unique ID that can be used to represent a loan within the same platform. For the same loan, the value of this ID will remain the same across the loans taken, liquidations and repayment tables. For some platforms where the lender is issued a promissory note, the lender can send this note to any address, making the receiver the new lender. However, the unique_loan_id still remains the same although the final lender is different. The unique_loan_id changes only if the loanId and lender changes which would also indicate the previous loan has been fully paid off. - -{% enddocs %} - -{% docs evm_lender_address %} - -The address that gives out a loan to the borrower. When a loan is issued, a promissory note (an ERC721) is issued to the lender. The lender can transfer this note to any address which makes any receiving address the new lender. - -{% enddocs %} - -{% docs evm_borrower_address %} - -The address that receives the loan and has an NFT locked as collateral. - -{% enddocs %} - -{% docs evm_nft_address %} - -The address of the NFT used as collateral. - -{% enddocs %} - -{% docs evm_tokenid %} - -The tokenId of the NFT used as collateral. - -{% enddocs %} - -{% docs evm_loan_token_address %} - -The contract address of what the loan is denominated in. This could be either the native asset or other tokens. - -{% enddocs %} - -{% docs evm_loan_token_symbol %} - -The symbol of the loan token address. - -{% enddocs %} - -{% docs evm_principal_unadj %} - -The principal amount of the loan taken with unadjusted decimal places. - -{% enddocs %} - -{% docs evm_principal %} - -The principal amount of the loan taken with adjusted decimal places. - -{% enddocs %} - -{% docs evm_principal_usd %} - -The principal amount of the loan taken in USD terms. - -{% enddocs %} - -{% docs evm_interest_rate %} - -The non-annualized rate charged by the lender on the principal amount of the loan denominated in percentage (%). For fixed term loans, it is calculated by taking the difference between total debt and principal amount divided by principal amount. For perpetual term loans, interest rate is usually on an annual basis and total debt is calculated prorated. - -{% enddocs %} - -{% docs evm_apr %} - -The annualized interest rate denominated in percentage (%). - -{% enddocs %} - -{% docs evm_loan_term_type %} - -The type of loan terms, could be either a fixed loan or a perpetual loan. A fixed term loan has a fixed repayment date while a perpetual loan does not. - -{% enddocs %} - -{% docs evm_loan_start_timestamp %} - -The timestamp of when the loan offer is accepted. - -{% enddocs %} - -{% docs evm_loan_due_timestamp %} - -The timestamp of when the loan is due. For perpetual term loan, the value will be null. - -{% enddocs %} - -{% docs evm_loan_tenure %} - -The tenure of the loan denominated in seconds. For perpetual term loan, the value will be null. - -{% enddocs %} - -{% docs evm_lending_loans %} - -This table contains NFT lending events for loans backed by collateralized NFTs on this EVM blockchain. This could be depositing an NFT and taking out a loan or using the Buy Now Pay Later (BNPL) feature to take a loan out of the newly bought NFT. This NFT will remain locked until the loan is cleared. - -{% enddocs %} - -{% docs evm_nft_lending_event_type %} - -There are 2 types of loan creation events. It can either be a new loan or a refinance of an existing loan. Note that renegotiation events are categorized as refinance events in this table. Old loans are repaid and new loan ids are reissued so these would be new loan entries in this table. - -{% enddocs %} - -{% docs evm_debt_unadj %} - -The total debt of the loan (principal amount plus interests) with unadjusted decimal places. - -{% enddocs %} - -{% docs evm_debt %} - -The total debt of the loan (principal amount plus interests) with adjusted decimal places. - -{% enddocs %} - -{% docs evm_debt_usd %} - -The total debt of the loan (principal amount plus interests) in USD terms. - -{% enddocs %} - -{% docs evm_platform_fee_unadj %} - -The fee charged by the lending platform with unadjusted decimal places. - -{% enddocs %} - -{% docs evm_platform_fee %} - -The fee charged by the lending platform with adjusted decimal places. - -{% enddocs %} - -{% docs evm_platform_fee_usd %} - -The fee charged by the lending platform in USD terms. - -{% enddocs %} - -{% docs evm_mev_arbitrage %} - -This table contains the financial metrics from NFT arbitrage transactions including cost, revenue and profits. - -{% enddocs %} - -{% docs evm_mev_searcher %} - -The address of the MEV finder, taken from the origin address that initiated the transaction. - -{% enddocs %} - -{% docs evm_mev_contract %} - -The contract address that the MEV searcher uses to execute mev transactions, taken from the origin to address of the transaction. - -{% enddocs %} - -{% docs evm_cost_usd %} - -The total cost in USD to purchase the NFT(s) in the transaction. - -{% enddocs %} - -{% docs evm_revenue_usd %} - -The total revenue in USD from selling the NFT(s) and other related tokens in the transaction. - -{% enddocs %} - -{% docs evm_miner_tip_usd %} - -The total amount in USD sent to the block miner/builder as a tip to include the transaction in the block. - -{% enddocs %} - -{% docs evm_profit_usd %} - -The remainder in USD after subtracting cost, miner tip and transaction fee from revenue. - -{% enddocs %} - -{% docs evm_funding_source %} - -The source of the funds used to perform the arbitrage. Currently there are three sources. Existing funds indicate that the user uses funds that are already in their balance while flash loan and flash swaps indicate that the user took a flash loan in the transaction. - -{% enddocs %} - -{% docs evm_arbitrage_direction %} - -The direction in which the arbitrage is performed. There are two possibilities of origin and destination: pool and marketplace. Pool represents marketplaces where users swap from a pool whereas marketplace represents regular marketplaces that are not pool-based. - -{% enddocs %} - -{% docs evm_fact_mev_arbitrage_events %} - -This table contains information about the NFTs involved in arbitrage transactions, documenting events from both the buy and sell sides. - -{% enddocs %} - -{% docs evm_trade_side %} - -The side of the trade that this event represents. This can be either buy or sell. Buy would represent the events where NFTs are bought while sell would present the events where the bought NFTs are sold. Note that the number of events for buy and sell may not be the same for a given transaction. - -{% enddocs %} - -{% docs evm_dim_nft_collection_metadata %} - -This table contains the metadata for popular NFT collections on this EVM blockchain. - -{% enddocs %} - -{% docs evm_nft_blockchain %} - -Blockchain where the NFT metadata is retrieved from. - -{% enddocs %} - -{% docs evm_collection_name %} - -The name for this NFT collection. - -{% enddocs %} - -{% docs evm_tokenid_name %} - -The name for this specific tokenId. This may be the same for all tokenIds within the same collection. - -{% enddocs %} - -{% docs evm_traits %} - -The traits for this tokenId in a key-value pair format. - -{% enddocs %} - -{% docs evm_tokenid_description %} - -The description for this specific tokenId. This may be the same for all tokenIds within the same collection. - -{% enddocs %} - -{% docs evm_tokenid_image_url %} - -The url of the image for this tokenId. - -{% enddocs %} - -{% docs evm_nft_address_tokenid %} - -The concatenation of NFT address and tokenId. - -{% enddocs %} - -{% docs evm_nft_quantity %} - -The number of NFTs transferred in this transaction. If it is an ERC1155, there can be multiple NFTs transferred in a single transaction. If it is an ERC721, this will be 1. - -{% enddocs %} - -{% docs evm_nft_token_standard %} - -The token standard of the NFT. - -{% enddocs %} diff --git a/models/doc_descriptions/fsc_evm/traces.md b/models/doc_descriptions/fsc_evm/traces.md deleted file mode 100644 index cebd31a..0000000 --- a/models/doc_descriptions/fsc_evm/traces.md +++ /dev/null @@ -1,125 +0,0 @@ -{% docs evm_traces_table_doc %} - -This table contains flattened trace data for internal contract calls. User-defined functions (UDFs) are available to decode hex encoded fields, including `utils.udf_hex_to_int()`. - -{% enddocs %} - -{% docs evm_traces_block_no %} - -The block number of this transaction. - -{% enddocs %} - -{% docs evm_traces_blocktime %} - -The block timestamp of this transaction. - -{% enddocs %} - -{% docs evm_traces_call_data %} - -The raw JSON data for this trace. - -{% enddocs %} - -{% docs evm_traces_value %} - -The amount of the native asset transferred in this trace. - -{% enddocs %} - -{% docs evm_traces_from %} - -The sending address of this trace. This is not necessarily the from address of the transaction. - -{% enddocs %} - -{% docs evm_traces_gas %} - -The gas supplied for this trace. - -{% enddocs %} - -{% docs evm_traces_gas_used %} - -The gas used for this trace. - -{% enddocs %} - -{% docs evm_traces_identifier %} - -This field represents the position and type of the trace within the transaction. - -{% enddocs %} - -{% docs evm_trace_index %} - -The index of the trace within the transaction. - -{% enddocs %} - -{% docs evm_traces_input %} - -The input data for this trace. - -{% enddocs %} - -{% docs evm_traces_output %} - -The output data for this trace. - -{% enddocs %} - -{% docs evm_sub_traces %} - -The amount of nested sub traces for this trace. - -{% enddocs %} - -{% docs evm_traces_to %} - -The receiving address of this trace. This is not necessarily the to address of the transaction. - -{% enddocs %} - -{% docs evm_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 %} - -{% docs evm_traces_type %} - -The type of internal transaction. Common trace types are `CALL`, `DELEGATECALL`, and `STATICCALL`. - -{% enddocs %} - -{% docs evm_trace_succeeded %} - -The boolean value representing if the trace succeeded. - -{% enddocs %} - -{% docs evm_trace_error_reason %} - -The reason for the trace failure, if any. - -{% enddocs %} - -{% docs evm_revert_reason %} - -The reason for the revert, if available. - -{% enddocs %} - -{% docs evm_trace_address %} - -The trace address for this trace. - -{% enddocs %} - -{% docs evm_trace_type %} - -The type of internal transaction. Common trace types are `CALL`, `DELEGATECALL`, and `STATICCALL`. - -{% enddocs %} diff --git a/models/doc_descriptions/fsc_evm/transactions.md b/models/doc_descriptions/fsc_evm/transactions.md deleted file mode 100644 index a5b74ea..0000000 --- a/models/doc_descriptions/fsc_evm/transactions.md +++ /dev/null @@ -1,188 +0,0 @@ -{% docs evm_tx_table_doc %} - -This table contains transaction level data for this EVM blockchain. Each transaction will have a unique transaction hash, along with transaction fees and a value transferred in the native asset when applicable. Transactions may be native asset transfers or interactions with contract addresses. For more information, please see [The Ethereum Organization - Transactions](https://ethereum.org/en/developers/docs/transactions/) - -Below are the specific native tokens that correspond to each EVM chain: - -| Status | Description | -| --------- | ----------- | -| ETHEREUM | ETH | -| BINANCE | BNB | -| POLYGON | POL | -| AVALANCHE | AVAX | -| ARBITRUM | ETH | -| OPTIMISM | ETH | -| GNOSIS | xDAI | -| KAIA | KLAY | -| SEI | SEI | -| CORE | CORE | - -{% enddocs %} - -{% docs evm_cumulative_gas_used %} - -The total amount of gas used when this transaction was executed in the block. - -{% enddocs %} - -{% docs evm_tx_block_hash %} - -Block hash is a unique 66-character identifier that is generated when a block is produced. - -{% enddocs %} - -{% docs evm_tx_fee %} - -Amount paid to validate the transaction in the native asset. - -{% enddocs %} - -{% docs evm_tx_gas_limit %} - -Maximum amount of gas allocated for the transaction. - -{% enddocs %} - -{% docs evm_tx_gas_price %} - -Cost per unit of gas in Gwei. - -{% enddocs %} - -{% docs evm_tx_gas_used %} - -Gas used by the transaction. - -{% enddocs %} - -{% docs evm_tx_hash %} - -Transaction hash is a unique 66-character identifier that is generated when a transaction is executed. - -{% enddocs %} - -{% docs evm_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 %} - -{% docs evm_tx_json %} - -This JSON column contains the transaction details, including event logs. - -{% enddocs %} - -{% docs evm_tx_nonce %} - -The number of transactions sent from a given address. - -{% enddocs %} - -{% docs evm_tx_origin_sig %} - -The function signature of the call that triggered this transaction. - -{% enddocs %} - -{% docs evm_origin_sig %} - -The function signature of the contract call that triggered this transaction. - -{% enddocs %} - -{% docs evm_tx_position %} - -The position of the transaction within the block. - -{% enddocs %} - -{% docs evm_tx_status %} - -Status of the transaction. - -{% enddocs %} - -{% docs evm_value %} - -The value transacted in the native asset. - -{% enddocs %} - -{% docs evm_effective_gas_price %} - -The total base charge plus tip paid for each unit of gas, in Gwei. - -{% enddocs %} - -{% docs evm_max_fee_per_gas %} - -The maximum fee per gas of the transaction, in Gwei. - -{% enddocs %} - -{% docs evm_max_priority_fee_per_gas %} - -The maximum priority fee per gas of the transaction, in Gwei. - -{% enddocs %} - -{% docs evm_r %} - -The r value of the transaction signature. - -{% enddocs %} - -{% docs evm_s %} - -The s value of the transaction signature. - -{% enddocs %} - -{% docs evm_v %} - -The v value of the transaction signature. - -{% enddocs %} - -{% docs evm_tx_succeeded %} - -Whether the transaction was successful, returned as a boolean. - -{% enddocs %} - -{% docs evm_tx_fee_precise %} - -The precise amount of the transaction fee. This is returned as a string to avoid precision loss. - -{% enddocs %} - -{% docs evm_tx_type %} - -The type of transaction. - -{% enddocs %} - -{% docs evm_mint %} - -The minting event associated with the transaction - -{% enddocs %} - -{% docs evm_source_hash %} - -The hash of the source transaction that created this transaction - -{% enddocs %} - -{% docs evm_eth_value %} - -The eth value for the transaction - -{% enddocs %} - -{% docs evm_chain_id %} - -The unique identifier for the chain the transaction was executed on. - -{% enddocs %} diff --git a/models/doc_descriptions/fsc_evm/transfers.md b/models/doc_descriptions/fsc_evm/transfers.md deleted file mode 100644 index eafaca3..0000000 --- a/models/doc_descriptions/fsc_evm/transfers.md +++ /dev/null @@ -1,144 +0,0 @@ -{% docs evm_transfers_table_doc %} - -This table contains all native asset 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. - -Below are the specific native tokens that correspond to each EVM chain: - -| Status | Description | -| --------- | ----------- | -| ETHEREUM | ETH | -| BINANCE | BNB | -| POLYGON | POL | -| AVALANCHE | AVAX | -| ARBITRUM | ETH | -| OPTIMISM | ETH | -| GNOSIS | xDAI | -| KAIA | KLAY | - -{% enddocs %} - -{% docs evm_transfer_table_doc %} - -This table contains 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 asset transfers are not included here. - -{% enddocs %} - -{% docs evm_fact_token_transfers_table_doc %} - -This fact-based table contains emitted event logs for ERC-20 Token Transfers (e.g. `Transfer`: topic_0 = `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`). The contract address is the token transferred, and the raw amount field is the amount of tokens transferred. The values in this table are not decimal adjusted, instead please use `core.dim_contracts` or `core.ez_token_transfers` to reference decimals or decimal adjusted values. This table does not contain ERC-721 and ERC-1155 token transfers, instead please use `nft.ez_nft_transfers`. Additionally, this table does not contain transfers of the chain's native asset, instead please use `core.ez_native_transfers`. - -{% enddocs %} - -{% docs evm_ez_token_transfers_table_doc %} - -This convenience table contains emitted event logs for ERC-20 Token Transfers (e.g. `Transfer`: topic_0 = `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`), including decimal adjusted values, USD values, and other helpful token metadata where available for each transfer event. The contract address is the token transferred, and the raw amount field is the amount of tokens transferred. Note, this table does not contain ERC-721 and ERC-1155 token transfers, instead please use `nft.ez_nft_transfers`. Additionally, this table does not contain transfers of the chain's native asset, instead please use `core.ez_native_transfers`. - -{% enddocs %} - -{% docs evm_ez_native_transfers_table_doc %} - -This convenience table contains all transfers for the chain's native asset, sourced from internal traces (`core.fact_traces`), and includes decimal adjusted and USD values where available. The origin addresses correspond to the to and from addresses in the `core.fact_transactions` table. Note, this table does not contain ERC-721 and ERC-1155 token transfers, instead please use `nft.ez_nft_transfers`. - -{% enddocs %} - -{% docs evm_amount %} - -Native asset value transferred, this is imported from the fsc-evm package. - -{% enddocs %} - -{% docs evm_amount_usd %} - -Native asset value transferred, in USD. - -{% enddocs %} - -{% docs evm_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 %} - -{% docs evm_origin_from %} - -The from address at the transaction level. - -{% enddocs %} - -{% docs evm_origin_to %} - -The to address at the transaction level. - -{% enddocs %} - -{% docs evm_transfer_amount %} - -The decimal transformed amount for this token. Tokens without a decimal adjustment will be nulled out here. - -{% enddocs %} - -{% docs evm_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 %} - -{% docs evm_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 %} - -{% docs evm_transfer_contract_address %} - -Contract address of the token being transferred. - -{% enddocs %} - -{% docs evm_transfer_from_address %} - -The sending address of this transfer. - -{% enddocs %} - -{% docs evm_transfer_has_decimal %} - -Whether or not our contracts model contains the necessary decimal adjustment for this token. - -{% enddocs %} - -{% docs evm_transfer_has_price %} - -Whether or not our prices model contains this hourly token price. - -{% enddocs %} - -{% docs evm_transfer_raw_amount %} - -The amount of tokens transferred. This value is not decimal adjusted. - -{% enddocs %} - -{% docs evm_transfer_raw_amount_precise %} - -The amount of tokens transferred returned as a string to preserve precision. This value is not decimal adjusted. - -{% enddocs %} - -{% docs evm_transfer_to_address %} - -The receiving address of this transfer. This can be a contract address. - -{% enddocs %} - -{% docs evm_transfer_token_price %} - -The price, if available, for this token at the transfer time. - -{% enddocs %} - -{% docs evm_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 %} diff --git a/models/doc_descriptions/general/deprecation.md b/models/doc_descriptions/general/deprecation.md deleted file mode 100644 index f9b3366..0000000 --- a/models/doc_descriptions/general/deprecation.md +++ /dev/null @@ -1,11 +0,0 @@ -{% 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 `xdai_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 deleted file mode 100644 index 726edb1..0000000 --- a/models/doc_descriptions/general/export_columns.md +++ /dev/null @@ -1,17 +0,0 @@ -{% 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 %} \ No newline at end of file diff --git a/models/doc_descriptions/general/gno_block_number.md b/models/doc_descriptions/general/gno_block_number.md deleted file mode 100644 index 081edca..0000000 --- a/models/doc_descriptions/general/gno_block_number.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_block_timestamp.md b/models/doc_descriptions/general/gno_block_timestamp.md deleted file mode 100644 index 1ca766f..0000000 --- a/models/doc_descriptions/general/gno_block_timestamp.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_decimals.md b/models/doc_descriptions/general/gno_decimals.md deleted file mode 100644 index 951877f..0000000 --- a/models/doc_descriptions/general/gno_decimals.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_from_address.md b/models/doc_descriptions/general/gno_from_address.md deleted file mode 100644 index 4f09c9c..0000000 --- a/models/doc_descriptions/general/gno_from_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_from_address %} - -The sending address of this transaction. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/general/gno_ingested_at.md b/models/doc_descriptions/general/gno_ingested_at.md deleted file mode 100644 index 4013841..0000000 --- a/models/doc_descriptions/general/gno_ingested_at.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_ingested_at %} - -Internal column. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/general/gno_symbol.md b/models/doc_descriptions/general/gno_symbol.md deleted file mode 100644 index 7f167b5..0000000 --- a/models/doc_descriptions/general/gno_symbol.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_symbol %} - -The symbol belonging to the address of the token - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/general/gno_to_address.md b/models/doc_descriptions/general/gno_to_address.md deleted file mode 100644 index 821e32e..0000000 --- a/models/doc_descriptions/general/gno_to_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/precise_amounts.md b/models/doc_descriptions/general/precise_amounts.md deleted file mode 100644 index 66af71b..0000000 --- a/models/doc_descriptions/general/precise_amounts.md +++ /dev/null @@ -1,17 +0,0 @@ -{% 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 %} \ No newline at end of file diff --git a/models/doc_descriptions/labels/gno_label.md b/models/doc_descriptions/labels/gno_label.md deleted file mode 100644 index 0c052af..0000000 --- a/models/doc_descriptions/labels/gno_label.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_project_name %} - -The name of the project for this address. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/labels/gno_label_address.md b/models/doc_descriptions/labels/gno_label_address.md deleted file mode 100644 index 9da4cf1..0000000 --- a/models/doc_descriptions/labels/gno_label_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_label_address_name.md b/models/doc_descriptions/labels/gno_label_address_name.md deleted file mode 100644 index 65f7e40..0000000 --- a/models/doc_descriptions/labels/gno_label_address_name.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_label_address_name %} - -The most granular label for this address. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/labels/gno_label_blockchain.md b/models/doc_descriptions/labels/gno_label_blockchain.md deleted file mode 100644 index 79cc9fe..0000000 --- a/models/doc_descriptions/labels/gno_label_blockchain.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_label_blockchain %} - -The name of the blockchain. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/labels/gno_label_creator.md b/models/doc_descriptions/labels/gno_label_creator.md deleted file mode 100644 index 946ce0b..0000000 --- a/models/doc_descriptions/labels/gno_label_creator.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_label_creator %} - -The name of the creator of the label. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/labels/gno_label_subtype.md b/models/doc_descriptions/labels/gno_label_subtype.md deleted file mode 100644 index 0dce96e..0000000 --- a/models/doc_descriptions/labels/gno_label_subtype.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_label_type.md b/models/doc_descriptions/labels/gno_label_type.md deleted file mode 100644 index 1c4cac9..0000000 --- a/models/doc_descriptions/labels/gno_label_type.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_labels_table_doc.md b/models/doc_descriptions/labels/gno_labels_table_doc.md deleted file mode 100644 index 20effdf..0000000 --- a/models/doc_descriptions/labels/gno_labels_table_doc.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_labels_table %} - -This table contains labels for addresses on the Gnosis 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 deleted file mode 100644 index 10e72c4..0000000 --- a/models/doc_descriptions/labels/table_dim_labels.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 6a1b73a..0000000 --- a/models/doc_descriptions/nft/nft_aggregator_name.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 5f56a54..0000000 --- a/models/doc_descriptions/nft/nft_block_no.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 1080238..0000000 --- a/models/doc_descriptions/nft/nft_blocktime.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index eeb9c3d..0000000 --- a/models/doc_descriptions/nft/nft_buyer_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 27fa2f8..0000000 --- a/models/doc_descriptions/nft/nft_creator_fee.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 22c9396..0000000 --- a/models/doc_descriptions/nft/nft_creator_fee_usd.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 04c051e..0000000 --- a/models/doc_descriptions/nft/nft_currency_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs nft_currency_address %} - -The token contract address for this NFT event. This will be `xDAI` for native Gnosis 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 deleted file mode 100644 index 3dd3c73..0000000 --- a/models/doc_descriptions/nft/nft_currency_symbol.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 580ba06..0000000 --- a/models/doc_descriptions/nft/nft_erc1155_value.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 4e242db..0000000 --- a/models/doc_descriptions/nft/nft_event_index.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs nft_event_index %} - -The 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 deleted file mode 100644 index 82f5d8c..0000000 --- a/models/doc_descriptions/nft/nft_event_type.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index bf84608..0000000 --- a/models/doc_descriptions/nft/nft_events_table_doc.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs nft_events_table_doc %} - -This table contains NFT sales on the Gnosis 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 deleted file mode 100644 index a1d3c41..0000000 --- a/models/doc_descriptions/nft/nft_from_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 4ce24fc..0000000 --- a/models/doc_descriptions/nft/nft_intra_event_index.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 3d01653..0000000 --- a/models/doc_descriptions/nft/nft_metadata.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index a84c6bb..0000000 --- a/models/doc_descriptions/nft/nft_mint_count.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index d13ad7d..0000000 --- a/models/doc_descriptions/nft/nft_mint_doc.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs nft_mint_doc %} - -This table contains NFT mint events, defined as an NFT transfers from a burn address to an address, on the Gnosis 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 deleted file mode 100644 index 11faa62..0000000 --- a/models/doc_descriptions/nft/nft_mint_price.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs nft_mint_price %} - -The price paid in xDAI 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 deleted file mode 100644 index 7e8bf17..0000000 --- a/models/doc_descriptions/nft/nft_mint_price_usd.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 688ae3d..0000000 --- a/models/doc_descriptions/nft/nft_mints_symbol.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 84d1946..0000000 --- a/models/doc_descriptions/nft/nft_mints_token_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 03942a4..0000000 --- a/models/doc_descriptions/nft/nft_mints_token_price.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 9e500f7..0000000 --- a/models/doc_descriptions/nft/nft_mints_token_price_usd.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index b064027..0000000 --- a/models/doc_descriptions/nft/nft_nft_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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_origin_from.md b/models/doc_descriptions/nft/nft_origin_from.md deleted file mode 100644 index 252828b..0000000 --- a/models/doc_descriptions/nft/nft_origin_from.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 02b4ce6..0000000 --- a/models/doc_descriptions/nft/nft_origin_sig.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 316a2b6..0000000 --- a/models/doc_descriptions/nft/nft_origin_to.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index aa0f059..0000000 --- a/models/doc_descriptions/nft/nft_platform_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 18be47c..0000000 --- a/models/doc_descriptions/nft/nft_platform_exchange_version.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 6497c53..0000000 --- a/models/doc_descriptions/nft/nft_platform_fee.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 552cbfd..0000000 --- a/models/doc_descriptions/nft/nft_platform_fee_usd.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 05c78e1..0000000 --- a/models/doc_descriptions/nft/nft_platform_name.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 1dccd76..0000000 --- a/models/doc_descriptions/nft/nft_price.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 2dc1df1..0000000 --- a/models/doc_descriptions/nft/nft_price_usd.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 2ddcf23..0000000 --- a/models/doc_descriptions/nft/nft_project_name.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 198294c..0000000 --- a/models/doc_descriptions/nft/nft_seller_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 547c383..0000000 --- a/models/doc_descriptions/nft/nft_to_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 6d2e48b..0000000 --- a/models/doc_descriptions/nft/nft_tokenid.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 7ec60c9..0000000 --- a/models/doc_descriptions/nft/nft_total_fees.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index e37b719..0000000 --- a/models/doc_descriptions/nft/nft_total_fees_usd.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 821a053..0000000 --- a/models/doc_descriptions/nft/nft_transfer_doc.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs nft_transfer_doc %} - -This table contains NFT transfer events on the Gnosis 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 deleted file mode 100644 index 31556c8..0000000 --- a/models/doc_descriptions/nft/nft_tx_fee.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs nft_tx_fee %} - -The gas fee for this transaction in xDAI. - -{% 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 deleted file mode 100644 index 24ea662..0000000 --- a/models/doc_descriptions/nft/nft_tx_fee_usd.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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 deleted file mode 100644 index 10e7762..0000000 --- a/models/doc_descriptions/nft/nft_tx_hash.md +++ /dev/null @@ -1,5 +0,0 @@ -{% 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/prices/prices.md b/models/doc_descriptions/prices/prices.md deleted file mode 100644 index 60d4e96..0000000 --- a/models/doc_descriptions/prices/prices.md +++ /dev/null @@ -1,143 +0,0 @@ -{% docs prices_dim_asset_metadata_table_doc %} - -A comprehensive dimensional table holding asset metadata and other relevant details pertaining to each id, from multiple providers. This data set includes raw, non-transformed data coming directly from the provider APIs and rows are not intended to be unique. As a result, there may be data quality issues persisting in the APIs that flow through to this dimensional model. If you are interested in using a curated data set instead, please utilize ez_asset_metadata. - -{% enddocs %} - -{% docs prices_ez_asset_metadata_table_doc %} - -A convenience table holding prioritized asset metadata and other relevant details pertaining to each token_address and native asset. This data set is highly curated and contains metadata for one unique asset per blockchain. - -{% enddocs %} - -{% docs prices_fact_prices_ohlc_hourly_table_doc %} - -A comprehensive fact table holding id and provider specific open, high, low, close hourly prices, from multiple providers. This data set includes raw, non-transformed data coming directly from the provider APIs and rows are not intended to be unique. As a result, there may be data quality issues persisting in the APIs that flow through to this fact based model. If you are interested in using a curated data set instead, please utilize ez_prices_hourly. - -{% enddocs %} - -{% docs prices_ez_prices_hourly_table_doc %} - -A convenience table for determining token prices by address and blockchain, and native asset prices by symbol and blockchain. This data set is highly curated and contains metadata for one price per hour per unique asset and blockchain. - -{% enddocs %} - -{% docs prices_provider %} - -The provider or source of the data. - -{% enddocs %} - -{% docs prices_asset_id %} - -The unique identifier representing the asset. - -{% enddocs %} - -{% docs prices_name %} - -The name of asset. - -{% enddocs %} - -{% docs prices_symbol %} - -The symbol of asset. - -{% enddocs %} - -{% docs prices_token_address %} - -The specific address representing the asset on a specific platform. This will be NULL if referring to a native asset. - -{% enddocs %} - -{% docs prices_token_address_evm %} - -The specific address representing the asset on a specific platform. This will be NULL if referring to a native asset. The case (upper / lower) may or may not be specified within the `dim_asset_metadata` table, as this column is raw and not transformed, coming directly from the provider APIs. However, in the `ez_` views, it will be lowercase by default for all EVMs. - -{% enddocs %} - -{% docs prices_blockchain %} - -The Blockchain, Network, or Platform for this asset. - -{% enddocs %} - -{% docs prices_blockchain_id %} - -The unique identifier of the Blockchain, Network, or Platform for this asset. - -{% enddocs %} - -{% docs prices_decimals %} - -The number of decimals for the asset. May be NULL. - -{% enddocs %} - -{% docs prices_is_native %} - -A flag indicating assets native to the respective blockchain. - -{% enddocs %} - -{% docs prices_is_deprecated %} - -A flag indicating if the asset is deprecated or no longer supported by the provider. - -{% enddocs %} - -{% docs prices_id_deprecation %} - -Deprecating soon! Please use the `asset_id` column instead. - -{% enddocs %} - -{% docs prices_decimals_deprecation %} - -Deprecating soon! Please use the decimals column in `ez_asset_metadata` or join in `dim_contracts` instead. - -{% enddocs %} - -{% docs prices_hour %} - -Hour that the price was recorded at. - -{% enddocs %} - -{% docs prices_price %} - -Closing price of the recorded hour in USD. - -{% enddocs %} - -{% docs prices_is_imputed %} - -A flag indicating if the price was imputed, or derived, from the last arriving record. This is generally used for tokens with low-liquidity or inconsistent reporting. - -{% enddocs %} - -{% docs prices_open %} - -Opening price of the recorded hour in USD. - -{% enddocs %} - -{% docs prices_high %} - -Highest price of the recorded hour in USD - -{% enddocs %} - -{% docs prices_low %} - -Lowest price of the recorded hour in USD - -{% enddocs %} - -{% docs prices_close %} - -Closing price of the recorded hour in USD - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/stats/evm_stats_core.md b/models/doc_descriptions/stats/evm_stats_core.md deleted file mode 100644 index e8a450a..0000000 --- a/models/doc_descriptions/stats/evm_stats_core.md +++ /dev/null @@ -1,71 +0,0 @@ -{% docs evm_ez_core_metrics_hourly_table_doc %} - -A convenience table that aggregates block and transaction related metrics using various aggregate functions such as SUM, COUNT, MIN and MAX from the fact_transactions table, on an hourly basis. - -{% enddocs %} - -{% docs evm_block_timestamp_hour %} - -The hour of the timestamp of the block. - -{% enddocs %} - -{% docs evm_block_number_min %} - -The minimum block number in the hour. - -{% enddocs %} - -{% docs evm_block_number_max %} - -The maximum block number in the hour. - -{% enddocs %} - -{% docs evm_block_count %} - -The number of blocks in the hour. - -{% enddocs %} - -{% docs evm_transaction_count %} - -The number of transactions in the hour. - -{% enddocs %} - -{% docs evm_transaction_count_success %} - -The number of successful transactions in the hour. - -{% enddocs %} - -{% docs evm_transaction_count_failed %} - -The number of failed transactions in the hour. - -{% enddocs %} - -{% docs evm_unique_from_count %} - -The number of unique origin from addresses in the hour. - -{% enddocs %} - -{% docs evm_unique_to_count %} - -The number of unique origin to addresses in the hour. - -{% enddocs %} - -{% docs evm_total_fees_native %} - -The sum of all fees in the hour, in the native fee currency. Note, Snowflake's native SUM() function may limit decimal precision. To view precise transaction fee values, please use the `tx_fee_precise` column in `core.fact_transactions`. - -{% enddocs %} - -{% docs evm_total_fees_usd %} - -The sum of all fees in the hour, in USD, rounded to 2 decimal places. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/gno_traces_block_no.md b/models/doc_descriptions/traces/gno_traces_block_no.md deleted file mode 100644 index bce69e8..0000000 --- a/models/doc_descriptions/traces/gno_traces_block_no.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_traces_block_no %} - -The block number of this transaction. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/gno_traces_blocktime.md b/models/doc_descriptions/traces/gno_traces_blocktime.md deleted file mode 100644 index 38ef19d..0000000 --- a/models/doc_descriptions/traces/gno_traces_blocktime.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_traces_blocktime %} - -The block timestamp of this transaction. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/gno_traces_call_data.md b/models/doc_descriptions/traces/gno_traces_call_data.md deleted file mode 100644 index 360a596..0000000 --- a/models/doc_descriptions/traces/gno_traces_call_data.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_traces_call_data %} - -The raw JSON data for this trace. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/gno_traces_from.md b/models/doc_descriptions/traces/gno_traces_from.md deleted file mode 100644 index ddb64c6..0000000 --- a/models/doc_descriptions/traces/gno_traces_from.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_traces_gas.md b/models/doc_descriptions/traces/gno_traces_gas.md deleted file mode 100644 index bd2eb47..0000000 --- a/models/doc_descriptions/traces/gno_traces_gas.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_traces_gas %} - -The gas supplied for this trace. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/gno_traces_gas_used.md b/models/doc_descriptions/traces/gno_traces_gas_used.md deleted file mode 100644 index cdd4f2e..0000000 --- a/models/doc_descriptions/traces/gno_traces_gas_used.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_traces_gas_used %} - -The gas used for this trace. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/gno_traces_identifier.md b/models/doc_descriptions/traces/gno_traces_identifier.md deleted file mode 100644 index 68eb2e2..0000000 --- a/models/doc_descriptions/traces/gno_traces_identifier.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_traces_index.md b/models/doc_descriptions/traces/gno_traces_index.md deleted file mode 100644 index 06e15f9..0000000 --- a/models/doc_descriptions/traces/gno_traces_index.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_trace_index %} - -The index of the trace within the transaction. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/gno_traces_input.md b/models/doc_descriptions/traces/gno_traces_input.md deleted file mode 100644 index 03fb180..0000000 --- a/models/doc_descriptions/traces/gno_traces_input.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_traces_input %} - -The input data for this trace. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/gno_traces_output.md b/models/doc_descriptions/traces/gno_traces_output.md deleted file mode 100644 index 31f8516..0000000 --- a/models/doc_descriptions/traces/gno_traces_output.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_traces_output %} - -The output data for this trace. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/traces/gno_traces_sub.md b/models/doc_descriptions/traces/gno_traces_sub.md deleted file mode 100644 index 0340b4f..0000000 --- a/models/doc_descriptions/traces/gno_traces_sub.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_traces_table_doc.md b/models/doc_descriptions/traces/gno_traces_table_doc.md deleted file mode 100644 index 9d7ba53..0000000 --- a/models/doc_descriptions/traces/gno_traces_table_doc.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_traces_table_doc %} - -This table contains flattened trace data for internal contract calls on the Gnosis 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/gno_traces_to.md b/models/doc_descriptions/traces/gno_traces_to.md deleted file mode 100644 index 7e4ff1a..0000000 --- a/models/doc_descriptions/traces/gno_traces_to.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_traces_tx_hash.md b/models/doc_descriptions/traces/gno_traces_tx_hash.md deleted file mode 100644 index 9a3f046..0000000 --- a/models/doc_descriptions/traces/gno_traces_tx_hash.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_traces_type.md b/models/doc_descriptions/traces/gno_traces_type.md deleted file mode 100644 index 70db14f..0000000 --- a/models/doc_descriptions/traces/gno_traces_type.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_traces_value.md b/models/doc_descriptions/traces/gno_traces_value.md deleted file mode 100644 index 0752d0f..0000000 --- a/models/doc_descriptions/traces/gno_traces_value.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_traces_value %} - -The amount of xDAI transferred in this trace. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/gno_cumulative_gas_used.md b/models/doc_descriptions/transactions/gno_cumulative_gas_used.md deleted file mode 100644 index 5516938..0000000 --- a/models/doc_descriptions/transactions/gno_cumulative_gas_used.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_tx_block_hash.md b/models/doc_descriptions/transactions/gno_tx_block_hash.md deleted file mode 100644 index d2c3322..0000000 --- a/models/doc_descriptions/transactions/gno_tx_block_hash.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_tx_fee.md b/models/doc_descriptions/transactions/gno_tx_fee.md deleted file mode 100644 index 2ac9511..0000000 --- a/models/doc_descriptions/transactions/gno_tx_fee.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_tx_fee %} - -Amount paid to validate the transaction in xDAI. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/gno_tx_gas_limit.md b/models/doc_descriptions/transactions/gno_tx_gas_limit.md deleted file mode 100644 index 97d84b7..0000000 --- a/models/doc_descriptions/transactions/gno_tx_gas_limit.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_tx_gas_price.md b/models/doc_descriptions/transactions/gno_tx_gas_price.md deleted file mode 100644 index a958496..0000000 --- a/models/doc_descriptions/transactions/gno_tx_gas_price.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_tx_gas_price %} - -Cost per unit of gas in Gwei. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/gno_tx_gas_used.md b/models/doc_descriptions/transactions/gno_tx_gas_used.md deleted file mode 100644 index dbe49ad..0000000 --- a/models/doc_descriptions/transactions/gno_tx_gas_used.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_tx_gas_used %} - -Gas used by transaction. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/gno_tx_hash.md b/models/doc_descriptions/transactions/gno_tx_hash.md deleted file mode 100644 index 4559c0d..0000000 --- a/models/doc_descriptions/transactions/gno_tx_hash.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_tx_input_data.md b/models/doc_descriptions/transactions/gno_tx_input_data.md deleted file mode 100644 index 83c9e96..0000000 --- a/models/doc_descriptions/transactions/gno_tx_input_data.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_tx_json.md b/models/doc_descriptions/transactions/gno_tx_json.md deleted file mode 100644 index 815d822..0000000 --- a/models/doc_descriptions/transactions/gno_tx_json.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_tx_nonce.md b/models/doc_descriptions/transactions/gno_tx_nonce.md deleted file mode 100644 index bc0d880..0000000 --- a/models/doc_descriptions/transactions/gno_tx_nonce.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_tx_origin_sig.md b/models/doc_descriptions/transactions/gno_tx_origin_sig.md deleted file mode 100644 index 9f20989..0000000 --- a/models/doc_descriptions/transactions/gno_tx_origin_sig.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_tx_origin_sig %} - -The function signature of the contract call. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/gno_tx_position.md b/models/doc_descriptions/transactions/gno_tx_position.md deleted file mode 100644 index a22c6b7..0000000 --- a/models/doc_descriptions/transactions/gno_tx_position.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_tx_position %} - -The position of the transaction within the block. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/gno_tx_status.md b/models/doc_descriptions/transactions/gno_tx_status.md deleted file mode 100644 index 3572b9b..0000000 --- a/models/doc_descriptions/transactions/gno_tx_status.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_tx_status %} - -Status of the transaction. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transactions/gno_tx_table_doc.md b/models/doc_descriptions/transactions/gno_tx_table_doc.md deleted file mode 100644 index 6d7ade7..0000000 --- a/models/doc_descriptions/transactions/gno_tx_table_doc.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_tx_table_doc %} - -This table contains transaction level data for the Gnosis Blockchain. Each transaction will have a unique transaction hash, along with transactions fees and an xDAI value transferred when applicable. Transactions may be native xDAI 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/gno_value.md b/models/doc_descriptions/transactions/gno_value.md deleted file mode 100644 index 004151f..0000000 --- a/models/doc_descriptions/transactions/gno_value.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_value %} - -The value transacted in xDAI. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/gno_eth_amount.md b/models/doc_descriptions/transfers/gno_eth_amount.md deleted file mode 100644 index 3f7fed7..0000000 --- a/models/doc_descriptions/transfers/gno_eth_amount.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_xdai_amount %} - -xDAI value transferred. - -{% enddocs %} diff --git a/models/doc_descriptions/transfers/gno_eth_amount_usd.md b/models/doc_descriptions/transfers/gno_eth_amount_usd.md deleted file mode 100644 index 4621e33..0000000 --- a/models/doc_descriptions/transfers/gno_eth_amount_usd.md +++ /dev/null @@ -1,6 +0,0 @@ - -{% docs gno_xdai_amount_usd %} - -xDAI value transferred, in USD. - -{% enddocs %} diff --git a/models/doc_descriptions/transfers/gno_ez_eth_transfers_table_doc.md b/models/doc_descriptions/transfers/gno_ez_eth_transfers_table_doc.md deleted file mode 100644 index c6e1c90..0000000 --- a/models/doc_descriptions/transfers/gno_ez_eth_transfers_table_doc.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_ez_xdai_transfers_table_doc %} - -This table contains all native xDAI 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. *Column Name Update: `eth__address` has been migrated to `xdai__address`, values remain unchanged* - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/gno_ez_transfer_table_doc.md b/models/doc_descriptions/transfers/gno_ez_transfer_table_doc.md deleted file mode 100644 index 321e047..0000000 --- a/models/doc_descriptions/transfers/gno_ez_transfer_table_doc.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_ez_transfer_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 xDAI transfers are not included here. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/gno_log_id_transfers.md b/models/doc_descriptions/transfers/gno_log_id_transfers.md deleted file mode 100644 index 07797bb..0000000 --- a/models/doc_descriptions/transfers/gno_log_id_transfers.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_origin_from.md b/models/doc_descriptions/transfers/gno_origin_from.md deleted file mode 100644 index 6ca7559..0000000 --- a/models/doc_descriptions/transfers/gno_origin_from.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_eth_origin_from %} - -The from address at the transaction level. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/gno_origin_to.md b/models/doc_descriptions/transfers/gno_origin_to.md deleted file mode 100644 index efb6861..0000000 --- a/models/doc_descriptions/transfers/gno_origin_to.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_eth_origin_to %} - -The to address at the transaction level. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/gno_transfer_amount.md b/models/doc_descriptions/transfers/gno_transfer_amount.md deleted file mode 100644 index 340ef7a..0000000 --- a/models/doc_descriptions/transfers/gno_transfer_amount.md +++ /dev/null @@ -1,11 +0,0 @@ -{% docs gno_transfer_amount %} - -The decimal transformed amount for this token. Tokens without a decimal adjustment will be nulled out here. - -{% enddocs %} - -{% docs gno_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/gno_transfer_amount_usd.md b/models/doc_descriptions/transfers/gno_transfer_amount_usd.md deleted file mode 100644 index 52671e5..0000000 --- a/models/doc_descriptions/transfers/gno_transfer_amount_usd.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_transfer_contract_address.md b/models/doc_descriptions/transfers/gno_transfer_contract_address.md deleted file mode 100644 index 3714ec3..0000000 --- a/models/doc_descriptions/transfers/gno_transfer_contract_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_transfer_contract_address %} - -Contract address of the token being transferred. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/gno_transfer_from_address.md b/models/doc_descriptions/transfers/gno_transfer_from_address.md deleted file mode 100644 index 2a9dcb6..0000000 --- a/models/doc_descriptions/transfers/gno_transfer_from_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_transfer_from_address %} - -The sending address of this transfer. - -{% enddocs %} \ No newline at end of file diff --git a/models/doc_descriptions/transfers/gno_transfer_has_decimal.md b/models/doc_descriptions/transfers/gno_transfer_has_decimal.md deleted file mode 100644 index 5bb1233..0000000 --- a/models/doc_descriptions/transfers/gno_transfer_has_decimal.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_transfer_has_price.md b/models/doc_descriptions/transfers/gno_transfer_has_price.md deleted file mode 100644 index 7fd0ef8..0000000 --- a/models/doc_descriptions/transfers/gno_transfer_has_price.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_transfer_raw_amount.md b/models/doc_descriptions/transfers/gno_transfer_raw_amount.md deleted file mode 100644 index 2c3dbb0..0000000 --- a/models/doc_descriptions/transfers/gno_transfer_raw_amount.md +++ /dev/null @@ -1,11 +0,0 @@ -{% docs gno_transfer_raw_amount %} - -The amount of tokens transferred. This value is not decimal adjusted. - -{% enddocs %} - -{% docs gno_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/gno_transfer_to_address.md b/models/doc_descriptions/transfers/gno_transfer_to_address.md deleted file mode 100644 index 4bbf9af..0000000 --- a/models/doc_descriptions/transfers/gno_transfer_to_address.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_transfer_token_price.md b/models/doc_descriptions/transfers/gno_transfer_token_price.md deleted file mode 100644 index 33aba87..0000000 --- a/models/doc_descriptions/transfers/gno_transfer_token_price.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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/gno_transfer_tx_hash.md b/models/doc_descriptions/transfers/gno_transfer_tx_hash.md deleted file mode 100644 index f5b6270..0000000 --- a/models/doc_descriptions/transfers/gno_transfer_tx_hash.md +++ /dev/null @@ -1,5 +0,0 @@ -{% docs gno_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 deleted file mode 100644 index 577a226..0000000 --- a/models/github_actions/github_actions__current_task_status.sql +++ /dev/null @@ -1,6 +0,0 @@ -{{ 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 deleted file mode 100644 index 7f9db96..0000000 --- a/models/github_actions/github_actions__current_task_status.yml +++ /dev/null @@ -1,18 +0,0 @@ -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 - config: - severity: warn - - 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 deleted file mode 100644 index 9c35ce7..0000000 --- a/models/github_actions/github_actions__task_history.sql +++ /dev/null @@ -1,5 +0,0 @@ -{{ 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 deleted file mode 100644 index 117ded5..0000000 --- a/models/github_actions/github_actions__task_performance.sql +++ /dev/null @@ -1,5 +0,0 @@ -{{ 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 deleted file mode 100644 index ff95a44..0000000 --- a/models/github_actions/github_actions__task_schedule.sql +++ /dev/null @@ -1,5 +0,0 @@ -{{ 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 deleted file mode 100644 index feab82a..0000000 --- a/models/github_actions/github_actions__tasks.sql +++ /dev/null @@ -1,5 +0,0 @@ -{{ config( - materialized = 'view' -) }} - -{{ fsc_utils.gha_tasks_view() }} \ No newline at end of file diff --git a/models/gold/core/core__dim_contract_abis.sql b/models/gold/core/core__dim_contract_abis.sql deleted file mode 100644 index 00bc10d..0000000 --- a/models/gold/core/core__dim_contract_abis.sql +++ /dev/null @@ -1,16 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - contract_address, - DATA AS abi, - abi_source, - bytecode, - abis_id AS dim_contract_abis_id, - inserted_timestamp, - modified_timestamp -FROM - {{ ref('silver__abis') }} diff --git a/models/gold/core/core__dim_contract_abis.yml b/models/gold/core/core__dim_contract_abis.yml deleted file mode 100644 index c87fb89..0000000 --- a/models/gold/core/core__dim_contract_abis.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: 2 -models: - - name: core__dim_contract_abis - description: > - 'This table contains the contract ABIs that we have sourced from Gnosisscan, the community, or bytecode matched. This table is the source of ABIs used in the `core__ez_decoded_event_logs` and `core__fact_decoded_event_logs` tables. - We first try to source ABIs from Gnosisscan. If we cannot find an ABI on Gnosisscan, we will rely on user submissions. To add a contract to this table, please visit [here](https://science.flipsidecrypto.xyz/abi-requestor/). - If we are unable to locate an ABI for a contract from Gnosisscan or the community, we will try to find an ABI to use by matching the contract bytecode to a known contract bytecode we do have an ABI for.' - - columns: - - name: CONTRACT_ADDRESS - description: 'The address of the contract.' - - name: ABI - description: 'The JSON ABI for the contract.' - - name: ABI_SOURCE - description: 'The source of the ABI. This can be `Gnosisscan`, `user_submitted`, or `bytecode_matched`.' - - name: BYTECODE - description: 'The deployed bytecode of the contract.' - - diff --git a/models/gold/core/core__dim_contracts.sql b/models/gold/core/core__dim_contracts.sql deleted file mode 100644 index 8c65ce7..0000000 --- a/models/gold/core/core__dim_contracts.sql +++ /dev/null @@ -1,33 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - c0.created_contract_address AS address, - c1.token_symbol AS symbol, - c1.token_name AS NAME, - c1.token_decimals AS decimals, - c0.block_number AS created_block_number, - c0.block_timestamp AS created_block_timestamp, - c0.tx_hash AS created_tx_hash, - c0.creator_address AS creator_address, - COALESCE ( - c0.created_contracts_id, - {{ dbt_utils.generate_surrogate_key( - ['c0.created_contract_address'] - ) }} - ) AS dim_contracts_id, - GREATEST(COALESCE(c0.inserted_timestamp, '2000-01-01'), COALESCE(c1.inserted_timestamp, '2000-01-01')) AS inserted_timestamp, - GREATEST(COALESCE(c0.modified_timestamp, '2000-01-01'), COALESCE(c1.modified_timestamp, '2000-01-01')) AS modified_timestamp -FROM - {{ ref('silver__created_contracts') }} - c0 - LEFT JOIN {{ ref('silver__contracts') }} - c1 - ON LOWER( - c0.created_contract_address - ) = LOWER( - c1.contract_address - ) diff --git a/models/gold/core/core__dim_contracts.yml b/models/gold/core/core__dim_contracts.yml deleted file mode 100644 index 4505b6c..0000000 --- a/models/gold/core/core__dim_contracts.yml +++ /dev/null @@ -1,28 +0,0 @@ -version: 2 -models: - - name: core__dim_contracts - description: This table contains all the contracts that are deployed on the Gnosis blockchain along with their on-chain metadata. - - columns: - - name: ADDRESS - description: 'The address of the contract.' - - name: SYMBOL - description: 'The symbol of the contract.' - - name: NAME - description: 'The name of the contract.' - - name: DECIMALS - description: 'The number of decimals used to adjust amount for this contract.' - - name: CREATED_BLOCK_NUMBER - description: 'The block number when the contract was created' - - name: CREATED_BLOCK_TIMESTAMP - description: 'The block timestamp when the contract was created' - - name: CREATED_TX_HASH - description: 'The transaction hash when the contract was created' - - name: CREATOR_ADDRESS - description: 'The address of the creator of the contract' - - name: DIM_CONTRACTS_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/core/core__dim_labels.sql b/models/gold/core/core__dim_labels.sql deleted file mode 100644 index 21cefa2..0000000 --- a/models/gold/core/core__dim_labels.sql +++ /dev/null @@ -1,19 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - blockchain, - creator, - address, - address_name, - label_type, - label_subtype, - project_name, - labels_combined_id AS dim_labels_id, - inserted_timestamp, - modified_timestamp -FROM - {{ ref('silver__labels') }} diff --git a/models/gold/core/core__dim_labels.yml b/models/gold/core/core__dim_labels.yml deleted file mode 100644 index a9761b1..0000000 --- a/models/gold/core/core__dim_labels.yml +++ /dev/null @@ -1,60 +0,0 @@ -version: 2 -models: - - name: core__dim_labels - description: '{{ doc("table_dim_labels") }}' - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - BLOCKCHAIN - - CREATOR - - ADDRESS - columns: - - name: BLOCKCHAIN - description: '{{ doc("gno_label_blockchain") }}' - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_set: - value_set: ['gnosis'] - - name: CREATOR - description: '{{ doc("gno_label_creator") }}' - tests: - - not_null - - name: ADDRESS - description: '{{ doc("gno_label_address") }}' - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: ADDRESS_NAME - description: '{{ doc("gno_labels_table") }}' - tests: - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - STRING - - VARCHAR - - name: LABEL_TYPE - description: '{{ doc("gno_label_type") }}' - tests: - - not_null - - name: LABEL_SUBTYPE - description: '{{ doc("gno_label_subtype") }}' - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - STRING - - VARCHAR - - name: PROJECT_NAME - description: '{{ doc("gno_project_name") }}' - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - STRING - - VARCHAR - - name: DIM_LABELS_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/core/core__ez_decoded_event_logs.sql b/models/gold/core/core__ez_decoded_event_logs.sql deleted file mode 100644 index c68db4c..0000000 --- a/models/gold/core/core__ez_decoded_event_logs.sql +++ /dev/null @@ -1,68 +0,0 @@ -{{ config ( - materialized = "incremental", - unique_key = "ez_decoded_event_logs_id", - incremental_strategy = 'delete+insert', - cluster_by = "block_timestamp::date", - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(ez_decoded_event_logs_id, contract_name, contract_address)", - tags = ['decoded_logs'] -) }} - -SELECT - block_number, - block_timestamp, - tx_hash, - {# tx_position, #} -- new column - event_index, - contract_address, - topics, - topics [0] :: STRING AS topic_0, - --new column - topics [1] :: STRING AS topic_1, - --new column - topics [2] :: STRING AS topic_2, - --new column - topics [3] :: STRING AS topic_3, - --new column - DATA, - event_removed, - origin_from_address, - origin_to_address, - origin_function_signature, - CASE - WHEN tx_status = 'SUCCESS' THEN TRUE - ELSE FALSE - END AS tx_succeeded, - event_name, - decoded_data AS full_decoded_log, - decoded_flat AS decoded_log, - token_name AS contract_name, - COALESCE ( - decoded_logs_id, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash', 'event_index'] - ) }} - ) AS ez_decoded_event_logs_id, - -{% if is_incremental() %} -SYSDATE() AS inserted_timestamp, -SYSDATE() AS modified_timestamp, -{% else %} - GREATEST(block_timestamp, DATEADD('day', -10, SYSDATE())) AS inserted_timestamp, - GREATEST(block_timestamp, DATEADD('day', -10, SYSDATE())) AS modified_timestamp, -{% endif %} - -tx_status --deprecate -FROM - {{ ref('silver__decoded_logs') }} - l - LEFT JOIN {{ ref('silver__contracts') }} C USING (contract_address) -WHERE - 1 = 1 - -{% if is_incremental() %} -AND l.modified_timestamp > ( - SELECT - COALESCE(MAX(modified_timestamp), '2000-01-01' :: TIMESTAMP) - FROM - {{ this }}) - {% endif %} diff --git a/models/gold/core/core__ez_decoded_event_logs.yml b/models/gold/core/core__ez_decoded_event_logs.yml deleted file mode 100644 index af4317d..0000000 --- a/models/gold/core/core__ez_decoded_event_logs.yml +++ /dev/null @@ -1,75 +0,0 @@ -version: 2 -models: - - name: core__ez_decoded_event_logs - description: > - 'For information on how to submit a contract for decoding, as well as how ABIs are sourced, please visit [here](https://science.flipsidecrypto.xyz/abi-requestor/). - This model contains decoded event logs for contracts that we have an ABI for. Please note, this table does not include all event logs, only those that we have an ABI for. - The `decoded_log` column is the easiest place to query decoded data. It is a JSON object, where the keys are the names of the event parameters, and the values are the values of the event parameters. - You can select from this column using the following sample format, `decoded_log:from::string` or more generally, `decoded_log:::datatype`. See below for a full sample query. - The `full_decoded_logs` column contains the same information, as well as additional fields such as the datatype of the decoded data. You may need to laterally flatten this column to query the data. - - Sample query for USDC Transfer events: - - ```sql - select - tx_hash, - block_number, - contract_address, - decoded_log:from::string as from_address, - decoded_log:to::string as to_address, - decoded_log:value::integer as value - from ethereum.core.fact_decoded_event_logs - where contract_address = lower('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48') - and block_number between 16400000 and 16405000 - and event_name = 'Transfer' - limit 50```' - - columns: - - name: BLOCK_NUMBER - description: '{{ doc("gno_block_number") }}' - - name: BLOCK_TIMESTAMP - description: '{{ doc("gno_block_timestamp") }}' - - name: TX_HASH - description: '{{ doc("gno_logs_tx_hash") }}' - - name: EVENT_INDEX - description: '{{ doc("gno_event_index") }}' - - name: CONTRACT_ADDRESS - description: '{{ doc("gno_logs_contract_address") }}' - - name: CONTRACT_NAME - description: "The name of the contract, if the contract has a name() function." - - name: EVENT_NAME - description: "The name of the event, as defined in the contract ABI." - - name: DECODED_LOG - description: "The flattened decoded log, where the keys are the names of the event parameters, and the values are the values of the event parameters." - - name: FULL_DECODED_LOG - description: "The full decoded log, including the event name, the event parameters, and the data type of the event parameters." - - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("gno_tx_origin_sig") }}' - - name: ORIGIN_FROM_ADDRESS - description: '{{ doc("gno_origin_from") }}' - - name: ORIGIN_TO_ADDRESS - description: '{{ doc("gno_origin_to") }}' - - name: TOPICS - description: '{{ doc("gno_topics") }}' - - name: TOPIC_0 - description: '{{ doc("evm_topic_0") }}' - - name: TOPIC_1 - description: '{{ doc("evm_topic_1") }}' - - name: TOPIC_2 - description: '{{ doc("evm_topic_2") }}' - - name: TOPIC_3 - description: '{{ doc("evm_topic_3") }}' - - name: DATA - description: '{{ doc("gno_logs_data") }}' - - name: EVENT_REMOVED - description: '{{ doc("gno_event_removed") }}' - - name: TX_STATUS - description: '{{ doc("evm_column_deprecation_notice_tx_status") }}' - - name: TX_SUCCEEDED - description: '{{ doc("gno_tx_status") }}' - - name: EZ_DECODED_EVENT_LOGS_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' diff --git a/models/gold/core/core__ez_native_transfers.sql b/models/gold/core/core__ez_native_transfers.sql deleted file mode 100644 index 75ff1cb..0000000 --- a/models/gold/core/core__ez_native_transfers.sql +++ /dev/null @@ -1,27 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - block_number, - block_timestamp, - tx_hash, - tx_position, - trace_index, - from_address, - to_address, - amount, - amount_precise_raw, - amount_precise, - amount_usd, - origin_from_address, - origin_to_address, - origin_function_signature, - native_transfers_id AS ez_native_transfers_id, - inserted_timestamp, - modified_timestamp, - identifier --deprecate -FROM - {{ ref('silver__native_transfers') }} diff --git a/models/gold/core/core__ez_native_transfers.yml b/models/gold/core/core__ez_native_transfers.yml deleted file mode 100644 index 8695c52..0000000 --- a/models/gold/core/core__ez_native_transfers.yml +++ /dev/null @@ -1,42 +0,0 @@ -version: 2 -models: - - name: core__ez_native_transfers - description: '{{ doc("evm_ez_native_transfers_table_doc") }}' - - columns: - - name: TX_HASH - description: '{{ doc("gno_transfer_tx_hash") }}' - - name: BLOCK_NUMBER - description: '{{ doc("gno_block_number") }}' - - name: BLOCK_TIMESTAMP - description: '{{ doc("gno_block_timestamp") }}' - - name: TX_POSITION - description: '{{ doc("gno_tx_position") }}' - - name: TRACE_INDEX - description: '{{ doc("gno_trace_index") }}' - - name: IDENTIFIER - description: '{{ doc("evm_column_deprecation_notice_identifier") }}' - - name: ORIGIN_FROM_ADDRESS - description: '{{ doc("gno_origin_from") }}' - - name: ORIGIN_TO_ADDRESS - description: '{{ doc("gno_origin_to") }}' - - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("gno_origin_sig") }}' - - name: FROM_ADDRESS - description: '{{ doc("gno_transfer_from_address") }}' - - name: TO_ADDRESS - description: '{{ doc("gno_transfer_to_address") }}' - - name: AMOUNT - description: '{{ doc("gno_xdai_amount") }}' - - name: AMOUNT_PRECISE_RAW - description: '{{ doc("precise_amount_unadjusted") }}' - - name: AMOUNT_PRECISE - description: '{{ doc("precise_amount_adjusted") }}' - - name: AMOUNT_USD - description: '{{ doc("gno_xdai_amount_usd") }}' - - name: EZ_NATIVE_TRANSFERS_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' diff --git a/models/gold/core/core__ez_token_transfers.sql b/models/gold/core/core__ez_token_transfers.sql deleted file mode 100644 index 3dbc797..0000000 --- a/models/gold/core/core__ez_token_transfers.sql +++ /dev/null @@ -1,49 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - block_number, - block_timestamp, - tx_hash, - event_index, - origin_function_signature, - origin_from_address, - origin_to_address, - contract_address, - from_address, - to_address, - raw_amount_precise, - raw_amount, - amount_precise, - amount, - amount_usd, - decimals, - symbol, - COALESCE ( - transfers_id, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash', 'event_index'] - ) }} - ) AS ez_token_transfers_id, - COALESCE( - inserted_timestamp, - '2000-01-01' - ) AS inserted_timestamp, - COALESCE( - modified_timestamp, - '2000-01-01' - ) AS modified_timestamp, - token_price, - --deprecate - has_decimal, - --deprecate - has_price, - --deprecate - _log_id, - --deprecate - _inserted_timestamp --deprecate -FROM - {{ ref('silver__transfers') }} diff --git a/models/gold/core/core__ez_token_transfers.yml b/models/gold/core/core__ez_token_transfers.yml deleted file mode 100644 index eed0fa6..0000000 --- a/models/gold/core/core__ez_token_transfers.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: 2 -models: - - name: core__ez_token_transfers - description: '{{ doc("evm_ez_token_transfers_table_doc") }}' - - columns: - - name: BLOCK_NUMBER - description: '{{ doc("gno_block_number") }}' - - name: BLOCK_TIMESTAMP - description: '{{ doc("gno_block_timestamp") }}' - - name: TX_HASH - description: '{{ doc("gno_transfer_tx_hash") }}' - - name: EVENT_INDEX - description: '{{ doc("gno_event_index") }}' - - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("gno_origin_sig") }}' - - name: ORIGIN_FROM_ADDRESS - description: '{{ doc("gno_origin_from") }}' - - name: ORIGIN_TO_ADDRESS - description: '{{ doc("gno_origin_to") }}' - - name: CONTRACT_ADDRESS - description: '{{ doc("gno_transfer_contract_address") }}' - - name: FROM_ADDRESS - description: '{{ doc("gno_transfer_from_address") }}' - - name: TO_ADDRESS - description: '{{ doc("gno_transfer_to_address") }}' - - name: RAW_AMOUNT_PRECISE - description: '{{ doc("gno_transfer_raw_amount_precise") }}' - - name: RAW_AMOUNT - description: '{{ doc("gno_transfer_raw_amount") }}' - - name: AMOUNT_PRECISE - description: '{{ doc("gno_transfer_amount_precise") }}' - - name: TOKEN_PRICE - description: '{{ doc("gno_transfer_token_price") }}' - - name: AMOUNT - description: '{{ doc("gno_transfer_amount") }}' - - name: AMOUNT_USD - description: '{{ doc("gno_transfer_amount_usd") }}' - - name: DECIMALS - description: '{{ doc("gno_decimals") }}' - - name: SYMBOL - description: '{{ doc("gno_symbol") }}' - - name: TOKEN_PRICE - description: '{{ doc("evm_column_deprecation_notice_token_price") }}' - - name: HAS_DECIMAL - description: '{{ doc("evm_column_deprecation_notice_has_decimal") }}' - - name: HAS_PRICE - description: '{{ doc("evm_column_deprecation_notice_has_price") }}' - - name: _LOG_ID - description: '{{ doc("evm_column_deprecation_notice_log_id") }}' - - name: _INSERTED_TIMESTAMP - description: '{{ doc("evm_column_deprecation_notice_inserted_timestamp") }}' - - name: EZ_TOKEN_TRANSFERS_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' diff --git a/models/gold/core/core__fact_blocks.sql b/models/gold/core/core__fact_blocks.sql deleted file mode 100644 index 8632c76..0000000 --- a/models/gold/core/core__fact_blocks.sql +++ /dev/null @@ -1,113 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - A.block_number AS block_number, - HASH AS block_hash, - -- new column - block_timestamp, - 'mainnet' AS network, - tx_count, - SIZE, - miner, - extra_data, - parent_hash, - gas_used, - gas_limit, - base_fee_per_gas, - --new - difficulty, - total_difficulty, - sha3_uncles, - uncles AS uncle_blocks, - nonce, - --new column - receipts_root, - state_root, - -- new column - transactions_root, - -- new column - logs_bloom, - -- new column - {# withdrawals, - -- new column - withdrawals_root, - -- new column #} - COALESCE ( - blocks_id, - {{ dbt_utils.generate_surrogate_key( - ['a.block_number'] - ) }} - ) AS fact_blocks_id, - GREATEST( - COALESCE( - A.inserted_timestamp, - '2000-01-01' - ), - COALESCE( - d.inserted_timestamp, - '2000-01-01' - ) - ) AS inserted_timestamp, - GREATEST( - COALESCE( - A.modified_timestamp, - '2000-01-01' - ), - COALESCE( - d.modified_timestamp, - '2000-01-01' - ) - ) AS modified_timestamp, - 'gnosis' AS blockchain, - --deprecate - HASH, - --deprecate - OBJECT_CONSTRUCT( - 'baseFeePerGas', - base_fee_per_gas, - 'difficulty', - difficulty, - 'extraData', - extra_data, - 'gasLimit', - gas_limit, - 'gasUsed', - gas_used, - 'hash', - HASH, - 'logsBloom', - logs_bloom, - 'miner', - miner, - 'nonce', - nonce, - 'number', - NUMBER, - 'parentHash', - parent_hash, - 'receiptsRoot', - receipts_root, - 'sha3Uncles', - sha3_uncles, - 'size', - SIZE, - 'stateRoot', - state_root, - 'timestamp', - block_timestamp, - 'totalDifficulty', - total_difficulty, - 'transactionsRoot', - transactions_root, - 'uncles', - uncles - ) AS block_header_json --deprecate -FROM - {{ ref('silver__blocks') }} A - LEFT JOIN {{ ref('silver__tx_count') }} - d - ON A.block_number = d.block_number diff --git a/models/gold/core/core__fact_blocks.yml b/models/gold/core/core__fact_blocks.yml deleted file mode 100644 index 53ba877..0000000 --- a/models/gold/core/core__fact_blocks.yml +++ /dev/null @@ -1,60 +0,0 @@ -version: 2 -models: - - name: core__fact_blocks - description: '{{ doc("evm_blocks_table_doc") }}' - - columns: - - name: BLOCK_NUMBER - description: '{{ doc("evm_block_number") }}' - - name: BLOCK_TIMESTAMP - description: '{{ doc("evm_block_timestamp") }}' - - name: NETWORK - description: '{{ doc("evm_network") }}' - - name: BLOCKCHAIN - description: '{{ doc("evm_column_deprecation_notice_blockchain") }}' - - name: TX_COUNT - description: '{{ doc("evm_tx_count") }}' - - name: DIFFICULTY - description: '{{ doc("evm_difficulty") }}' - - name: TOTAL_DIFFICULTY - description: '{{ doc("evm_total_difficulty") }}' - - name: EXTRA_DATA - description: '{{ doc("evm_extra_data") }}' - - name: GAS_LIMIT - description: '{{ doc("evm_gas_limit") }}' - - name: GAS_USED - description: '{{ doc("evm_gas_used") }}' - - name: BASE_FEE_PER_GAS - description: '{{ doc("evm_base_fee_per_gas") }}' - - name: HASH - description: '{{ doc("evm_column_deprecation_notice_hash") }}' - - name: BLOCK_HASH - description: '{{ doc("evm_blocks_hash") }}' - - name: PARENT_HASH - description: '{{ doc("evm_parent_hash") }}' - - name: RECEIPTS_ROOT - description: '{{ doc("evm_receipts_root") }}' - - name: SHA3_UNCLES - description: '{{ doc("evm_sha3_uncles") }}' - - name: SIZE - description: '{{ doc("evm_size") }}' - - name: UNCLE_BLOCKS - description: '{{ doc("evm_uncle_blocks") }}' - - name: BLOCK_HEADER_JSON - description: '{{ doc("evm_column_deprecation_notice_block_header_json") }}' - - name: MINER - description: '{{ doc("evm_miner") }}' - - name: NONCE - description: '{{ doc("evm_blocks_nonce") }}' - - name: STATE_ROOT - description: '{{ doc("evm_state_root") }}' - - name: TRANSACTIONS_ROOT - description: '{{ doc("evm_transactions_root") }}' - - name: LOGS_BLOOM - description: '{{ doc("evm_logs_bloom") }}' - - name: FACT_BLOCKS_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' diff --git a/models/gold/core/core__fact_decoded_event_logs.sql b/models/gold/core/core__fact_decoded_event_logs.sql deleted file mode 100644 index aab1f0c..0000000 --- a/models/gold/core/core__fact_decoded_event_logs.sql +++ /dev/null @@ -1,31 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - block_number, - block_timestamp, - tx_hash, - event_index, - contract_address, - event_name, - decoded_flat AS decoded_log, - decoded_data AS full_decoded_log, - COALESCE ( - decoded_logs_id, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash', 'event_index'] - ) }} - ) AS fact_decoded_event_logs_id, - COALESCE( - inserted_timestamp, - '2000-01-01' - ) AS inserted_timestamp, - COALESCE( - modified_timestamp, - '2000-01-01' - ) AS modified_timestamp -FROM - {{ ref('silver__decoded_logs') }} diff --git a/models/gold/core/core__fact_decoded_event_logs.yml b/models/gold/core/core__fact_decoded_event_logs.yml deleted file mode 100644 index f644c99..0000000 --- a/models/gold/core/core__fact_decoded_event_logs.yml +++ /dev/null @@ -1,28 +0,0 @@ -version: 2 -models: - - name: core__fact_decoded_event_logs - description: '{{ doc("evm_table_deprecation_notice_fact_decoded_event_logs") }}' - - columns: - - name: BLOCK_NUMBER - description: '{{ doc("gno_block_number") }}' - - name: BLOCK_TIMESTAMP - description: '{{ doc("gno_block_timestamp") }}' - - name: TX_HASH - description: '{{ doc("gno_logs_tx_hash") }}' - - name: EVENT_INDEX - description: '{{ doc("gno_event_index") }}' - - name: CONTRACT_ADDRESS - description: '{{ doc("gno_logs_contract_address") }}' - - name: EVENT_NAME - description: "The name of the event, as defined in the contract ABI." - - name: DECODED_LOG - description: "The flattened decoded log, where the keys are the names of the event parameters, and the values are the values of the event parameters." - - name: FULL_DECODED_LOG - description: "The full decoded log, including the event name, the event parameters, and the data type of the event parameters." - - name: FACT_DECODED_EVENT_LOGS_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' diff --git a/models/gold/core/core__fact_event_logs.sql b/models/gold/core/core__fact_event_logs.sql deleted file mode 100644 index e2bb5c6..0000000 --- a/models/gold/core/core__fact_event_logs.sql +++ /dev/null @@ -1,50 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - block_number, - block_timestamp, - tx_hash, - event_index, - contract_address, - topics, - topics [0] :: STRING AS topic_0, - --new column - topics [1] :: STRING AS topic_1, - --new column - topics [2] :: STRING AS topic_2, - --new column - topics [3] :: STRING AS topic_3, - --new column - DATA, - event_removed, - origin_function_signature, - origin_from_address, - origin_to_address, - CASE - WHEN tx_status = 'SUCCESS' THEN TRUE - ELSE FALSE - END AS tx_succeeded, - -- new column - COALESCE ( - logs_id, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash', 'event_index'] - ) }} - ) AS fact_event_logs_id, - COALESCE( - inserted_timestamp, - '2000-01-01' - ) AS inserted_timestamp, - COALESCE( - modified_timestamp, - '2000-01-01' - ) AS modified_timestamp, - tx_status, - --deprecate - _log_id --deprecate -FROM - {{ ref('silver__logs') }} diff --git a/models/gold/core/core__fact_event_logs.yml b/models/gold/core/core__fact_event_logs.yml deleted file mode 100644 index 45fc35b..0000000 --- a/models/gold/core/core__fact_event_logs.yml +++ /dev/null @@ -1,48 +0,0 @@ -version: 2 -models: - - name: core__fact_event_logs - description: '{{ doc("evm_logs_table_doc") }}' - - columns: - - name: BLOCK_NUMBER - description: '{{ doc("evm_block_number") }}' - - name: BLOCK_TIMESTAMP - description: '{{ doc("evm_block_timestamp") }}' - - name: TX_HASH - description: '{{ doc("evm_logs_tx_hash") }}' - - name: EVENT_INDEX - description: '{{ doc("evm_event_index") }}' - - name: CONTRACT_ADDRESS - description: '{{ doc("evm_logs_contract_address") }}' - - name: TOPICS - description: '{{ doc("evm_topics") }}' - - name: TOPIC_0 - description: '{{ doc("evm_topic_0") }}' - - name: TOPIC_1 - description: '{{ doc("evm_topic_1") }}' - - name: TOPIC_2 - description: '{{ doc("evm_topic_2") }}' - - name: TOPIC_3 - description: '{{ doc("evm_topic_3") }}' - - name: DATA - description: '{{ doc("evm_logs_data") }}' - - name: EVENT_REMOVED - description: '{{ doc("evm_event_removed") }}' - - name: _LOG_ID - description: '{{ doc("evm_column_deprecation_notice_log_id") }}' - - name: TX_STATUS - description: '{{ doc("evm_column_deprecation_notice_tx_status") }}' - - name: TX_SUCCEEDED - description: '{{ doc("evm_tx_succeeded") }}' - - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("evm_origin_sig") }}' - - name: ORIGIN_FROM_ADDRESS - description: '{{ doc("evm_origin_from") }}' - - name: ORIGIN_TO_ADDRESS - description: '{{ doc("evm_origin_to") }}' - - name: FACT_EVENT_LOGS_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' diff --git a/models/gold/core/core__fact_token_transfers.sql b/models/gold/core/core__fact_token_transfers.sql deleted file mode 100644 index 8908c54..0000000 --- a/models/gold/core/core__fact_token_transfers.sql +++ /dev/null @@ -1,36 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - block_number, - block_timestamp, - tx_hash, - event_index, - origin_function_signature, - origin_from_address, - origin_to_address, - contract_address, - from_address, - to_address, - raw_amount, - raw_amount_precise, - _log_id, - COALESCE ( - transfers_id, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash', 'event_index'] - ) }} - ) AS fact_token_transfers_id, - COALESCE( - inserted_timestamp, - '2000-01-01' - ) AS inserted_timestamp, - COALESCE( - modified_timestamp, - '2000-01-01' - ) AS modified_timestamp -FROM - {{ ref('silver__transfers') }} diff --git a/models/gold/core/core__fact_token_transfers.yml b/models/gold/core/core__fact_token_transfers.yml deleted file mode 100644 index e8db3b3..0000000 --- a/models/gold/core/core__fact_token_transfers.yml +++ /dev/null @@ -1,38 +0,0 @@ -version: 2 -models: - - name: core__fact_token_transfers - description: '{{ doc("evm_table_deprecation_notice_fact_token_transfers") }}' - - columns: - - name: BLOCK_NUMBER - description: '{{ doc("gno_block_number") }}' - - name: BLOCK_TIMESTAMP - description: '{{ doc("gno_block_timestamp") }}' - - name: TX_HASH - description: '{{ doc("gno_transfer_tx_hash") }}' - - name: EVENT_INDEX - description: '{{ doc("gno_event_index") }}' - - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("gno_origin_sig") }}' - - name: ORIGIN_FROM_ADDRESS - description: '{{ doc("gno_origin_from") }}' - - name: ORIGIN_TO_ADDRESS - description: '{{ doc("gno_origin_to") }}' - - name: CONTRACT_ADDRESS - description: '{{ doc("gno_transfer_contract_address") }}' - - name: FROM_ADDRESS - description: '{{ doc("gno_transfer_from_address") }}' - - name: TO_ADDRESS - description: '{{ doc("gno_transfer_to_address") }}' - - name: RAW_AMOUNT - description: '{{ doc("gno_transfer_raw_amount") }}' - - name: RAW_AMOUNT_PRECISE - description: '{{ doc("gno_transfer_raw_amount_precise") }}' - - name: _LOG_ID - description: '{{ doc("internal_column") }}' - - name: FACT_TOKEN_TRANSFERS_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' diff --git a/models/gold/core/core__fact_traces.sql b/models/gold/core/core__fact_traces.sql deleted file mode 100644 index cc13c07..0000000 --- a/models/gold/core/core__fact_traces.sql +++ /dev/null @@ -1,493 +0,0 @@ -{{ config ( - materialized = "incremental", - incremental_strategy = 'delete+insert', - unique_key = "block_number", - cluster_by = "block_timestamp::date", - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION", - tags = ['non_realtime'], - full_refresh = false -) }} -{# {{ fsc_evm.gold_traces_v1( -full_reload_start_block = 5000000, -full_reload_blocks = 3000000 -) }} -#} -WITH silver_traces AS ( - - SELECT - block_number, - tx_position, - trace_address, - parent_trace_address, - trace_address_array, - trace_json, - traces_id, - 'regular' AS source - FROM - {{ ref('silver__traces') }} - WHERE - 1 = 1 - -{% if is_incremental() and not full_reload_mode %} -AND modified_timestamp > ( - SELECT - MAX(modified_timestamp) - FROM - {{ this }} -) {% elif is_incremental() and full_reload_mode %} -AND block_number BETWEEN ( - SELECT - MAX( - block_number - ) - FROM - {{ this }} -) -AND ( - SELECT - MAX( - block_number - ) + 3000000 - FROM - {{ this }} -) -{% else %} - AND block_number <= 5000000 -{% endif %} -), -sub_traces AS ( - SELECT - block_number, - tx_position, - parent_trace_address, - COUNT(*) AS sub_traces - FROM - silver_traces - GROUP BY - block_number, - tx_position, - parent_trace_address -), -trace_index_array AS ( - SELECT - block_number, - tx_position, - trace_address, - ARRAY_AGG(flat_value) AS number_array - FROM - ( - SELECT - block_number, - tx_position, - trace_address, - IFF( - VALUE :: STRING = 'ORIGIN', - -1, - VALUE :: INT - ) AS flat_value - FROM - silver_traces, - LATERAL FLATTEN ( - input => trace_address_array - ) - ) - GROUP BY - block_number, - tx_position, - trace_address -), -trace_index_sub_traces AS ( - SELECT - b.block_number, - b.tx_position, - b.trace_address, - IFNULL( - sub_traces, - 0 - ) AS sub_traces, - number_array, - ROW_NUMBER() over ( - PARTITION BY b.block_number, - b.tx_position - ORDER BY - number_array ASC - ) - 1 AS trace_index, - b.trace_json, - b.traces_id, - b.source - FROM - silver_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 trace_index_array n - ON b.block_number = n.block_number - AND b.tx_position = n.tx_position - AND b.trace_address = n.trace_address -), -errored_traces AS ( - SELECT - block_number, - tx_position, - trace_address, - trace_json - FROM - trace_index_sub_traces - WHERE - trace_json :error :: STRING IS NOT NULL -), -error_logic AS ( - SELECT - b0.block_number, - b0.tx_position, - b0.trace_address, - b0.trace_json :error :: STRING AS error, - b1.trace_json :error :: STRING AS any_error, - b2.trace_json :error :: STRING AS origin_error - FROM - trace_index_sub_traces b0 - LEFT JOIN errored_traces b1 - ON b0.block_number = b1.block_number - AND b0.tx_position = b1.tx_position - AND b0.trace_address RLIKE CONCAT( - '^', - b1.trace_address, - '(_[0-9]+)*$' - ) - LEFT JOIN errored_traces b2 - ON b0.block_number = b2.block_number - AND b0.tx_position = b2.tx_position - AND b2.trace_address = 'ORIGIN' -), -aggregated_errors AS ( - SELECT - block_number, - tx_position, - trace_address, - error, - IFF(MAX(any_error) IS NULL - AND error IS NULL - AND origin_error IS NULL, TRUE, FALSE) AS trace_succeeded - FROM - error_logic - GROUP BY - block_number, - tx_position, - trace_address, - error, - origin_error), - json_traces AS ( - SELECT - block_number, - tx_position, - trace_address, - sub_traces, - number_array, - trace_index, - trace_json AS DATA, - trace_succeeded, - trace_json :error :: STRING AS error_reason, - trace_json :revertReason :: STRING AS revert_reason, - trace_json :from :: STRING AS from_address, - trace_json :to :: STRING AS to_address, - IFNULL( - trace_json :value :: STRING, - '0x0' - ) AS value_hex, - IFNULL( - utils.udf_hex_to_int( - trace_json :value :: STRING - ), - '0' - ) AS value_precise_raw, - utils.udf_decimal_adjust( - value_precise_raw, - 18 - ) AS value_precise, - value_precise :: FLOAT AS 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, - IFF( - trace_succeeded, - 'SUCCESS', - 'FAIL' - ) AS trace_status, - traces_id - FROM - trace_index_sub_traces - JOIN aggregated_errors USING ( - block_number, - tx_position, - trace_address - ) - ), - incremental_traces AS ( - SELECT - f.block_number, - t.tx_hash, - t.block_timestamp, - t.origin_function_signature, - t.from_address AS origin_from_address, - t.to_address AS origin_to_address, - t.tx_status, - f.tx_position, - f.trace_index, - f.from_address AS from_address, - f.to_address AS to_address, - f.value_hex, - f.value_precise_raw, - f.value_precise, - f.value, - f.gas, - f.gas_used, - f.input, - f.output, - f.type, - f.identifier, - f.sub_traces, - f.error_reason, - f.revert_reason, - f.trace_status, - f.data, - f.traces_id, - f.trace_succeeded, - f.trace_address, - IFF( - t.tx_status = 'SUCCESS', - TRUE, - FALSE - ) AS tx_succeeded - FROM - json_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 not full_reload_mode %} -AND t.modified_timestamp >= ( - SELECT - DATEADD('hour', -24, MAX(modified_timestamp)) - FROM - {{ this }}) - {% endif %} -) - -{% if is_incremental() %}, -overflow_blocks AS ( - SELECT - DISTINCT block_number - FROM - silver_traces - WHERE - source = 'overflow' -), -heal_missing_data AS ( - SELECT - t.block_number, - txs.tx_hash, - txs.block_timestamp, - txs.origin_function_signature, - txs.from_address AS origin_from_address, - txs.to_address AS origin_to_address, - txs.tx_status, - t.tx_position, - t.trace_index, - t.from_address, - t.to_address, - t.value_hex, - t.value_precise_raw, - t.value_precise, - t.value, - t.gas, - t.gas_used, - t.input, - t.output, - t.type, - t.identifier, - t.sub_traces, - t.error_reason, - t.revert_reason, - t.trace_status, - t.data, - t.fact_traces_id AS traces_id, - t.trace_succeeded, - t.trace_address, - IFF( - txs.tx_status = 'SUCCESS', - TRUE, - FALSE - ) AS tx_succeeded - FROM - {{ this }} - t - JOIN {{ ref('silver__transactions') }} - txs - ON t.tx_position = txs.position - AND t.block_number = txs.block_number - WHERE - t.tx_hash IS NULL - OR t.block_timestamp IS NULL - OR t.tx_status IS NULL -) -{% endif %}, -all_traces AS ( - SELECT - block_number, - tx_hash, - block_timestamp, - origin_function_signature, - origin_from_address, - origin_to_address, - tx_status, - tx_position, - trace_index, - from_address, - to_address, - value_hex, - value_precise_raw, - value_precise, - VALUE, - gas, - gas_used, - input, - output, - TYPE, - identifier, - sub_traces, - error_reason, - revert_reason, - trace_status, - DATA, - trace_succeeded, - trace_address, - tx_succeeded - FROM - incremental_traces - -{% if is_incremental() %} -UNION ALL -SELECT - block_number, - tx_hash, - block_timestamp, - origin_function_signature, - origin_from_address, - origin_to_address, - tx_status, - tx_position, - trace_index, - from_address, - to_address, - value_hex, - value_precise_raw, - value_precise, - VALUE, - gas, - gas_used, - input, - output, - TYPE, - identifier, - sub_traces, - error_reason, - revert_reason, - trace_status, - DATA, - trace_succeeded, - trace_address, - tx_succeeded -FROM - heal_missing_data -UNION ALL -SELECT - block_number, - tx_hash, - block_timestamp, - origin_function_signature, - origin_from_address, - origin_to_address, - tx_status, - tx_position, - trace_index, - from_address, - to_address, - value_hex, - value_precise_raw, - value_precise, - VALUE, - gas, - gas_used, - input, - output, - TYPE, - identifier, - sub_traces, - error_reason, - revert_reason, - trace_status, - DATA, - trace_succeeded, - trace_address, - tx_succeeded -FROM - {{ this }} - JOIN overflow_blocks USING (block_number) -{% endif %} -) -SELECT - block_number, - block_timestamp, - tx_hash, - tx_position, - trace_index, - from_address, - to_address, - input, - output, - TYPE, - trace_address, - sub_traces, - VALUE, - value_precise_raw, - value_precise, - value_hex, - gas, - gas_used, - origin_from_address, - origin_to_address, - origin_function_signature, - trace_succeeded, - error_reason, - revert_reason, - tx_succeeded, - identifier, - --deprecate - DATA, - --deprecate - tx_status, - --deprecate - trace_status, - --deprecate - {{ dbt_utils.generate_surrogate_key( - ['tx_hash', 'trace_index'] - ) }} AS fact_traces_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp -FROM - all_traces qualify(ROW_NUMBER() over(PARTITION BY block_number, tx_position, trace_index -ORDER BY - modified_timestamp DESC, block_timestamp DESC nulls last)) = 1 diff --git a/models/gold/core/core__fact_traces.yml b/models/gold/core/core__fact_traces.yml deleted file mode 100644 index 0e05c85..0000000 --- a/models/gold/core/core__fact_traces.yml +++ /dev/null @@ -1,64 +0,0 @@ -version: 2 -models: - - name: core__fact_traces - description: '{{ doc("evm_traces_table_doc") }}' - - columns: - - name: BLOCK_NUMBER - description: '{{ doc("evm_traces_block_no") }}' - - name: BLOCK_TIMESTAMP - description: '{{ doc("evm_traces_blocktime") }}' - - name: TX_HASH - description: '{{ doc("evm_traces_tx_hash") }}' - - name: TX_POSITION - description: '{{ doc("evm_tx_position") }}' - - name: FROM_ADDRESS - description: '{{ doc("evm_traces_from") }}' - - name: TO_ADDRESS - description: '{{ doc("evm_traces_to") }}' - - name: VALUE - description: '{{ doc("evm_traces_value") }}' - - name: VALUE_PRECISE_RAW - description: '{{ doc("evm_precise_amount_unadjusted") }}' - - name: VALUE_PRECISE - description: '{{ doc("evm_precise_amount_adjusted") }}' - - name: VALUE_HEX - description: '{{ doc("evm_value_hex") }}' - - name: GAS - description: '{{ doc("evm_traces_gas") }}' - - name: GAS_USED - description: '{{ doc("evm_traces_gas_used") }}' - - name: INPUT - description: '{{ doc("evm_traces_input") }}' - - name: OUTPUT - description: '{{ doc("evm_traces_output") }}' - - name: TYPE - description: '{{ doc("evm_traces_type") }}' - - name: IDENTIFIER - description: '{{ doc("evm_column_deprecation_notice_identifier") }}' - - name: TRACE_ADDRESS - description: '{{ doc("evm_trace_address") }}' - - name: DATA - description: '{{ doc("evm_column_deprecation_notice_data") }}' - - name: TX_STATUS - description: '{{ doc("evm_column_deprecation_notice_tx_status") }}' - - name: TX_SUCCEEDED - description: '{{ doc("evm_tx_succeeded") }}' - - name: TRACE_SUCCEEDED - description: '{{ doc("evm_trace_succeeded") }}' - - name: SUB_TRACES - description: '{{ doc("evm_sub_traces") }}' - - name: TRACE_STATUS - description: '{{ doc("evm_column_deprecation_notice_trace_status") }}' - - name: ERROR_REASON - description: '{{ doc("evm_trace_error_reason") }}' - - name: REVERT_REASON - description: '{{ doc("evm_revert_reason") }}' - - name: TRACE_INDEX - description: The index of the trace within the transaction. - - name: FACT_TRACES_ID - description: '{{ doc("evm_pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("evm_inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("evm_modified_timestamp") }}' diff --git a/models/gold/core/core__fact_transactions.sql b/models/gold/core/core__fact_transactions.sql deleted file mode 100644 index 42046a1..0000000 --- a/models/gold/core/core__fact_transactions.sql +++ /dev/null @@ -1,58 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - block_number, - block_timestamp, - tx_hash, - from_address, - to_address, - origin_function_signature, - VALUE, - value_precise_raw, - value_precise, - tx_fee, - tx_fee_precise, - CASE - WHEN tx_status = 'SUCCESS' THEN TRUE - ELSE FALSE - END AS tx_succeeded, - tx_type, - nonce, - POSITION AS tx_position, - -- new - input_data, - gas_price, - gas_used, - gas AS gas_limit, - cumulative_gas_used, - effective_gas_price, - max_fee_per_gas, - max_priority_fee_per_gas, - r, - s, - v, - COALESCE ( - transactions_id, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash'] - ) }} - ) AS fact_transactions_id, - COALESCE( - inserted_timestamp, - '2000-01-01' - ) AS inserted_timestamp, - COALESCE( - modified_timestamp, - '2000-01-01' - ) AS modified_timestamp, - block_hash, - --deprecate - tx_status AS status, - --deprecate - POSITION --deprecate -FROM - {{ ref('silver__transactions') }} diff --git a/models/gold/core/core__fact_transactions.yml b/models/gold/core/core__fact_transactions.yml deleted file mode 100644 index 059fdd6..0000000 --- a/models/gold/core/core__fact_transactions.yml +++ /dev/null @@ -1,70 +0,0 @@ -version: 2 -models: - - name: core__fact_transactions - description: '{{ doc("evm_tx_table_doc") }}' - - columns: - - name: BLOCK_NUMBER - description: '{{ doc("evm_block_number") }}' - - name: BLOCK_TIMESTAMP - description: '{{ doc("evm_block_timestamp") }}' - - name: BLOCK_HASH - description: '{{ doc("evm_column_deprecation_notice_block_hash") }}' - - name: TX_HASH - description: '{{ doc("evm_tx_hash") }}' - - name: NONCE - description: '{{ doc("evm_tx_nonce") }}' - - name: POSITION - description: '{{ doc("evm_column_deprecation_notice_position") }}' - - name: TX_POSITION - description: '{{ doc("evm_tx_position") }}' - - name: FROM_ADDRESS - description: '{{ doc("evm_from_address") }}' - - name: TO_ADDRESS - description: '{{ doc("evm_to_address") }}' - - name: VALUE - description: '{{ doc("evm_value") }}' - - name: VALUE_PRECISE_RAW - description: '{{ doc("precise_amount_unadjusted") }}' - - name: VALUE_PRECISE - description: '{{ doc("precise_amount_adjusted") }}' - - name: TX_FEE - description: '{{ doc("evm_tx_fee") }}' - - name: TX_FEE_PRECISE - description: '{{ doc("tx_fee_precise") }}' - - name: GAS_PRICE - description: '{{ doc("evm_tx_gas_price") }}' - - name: GAS_USED - description: '{{ doc("evm_tx_gas_used") }}' - - name: GAS_LIMIT - description: '{{ doc("evm_tx_gas_limit") }}' - - name: CUMULATIVE_GAS_USED - description: '{{ doc("evm_cumulative_gas_used") }}' - - name: EFFECTIVE_GAS_PRICE - description: '{{ doc("evm_effective_gas_price") }}' - - name: MAX_FEE_PER_GAS - description: The maximum fee per gas of the transaction, in Gwei. - - name: MAX_PRIORITY_FEE_PER_GAS - description: The maximum priority fee per gas of the transaction, in Gwei. - - name: STATUS - description: '{{ doc("evm_column_deprecation_notice_tx_status") }}' - - name: TX_SUCCEEDED - description: '{{ doc("evm_tx_succeeded") }}' - - name: INPUT_DATA - description: '{{ doc("evm_tx_input_data") }}' - - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("evm_tx_origin_sig") }}' - - name: TX_TYPE - description: The type of the transaction, 2 for EIP-1559 transactions and 0 for legacy transactions. - - name: r - description: The r value of the transaction signature. - - name: s - description: The s value of the transaction signature. - - name: v - description: The v value of the transaction signature. - - name: FACT_TRANSACTIONS_ID - description: '{{ doc("evm_pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("evm_inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("evm_modified_timestamp") }}' diff --git a/models/gold/core/tests/traces/test_gold__fact_traces_full.sql b/models/gold/core/tests/traces/test_gold__fact_traces_full.sql deleted file mode 100644 index ced1fba..0000000 --- a/models/gold/core/tests/traces/test_gold__fact_traces_full.sql +++ /dev/null @@ -1,9 +0,0 @@ -{{ config ( - materialized = "view", - tags = ['full_test'] -) }} - -SELECT - * -FROM - {{ ref('core__fact_traces') }} diff --git a/models/gold/core/tests/traces/test_gold__fact_traces_full.yml b/models/gold/core/tests/traces/test_gold__fact_traces_full.yml deleted file mode 100644 index 6677117..0000000 --- a/models/gold/core/tests/traces/test_gold__fact_traces_full.yml +++ /dev/null @@ -1,120 +0,0 @@ -version: 2 -models: - - name: test_gold__fact_traces_full - description: "This is a view used to test all of the gold fact traces model." - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TX_HASH - - TRACE_INDEX - - fsc_utils.sequence_gaps: - partition_by: - - TX_HASH - column_name: TRACE_INDEX - where: BLOCK_TIMESTAMP < CURRENT_DATE - 1 AND TX_HASH IS NOT NULL - - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: BLOCK_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 2 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_LTZ - - TIMESTAMP_NTZ - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TX_POSITION - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: TRACE_INDEX - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: FROM_ADDRESS - tests: - - not_null: - where: TYPE <> 'SELFDESTRUCT' - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TO_ADDRESS - tests: - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - where: TO_ADDRESS IS NOT NULL - - name: INPUT - tests: - - not_null - - name: TYPE - tests: - - not_null - - name: TRACE_ADDRESS - tests: - - not_null - - name: SUB_TRACES - tests: - - not_null - - name: VALUE - tests: - - not_null - - name: VALUE_PRECISE_RAW - tests: - - not_null - - name: VALUE_PRECISE - tests: - - not_null - - name: VALUE_HEX - tests: - - not_null - - name: GAS - tests: - - not_null - - name: GAS_USED - tests: - - not_null - - name: ORIGIN_FROM_ADDRESS - tests: - - not_null - - name: ORIGIN_FUNCTION_SIGNATURE - tests: - - not_null - - name: TRACE_SUCCEEDED - tests: - - not_null - - name: TX_SUCCEEDED - tests: - - not_null - - name: FACT_TRACES_ID - tests: - - not_null - - name: INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 2 - - name: MODIFIED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 2 diff --git a/models/gold/core/tests/traces/test_gold__fact_traces_recent.sql b/models/gold/core/tests/traces/test_gold__fact_traces_recent.sql deleted file mode 100644 index 4bed00f..0000000 --- a/models/gold/core/tests/traces/test_gold__fact_traces_recent.sql +++ /dev/null @@ -1,16 +0,0 @@ -{{ config ( - materialized = "view", - tags = ['recent_test'] -) }} - -SELECT - * -FROM - {{ ref('core__fact_traces') }} -WHERE - block_number > ( - SELECT - block_number - FROM - {{ ref('_block_lookback') }} - ) diff --git a/models/gold/core/tests/traces/test_gold__fact_traces_recent.yml b/models/gold/core/tests/traces/test_gold__fact_traces_recent.yml deleted file mode 100644 index 4206f50..0000000 --- a/models/gold/core/tests/traces/test_gold__fact_traces_recent.yml +++ /dev/null @@ -1,120 +0,0 @@ -version: 2 -models: - - name: test_gold__fact_traces_recent - description: "This is a view used to test the last three days of fact traces." - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TX_HASH - - TRACE_INDEX - - fsc_utils.sequence_gaps: - partition_by: - - TX_HASH - column_name: TRACE_INDEX - where: TX_HASH IS NOT NULL - - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: BLOCK_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 2 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_LTZ - - TIMESTAMP_NTZ - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TX_POSITION - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: TRACE_INDEX - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: FROM_ADDRESS - tests: - - not_null: - where: TYPE <> 'SELFDESTRUCT' - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TO_ADDRESS - tests: - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - where: TO_ADDRESS IS NOT NULL - - name: INPUT - tests: - - not_null - - name: TYPE - tests: - - not_null - - name: TRACE_ADDRESS - tests: - - not_null - - name: SUB_TRACES - tests: - - not_null - - name: VALUE - tests: - - not_null - - name: VALUE_PRECISE_RAW - tests: - - not_null - - name: VALUE_PRECISE - tests: - - not_null - - name: VALUE_HEX - tests: - - not_null - - name: GAS - tests: - - not_null - - name: GAS_USED - tests: - - not_null - - name: ORIGIN_FROM_ADDRESS - tests: - - not_null - - name: ORIGIN_FUNCTION_SIGNATURE - tests: - - not_null - - name: TRACE_SUCCEEDED - tests: - - not_null - - name: TX_SUCCEEDED - tests: - - not_null - - name: FACT_TRACES_ID - tests: - - not_null - - name: INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 2 - - name: MODIFIED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 2 diff --git a/models/gold/defi/defi__dim_dex_liquidity_pools.sql b/models/gold/defi/defi__dim_dex_liquidity_pools.sql index e0f30d3..1671d71 100644 --- a/models/gold/defi/defi__dim_dex_liquidity_pools.sql +++ b/models/gold/defi/defi__dim_dex_liquidity_pools.sql @@ -9,7 +9,8 @@ 'PURPOSE': 'DEX, LIQUIDITY, POOLS, LP, SWAPS', } } - } + }, + tags = ['gold','defi','dex','curated'] ) }} SELECT diff --git a/models/gold/defi/defi__dim_dex_liquidity_pools.yml b/models/gold/defi/defi__dim_dex_liquidity_pools.yml index 99262fe..76e1d7b 100644 --- a/models/gold/defi/defi__dim_dex_liquidity_pools.yml +++ b/models/gold/defi/defi__dim_dex_liquidity_pools.yml @@ -1,32 +1,32 @@ version: 2 models: - name: defi__dim_dex_liquidity_pools - description: '{{ doc("eth_dex_lp_table_doc") }}' + description: '{{ doc("evm_dim_dex_lp_table_doc") }}' columns: - name: CREATION_BLOCK - description: '{{ doc("eth_dex_creation_block") }}' + description: '{{ doc("evm_dex_creation_block") }}' - name: CREATION_TIME - description: '{{ doc("eth_dex_creation_time") }}' + description: '{{ doc("evm_dex_creation_time") }}' - name: CREATION_TX - description: '{{ doc("eth_dex_creation_tx") }}' + description: '{{ doc("evm_dex_creation_tx") }}' - name: FACTORY_ADDRESS - description: '{{ doc("eth_dex_factory_address") }}' + description: '{{ doc("evm_dex_factory_address") }}' - name: PLATFORM - description: '{{ doc("eth_dex_platform") }}' + description: '{{ doc("evm_dex_platform") }}' - name: POOL_ADDRESS - description: '{{ doc("eth_dex_pool_address") }}' + description: '{{ doc("evm_dex_pool_address") }}' - name: POOL_NAME - description: '{{ doc("eth_dex_pool_name") }}' + description: '{{ doc("evm_dex_pool_name") }}' - name: TOKENS - description: '{{ doc("eth_dex_lp_tokens") }}' + description: '{{ doc("evm_dex_lp_tokens") }}' - name: SYMBOLS - description: '{{ doc("eth_dex_lp_symbols") }}' + description: '{{ doc("evm_dex_lp_symbols") }}' - name: DECIMALS - description: '{{ doc("eth_dex_lp_decimals") }}' + description: '{{ doc("evm_dex_lp_decimals") }}' - name: DIM_DEX_LIQUIDITY_POOLS_ID - description: '{{ doc("pk") }}' + description: '{{ doc("evm_pk") }}' - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' + description: '{{ doc("evm_inserted_timestamp") }}' - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file + description: '{{ doc("evm_modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/defi/defi__ez_bridge_activity.sql b/models/gold/defi/defi__ez_bridge_activity.sql index 24537eb..2c393c3 100644 --- a/models/gold/defi/defi__ez_bridge_activity.sql +++ b/models/gold/defi/defi__ez_bridge_activity.sql @@ -7,7 +7,8 @@ 'table':{ 'PROTOCOL': 'CELER, HOP, MESON, CCIP', 'PURPOSE': 'BRIDGE' - } } } + } } }, + tags = ['gold','defi','bridge','curated','ez'] ) }} SELECT diff --git a/models/gold/defi/defi__ez_bridge_activity.yml b/models/gold/defi/defi__ez_bridge_activity.yml index 5b41241..cc7a271 100644 --- a/models/gold/defi/defi__ez_bridge_activity.yml +++ b/models/gold/defi/defi__ez_bridge_activity.yml @@ -1,27 +1,27 @@ version: 2 models: - name: defi__ez_bridge_activity - description: '{{ doc("evm_bridge_table_doc") }}' + description: '{{ doc("evm_ez_bridge_activity_table_doc") }}' columns: - name: BLOCK_NUMBER - description: '{{ doc("gno_block_number") }}' + description: '{{ doc("evm_block_number") }}' - name: BLOCK_TIMESTAMP - description: '{{ doc("gno_block_timestamp") }}' + description: '{{ doc("evm_block_timestamp") }}' - name: TX_HASH - description: '{{ doc("gno_logs_tx_hash") }}' + description: '{{ doc("evm_logs_tx_hash") }}' - name: CONTRACT_ADDRESS - description: '{{ doc("gno_logs_contract_address") }}' + description: '{{ doc("evm_logs_contract_address") }}' - name: EVENT_NAME - description: '{{ doc("gno_event_name") }}' + description: '{{ doc("evm_event_name") }}' - name: EVENT_INDEX - description: '{{ doc("gno_event_index") }}' + description: '{{ doc("evm_event_index") }}' - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("nft_origin_sig") }}' + description: '{{ doc("evm_nft_origin_sig") }}' - name: ORIGIN_FROM_ADDRESS description: '{{ doc("evm_bridge_origin_from") }}' - name: ORIGIN_TO_ADDRESS - description: '{{ doc("gno_origin_from") }}' + description: '{{ doc("evm_origin_from") }}' - name: PLATFORM description: '{{ doc("evm_bridge_platform") }}' - name: SENDER @@ -47,8 +47,8 @@ models: - name: AMOUNT_USD description: '{{ doc("evm_bridge_amount_usd") }}' - name: EZ_BRIDGE_ACTIVITY_ID - description: '{{ doc("pk") }}' + description: '{{ doc("evm_pk") }}' - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' + description: '{{ doc("evm_inserted_timestamp") }}' - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file + description: '{{ doc("evm_modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/defi/defi__ez_dex_swaps.sql b/models/gold/defi/defi__ez_dex_swaps.sql index 987743b..50ad000 100644 --- a/models/gold/defi/defi__ez_dex_swaps.sql +++ b/models/gold/defi/defi__ez_dex_swaps.sql @@ -9,7 +9,8 @@ 'PURPOSE': 'DEX, SWAPS' } } - } + }, + tags = ['gold','defi','dex','curated','ez'] ) }} SELECT @@ -71,6 +72,5 @@ SELECT COALESCE( modified_timestamp, '2000-01-01' - ) AS modified_timestamp, - _log_id -- deprecate + ) AS modified_timestamp FROM {{ ref('silver_dex__complete_dex_swaps') }} \ No newline at end of file diff --git a/models/gold/defi/defi__ez_dex_swaps.yml b/models/gold/defi/defi__ez_dex_swaps.yml index 9deab85..68491b3 100644 --- a/models/gold/defi/defi__ez_dex_swaps.yml +++ b/models/gold/defi/defi__ez_dex_swaps.yml @@ -1,58 +1,56 @@ version: 2 models: - name: defi__ez_dex_swaps - description: '{{ doc("eth_ez_dex_swaps_table_doc") }}' + description: '{{ doc("evm_ez_dex_swaps_table_doc") }}' columns: - name: BLOCK_NUMBER - description: '{{ doc("gno_block_number") }}' + description: '{{ doc("evm_block_number") }}' - name: BLOCK_TIMESTAMP - description: '{{ doc("gno_block_timestamp") }}' + description: '{{ doc("evm_block_timestamp") }}' - name: TX_HASH - description: '{{ doc("gno_logs_tx_hash") }}' + description: '{{ doc("evm_logs_tx_hash") }}' - name: CONTRACT_ADDRESS - description: '{{ doc("gno_logs_contract_address") }}' + description: '{{ doc("evm_logs_contract_address") }}' - name: EVENT_NAME - description: '{{ doc("gno_event_name") }}' + description: '{{ doc("evm_event_name") }}' - name: AMOUNT_IN - description: '{{ doc("eth_dex_swaps_amount_in") }}' + description: '{{ doc("evm_dex_swaps_amount_in") }}' - name: AMOUNT_OUT - description: '{{ doc("eth_dex_swaps_amount_out") }}' + description: '{{ doc("evm_dex_swaps_amount_out") }}' - name: AMOUNT_IN_USD - description: '{{ doc("eth_dex_swaps_amount_in_usd") }}' + description: '{{ doc("evm_dex_swaps_amount_in_usd") }}' - name: AMOUNT_OUT_USD - description: '{{ doc("eth_dex_swaps_amount_out_usd") }}' + description: '{{ doc("evm_dex_swaps_amount_out_usd") }}' - name: TOKEN_IN - description: '{{ doc("eth_dex_swaps_token_in") }}' + description: '{{ doc("evm_dex_swaps_token_in") }}' - name: TOKEN_OUT - description: '{{ doc("eth_dex_swaps_token_out") }}' + description: '{{ doc("evm_dex_swaps_token_out") }}' - name: SYMBOL_IN - description: '{{ doc("eth_dex_swaps_symbol_in") }}' + description: '{{ doc("evm_dex_swaps_symbol_in") }}' - name: SYMBOL_OUT - description: '{{ doc("eth_dex_swaps_symbol_out") }}' + description: '{{ doc("evm_dex_swaps_symbol_out") }}' - name: SENDER - description: '{{ doc("eth_dex_swaps_sender") }}' + description: '{{ doc("evm_dex_swaps_sender") }}' - name: TX_TO - description: '{{ doc("eth_dex_swaps_tx_to") }}' + description: '{{ doc("evm_dex_swaps_tx_to") }}' - name: PLATFORM - description: '{{ doc("eth_dex_platform") }}' + description: '{{ doc("evm_dex_platform") }}' - name: EVENT_INDEX - description: '{{ doc("gno_event_index") }}' - - name: _LOG_ID - description: '{{ doc("evm_column_deprecation_notice_log_id") }}' + description: '{{ doc("evm_event_index") }}' - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("gno_tx_origin_sig") }}' + description: '{{ doc("evm_tx_origin_sig") }}' - name: ORIGIN_FROM_ADDRESS - description: '{{ doc("gno_origin_from") }}' + description: '{{ doc("evm_origin_from") }}' - name: ORIGIN_TO_ADDRESS - description: '{{ doc("gno_origin_to") }}' + description: '{{ doc("evm_origin_to") }}' - name: AMOUNT_IN_UNADJ - description: '{{ doc("eth_dex_swaps_amount_in_unadj") }}' + description: '{{ doc("evm_dex_swaps_amount_in_unadj") }}' - name: AMOUNT_OUT_UNADJ - description: '{{ doc("eth_dex_swaps_amount_out_unadj") }}' + description: '{{ doc("evm_dex_swaps_amount_out_unadj") }}' - name: EZ_DEX_SWAPS_ID - description: '{{ doc("pk") }}' + description: '{{ doc("evm_pk") }}' - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' + description: '{{ doc("evm_inserted_timestamp") }}' - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' + description: '{{ doc("evm_modified_timestamp") }}' diff --git a/models/gold/defi/lending/defi__ez_lending_borrows.sql b/models/gold/defi/lending/defi__ez_lending_borrows.sql index 4ae1fcb..8ebd188 100644 --- a/models/gold/defi/lending/defi__ez_lending_borrows.sql +++ b/models/gold/defi/lending/defi__ez_lending_borrows.sql @@ -9,7 +9,8 @@ 'PURPOSE': 'LENDING, BORROWS' } } - } + }, + tags = ['gold','defi','lending','curated','ez'] ) }} SELECT diff --git a/models/gold/defi/lending/defi__ez_lending_borrows.yml b/models/gold/defi/lending/defi__ez_lending_borrows.yml index 46fdc43..dea4046 100644 --- a/models/gold/defi/lending/defi__ez_lending_borrows.yml +++ b/models/gold/defi/lending/defi__ez_lending_borrows.yml @@ -1,46 +1,46 @@ version: 2 models: - name: defi__ez_lending_borrows - description: '{{ doc("complete_lending_borrows_table_doc") }}' + description: '{{ doc("evm_complete_lending_borrows_table_doc") }}' columns: - name: BLOCK_NUMBER - description: '{{ doc("gno_block_number") }}' + description: '{{ doc("evm_block_number") }}' - name: BLOCK_TIMESTAMP - description: '{{ doc("gno_block_timestamp") }}' + description: '{{ doc("evm_block_timestamp") }}' - name: TX_HASH - description: '{{ doc("gno_logs_tx_hash") }}' + description: '{{ doc("evm_logs_tx_hash") }}' - name: CONTRACT_ADDRESS - description: '{{ doc("gno_logs_contract_address") }}' + description: '{{ doc("evm_logs_contract_address") }}' - name: EVENT_NAME - description: '{{ doc("gno_event_name") }}' + description: '{{ doc("evm_event_name") }}' - name: EVENT_INDEX - description: '{{ doc("gno_event_index") }}' + description: '{{ doc("evm_event_index") }}' - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("nft_origin_sig") }}' + description: '{{ doc("evm_nft_origin_sig") }}' - name: ORIGIN_FROM_ADDRESS - description: '{{ doc("gno_origin_from") }}' + description: '{{ doc("evm_origin_from") }}' - name: ORIGIN_TO_ADDRESS - description: '{{ doc("gno_origin_to") }}' + description: '{{ doc("evm_origin_to") }}' - name: PLATFORM - description: '{{ doc("complete_lending_platform") }}' + description: '{{ doc("evm_complete_lending_platform") }}' - name: PROTOCOL_MARKET - description: '{{ doc("complete_lending_protocol_token") }}' + description: '{{ doc("evm_complete_lending_protocol_token") }}' - name: BORROWER - description: '{{ doc("complete_lending_borrower") }}' + description: '{{ doc("evm_complete_lending_borrower") }}' - name: TOKEN_ADDRESS - description: '{{ doc("complete_lending_token_address") }}' + description: '{{ doc("evm_complete_lending_token_address") }}' - name: TOKEN_SYMBOL - description: '{{ doc("gno_symbol") }}' + description: '{{ doc("evm_complete_lending_token_symbol") }}' - name: AMOUNT_UNADJ - description: '{{ doc("complete_lending_amount_unadj") }}' + description: '{{ doc("evm_complete_lending_amount_unadj") }}' - name: AMOUNT - description: '{{ doc("complete_lending_amount") }}' + description: '{{ doc("evm_complete_lending_amount") }}' - name: AMOUNT_USD - description: '{{ doc("complete_lending_amount_usd") }}' + description: '{{ doc("evm_complete_lending_amount_usd") }}' - name: EZ_LENDING_BORROWS_ID - description: '{{ doc("pk") }}' + description: '{{ doc("evm_pk") }}' - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' + description: '{{ doc("evm_inserted_timestamp") }}' - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file + description: '{{ doc("evm_modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/defi/lending/defi__ez_lending_deposits.sql b/models/gold/defi/lending/defi__ez_lending_deposits.sql index b937a70..0dc700d 100644 --- a/models/gold/defi/lending/defi__ez_lending_deposits.sql +++ b/models/gold/defi/lending/defi__ez_lending_deposits.sql @@ -9,7 +9,8 @@ 'PURPOSE': 'LENDING, DEPOSITS' } } - } + }, + tags = ['gold','defi','lending','curated','ez'] ) }} SELECT diff --git a/models/gold/defi/lending/defi__ez_lending_deposits.yml b/models/gold/defi/lending/defi__ez_lending_deposits.yml index 5732a04..c0a10a4 100644 --- a/models/gold/defi/lending/defi__ez_lending_deposits.yml +++ b/models/gold/defi/lending/defi__ez_lending_deposits.yml @@ -1,46 +1,46 @@ version: 2 models: - name: defi__ez_lending_deposits - description: '{{ doc("complete_lending_deposits_table_doc") }}' + description: '{{ doc("evm_complete_lending_deposits_table_doc") }}' columns: - name: BLOCK_NUMBER - description: '{{ doc("gno_block_number") }}' + description: '{{ doc("evm_block_number") }}' - name: BLOCK_TIMESTAMP - description: '{{ doc("gno_block_timestamp") }}' + description: '{{ doc("evm_block_timestamp") }}' - name: TX_HASH - description: '{{ doc("gno_logs_tx_hash") }}' + description: '{{ doc("evm_logs_tx_hash") }}' - name: CONTRACT_ADDRESS - description: '{{ doc("gno_logs_contract_address") }}' + description: '{{ doc("evm_logs_contract_address") }}' - name: EVENT_NAME - description: '{{ doc("gno_event_name") }}' + description: '{{ doc("evm_event_name") }}' - name: EVENT_INDEX - description: '{{ doc("gno_event_index") }}' + description: '{{ doc("evm_event_index") }}' - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("nft_origin_sig") }}' + description: '{{ doc("evm_nft_origin_sig") }}' - name: ORIGIN_FROM_ADDRESS - description: '{{ doc("gno_origin_from") }}' + description: '{{ doc("evm_origin_from") }}' - name: ORIGIN_TO_ADDRESS - description: '{{ doc("gno_origin_to") }}' + description: '{{ doc("evm_origin_to") }}' - name: PLATFORM - description: '{{ doc("complete_lending_platform") }}' + description: '{{ doc("evm_complete_lending_platform") }}' - name: PROTOCOL_MARKET - description: '{{ doc("complete_lending_protocol_token") }}' + description: '{{ doc("evm_complete_lending_protocol_token") }}' - name: DEPOSITOR - description: '{{ doc("complete_lending_depositor") }}' + description: '{{ doc("evm_complete_lending_depositor") }}' - name: TOKEN_ADDRESS - description: '{{ doc("complete_lending_token_address") }}' + description: '{{ doc("evm_complete_lending_token_address") }}' - name: TOKEN_SYMBOL - description: '{{ doc("gno_symbol") }}' + description: '{{ doc("evm_complete_lending_token_symbol") }}' - name: AMOUNT_UNADJ - description: '{{ doc("complete_lending_amount_unadj") }}' + description: '{{ doc("evm_complete_lending_amount_unadj") }}' - name: AMOUNT - description: '{{ doc("complete_lending_amount") }}' + description: '{{ doc("evm_complete_lending_amount") }}' - name: AMOUNT_USD - description: '{{ doc("complete_lending_amount_usd") }}' + description: '{{ doc("evm_complete_lending_amount_usd") }}' - name: EZ_LENDING_DEPOSITS_ID - description: '{{ doc("pk") }}' + description: '{{ doc("evm_pk") }}' - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' + description: '{{ doc("evm_inserted_timestamp") }}' - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file + description: '{{ doc("evm_modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/defi/lending/defi__ez_lending_flashloans.sql b/models/gold/defi/lending/defi__ez_lending_flashloans.sql index 7d2ee29..a23592a 100644 --- a/models/gold/defi/lending/defi__ez_lending_flashloans.sql +++ b/models/gold/defi/lending/defi__ez_lending_flashloans.sql @@ -9,7 +9,8 @@ 'PURPOSE': 'LENDING, FLASHLOANS' } } - } + }, + tags = ['gold','defi','lending','curated','ez'] ) }} SELECT diff --git a/models/gold/defi/lending/defi__ez_lending_flashloans.yml b/models/gold/defi/lending/defi__ez_lending_flashloans.yml index 14b5693..3e26134 100644 --- a/models/gold/defi/lending/defi__ez_lending_flashloans.yml +++ b/models/gold/defi/lending/defi__ez_lending_flashloans.yml @@ -1,54 +1,54 @@ version: 2 models: - name: defi__ez_lending_flashloans - description: '{{ doc("complete_lending_flashloans_table_doc") }}' + description: '{{ doc("evm_complete_lending_flashloans_table_doc") }}' columns: - name: BLOCK_NUMBER - description: '{{ doc("gno_block_number") }}' + description: '{{ doc("evm_block_number") }}' - name: BLOCK_TIMESTAMP - description: '{{ doc("gno_block_timestamp") }}' + description: '{{ doc("evm_block_timestamp") }}' - name: TX_HASH - description: '{{ doc("gno_logs_tx_hash") }}' + description: '{{ doc("evm_logs_tx_hash") }}' - name: CONTRACT_ADDRESS - description: '{{ doc("gno_logs_contract_address") }}' + description: '{{ doc("evm_logs_contract_address") }}' - name: EVENT_NAME - description: '{{ doc("gno_event_name") }}' + description: '{{ doc("evm_event_name") }}' - name: EVENT_INDEX - description: '{{ doc("gno_event_index") }}' + description: '{{ doc("evm_event_index") }}' - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("nft_origin_sig") }}' + description: '{{ doc("evm_nft_origin_sig") }}' - name: ORIGIN_FROM_ADDRESS - description: '{{ doc("gno_origin_from") }}' + description: '{{ doc("evm_origin_from") }}' - name: ORIGIN_TO_ADDRESS - description: '{{ doc("gno_origin_to") }}' + description: '{{ doc("evm_origin_to") }}' - name: PLATFORM - description: '{{ doc("complete_lending_platform") }}' + description: '{{ doc("evm_complete_lending_platform") }}' - name: INITIATOR - description: '{{ doc("complete_lending_initiator_address") }}' + description: '{{ doc("evm_complete_lending_initiator_address") }}' - name: TARGET - description: '{{ doc("complete_lending_target_address") }}' + description: '{{ doc("evm_complete_lending_target_address") }}' - name: PROTOCOL_MARKET - description: '{{ doc("complete_lending_protocol_token") }}' + description: '{{ doc("evm_complete_lending_protocol_token") }}' - name: FLASHLOAN_TOKEN - description: '{{ doc("complete_lending_flashloan_token") }}' + description: '{{ doc("evm_complete_lending_flashloan_token") }}' - name: FLASHLOAN_TOKEN_SYMBOL - description: '{{ doc("gno_symbol") }}' + description: '{{ doc("evm_complete_lending_flashloan_token_symbol") }}' - name: FLASHLOAN_AMOUNT_UNADJ - description: '{{ doc("complete_lending_flashloan_amount_unadj") }}' + description: '{{ doc("evm_complete_lending_flashloan_amount_unadj") }}' - name: FLASHLOAN_AMOUNT - description: '{{ doc("complete_lending_flashloan_amount") }}' + description: '{{ doc("evm_complete_lending_flashloan_amount") }}' - name: FLASHLOAN_AMOUNT_USD - description: '{{ doc("complete_lending_flashloan_amount_usd") }}' + description: '{{ doc("evm_complete_lending_flashloan_amount_usd") }}' - name: PREMIUM_AMOUNT_UNADJ - description: '{{ doc("complete_lending_premium_amount_unadj") }}' + description: '{{ doc("evm_complete_lending_premium_amount_unadj") }}' - name: PREMIUM_AMOUNT - description: '{{ doc("complete_lending_premium_amount") }}' + description: '{{ doc("evm_complete_lending_premium_amount") }}' - name: PREMIUM_AMOUNT_USD - description: '{{ doc("complete_lending_premium_amount_usd") }}' + description: '{{ doc("evm_complete_lending_premium_amount_usd") }}' - name: EZ_LENDING_FLASHLOANS_ID - description: '{{ doc("pk") }}' + description: '{{ doc("evm_pk") }}' - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' + description: '{{ doc("evm_inserted_timestamp") }}' - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file + description: '{{ doc("evm_modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/defi/lending/defi__ez_lending_liquidations.sql b/models/gold/defi/lending/defi__ez_lending_liquidations.sql index d44c000..2acd648 100644 --- a/models/gold/defi/lending/defi__ez_lending_liquidations.sql +++ b/models/gold/defi/lending/defi__ez_lending_liquidations.sql @@ -9,7 +9,8 @@ 'PURPOSE': 'LENDING, LIQUIDATIONS' } } - } + }, + tags = ['gold','defi','lending','curated','ez'] ) }} SELECT diff --git a/models/gold/defi/lending/defi__ez_lending_liquidations.yml b/models/gold/defi/lending/defi__ez_lending_liquidations.yml index d404adc..d8b189a 100644 --- a/models/gold/defi/lending/defi__ez_lending_liquidations.yml +++ b/models/gold/defi/lending/defi__ez_lending_liquidations.yml @@ -1,52 +1,52 @@ version: 2 models: - name: defi__ez_lending_liquidations - description: '{{ doc("complete_lending_liquidations_table_doc") }}' + description: '{{ doc("evm_complete_lending_liquidations_table_doc") }}' columns: - name: BLOCK_NUMBER - description: '{{ doc("gno_block_number") }}' + description: '{{ doc("evm_block_number") }}' - name: BLOCK_TIMESTAMP - description: '{{ doc("gno_block_timestamp") }}' + description: '{{ doc("evm_block_timestamp") }}' - name: TX_HASH - description: '{{ doc("gno_logs_tx_hash") }}' + description: '{{ doc("evm_logs_tx_hash") }}' - name: CONTRACT_ADDRESS - description: '{{ doc("gno_logs_contract_address") }}' + description: '{{ doc("evm_logs_contract_address") }}' - name: EVENT_NAME - description: '{{ doc("gno_event_name") }}' + description: '{{ doc("evm_event_name") }}' - name: EVENT_INDEX - description: '{{ doc("gno_event_index") }}' + description: '{{ doc("evm_event_index") }}' - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("nft_origin_sig") }}' + description: '{{ doc("evm_nft_origin_sig") }}' - name: ORIGIN_FROM_ADDRESS - description: '{{ doc("gno_origin_from") }}' + description: '{{ doc("evm_origin_from") }}' - name: ORIGIN_TO_ADDRESS - description: '{{ doc("gno_origin_to") }}' + description: '{{ doc("evm_origin_to") }}' - name: PLATFORM - description: '{{ doc("complete_lending_platform") }}' + description: '{{ doc("evm_complete_lending_platform") }}' - name: LIQUIDATOR - description: '{{ doc("complete_lending_liquidator") }}' + description: '{{ doc("evm_complete_lending_liquidator") }}' - name: BORROWER - description: '{{ doc("complete_lending_borrower") }}' + description: '{{ doc("evm_complete_lending_borrower") }}' - name: PROTOCOL_MARKET - description: '{{ doc("complete_lending_protocol_token") }}' + description: '{{ doc("evm_complete_lending_protocol_token") }}' - name: COLLATERAL_TOKEN - description: '{{ doc("complete_lending_collateral_asset") }}' + description: '{{ doc("evm_complete_lending_collateral_asset") }}' - name: COLLATERAL_TOKEN_SYMBOL - description: '{{ doc("gno_symbol") }}' + description: '{{ doc("evm_complete_lending_token_symbol") }}' - name: AMOUNT_UNADJ - description: '{{ doc("complete_lending_amount_unadj") }}' + description: '{{ doc("evm_complete_lending_amount_unadj") }}' - name: AMOUNT - description: '{{ doc("complete_lending_amount") }}' + description: '{{ doc("evm_complete_lending_amount") }}' - name: AMOUNT_USD - description: '{{ doc("complete_lending_amount_usd") }}' + description: '{{ doc("evm_complete_lending_amount_usd") }}' - name: DEBT_TOKEN - description: '{{ doc("complete_lending_debt_asset") }}' + description: '{{ doc("evm_complete_lending_debt_asset") }}' - name: DEBT_TOKEN_SYMBOL - description: '{{ doc("gno_symbol") }}' + description: '{{ doc("evm_complete_lending_token_symbol") }}' - name: EZ_LENDING_LIQUDATIONS_ID - description: '{{ doc("pk") }}' + description: '{{ doc("evm_pk") }}' - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' + description: '{{ doc("evm_inserted_timestamp") }}' - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file + description: '{{ doc("evm_modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/defi/lending/defi__ez_lending_repayments.sql b/models/gold/defi/lending/defi__ez_lending_repayments.sql index f95215e..5fe2630 100644 --- a/models/gold/defi/lending/defi__ez_lending_repayments.sql +++ b/models/gold/defi/lending/defi__ez_lending_repayments.sql @@ -9,7 +9,8 @@ 'PURPOSE': 'LENDING, REPAYMENTS' } } - } + }, + tags = ['gold','defi','lending','curated','ez'] ) }} SELECT diff --git a/models/gold/defi/lending/defi__ez_lending_repayments.yml b/models/gold/defi/lending/defi__ez_lending_repayments.yml index aaf777d..01c40db 100644 --- a/models/gold/defi/lending/defi__ez_lending_repayments.yml +++ b/models/gold/defi/lending/defi__ez_lending_repayments.yml @@ -1,48 +1,48 @@ version: 2 models: - name: defi__ez_lending_repayments - description: '{{ doc("complete_lending_repayments_table_doc") }}' + description: '{{ doc("evm_complete_lending_repayments_table_doc") }}' columns: - name: BLOCK_NUMBER - description: '{{ doc("gno_block_number") }}' + description: '{{ doc("evm_block_number") }}' - name: BLOCK_TIMESTAMP - description: '{{ doc("gno_block_timestamp") }}' + description: '{{ doc("evm_block_timestamp") }}' - name: TX_HASH - description: '{{ doc("gno_logs_tx_hash") }}' + description: '{{ doc("evm_logs_tx_hash") }}' - name: CONTRACT_ADDRESS - description: '{{ doc("gno_logs_contract_address") }}' + description: '{{ doc("evm_logs_contract_address") }}' - name: EVENT_NAME - description: '{{ doc("gno_event_name") }}' + description: '{{ doc("evm_event_name") }}' - name: EVENT_INDEX - description: '{{ doc("gno_event_index") }}' + description: '{{ doc("evm_event_index") }}' - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("nft_origin_sig") }}' + description: '{{ doc("evm_nft_origin_sig") }}' - name: ORIGIN_FROM_ADDRESS - description: '{{ doc("gno_origin_from") }}' + description: '{{ doc("evm_origin_from") }}' - name: ORIGIN_TO_ADDRESS - description: '{{ doc("gno_origin_to") }}' + description: '{{ doc("evm_origin_to") }}' - name: PLATFORM - description: '{{ doc("complete_lending_platform") }}' + description: '{{ doc("evm_complete_lending_platform") }}' - name: PAYER - description: '{{ doc("complete_lending_payer") }}' + description: '{{ doc("evm_complete_lending_payer") }}' - name: BORROWER - description: '{{ doc("complete_lending_borrower") }}' + description: '{{ doc("evm_complete_lending_borrower") }}' - name: PROTOCOL_MARKET - description: '{{ doc("complete_lending_protocol_token") }}' + description: '{{ doc("evm_complete_lending_protocol_token") }}' - name: TOKEN_ADDRESS - description: '{{ doc("complete_lending_token_address") }}' + description: '{{ doc("evm_complete_lending_token_address") }}' - name: TOKEN_SYMBOL - description: '{{ doc("complete_lending_token_symbol") }}' + description: '{{ doc("evm_complete_lending_token_symbol") }}' - name: AMOUNT_UNADJ - description: '{{ doc("complete_lending_amount_unadj") }}' + description: '{{ doc("evm_complete_lending_amount_unadj") }}' - name: AMOUNT - description: '{{ doc("complete_lending_amount") }}' + description: '{{ doc("evm_complete_lending_amount") }}' - name: AMOUNT_USD - description: '{{ doc("complete_lending_amount_usd") }}' + description: '{{ doc("evm_complete_lending_amount_usd") }}' - name: EZ_LENDING_REPAYMENTS_ID - description: '{{ doc("pk") }}' + description: '{{ doc("evm_pk") }}' - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' + description: '{{ doc("evm_inserted_timestamp") }}' - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file + description: '{{ doc("evm_modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/defi/lending/defi__ez_lending_withdraws.sql b/models/gold/defi/lending/defi__ez_lending_withdraws.sql index 92b0e5e..17ef7e2 100644 --- a/models/gold/defi/lending/defi__ez_lending_withdraws.sql +++ b/models/gold/defi/lending/defi__ez_lending_withdraws.sql @@ -9,7 +9,8 @@ 'PURPOSE': 'LENDING, WITHDRAWS' } } - } + }, + tags = ['gold','defi','lending','curated','ez'] ) }} SELECT diff --git a/models/gold/defi/lending/defi__ez_lending_withdraws.yml b/models/gold/defi/lending/defi__ez_lending_withdraws.yml index a80d0fe..1c08816 100644 --- a/models/gold/defi/lending/defi__ez_lending_withdraws.yml +++ b/models/gold/defi/lending/defi__ez_lending_withdraws.yml @@ -1,46 +1,46 @@ version: 2 models: - name: defi__ez_lending_withdraws - description: '{{ doc("complete_lending_withdraws_table_doc") }}' + description: '{{ doc("evm_complete_lending_withdraws_table_doc") }}' columns: - name: BLOCK_NUMBER - description: '{{ doc("gno_block_number") }}' + description: '{{ doc("evm_block_number") }}' - name: BLOCK_TIMESTAMP - description: '{{ doc("gno_block_timestamp") }}' + description: '{{ doc("evm_block_timestamp") }}' - name: TX_HASH - description: '{{ doc("gno_logs_tx_hash") }}' + description: '{{ doc("evm_logs_tx_hash") }}' - name: CONTRACT_ADDRESS - description: '{{ doc("gno_logs_contract_address") }}' + description: '{{ doc("evm_logs_contract_address") }}' - name: EVENT_NAME - description: '{{ doc("gno_event_name") }}' + description: '{{ doc("evm_event_name") }}' - name: EVENT_INDEX - description: '{{ doc("gno_event_index") }}' + description: '{{ doc("evm_event_index") }}' - name: ORIGIN_FUNCTION_SIGNATURE - description: '{{ doc("nft_origin_sig") }}' + description: '{{ doc("evm_nft_origin_sig") }}' - name: ORIGIN_FROM_ADDRESS - description: '{{ doc("gno_origin_from") }}' + description: '{{ doc("evm_origin_from") }}' - name: ORIGIN_TO_ADDRESS - description: '{{ doc("gno_origin_to") }}' + description: '{{ doc("evm_origin_to") }}' - name: PLATFORM - description: '{{ doc("complete_lending_platform") }}' + description: '{{ doc("evm_complete_lending_platform") }}' - name: DEPOSITOR - description: '{{ doc("borrower") }}' + description: '{{ doc("evm_borrower") }}' - name: PROTOCOL_MARKET - description: '{{ doc("complete_lending_protocol_token") }}' + description: '{{ doc("evm_complete_lending_protocol_token") }}' - name: TOKEN_ADDRESS - description: '{{ doc("complete_lending_token_address") }}' + description: '{{ doc("evm_complete_lending_token_address") }}' - name: TOKEN_SYMBOL - description: '{{ doc("complete_lending_token_symbol") }}' + description: '{{ doc("evm_complete_lending_token_symbol") }}' - name: AMOUNT_UNADJ - description: '{{ doc("complete_lending_amount_unadj") }}' + description: '{{ doc("evm_complete_lending_amount_unadj") }}' - name: AMOUNT - description: '{{ doc("complete_lending_amount") }}' + description: '{{ doc("evm_complete_lending_amount") }}' - name: AMOUNT_USD - description: '{{ doc("complete_lending_amount_usd") }}' + description: '{{ doc("evm_complete_lending_amount_usd") }}' - name: EZ_LENDING_WITHDRAWS_ID - description: '{{ doc("pk") }}' + description: '{{ doc("evm_pk") }}' - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' + description: '{{ doc("evm_inserted_timestamp") }}' - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file + description: '{{ doc("evm_modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/nft/nft__ez_nft_transfers.sql b/models/gold/nft/nft__ez_nft_transfers.sql deleted file mode 100644 index 0ebea7f..0000000 --- a/models/gold/nft/nft__ez_nft_transfers.sql +++ /dev/null @@ -1,54 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true }, - meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'NFT' } } } -) }} - -SELECT - block_timestamp, - block_number, - tx_hash, - {#tx_position, -- new #} - event_index, - intra_event_index, - token_transfer_type, - iff(from_address = '0x0000000000000000000000000000000000000000', TRUE, FALSE) as is_mint, -- new - from_address, -- new - to_address, -- new - contract_address, -- new - tokenId as token_id, -- new - coalesce(erc1155_value, '1')::STRING AS quantity, - case - when token_transfer_type = 'erc721_Transfer' then 'erc721' - when token_transfer_type = 'erc1155_TransferSingle' then 'erc1155' - when token_transfer_type = 'erc1155_TransferBatch' then 'erc1155' - end as token_standard, - project_name as name, -- new - {#origin_function_signature, -- new - origin_from_address, -- new - origin_to_address -- new - #} - COALESCE ( - nft_transfers_id, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash','event_index','intra_event_index'] - ) }} - ) AS ez_nft_transfers_id, - COALESCE( - inserted_timestamp, - '2000-01-01' - ) AS inserted_timestamp, - COALESCE( - modified_timestamp, - '2000-01-01' - ) AS modified_timestamp, - event_type, --deprecate - from_address as nft_from_address, --deprecate - to_address as nft_to_address, --deprecate - contract_address as nft_address, --deprecate - tokenId, --deprecate - erc1155_value, --deprecate - project_name --deprecate -FROM - {{ ref('silver__nft_transfers') }} diff --git a/models/gold/nft/nft__ez_nft_transfers.yml b/models/gold/nft/nft__ez_nft_transfers.yml deleted file mode 100644 index 4efad39..0000000 --- a/models/gold/nft/nft__ez_nft_transfers.yml +++ /dev/null @@ -1,50 +0,0 @@ -version: 2 -models: - - name: nft__ez_nft_transfers - description: '{{ doc("evm_ez_nft_transfer_table_doc") }}' - - columns: - - name: BLOCK_NUMBER - description: '{{ doc("nft_block_no") }}' - - name: BLOCK_TIMESTAMP - description: '{{ doc("nft_blocktime") }}' - - name: TX_HASH - description: '{{ doc("nft_tx_hash") }}' - - name: EVENT_INDEX - description: '{{ doc("nft_event_index") }}' - - name: INTRA_EVENT_INDEX - description: '{{ doc("nft_intra_event_index") }}' - - name: EVENT_TYPE - description: '{{ doc("evm_column_deprecation_notice_event_type") }}' - - name: NFT_ADDRESS - description: '{{ doc("evm_column_deprecation_notice_nft_address") }}' - - name: CONTRACT_ADDRESS - description: '{{ doc("evm_nft_nft_address") }}' - - name: NAME - description: '{{ doc("evm_nft_project_name") }}' - - name: PROJECT_NAME - description: '{{ doc("evm_column_deprecation_notice_project_name") }}' - - name: NFT_FROM_ADDRESS - description: '{{ doc("evm_column_deprecation_notice_nft_from_address") }}' - - name: FROM_ADDRESS - description: '{{ doc("evm_nft_from_address") }}' - - name: NFT_TO_ADDRESS - description: '{{ doc("evm_column_deprecation_notice_nft_to_address") }}' - - name: TO_ADDRESS - description: '{{ doc("evm_nft_to_address") }}' - - name: TOKENID - description: '{{ doc("evm_column_deprecation_notice_tokenid") }}' - - name: TOKEN_ID - description: '{{ doc("evm_nft_tokenid") }}' - - name: ERC1155_VALUE - description: '{{ doc("evm_column_deprecation_notice_erc1155_value") }}' - - name: QUANTITY - description: '{{ doc("evm_nft_quantity") }}' - - name: TOKEN_STANDARD - description: '{{ doc("evm_nft_token_standard") }}' - - name: EZ_NFT_TRANSFERS_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' diff --git a/models/gold/price/price__dim_asset_metadata.sql b/models/gold/price/price__dim_asset_metadata.sql deleted file mode 100644 index 71bf27f..0000000 --- a/models/gold/price/price__dim_asset_metadata.sql +++ /dev/null @@ -1,19 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - token_address, - asset_id, - symbol, - name, - platform AS blockchain, - platform_id AS blockchain_id, - provider, - inserted_timestamp, - modified_timestamp, - complete_provider_asset_metadata_id AS dim_asset_metadata_id -FROM - {{ ref('silver__complete_provider_asset_metadata') }} \ No newline at end of file diff --git a/models/gold/price/price__dim_asset_metadata.yml b/models/gold/price/price__dim_asset_metadata.yml deleted file mode 100644 index db7ec28..0000000 --- a/models/gold/price/price__dim_asset_metadata.yml +++ /dev/null @@ -1,26 +0,0 @@ -version: 2 -models: - - name: price__dim_asset_metadata - description: '{{ doc("prices_dim_asset_metadata_table_doc") }}' - - columns: - - name: PROVIDER - description: '{{ doc("prices_provider")}}' - - name: ASSET_ID - description: '{{ doc("prices_asset_id") }}' - - name: NAME - description: '{{ doc("prices_name") }}' - - name: SYMBOL - description: '{{ doc("prices_symbol") }}' - - name: TOKEN_ADDRESS - description: '{{ doc("prices_token_address_evm") }}' - - name: BLOCKCHAIN - description: '{{ doc("prices_blockchain") }}' - - name: BLOCKCHAIN_ID - description: '{{ doc("prices_blockchain_id") }}' - - name: DIM_ASSET_METADATA_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/price/price__ez_asset_metadata.sql b/models/gold/price/price__ez_asset_metadata.sql deleted file mode 100644 index f8c8f8b..0000000 --- a/models/gold/price/price__ez_asset_metadata.sql +++ /dev/null @@ -1,35 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - token_address, - asset_id, - symbol, - NAME, - decimals, - blockchain, - FALSE AS is_native, - is_deprecated, - inserted_timestamp, - modified_timestamp, - complete_token_asset_metadata_id AS ez_asset_metadata_id -FROM - {{ ref('silver__complete_token_asset_metadata') }} -UNION ALL -SELECT - NULL AS token_address, - asset_id, - symbol, - NAME, - decimals, - blockchain, - TRUE AS is_native, - is_deprecated, - inserted_timestamp, - modified_timestamp, - complete_native_asset_metadata_id AS ez_asset_metadata_id -FROM - {{ ref('silver__complete_native_asset_metadata') }} diff --git a/models/gold/price/price__ez_asset_metadata.yml b/models/gold/price/price__ez_asset_metadata.yml deleted file mode 100644 index 57088a9..0000000 --- a/models/gold/price/price__ez_asset_metadata.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: 2 -models: - - name: price__ez_asset_metadata - description: '{{ doc("prices_ez_asset_metadata_table_doc") }}' - - columns: - - name: ASSET_ID - description: '{{ doc("prices_asset_id") }}' - - name: NAME - description: '{{ doc("prices_name") }}' - - name: SYMBOL - description: '{{ doc("prices_symbol") }}' - - name: TOKEN_ADDRESS - description: '{{ doc("prices_token_address_evm") }}' - - name: BLOCKCHAIN - description: '{{ doc("prices_blockchain") }}' - - name: DECIMALS - description: '{{ doc("prices_decimals") }}' - - name: IS_NATIVE - description: '{{ doc("prices_is_native") }}' - - name: IS_DEPRECATED - description: '{{ doc("prices_is_deprecated") }}' - - name: EZ_ASSET_METADATA_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' - \ No newline at end of file diff --git a/models/gold/price/price__ez_prices_hourly.sql b/models/gold/price/price__ez_prices_hourly.sql deleted file mode 100644 index dfda724..0000000 --- a/models/gold/price/price__ez_prices_hourly.sql +++ /dev/null @@ -1,39 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - HOUR, - token_address, - symbol, - NAME, - decimals, - price, - blockchain, - FALSE AS is_native, - is_imputed, - is_deprecated, - inserted_timestamp, - modified_timestamp, - complete_token_prices_id AS ez_prices_hourly_id -FROM - {{ ref('silver__complete_token_prices') }} -UNION ALL -SELECT - HOUR, - NULL AS token_address, - symbol, - NAME, - decimals, - price, - blockchain, - TRUE AS is_native, - is_imputed, - is_deprecated, - inserted_timestamp, - modified_timestamp, - complete_native_prices_id AS ez_prices_hourly_id -FROM - {{ ref('silver__complete_native_prices') }} diff --git a/models/gold/price/price__ez_prices_hourly.yml b/models/gold/price/price__ez_prices_hourly.yml deleted file mode 100644 index 96cf4e5..0000000 --- a/models/gold/price/price__ez_prices_hourly.yml +++ /dev/null @@ -1,30 +0,0 @@ -version: 2 -models: - - name: price__ez_prices_hourly - description: '{{ doc("prices_ez_prices_hourly_table_doc") }}' - - columns: - - name: HOUR - description: '{{ doc("prices_hour")}}' - - name: TOKEN_ADDRESS - description: '{{ doc("prices_token_address_evm") }}' - - name: SYMBOL - description: '{{ doc("prices_symbol") }}' - - name: BLOCKCHAIN - description: '{{ doc("prices_blockchain") }}' - - name: DECIMALS - description: '{{ doc("prices_decimals") }}' - - name: PRICE - description: '{{ doc("prices_price") }}' - - name: IS_NATIVE - description: '{{ doc("prices_is_native") }}' - - name: IS_IMPUTED - description: '{{ doc("prices_is_imputed") }}' - - name: IS_DEPRECATED - description: '{{ doc("prices_is_deprecated") }}' - - name: EZ_PRICES_HOURLY_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/price/price__fact_prices_ohlc_hourly.sql b/models/gold/price/price__fact_prices_ohlc_hourly.sql deleted file mode 100644 index 2be7d75..0000000 --- a/models/gold/price/price__fact_prices_ohlc_hourly.sql +++ /dev/null @@ -1,19 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true } -) }} - -SELECT - asset_id, - recorded_hour AS HOUR, - OPEN, - high, - low, - CLOSE, - provider, - inserted_timestamp, - modified_timestamp, - complete_provider_prices_id AS fact_prices_ohlc_hourly_id -FROM - {{ ref('silver__complete_provider_prices') }} diff --git a/models/gold/price/price__fact_prices_ohlc_hourly.yml b/models/gold/price/price__fact_prices_ohlc_hourly.yml deleted file mode 100644 index 29ff045..0000000 --- a/models/gold/price/price__fact_prices_ohlc_hourly.yml +++ /dev/null @@ -1,24 +0,0 @@ -version: 2 -models: - - name: price__fact_prices_ohlc_hourly - description: '{{ doc("prices_fact_prices_ohlc_hourly_table_doc") }}' - - columns: - - name: HOUR - description: '{{ doc("prices_hour")}}' - - name: ASSET_ID - description: '{{ doc("prices_asset_id") }}' - - name: OPEN - description: '{{ doc("prices_open") }}' - - name: HIGH - description: '{{ doc("prices_high") }}' - - name: LOW - description: '{{ doc("prices_low") }}' - - name: CLOSE - description: '{{ doc("prices_close") }}' - - name: FACT_PRICES_OHLC_HOURLY_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/stats/stats__ez_core_metrics_hourly.sql b/models/gold/stats/stats__ez_core_metrics_hourly.sql deleted file mode 100644 index 542b1e9..0000000 --- a/models/gold/stats/stats__ez_core_metrics_hourly.sql +++ /dev/null @@ -1,38 +0,0 @@ -{{ config( - materialized = 'view', - persist_docs ={ "relation": true, - "columns": true }, - meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'STATS, METRICS, CORE, HOURLY', - } } } -) }} - -SELECT - block_timestamp_hour, - block_number_min, - block_number_max, - block_count, - transaction_count, - transaction_count_success, - transaction_count_failed, - unique_from_count, - unique_to_count, - total_fees AS total_fees_native, - ROUND( - total_fees * LAST_VALUE( - p.price ignore nulls - ) over ( - ORDER BY - block_timestamp_hour rows unbounded preceding - ), - 2 - ) AS total_fees_usd, - core_metrics_hourly_id AS ez_core_metrics_hourly_id, - s.inserted_timestamp AS inserted_timestamp, - s.modified_timestamp AS modified_timestamp -FROM - {{ ref('silver_stats__core_metrics_hourly') }} - s - LEFT JOIN {{ ref('price__ez_prices_hourly') }} - p - ON s.block_timestamp_hour = p.hour - AND p.token_address = '0xe91d153e0b41518a2ce8dd3d7944fa863463a97d' --WXDAI diff --git a/models/gold/stats/stats__ez_core_metrics_hourly.yml b/models/gold/stats/stats__ez_core_metrics_hourly.yml deleted file mode 100644 index 99deaa9..0000000 --- a/models/gold/stats/stats__ez_core_metrics_hourly.yml +++ /dev/null @@ -1,34 +0,0 @@ -version: 2 -models: - - name: stats__ez_core_metrics_hourly - description: '{{ doc("evm_ez_core_metrics_hourly_table_doc") }}' - - columns: - - name: BLOCK_TIMESTAMP_HOUR - description: '{{ doc("evm_block_timestamp_hour") }}' - - name: BLOCK_NUMBER_MIN - description: '{{ doc("evm_block_number_min") }}' - - name: BLOCK_NUMBER_MAX - description: '{{ doc("evm_block_number_max") }}' - - name: BLOCK_COUNT - description: '{{ doc("evm_block_count") }}' - - name: TRANSACTION_COUNT - description: '{{ doc("evm_transaction_count") }}' - - name: TRANSACTION_COUNT_SUCCESS - description: '{{ doc("evm_transaction_count_success") }}' - - name: TRANSACTION_COUNT_FAILED - description: '{{ doc("evm_transaction_count_failed") }}' - - name: UNIQUE_FROM_COUNT - description: '{{ doc("evm_unique_from_count") }}' - - name: UNIQUE_TO_COUNT - description: '{{ doc("evm_unique_to_count") }}' - - name: TOTAL_FEES_ETH - description: '{{ doc("evm_total_fees_native") }}' - - name: TOTAL_FEES_USD - description: '{{ doc("evm_total_fees_usd") }}' - - name: EZ_CORE_METRICS_HOURLY_ID - description: '{{ doc("pk") }}' - - name: INSERTED_TIMESTAMP - description: '{{ doc("inserted_timestamp") }}' - - name: MODIFIED_TIMESTAMP - description: '{{ doc("modified_timestamp") }}' \ No newline at end of file diff --git a/models/gold/tests/test_gold__ez_xdai_transfers_full.sql b/models/gold/tests/test_gold__ez_xdai_transfers_full.sql deleted file mode 100644 index c216052..0000000 --- a/models/gold/tests/test_gold__ez_xdai_transfers_full.sql +++ /dev/null @@ -1,9 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['full_test'] -) }} - -SELECT - * -FROM - {{ ref('core__ez_native_transfers') }} diff --git a/models/gold/tests/test_gold__ez_xdai_transfers_full.yml b/models/gold/tests/test_gold__ez_xdai_transfers_full.yml deleted file mode 100644 index 4973cd0..0000000 --- a/models/gold/tests/test_gold__ez_xdai_transfers_full.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 -models: - - name: test_gold__ez_xdai_transfers_full - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - BLOCK_NUMBER - - TX_POSITION - - TRACE_INDEX - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: BLOCK_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: FROM_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TO_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: AMOUNT - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: ORIGIN_FUNCTION_SIGNATURE - tests: - - not_null - - name: ORIGIN_FROM_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: ORIGIN_TO_ADDRESS - tests: - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ \ No newline at end of file diff --git a/models/gold/tests/test_gold__ez_xdai_transfers_recent.sql b/models/gold/tests/test_gold__ez_xdai_transfers_recent.sql deleted file mode 100644 index 64c13ee..0000000 --- a/models/gold/tests/test_gold__ez_xdai_transfers_recent.sql +++ /dev/null @@ -1,27 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['recent_test'] -) }} - -WITH last_3_days AS ( - - SELECT - block_number - FROM - {{ ref("_max_block_by_date") }} - qualify ROW_NUMBER() over ( - ORDER BY - block_number DESC - ) = 3 -) -SELECT - * -FROM - {{ ref('core__ez_native_transfers') }} -WHERE - block_number >= ( - SELECT - block_number - FROM - last_3_days - ) diff --git a/models/gold/tests/test_gold__ez_xdai_transfers_recent.yml b/models/gold/tests/test_gold__ez_xdai_transfers_recent.yml deleted file mode 100644 index dbb96fa..0000000 --- a/models/gold/tests/test_gold__ez_xdai_transfers_recent.yml +++ /dev/null @@ -1,61 +0,0 @@ -version: 2 -models: - - name: test_gold__ez_xdai_transfers_recent - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - BLOCK_NUMBER - - TX_POSITION - - TRACE_INDEX - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: BLOCK_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: FROM_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TO_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: AMOUNT - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: ORIGIN_FUNCTION_SIGNATURE - tests: - - not_null - - name: ORIGIN_FROM_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: ORIGIN_TO_ADDRESS - tests: - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ \ No newline at end of file diff --git a/models/silver/ABIs/silver__abis.sql b/models/silver/ABIs/silver__abis.sql deleted file mode 100644 index 1db9a27..0000000 --- a/models/silver/ABIs/silver__abis.sql +++ /dev/null @@ -1,181 +0,0 @@ -{{ config ( - materialized = "incremental", - unique_key = "contract_address", - merge_exclude_columns = ["inserted_timestamp"], - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(contract_address,abi_hash,bytecode), SUBSTRING(contract_address,abi_hash,bytecode)", - tags = ['abis'] -) }} - -WITH override_abis AS ( - - SELECT - contract_address, - PARSE_JSON(DATA) AS abi, - TO_TIMESTAMP_LTZ(SYSDATE()) AS _inserted_timestamp, - 'flipside' AS abi_source, - 'flipside' AS discord_username, - SHA2(abi) AS abi_hash, - 1 AS priority - FROM - {{ ref('silver__override_abis') }} - WHERE - contract_address IS NOT NULL -), -verified_abis AS ( - SELECT - contract_address, - DATA, - _inserted_timestamp, - abi_source, - discord_username, - abi_hash, - 2 AS priority - FROM - {{ ref('silver__verified_abis') }} - WHERE - abi_source = 'gnosisscan' - -{% if is_incremental() %} -AND _inserted_timestamp >= ( - SELECT - MAX( - _inserted_timestamp - ) - FROM - {{ this }} - WHERE - abi_source = 'gnosisscan' -) -{% endif %} -), -user_abis AS ( - SELECT - contract_address, - DATA, - _inserted_timestamp, - abi_source, - discord_username, - abi_hash, - 2 AS priority - FROM - {{ ref('silver__verified_abis') }} - WHERE - abi_source = 'user' - -{% if is_incremental() %} -AND _inserted_timestamp >= ( - SELECT - MAX( - _inserted_timestamp - ) - FROM - {{ this }} - WHERE - abi_source = 'user' -) -{% endif %} -), -bytecode_abis AS ( - SELECT - contract_address, - abi, - abi_hash, - 'bytecode_matched' AS abi_source, - NULL AS discord_username, - _inserted_timestamp, - 3 AS priority - FROM - {{ ref('silver__bytecode_abis') }} - WHERE - 1 = 1 - -{% if is_incremental() %} -AND _inserted_timestamp >= ( - SELECT - MAX( - _inserted_timestamp - ) - FROM - {{ this }} - WHERE - abi_source = 'bytecode_matched' -) -{% endif %} -), -all_abis AS ( - SELECT - contract_address, - abi AS DATA, - _inserted_timestamp, - abi_source, - discord_username, - abi_hash, - priority - FROM - override_abis - UNION - SELECT - contract_address, - DATA, - _inserted_timestamp, - abi_source, - discord_username, - abi_hash, - priority - FROM - verified_abis - UNION - SELECT - contract_address, - DATA, - _inserted_timestamp, - abi_source, - discord_username, - abi_hash, - priority - FROM - user_abis - UNION - SELECT - contract_address, - abi AS DATA, - _inserted_timestamp, - abi_source, - discord_username, - abi_hash, - priority - FROM - bytecode_abis -), -priority_abis AS ( - SELECT - contract_address, - DATA, - _inserted_timestamp, - abi_source, - discord_username, - abi_hash, - priority - FROM - all_abis qualify(ROW_NUMBER() over(PARTITION BY contract_address - ORDER BY - priority ASC)) = 1 -) -SELECT - p.contract_address, - p.data, - p._inserted_timestamp, - p.abi_source, - p.discord_username, - p.abi_hash, - created_contract_input AS bytecode, - {{ dbt_utils.generate_surrogate_key( - ['contract_address'] - ) }} AS abis_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - priority_abis p - LEFT JOIN {{ ref('silver__created_contracts') }} - ON p.contract_address = created_contract_address diff --git a/models/silver/ABIs/silver__abis.yml b/models/silver/ABIs/silver__abis.yml deleted file mode 100644 index ad57edf..0000000 --- a/models/silver/ABIs/silver__abis.yml +++ /dev/null @@ -1,8 +0,0 @@ - -version: 2 -models: - - name: silver__abis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - CONTRACT_ADDRESS \ No newline at end of file diff --git a/models/silver/ABIs/silver__bytecode_abis.sql b/models/silver/ABIs/silver__bytecode_abis.sql deleted file mode 100644 index 32c20b4..0000000 --- a/models/silver/ABIs/silver__bytecode_abis.sql +++ /dev/null @@ -1,76 +0,0 @@ -{{ config ( - materialized = "incremental", - unique_key = "contract_address", - tags = ['abis'] -) }} - -WITH contracts_with_abis AS ( - -- Identifying contracts with verified ABIs - - SELECT - created_contract_address AS contract_address - FROM - {{ ref('silver__created_contracts') }} - JOIN {{ ref('silver__verified_abis') }} A - ON A.contract_address = created_contract_address -), -contracts_without_abis AS ( - -- Contracts that are missing ABIs - SELECT - created_contract_address AS contract_address, - created_contract_input AS bytecode - FROM - {{ ref('silver__created_contracts') }} - WHERE - created_contract_address NOT IN ( - SELECT - contract_address - FROM - contracts_with_abis - ) - -{% if is_incremental() %} -AND created_contract_address NOT IN ( - SELECT - contract_address - FROM - {{ this }} -) -{% endif %} -), -unique_bytecode_abis AS ( - -- Bytecodes from created_contracts with a unique ABI - SELECT - cc.created_contract_input AS bytecode, - va.data AS abi, - va.abi_hash - FROM - {{ ref('silver__created_contracts') }} - cc - JOIN {{ ref('silver__verified_abis') }} - va - ON cc.created_contract_address = va.contract_address - GROUP BY - cc.created_contract_input, - va.data, - va.abi_hash - HAVING - COUNT( - DISTINCT va.data - ) = 1 -- Ensuring there's only one ABI per bytecode -) -- Final matching -SELECT - contract_address, - abi, - abi_hash, - -{% if is_incremental() %} -SYSDATE() -{% else %} - TO_TIMESTAMP_NTZ('2000-01-01 00:00:00') -{% endif %} - -AS _inserted_timestamp -FROM - contracts_without_abis - JOIN unique_bytecode_abis USING (bytecode) diff --git a/models/silver/ABIs/silver__bytecode_abis.yml b/models/silver/ABIs/silver__bytecode_abis.yml deleted file mode 100644 index 704e39d..0000000 --- a/models/silver/ABIs/silver__bytecode_abis.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: 2 -models: - - name: silver__bytecode_abis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - CONTRACT_ADDRESS - - ABI_HASH \ No newline at end of file diff --git a/models/silver/ABIs/silver__complete_event_abis.sql b/models/silver/ABIs/silver__complete_event_abis.sql deleted file mode 100644 index 67e1697..0000000 --- a/models/silver/ABIs/silver__complete_event_abis.sql +++ /dev/null @@ -1,216 +0,0 @@ -{{ config ( - materialized = 'incremental', - unique_key = ['parent_contract_address','event_signature','start_block'], - merge_exclude_columns = ["inserted_timestamp"], - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION", - tags = ['abis'] -) }} - -WITH new_abis AS ( - - SELECT - DISTINCT contract_address - FROM - {{ ref('silver__flat_event_abis') }} - -{% if is_incremental() %} -WHERE - _inserted_timestamp >= ( - SELECT - MAX(_inserted_timestamp) - INTERVAL '12 hours' - FROM - {{ this }} - ) -{% endif %} -), -proxies AS ( - SELECT - p0.created_block, - p0.proxy_created_block, - p0.contract_address, - p0.proxy_address, - p0.start_block, - p0._id, - p0._inserted_timestamp - FROM - {{ ref('silver__proxies') }} - p0 - JOIN new_abis na0 - ON p0.contract_address = na0.contract_address - UNION - SELECT - p1.created_block, - p1.proxy_created_block, - p1.contract_address, - p1.proxy_address, - p1.start_block, - p1._id, - p1._inserted_timestamp - FROM - {{ ref('silver__proxies') }} - p1 - JOIN new_abis na1 - ON p1.proxy_address = na1.contract_address -), -all_relevant_contracts AS ( - SELECT - DISTINCT contract_address - FROM - proxies - UNION - SELECT - DISTINCT proxy_address AS contract_address - FROM - proxies - UNION - SELECT - contract_address - FROM - new_abis -), -flat_abis AS ( - SELECT - contract_address, - event_name, - abi, - simple_event_name, - event_signature, - NAME, - inputs, - event_type, - _inserted_timestamp - FROM - {{ ref('silver__flat_event_abis') }} - JOIN all_relevant_contracts USING (contract_address) -), -base AS ( - SELECT - ea.contract_address, - event_name, - abi, - simple_event_name, - event_signature, - NAME, - inputs, - event_type, - ea._inserted_timestamp, - pb._inserted_timestamp AS proxy_inserted_timestamp, - pb.start_block, - pb.proxy_created_block, - pb.contract_address AS base_contract_address, - 1 AS priority - FROM - flat_abis ea - JOIN proxies pb - ON ea.contract_address = pb.proxy_address - UNION ALL - SELECT - eab.contract_address, - event_name, - abi, - simple_event_name, - event_signature, - NAME, - inputs, - event_type, - eab._inserted_timestamp, - pbb._inserted_timestamp AS proxy_inserted_timestamp, - pbb.created_block AS start_block, - pbb.proxy_created_block, - pbb.contract_address AS base_contract_address, - 2 AS priority - FROM - flat_abis eab - JOIN ( - SELECT - DISTINCT contract_address, - created_block, - proxy_created_block, - _inserted_timestamp - FROM - proxies - ) pbb - ON eab.contract_address = pbb.contract_address - UNION ALL - SELECT - contract_address, - event_name, - abi, - simple_event_name, - event_signature, - NAME, - inputs, - event_type, - _inserted_timestamp, - NULL AS proxy_inserted_timestamp, - 0 AS start_block, - NULL AS proxy_created_block, - contract_address AS base_contract_address, - 3 AS priority - FROM - flat_abis eac - WHERE - contract_address NOT IN ( - SELECT - DISTINCT contract_address - FROM - proxies - ) -), -new_records AS ( - SELECT - base_contract_address AS parent_contract_address, - event_name, - abi, - start_block, - proxy_created_block, - simple_event_name, - event_signature, - NAME, - inputs, - event_type, - _inserted_timestamp, - proxy_inserted_timestamp - FROM - base qualify ROW_NUMBER() over ( - PARTITION BY parent_contract_address, - NAME, - event_type, - event_signature, - start_block - ORDER BY - priority ASC, - _inserted_timestamp DESC, - proxy_created_block DESC nulls last, - proxy_inserted_timestamp DESC nulls last - ) = 1 -) -SELECT - parent_contract_address, - event_name, - abi, - start_block, - proxy_created_block, - simple_event_name, - event_signature, - IFNULL(LEAD(start_block) over (PARTITION BY parent_contract_address, event_signature -ORDER BY - start_block) -1, 1e18) AS end_block, - _inserted_timestamp, - proxy_inserted_timestamp, - SYSDATE() AS _updated_timestamp, - {{ dbt_utils.generate_surrogate_key( - ['parent_contract_address','event_signature','start_block'] - ) }} AS complete_event_abis_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - new_records qualify ROW_NUMBER() over ( - PARTITION BY parent_contract_address, - event_name, - event_signature, - start_block - ORDER BY - _inserted_timestamp DESC - ) = 1 diff --git a/models/silver/ABIs/silver__complete_event_abis.yml b/models/silver/ABIs/silver__complete_event_abis.yml deleted file mode 100644 index 9004009..0000000 --- a/models/silver/ABIs/silver__complete_event_abis.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 2 -models: - - name: silver__complete_event_abis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - PARENT_CONTRACT_ADDRESS - - EVENT_SIGNATURE - - START_BLOCK \ No newline at end of file diff --git a/models/silver/ABIs/silver__flat_event_abis.sql b/models/silver/ABIs/silver__flat_event_abis.sql deleted file mode 100644 index da102b9..0000000 --- a/models/silver/ABIs/silver__flat_event_abis.sql +++ /dev/null @@ -1,112 +0,0 @@ -{{ config ( - materialized = 'incremental', - incremental_strategy = 'delete+insert', - unique_key = 'contract_address', - cluster_by = '_inserted_timestamp::date', - tags = ['abis'], - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY (contract_address)" -) }} - -WITH abi_base AS ( - - SELECT - contract_address, - DATA, - _inserted_timestamp - FROM - {{ ref('silver__abis') }} - -{% if is_incremental() %} -WHERE - _inserted_timestamp >= ( - SELECT - MAX(_inserted_timestamp) - INTERVAL '24 hours' - FROM - {{ this }} - ) -{% endif %} -), -flat_abi AS ( - SELECT - contract_address, - _inserted_timestamp, - DATA, - VALUE :inputs AS inputs, - VALUE :payable :: BOOLEAN AS payable, - VALUE :stateMutability :: STRING AS stateMutability, - VALUE :type :: STRING AS TYPE, - VALUE :anonymous :: BOOLEAN AS anonymous, - VALUE :name :: STRING AS NAME - FROM - abi_base, - LATERAL FLATTEN ( - input => DATA - ) - WHERE - TYPE = 'event' qualify ROW_NUMBER() over ( - PARTITION BY contract_address, - NAME, - inputs - ORDER BY - LENGTH(inputs) - ) = 1 -), -event_types AS ( - SELECT - contract_address, - _inserted_timestamp, - inputs, - anonymous, - NAME, - ARRAY_AGG( - VALUE :type :: STRING - ) AS event_type - FROM - flat_abi, - LATERAL FLATTEN ( - input => inputs - ) - GROUP BY - contract_address, - _inserted_timestamp, - inputs, - anonymous, - NAME -), -apply_udfs AS ( - SELECT - contract_address, - NAME AS event_name, - PARSE_JSON( - OBJECT_CONSTRUCT( - 'anonymous', - anonymous, - 'inputs', - inputs, - 'name', - NAME, - 'type', - 'event' - ) :: STRING - ) AS abi, - utils.udf_evm_text_signature(abi) AS simple_event_name, - utils.udf_keccak256(simple_event_name) AS event_signature, - NAME, - inputs, - event_type, - _inserted_timestamp - FROM - event_types -) -SELECT - contract_address, - event_name, - abi, - simple_event_name, - event_signature, - NAME, - inputs, - event_type, - _inserted_timestamp -FROM - apply_udfs diff --git a/models/silver/ABIs/silver__override_abis.sql b/models/silver/ABIs/silver__override_abis.sql deleted file mode 100644 index 88b8439..0000000 --- a/models/silver/ABIs/silver__override_abis.sql +++ /dev/null @@ -1,8 +0,0 @@ -{{ config( - materialized = 'view', - tags = ['abis'] -) }} - -SELECT - NULL AS contract_address, - NULL AS DATA diff --git a/models/silver/ABIs/silver__proxies.sql b/models/silver/ABIs/silver__proxies.sql deleted file mode 100644 index a328b24..0000000 --- a/models/silver/ABIs/silver__proxies.sql +++ /dev/null @@ -1,104 +0,0 @@ -{{ config ( - materialized = 'incremental', - unique_key = ['contract_address','proxy_address'], - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION", - tags = ['abis'] -) }} - -WITH base AS ( - - SELECT - from_address, - to_address, - MIN(block_number) AS start_block, - MAX(modified_timestamp) AS _inserted_timestamp - FROM - {{ ref('core__fact_traces') }} - WHERE - TYPE = 'DELEGATECALL' - AND trace_succeeded - AND tx_succeeded - AND from_address != to_address -- exclude self-calls - -{% if is_incremental() %} -AND modified_timestamp >= ( - SELECT - MAX(_inserted_timestamp) - INTERVAL '24 hours' - FROM - {{ this }} -) -{% endif %} -GROUP BY - from_address, - to_address -), -create_id AS ( - SELECT - from_address AS contract_address, - to_address AS proxy_address, - start_block, - CONCAT( - from_address, - '-', - to_address - ) AS _id, - _inserted_timestamp - FROM - base -), -heal AS ( - SELECT - contract_address, - proxy_address, - start_block, - _id, - _inserted_timestamp - FROM - create_id - -{% if is_incremental() %} -UNION ALL -SELECT - contract_address, - proxy_address, - start_block, - _id, - _inserted_timestamp -FROM - {{ this }} - JOIN create_id USING ( - contract_address, - proxy_address - ) -{% endif %} -), -FINAL AS ( - SELECT - contract_address, - proxy_address, - start_block, - _id, - _inserted_timestamp - FROM - heal qualify ROW_NUMBER() over ( - PARTITION BY contract_address, - proxy_address - ORDER BY - start_block ASC - ) = 1 -) -SELECT - f.contract_address, - f.proxy_address, - f.start_block, - f._id, - f._inserted_timestamp, - C.block_number AS created_block, - p.block_number AS proxy_created_block -FROM - FINAL f - JOIN {{ ref('silver__created_contracts') }} C - ON f.contract_address = C.created_contract_address - JOIN {{ ref('silver__created_contracts') }} - p - ON f.proxy_address = p.created_contract_address diff --git a/models/silver/ABIs/silver__proxies.yml b/models/silver/ABIs/silver__proxies.yml deleted file mode 100644 index da5fa8f..0000000 --- a/models/silver/ABIs/silver__proxies.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: 2 -models: - - name: silver__proxies - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - _ID \ No newline at end of file diff --git a/models/silver/ABIs/silver__user_verified_abis.sql b/models/silver/ABIs/silver__user_verified_abis.sql deleted file mode 100644 index e54b192..0000000 --- a/models/silver/ABIs/silver__user_verified_abis.sql +++ /dev/null @@ -1,550 +0,0 @@ -{{ config ( - materialized = "incremental", - unique_key = "id", - tags = ['abis'] -) }} - -WITH base AS ( - - SELECT - contract_address, - abi, - PARSE_JSON(abi) AS DATA, - SHA2(PARSE_JSON(abi)) AS abi_hash, - discord_username, - _inserted_timestamp - FROM - {{ source( - "crosschain_public", - "user_abis" - ) }} - WHERE - blockchain = 'gnosis' - AND NOT duplicate_abi - -{% if is_incremental() %} -AND contract_address NOT IN ( - SELECT - contract_address - FROM - {{ this }} -) -AND _inserted_timestamp > ( - SELECT - COALESCE( - MAX( - _inserted_timestamp - ), - '1970-01-01' - ) - FROM - {{ this }} -) -{% endif %} -ORDER BY - _inserted_timestamp ASC -LIMIT - 10 -), flat_event_abi AS ( - SELECT - contract_address, - _inserted_timestamp, - DATA, - VALUE :inputs AS inputs, - VALUE :payable :: BOOLEAN AS payable, - VALUE :stateMutability :: STRING AS stateMutability, - VALUE :type :: STRING AS TYPE, - VALUE :anonymous :: BOOLEAN AS anonymous, - VALUE :name :: STRING AS NAME - FROM - base, - LATERAL FLATTEN ( - input => DATA - ) - WHERE - TYPE = 'event' qualify ROW_NUMBER() over ( - PARTITION BY contract_address, - NAME, - inputs - ORDER BY - LENGTH(inputs) - ) = 1 -), -event_types AS ( - SELECT - contract_address, - _inserted_timestamp, - inputs, - anonymous, - NAME, - ARRAY_AGG( - VALUE :type :: STRING - ) AS event_type - FROM - flat_event_abi, - LATERAL FLATTEN ( - input => inputs - ) - GROUP BY - contract_address, - _inserted_timestamp, - inputs, - anonymous, - NAME -), -apply_event_udfs AS ( - SELECT - contract_address, - NAME AS event_name, - PARSE_JSON( - OBJECT_CONSTRUCT( - 'anonymous', - anonymous, - 'inputs', - inputs, - 'name', - NAME, - 'type', - 'event' - ) :: STRING - ) AS abi, - utils.udf_evm_text_signature(abi) AS simple_event_name, - utils.udf_keccak256(simple_event_name) AS event_signature, - NAME, - inputs, - event_type, - _inserted_timestamp - FROM - event_types -), -final_flat_event_abis AS ( - SELECT - contract_address, - event_name, - abi, - simple_event_name, - event_signature, - NAME, - inputs, - event_type, - _inserted_timestamp - FROM - apply_event_udfs -), -flat_function_abis AS ( - SELECT - contract_address, - DATA, - _inserted_timestamp, - VALUE :inputs AS inputs, - VALUE :outputs AS outputs, - VALUE :payable :: BOOLEAN AS payable, - VALUE :stateMutability :: STRING AS stateMutability, - VALUE :type :: STRING AS TYPE, - VALUE :name :: STRING AS NAME - FROM - base, - LATERAL FLATTEN ( - input => DATA - ) - WHERE - TYPE = 'function' -), -udf_function_abis AS ( - SELECT - *, - PARSE_JSON( - object_construct_keep_null( - 'inputs', - IFNULL( - inputs, - [] - ), - 'outputs', - IFNULL( - outputs, - [] - ), - 'name', - NAME, - 'type', - 'function' - ) :: STRING - ) AS abi, - utils.udf_evm_text_signature(abi) AS simple_function_name, - utils.udf_keccak256(simple_function_name) AS function_signature - FROM - flat_function_abis qualify ROW_NUMBER() over ( - PARTITION BY contract_address, - function_signature - ORDER BY - _inserted_timestamp DESC - ) = 1 -), -flat_inputs AS ( - SELECT - contract_address, - inputs, - NAME, - simple_function_name, - function_signature, - ARRAY_AGG( - VALUE :type :: STRING - ) AS inputs_type - FROM - udf_function_abis, - LATERAL FLATTEN ( - input => inputs - ) - GROUP BY - ALL -), -fill_missing_input_names AS ( - SELECT - contract_address, - NAME, - inputs_type, - simple_function_name, - function_signature, - VALUE :internalType :: STRING AS internalType, - VALUE :type :: STRING AS TYPE, - CASE - WHEN VALUE :name :: STRING = '' THEN CONCAT('input_', ROW_NUMBER() over (PARTITION BY contract_address, function_signature - ORDER BY - INDEX ASC) :: STRING) - ELSE VALUE :name :: STRING - END AS name_fixed, - inputs, - INDEX, - VALUE :components AS components - FROM - flat_inputs, - LATERAL FLATTEN ( - input => inputs - ) -), -final_flat_inputs AS ( - SELECT - contract_address, - NAME, - inputs_type, - simple_function_name, - function_signature, - ARRAY_AGG( - OBJECT_CONSTRUCT( - 'internalType', - internalType, - 'name', - name_fixed, - 'type', - TYPE, - 'components', - components - ) - ) within GROUP ( - ORDER BY - INDEX - ) AS inputs - FROM - fill_missing_input_names - GROUP BY - ALL -), -flat_outputs AS ( - SELECT - contract_address, - outputs, - simple_function_name, - function_signature, - NAME, - ARRAY_AGG( - VALUE :type :: STRING - ) AS outputs_type - FROM - udf_function_abis, - LATERAL FLATTEN ( - input => outputs - ) - GROUP BY - ALL -), -fill_missing_output_names AS ( - SELECT - contract_address, - NAME, - outputs_type, - simple_function_name, - function_signature, - VALUE :internalType :: STRING AS internalType, - VALUE :type :: STRING AS TYPE, - CASE - WHEN VALUE :name :: STRING = '' THEN CONCAT('output_', ROW_NUMBER() over (PARTITION BY contract_address, function_signature - ORDER BY - INDEX ASC) :: STRING) - ELSE VALUE :name :: STRING - END AS name_fixed, - outputs, - INDEX, - VALUE :components AS components - FROM - flat_outputs, - LATERAL FLATTEN ( - input => outputs - ) -), -final_flat_outputs AS ( - SELECT - contract_address, - NAME, - outputs_type, - simple_function_name, - function_signature, - ARRAY_AGG( - OBJECT_CONSTRUCT( - 'internalType', - internalType, - 'name', - name_fixed, - 'type', - TYPE, - 'components', - components - ) - ) within GROUP ( - ORDER BY - INDEX - ) AS outputs - FROM - fill_missing_output_names - GROUP BY - ALL -), -all_contracts AS ( - SELECT - A.contract_address, - A.name AS function_name, - i.inputs, - o.outputs, - i.inputs_type, - o.outputs_type, - A._inserted_timestamp, - A.function_signature, - A.simple_function_name - FROM - udf_function_abis A - LEFT JOIN final_flat_inputs i - ON A.contract_address = i.contract_address - AND A.function_signature = i.function_signature - LEFT JOIN final_flat_outputs o - ON A.contract_address = o.contract_address - AND A.function_signature = o.function_signature -), -apply_function_udfs AS ( - SELECT - contract_address, - function_name, - PARSE_JSON( - object_construct_keep_null( - 'inputs', - IFNULL( - inputs, - [] - ), - 'outputs', - IFNULL( - outputs, - [] - ), - 'name', - function_name, - 'type', - 'function' - ) :: STRING - ) AS abi, - simple_function_name, - function_signature, - inputs, - outputs, - inputs_type, - outputs_type, - _inserted_timestamp - FROM - all_contracts -), -final_function_abis AS ( - SELECT - contract_address, - function_name, - abi, - simple_function_name, - function_signature, - inputs, - outputs, - inputs_type, - outputs_type, - _inserted_timestamp - FROM - apply_function_udfs -), -new_abis AS ( - SELECT - DISTINCT contract_address - FROM - base -), -contracts AS ( - SELECT - contract_address - FROM - {{ ref('silver__proxies') }} - JOIN new_abis USING (contract_address) -), -proxies AS ( - SELECT - p.proxy_address, - p.contract_address - FROM - {{ ref('silver__proxies') }} - p - JOIN new_abis n - ON p.proxy_address = n.contract_address -), -final_groupings AS ( - SELECT - b.contract_address AS address, - C.contract_address, - proxy_address, - CASE - WHEN C.contract_address IS NOT NULL - AND proxy_address IS NOT NULL THEN 'contract' - WHEN C.contract_address IS NOT NULL THEN 'contract' - WHEN proxy_address IS NOT NULL THEN 'proxy' - WHEN C.contract_address IS NULL - AND proxy_address IS NULL THEN 'contract' - END AS TYPE, - p.contract_address AS proxy_parent, - CASE - WHEN TYPE = 'contract' THEN address - ELSE proxy_parent - END AS final_address - FROM - base b - LEFT JOIN ( - SELECT - DISTINCT contract_address - FROM - contracts - ) C - ON b.contract_address = C.contract_address - LEFT JOIN ( - SELECT - DISTINCT proxy_address, - contract_address - FROM - proxies - ) p - ON b.contract_address = proxy_address -), -identified_addresses AS ( - SELECT - DISTINCT address AS base_address, - final_address AS contract_address - FROM - final_groupings -), -function_mapping AS ( - SELECT - ia.base_address, - ia.contract_address, - LEFT( - function_signature, - 10 - ) AS function_sig - FROM - identified_addresses ia - JOIN final_function_abis ffa - ON ia.base_address = ffa.contract_address -), -valid_traces AS ( - SELECT - DISTINCT base_address - FROM - ( - SELECT - base_address - FROM - {{ ref('core__fact_traces') }} - JOIN function_mapping - ON function_sig = LEFT( - input, - 10 - ) - AND IFF( - TYPE = 'DELEGATECALL', - from_address, - to_address - ) = contract_address - WHERE - block_timestamp > DATEADD('month', -12, SYSDATE()) - LIMIT - 50000) - ), event_mapping AS ( - SELECT - ia.base_address, - ia.contract_address, - event_signature - FROM - identified_addresses ia - JOIN final_flat_event_abis fea - ON ia.base_address = fea.contract_address - ), - valid_logs AS ( - SELECT - DISTINCT base_address - FROM - ( - SELECT - base_address - FROM - {{ ref('core__fact_event_logs') }} - l - JOIN event_mapping ia - ON ia.contract_address = l.contract_address - AND event_signature = topics [0] :: STRING - WHERE - block_timestamp > DATEADD('month', -12, SYSDATE()) - LIMIT - 50000) - ), all_valid_addresses AS ( - SELECT - base_address - FROM - valid_traces - UNION - SELECT - base_address - FROM - valid_logs - ) - SELECT - contract_address, - abi, - discord_username, - _inserted_timestamp, - abi_hash, - CONCAT( - contract_address, - '-', - abi_hash - ) AS id - FROM - base - WHERE - contract_address IN ( - SELECT - base_address - FROM - all_valid_addresses - ) qualify(ROW_NUMBER() over(PARTITION BY contract_address - ORDER BY - _inserted_timestamp DESC)) = 1 diff --git a/models/silver/ABIs/silver__user_verified_abis.yml b/models/silver/ABIs/silver__user_verified_abis.yml deleted file mode 100644 index 912a5c8..0000000 --- a/models/silver/ABIs/silver__user_verified_abis.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: 2 -models: - - name: silver__user_verified_abis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - ID \ No newline at end of file diff --git a/models/silver/ABIs/silver__verified_abis.sql b/models/silver/ABIs/silver__verified_abis.sql deleted file mode 100644 index 647f581..0000000 --- a/models/silver/ABIs/silver__verified_abis.sql +++ /dev/null @@ -1,105 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = "contract_address", - tags = ['abis'] -) }} - -WITH base AS ( - - SELECT - contract_address, - PARSE_JSON( - abi_data :data :result - ) AS DATA, - _inserted_timestamp - FROM - {{ ref('bronze_api__contract_abis') }} - WHERE - abi_data :data :message :: STRING = 'OK' - -{% if is_incremental() %} -AND _inserted_timestamp >= ( - SELECT - MAX( - _inserted_timestamp - ) - FROM - {{ this }} -) -{% endif %} -), -gnosisscan_abis AS ( - SELECT - contract_address, - DATA, - _inserted_timestamp, - 'gnosisscan' AS abi_source - FROM - base -), -user_abis AS ( - SELECT - contract_address, - abi, - discord_username, - _inserted_timestamp, - 'user' AS abi_source, - abi_hash - FROM - {{ ref('silver__user_verified_abis') }} - -{% if is_incremental() %} -WHERE - _inserted_timestamp >= ( - SELECT - COALESCE( - MAX( - _inserted_timestamp - ), - '1970-01-01' - ) - FROM - {{ this }} - WHERE - abi_source = 'user' - ) - AND contract_address NOT IN ( - SELECT - contract_address - FROM - {{ this }} - ) -{% endif %} -), -all_abis AS ( - SELECT - contract_address, - DATA, - _inserted_timestamp, - abi_source, - NULL AS discord_username, - SHA2(DATA) AS abi_hash - FROM - gnosisscan_abis - UNION - SELECT - contract_address, - PARSE_JSON(abi) AS DATA, - _inserted_timestamp, - 'user' AS abi_source, - discord_username, - abi_hash - FROM - user_abis -) -SELECT - contract_address, - DATA, - _inserted_timestamp, - abi_source, - discord_username, - abi_hash -FROM - all_abis qualify(ROW_NUMBER() over(PARTITION BY contract_address -ORDER BY - _INSERTED_TIMESTAMP DESC)) = 1 diff --git a/models/silver/ABIs/silver__verified_abis.yml b/models/silver/ABIs/silver__verified_abis.yml deleted file mode 100644 index 2f623e9..0000000 --- a/models/silver/ABIs/silver__verified_abis.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: 2 -models: - - name: silver__verified_abis - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - CONTRACT_ADDRESS \ No newline at end of file diff --git a/models/silver/_observability/silver_observability__blocks_completeness.sql b/models/silver/_observability/silver_observability__blocks_completeness.sql deleted file mode 100644 index 7092fd5..0000000 --- a/models/silver/_observability/silver_observability__blocks_completeness.sql +++ /dev/null @@ -1,161 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'test_timestamp', - tags = ['observability'], - full_refresh = false -) }} - -WITH summary_stats AS ( - - SELECT - MIN(block_number) AS min_block, - MAX(block_number) AS max_block, - MIN(block_timestamp) AS min_block_timestamp, - MAX(block_timestamp) AS max_block_timestamp, - COUNT(1) AS blocks_tested - FROM - {{ ref('silver__blocks') }} - WHERE - block_timestamp <= DATEADD('hour', -12, CURRENT_TIMESTAMP()) - -{% if is_incremental() %} -AND ( - block_number >= ( - SELECT - MIN(block_number) - FROM - ( - SELECT - MIN(block_number) AS block_number - FROM - {{ ref('silver__blocks') }} - WHERE - block_timestamp BETWEEN DATEADD('hour', -96, CURRENT_TIMESTAMP()) - AND DATEADD('hour', -95, CURRENT_TIMESTAMP()) - UNION - SELECT - MIN(VALUE) - 1 AS block_number - FROM - ( - SELECT - blocks_impacted_array - FROM - {{ this }} - qualify ROW_NUMBER() over ( - ORDER BY - test_timestamp DESC - ) = 1 - ), - LATERAL FLATTEN( - input => blocks_impacted_array - ) - ) - ) {% if var('OBSERV_FULL_TEST') %} - OR block_number >= 0 - {% endif %} -) -{% endif %} -), -block_range AS ( - SELECT - _id AS block_number - FROM - {{ ref('silver__number_sequence') }} - WHERE - _id BETWEEN ( - SELECT - min_block - FROM - summary_stats - ) - AND ( - SELECT - max_block - FROM - summary_stats - ) -), -blocks AS ( - SELECT - l.block_number, - block_timestamp, - LAG( - l.block_number, - 1 - ) over ( - ORDER BY - l.block_number ASC - ) AS prev_BLOCK_NUMBER - FROM - {{ ref("silver__blocks") }} - l - INNER JOIN block_range b - ON l.block_number = b.block_number - AND l.block_number >= ( - SELECT - MIN(block_number) - FROM - block_range - ) -), -block_gen AS ( - SELECT - _id AS block_number - FROM - {{ ref('silver__number_sequence') }} - WHERE - _id BETWEEN ( - SELECT - MIN(block_number) - FROM - blocks - ) - AND ( - SELECT - MAX(block_number) - FROM - blocks - ) -) -SELECT - 'blocks' AS test_name, - MIN( - b.block_number - ) AS min_block, - MAX( - b.block_number - ) AS max_block, - MIN( - b.block_timestamp - ) AS min_block_timestamp, - MAX( - b.block_timestamp - ) AS max_block_timestamp, - COUNT(1) AS blocks_tested, - COUNT( - CASE - WHEN C.block_number IS NOT NULL THEN A.block_number - END - ) AS blocks_impacted_count, - ARRAY_AGG( - CASE - WHEN C.block_number IS NOT NULL THEN A.block_number - END - ) within GROUP ( - ORDER BY - A.block_number - ) AS blocks_impacted_array, - CURRENT_TIMESTAMP AS test_timestamp -FROM - block_gen A - LEFT JOIN blocks b - ON A.block_number = b.block_number - LEFT JOIN blocks C - ON A.block_number > C.prev_block_number - AND A.block_number < C.block_number - AND C.block_number - C.prev_block_number <> 1 -WHERE - COALESCE( - b.block_number, - C.block_number - ) IS NOT NULL diff --git a/models/silver/_observability/silver_observability__logs_completeness.sql b/models/silver/_observability/silver_observability__logs_completeness.sql deleted file mode 100644 index d82f574..0000000 --- a/models/silver/_observability/silver_observability__logs_completeness.sql +++ /dev/null @@ -1,119 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'test_timestamp', - tags = ['observability'], - full_refresh = false -) }} - -WITH summary_stats AS ( - - SELECT - MIN(block_number) AS min_block, - MAX(block_number) AS max_block, - MIN(block_timestamp) AS min_block_timestamp, - MAX(block_timestamp) AS max_block_timestamp, - COUNT(1) AS blocks_tested - FROM - {{ ref('silver__blocks') }} - WHERE - block_timestamp <= DATEADD('hour', -12, CURRENT_TIMESTAMP()) - -{% if is_incremental() %} -AND ( - block_number >= ( - SELECT - MIN(block_number) - FROM - ( - SELECT - MIN(block_number) AS block_number - FROM - {{ ref('silver__blocks') }} - WHERE - block_timestamp BETWEEN DATEADD('hour', -96, CURRENT_TIMESTAMP()) - AND DATEADD('hour', -95, CURRENT_TIMESTAMP()) - UNION - SELECT - MIN(VALUE) - 1 AS block_number - FROM - ( - SELECT - blocks_impacted_array - FROM - {{ this }} - qualify ROW_NUMBER() over ( - ORDER BY - test_timestamp DESC - ) = 1 - ), - LATERAL FLATTEN( - input => blocks_impacted_array - ) - ) - ) {% if var('OBSERV_FULL_TEST') %} - OR block_number >= 0 - {% endif %} -) -{% endif %} -), -block_range AS ( - SELECT - _id AS block_number - FROM - {{ ref('silver__number_sequence') }} - WHERE - _id BETWEEN ( - SELECT - min_block - FROM - summary_stats - ) - AND ( - SELECT - max_block - FROM - summary_stats - ) -), -broken_blocks AS ( - SELECT - DISTINCT block_number - FROM - {{ ref("silver__receipts") }} - r - LEFT JOIN {{ ref("silver__logs") }} - l USING ( - block_number, - tx_hash - ) - JOIN block_range USING (block_number) - WHERE - l.tx_hash IS NULL - AND ARRAY_SIZE( - r.logs - ) > 0 -), -impacted_blocks AS ( - SELECT - COUNT(1) AS blocks_impacted_count, - ARRAY_AGG(block_number) within GROUP ( - ORDER BY - block_number - ) AS blocks_impacted_array - FROM - broken_blocks -) -SELECT - 'event_logs' AS test_name, - min_block, - max_block, - min_block_timestamp, - max_block_timestamp, - blocks_tested, - blocks_impacted_count, - blocks_impacted_array, - CURRENT_TIMESTAMP() AS test_timestamp -FROM - summary_stats - JOIN impacted_blocks - ON 1 = 1 diff --git a/models/silver/_observability/silver_observability__receipts_completeness.sql b/models/silver/_observability/silver_observability__receipts_completeness.sql deleted file mode 100644 index eb27a05..0000000 --- a/models/silver/_observability/silver_observability__receipts_completeness.sql +++ /dev/null @@ -1,117 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'test_timestamp', - tags = ['observability'], - full_refresh = false -) }} - -WITH summary_stats AS ( - - SELECT - MIN(block_number) AS min_block, - MAX(block_number) AS max_block, - MIN(block_timestamp) AS min_block_timestamp, - MAX(block_timestamp) AS max_block_timestamp, - COUNT(1) AS blocks_tested - FROM - {{ ref('silver__blocks') }} - WHERE - block_timestamp <= DATEADD('hour', -12, CURRENT_TIMESTAMP()) - -{% if is_incremental() %} -AND ( - block_number >= ( - SELECT - MIN(block_number) - FROM - ( - SELECT - MIN(block_number) AS block_number - FROM - {{ ref('silver__blocks') }} - WHERE - block_timestamp BETWEEN DATEADD('hour', -96, CURRENT_TIMESTAMP()) - AND DATEADD('hour', -95, CURRENT_TIMESTAMP()) - UNION - SELECT - MIN(VALUE) - 1 AS block_number - FROM - ( - SELECT - blocks_impacted_array - FROM - {{ this }} - qualify ROW_NUMBER() over ( - ORDER BY - test_timestamp DESC - ) = 1 - ), - LATERAL FLATTEN( - input => blocks_impacted_array - ) - ) - ) {% if var('OBSERV_FULL_TEST') %} - OR block_number >= 0 - {% endif %} -) -{% endif %} -), -block_range AS ( - SELECT - _id AS block_number - FROM - {{ ref('silver__number_sequence') }} - WHERE - _id BETWEEN ( - SELECT - min_block - FROM - summary_stats - ) - AND ( - SELECT - max_block - FROM - summary_stats - ) -), -broken_blocks AS ( - SELECT - DISTINCT block_number - FROM - {{ ref("silver__transactions") }} - t - LEFT JOIN {{ ref("silver__receipts") }} - r USING ( - block_number, - tx_hash, - block_hash - ) - JOIN block_range USING (block_number) - WHERE - r.tx_hash IS NULL -), -impacted_blocks AS ( - SELECT - COUNT(1) AS blocks_impacted_count, - ARRAY_AGG(block_number) within GROUP ( - ORDER BY - block_number - ) AS blocks_impacted_array - FROM - broken_blocks -) -SELECT - 'receipts' AS test_name, - min_block, - max_block, - min_block_timestamp, - max_block_timestamp, - blocks_tested, - blocks_impacted_count, - blocks_impacted_array, - CURRENT_TIMESTAMP() AS test_timestamp -FROM - summary_stats - JOIN impacted_blocks - ON 1 = 1 diff --git a/models/silver/_observability/silver_observability__traces_completeness.sql b/models/silver/_observability/silver_observability__traces_completeness.sql deleted file mode 100644 index c3860db..0000000 --- a/models/silver/_observability/silver_observability__traces_completeness.sql +++ /dev/null @@ -1,116 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'test_timestamp', - tags = ['observability'], - full_refresh = false -) }} - -WITH summary_stats AS ( - - SELECT - MIN(block_number) AS min_block, - MAX(block_number) AS max_block, - MIN(block_timestamp) AS min_block_timestamp, - MAX(block_timestamp) AS max_block_timestamp, - COUNT(1) AS blocks_tested - FROM - {{ ref('silver__blocks') }} - WHERE - block_timestamp <= DATEADD('hour', -12, CURRENT_TIMESTAMP()) - -{% if is_incremental() %} -AND ( - block_number >= ( - SELECT - MIN(block_number) - FROM - ( - SELECT - MIN(block_number) AS block_number - FROM - {{ ref('silver__blocks') }} - WHERE - block_timestamp BETWEEN DATEADD('hour', -96, CURRENT_TIMESTAMP()) - AND DATEADD('hour', -95, CURRENT_TIMESTAMP()) - UNION - SELECT - MIN(VALUE) - 1 AS block_number - FROM - ( - SELECT - blocks_impacted_array - FROM - {{ this }} - qualify ROW_NUMBER() over ( - ORDER BY - test_timestamp DESC - ) = 1 - ), - LATERAL FLATTEN( - input => blocks_impacted_array - ) - ) - ) {% if var('OBSERV_FULL_TEST') %} - OR block_number >= 0 - {% endif %} -) -{% endif %} -), -block_range AS ( - SELECT - _id AS block_number - FROM - {{ ref('silver__number_sequence') }} - WHERE - _id BETWEEN ( - SELECT - min_block - FROM - summary_stats - ) - AND ( - SELECT - max_block - FROM - summary_stats - ) -), -broken_blocks AS ( - SELECT - DISTINCT block_number - FROM - {{ ref("silver__transactions") }} - tx - LEFT JOIN {{ ref("core__fact_traces") }} - tr USING ( - block_number, - tx_hash - ) - JOIN block_range USING (block_number) - WHERE - tr.tx_hash IS NULL -), -impacted_blocks AS ( - SELECT - COUNT(1) AS blocks_impacted_count, - ARRAY_AGG(block_number) within GROUP ( - ORDER BY - block_number - ) AS blocks_impacted_array - FROM - broken_blocks -) -SELECT - 'traces' AS test_name, - min_block, - max_block, - min_block_timestamp, - max_block_timestamp, - blocks_tested, - blocks_impacted_count, - blocks_impacted_array, - CURRENT_TIMESTAMP() AS test_timestamp -FROM - summary_stats - JOIN impacted_blocks - ON 1 = 1 diff --git a/models/silver/_observability/silver_observability__transactions_completeness.sql b/models/silver/_observability/silver_observability__transactions_completeness.sql deleted file mode 100644 index 3d0743b..0000000 --- a/models/silver/_observability/silver_observability__transactions_completeness.sql +++ /dev/null @@ -1,117 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'test_timestamp', - tags = ['observability'], - full_refresh = false -) }} - -WITH summary_stats AS ( - - SELECT - MIN(block_number) AS min_block, - MAX(block_number) AS max_block, - MIN(block_timestamp) AS min_block_timestamp, - MAX(block_timestamp) AS max_block_timestamp, - COUNT(1) AS blocks_tested - FROM - {{ ref('silver__blocks') }} - WHERE - block_timestamp <= DATEADD('hour', -12, CURRENT_TIMESTAMP()) - -{% if is_incremental() %} -AND ( - block_number >= ( - SELECT - MIN(block_number) - FROM - ( - SELECT - MIN(block_number) AS block_number - FROM - {{ ref('silver__blocks') }} - WHERE - block_timestamp BETWEEN DATEADD('hour', -96, CURRENT_TIMESTAMP()) - AND DATEADD('hour', -95, CURRENT_TIMESTAMP()) - UNION - SELECT - MIN(VALUE) - 1 AS block_number - FROM - ( - SELECT - blocks_impacted_array - FROM - {{ this }} - qualify ROW_NUMBER() over ( - ORDER BY - test_timestamp DESC - ) = 1 - ), - LATERAL FLATTEN( - input => blocks_impacted_array - ) - ) - ) {% if var('OBSERV_FULL_TEST') %} - OR block_number >= 0 - {% endif %} -) -{% endif %} -), -block_range AS ( - SELECT - _id AS block_number - FROM - {{ ref('silver__number_sequence') }} - WHERE - _id BETWEEN ( - SELECT - min_block - FROM - summary_stats - ) - AND ( - SELECT - max_block - FROM - summary_stats - ) -), -broken_blocks AS ( - SELECT - DISTINCT block_number - FROM - {{ ref("silver__confirmed_blocks") }} - b - LEFT JOIN {{ ref("silver__transactions") }} - t USING ( - block_number, - tx_hash, - block_hash - ) - JOIN block_range USING (block_number) - WHERE - t.tx_hash IS NULL -), -impacted_blocks AS ( - SELECT - COUNT(1) AS blocks_impacted_count, - ARRAY_AGG(block_number) within GROUP ( - ORDER BY - block_number - ) AS blocks_impacted_array - FROM - broken_blocks -) -SELECT - 'transactions' AS test_name, - min_block, - max_block, - min_block_timestamp, - max_block_timestamp, - blocks_tested, - blocks_impacted_count, - blocks_impacted_array, - CURRENT_TIMESTAMP() AS test_timestamp -FROM - summary_stats - JOIN impacted_blocks - ON 1 = 1 diff --git a/models/silver/core/silver__blocks.sql b/models/silver/core/silver__blocks.sql deleted file mode 100644 index e4150f7..0000000 --- a/models/silver/core/silver__blocks.sql +++ /dev/null @@ -1,91 +0,0 @@ --- depends_on: {{ ref('bronze__blocks') }} -{{ config( - materialized = 'incremental', - unique_key = "block_number", - cluster_by = "block_timestamp::date", - tags = ['non_realtime'], - merge_exclude_columns = ["inserted_timestamp"], - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(hash,parent_hash,receipts_root,sha3_uncles,state_root,transactions_root)", - full_refresh = false -) }} - -SELECT - block_number, - TRY_TO_NUMBER( - utils.udf_hex_to_int( - DATA :baseFeePerGas :: STRING - ) - ) AS base_fee_per_gas, - TRY_TO_NUMBER( - utils.udf_hex_to_int( - DATA :difficulty :: STRING - ) - ) AS difficulty, - DATA :extraData :: STRING AS extra_data, - TRY_TO_NUMBER( - utils.udf_hex_to_int( - DATA :gasLimit :: STRING - ) - ) AS gas_limit, - TRY_TO_NUMBER( - utils.udf_hex_to_int( - DATA :gasUsed :: STRING - ) - ) AS gas_used, - DATA :hash :: STRING AS HASH, - DATA :logsBloom :: STRING AS logs_bloom, - DATA :miner :: STRING AS miner, - TRY_TO_NUMBER( - utils.udf_hex_to_int( - DATA :nonce :: STRING - ) - ) AS nonce, - TRY_TO_NUMBER( - utils.udf_hex_to_int( - DATA :number :: STRING - ) - ) AS NUMBER, - DATA :parentHash :: STRING AS parent_hash, - DATA :receiptsRoot :: STRING AS receipts_root, - DATA :sha3Uncles :: STRING AS sha3_uncles, - TRY_TO_NUMBER( - utils.udf_hex_to_int( - DATA :size :: STRING - ) - ) AS SIZE, - DATA :stateRoot :: STRING AS state_root, - utils.udf_hex_to_int( - DATA :timestamp :: STRING - ) :: TIMESTAMP AS block_timestamp, - TRY_TO_NUMBER( - utils.udf_hex_to_int( - DATA :totalDifficulty :: STRING - ) - ) AS total_difficulty, - DATA :transactionsRoot :: STRING AS transactions_root, - DATA :uncles AS uncles, - _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__blocks') }} -WHERE - _inserted_timestamp >= ( - SELECT - MAX(_inserted_timestamp) _inserted_timestamp - FROM - {{ this }} - ) -{% else %} - {{ ref('bronze__blocks_fr') }} -{% endif %} - -qualify(ROW_NUMBER() over (PARTITION BY block_number -ORDER BY - _inserted_timestamp DESC)) = 1 diff --git a/models/silver/core/silver__confirmed_blocks.sql b/models/silver/core/silver__confirmed_blocks.sql deleted file mode 100644 index 1f4f2f2..0000000 --- a/models/silver/core/silver__confirmed_blocks.sql +++ /dev/null @@ -1,51 +0,0 @@ --- depends_on: {{ ref('bronze__confirm_blocks') }} -{{ config( - materialized = 'incremental', - incremental_strategy = 'delete+insert', - unique_key = "block_number", - cluster_by = "round(block_number,-3)", - tags = ['non_realtime'], - full_refresh = false -) }} - -WITH base AS ( - - SELECT - block_number, - DATA :result :hash :: STRING AS block_hash, - DATA :result :transactions txs, - _inserted_timestamp - FROM - -{% if is_incremental() %} -{{ ref('bronze__confirm_blocks') }} -WHERE - _inserted_timestamp >= ( - SELECT - IFNULL( - MAX( - _inserted_timestamp - ), - '1970-01-01' :: TIMESTAMP - ) _inserted_timestamp - FROM - {{ this }} - ) -{% else %} - {{ ref('bronze__confirm_blocks_fr') }} -{% endif %} - -qualify(ROW_NUMBER() over (PARTITION BY block_number -ORDER BY - _inserted_timestamp DESC)) = 1 -) -SELECT - block_number, - block_hash, - VALUE :: STRING AS tx_hash, - _inserted_timestamp -FROM - base, - LATERAL FLATTEN ( - input => txs - ) diff --git a/models/silver/core/silver__contracts.sql b/models/silver/core/silver__contracts.sql deleted file mode 100644 index b85c696..0000000 --- a/models/silver/core/silver__contracts.sql +++ /dev/null @@ -1,112 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = 'contract_address', - merge_exclude_columns = ["inserted_timestamp"], - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(contract_address, token_symbol, token_name), SUBSTRING(contract_address, token_symbol, token_name)", - tags = ['non_realtime'] -) }} - -WITH base_metadata AS ( - - SELECT - contract_address, - block_number, - function_sig AS function_signature, - read_result AS read_output, - _inserted_timestamp - FROM - {{ ref('bronze_api__token_reads') }} - WHERE - read_result IS NOT NULL - AND read_result <> '0x' - -{% if is_incremental() %} -AND _inserted_timestamp >= ( - SELECT - MAX( - _inserted_timestamp - ) - FROM - {{ this }} -) -{% endif %} -), -token_names AS ( - SELECT - contract_address, - block_number, - function_signature, - read_output, - utils.udf_hex_to_string( - SUBSTR(read_output,(64 * 2 + 3), len(read_output))) AS token_name - FROM - base_metadata - WHERE - function_signature = '0x06fdde03' - AND token_name IS NOT NULL - ), - token_symbols AS ( - SELECT - contract_address, - block_number, - function_signature, - read_output, - utils.udf_hex_to_string( - SUBSTR(read_output,(64 * 2 + 3), len(read_output))) AS token_symbol - FROM - base_metadata - WHERE - function_signature = '0x95d89b41' - AND token_symbol IS NOT NULL - ), - token_decimals AS ( - SELECT - contract_address, - CASE - WHEN LENGTH( - read_output :: STRING - ) <= 4300 THEN utils.udf_hex_to_int( - read_output :: STRING - ) - ELSE NULL - END AS token_decimals, - LENGTH(token_decimals) AS dec_length - FROM - base_metadata - WHERE - function_signature = '0x313ce567' - AND read_output IS NOT NULL - AND read_output <> '0x' - ), - contracts AS ( - SELECT - contract_address, - MAX(_inserted_timestamp) AS _inserted_timestamp - FROM - base_metadata - GROUP BY - 1 - ) - SELECT - c1.contract_address :: STRING AS contract_address, - token_name, - TRY_TO_NUMBER(token_decimals) AS token_decimals, - token_symbol, - _inserted_timestamp, - {{ dbt_utils.generate_surrogate_key( - ['c1.contract_address'] - ) }} AS contracts_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id - FROM - contracts c1 - LEFT JOIN token_names - ON c1.contract_address = token_names.contract_address - LEFT JOIN token_symbols - ON c1.contract_address = token_symbols.contract_address - LEFT JOIN token_decimals - ON c1.contract_address = token_decimals.contract_address - AND dec_length < 3 qualify(ROW_NUMBER() over(PARTITION BY c1.contract_address - ORDER BY - _inserted_timestamp DESC)) = 1 diff --git a/models/silver/core/silver__contracts.yml b/models/silver/core/silver__contracts.yml deleted file mode 100644 index 8097422..0000000 --- a/models/silver/core/silver__contracts.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: 2 -models: - - name: silver__contracts - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - CONTRACT_ADDRESS - columns: - - name: CONTRACT_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - STRING - - VARCHAR - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 2 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ diff --git a/models/silver/core/silver__created_contracts.sql b/models/silver/core/silver__created_contracts.sql deleted file mode 100644 index 0b7ba8d..0000000 --- a/models/silver/core/silver__created_contracts.sql +++ /dev/null @@ -1,46 +0,0 @@ -{{ config ( - materialized = "incremental", - unique_key = "created_contract_address", - merge_exclude_columns = ["inserted_timestamp"], - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(block_timestamp, tx_hash, created_contract_address, creator_address), SUBSTRING(created_contract_address, creator_address)", - tags = ['non_realtime'] -) }} - -SELECT - block_number, - block_timestamp, - tx_hash, - to_address AS created_contract_address, - from_address AS creator_address, - input AS created_contract_input, - modified_timestamp AS _inserted_timestamp, - {{ dbt_utils.generate_surrogate_key( - ['to_address'] - ) }} AS created_contracts_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - {{ ref('core__fact_traces') }} -WHERE - TYPE ILIKE 'create%' - AND to_address IS NOT NULL - AND input IS NOT NULL - AND input != '0x' - AND tx_succeeded - AND trace_succeeded - -{% if is_incremental() %} -AND _inserted_timestamp >= ( - SELECT - MAX( - _inserted_timestamp - ) :: DATE - 1 - FROM - {{ this }} -) -{% endif %} - -qualify(ROW_NUMBER() over(PARTITION BY created_contract_address -ORDER BY - _inserted_timestamp DESC)) = 1 diff --git a/models/silver/core/silver__created_contracts.yml b/models/silver/core/silver__created_contracts.yml deleted file mode 100644 index ed60983..0000000 --- a/models/silver/core/silver__created_contracts.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: 2 -models: - - name: silver__created_contracts - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - created_contract_address - columns: - - name: BLOCK_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ - \ No newline at end of file diff --git a/models/silver/core/silver__decoded_logs.sql b/models/silver/core/silver__decoded_logs.sql deleted file mode 100644 index 7058bef..0000000 --- a/models/silver/core/silver__decoded_logs.sql +++ /dev/null @@ -1,246 +0,0 @@ --- depends_on: {{ ref('bronze__decoded_logs') }} -{{ config ( - materialized = "incremental", - unique_key = ['block_number', 'event_index'], - cluster_by = "block_timestamp::date", - incremental_predicates = ["dynamic_range", "block_number"], - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION", - merge_exclude_columns = ["inserted_timestamp"], - full_refresh = false, - tags = ['decoded_logs','reorg'] -) }} - -WITH base_data AS ( - - SELECT - block_number :: INTEGER AS block_number, - SPLIT( - id, - '-' - ) [0] :: STRING AS tx_hash, - SPLIT( - id, - '-' - ) [1] :: INTEGER AS event_index, - DATA :name :: STRING AS event_name, - LOWER( - DATA :address :: STRING - ) :: STRING AS contract_address, - DATA AS decoded_data, - id :: STRING AS _log_id, - TO_TIMESTAMP_NTZ(_inserted_timestamp) AS _inserted_timestamp - FROM - -{% if is_incremental() %} -{{ ref('bronze__decoded_logs') }} -WHERE - TO_TIMESTAMP_NTZ(_inserted_timestamp) >= ( - SELECT - MAX(_inserted_timestamp) - INTERVAL '2 hours' - FROM - {{ this }} - ) - AND DATA NOT ILIKE '%Event topic is not present in given ABI%' -{% else %} - {{ ref('bronze__decoded_logs_fr') }} -WHERE - DATA NOT ILIKE '%Event topic is not present in given ABI%' -{% endif %} - -qualify(ROW_NUMBER() over (PARTITION BY block_number, event_index -ORDER BY - _inserted_timestamp DESC, _partition_by_created_date DESC)) = 1 -), -transformed_logs AS ( - SELECT - block_number, - tx_hash, - event_index, - contract_address, - event_name, - decoded_data, - _inserted_timestamp, - _log_id, - utils.udf_transform_logs(decoded_data) AS transformed - FROM - base_data -), -FINAL AS ( - SELECT - b.tx_hash, - b.block_number, - b.event_index, - b.event_name, - b.contract_address, - b.decoded_data, - transformed, - b._log_id, - b._inserted_timestamp, - OBJECT_AGG( - DISTINCT CASE - WHEN v.value :name = '' THEN CONCAT( - 'anonymous_', - v.index - ) - ELSE v.value :name - END, - v.value :value - ) AS decoded_flat - FROM - transformed_logs b, - LATERAL FLATTEN( - input => transformed :data - ) v - GROUP BY - b.tx_hash, - b.block_number, - b.event_index, - b.event_name, - b.contract_address, - b.decoded_data, - transformed, - b._log_id, - b._inserted_timestamp -), -new_records AS ( - SELECT - b.tx_hash, - b.block_number, - b.event_index, - b.event_name, - b.contract_address, - b.decoded_data, - b.transformed, - b._log_id, - b._inserted_timestamp, - b.decoded_flat, - block_timestamp, - origin_function_signature, - origin_from_address, - origin_to_address, - topics, - DATA, - event_removed :: STRING AS event_removed, - tx_status, - CASE - WHEN block_timestamp IS NULL THEN TRUE - ELSE FALSE - END AS is_pending - FROM - FINAL b - LEFT JOIN {{ ref('silver__logs') }} USING ( - block_number, - _log_id - ) -) - -{% if is_incremental() %}, -missing_data AS ( - SELECT - t.tx_hash, - t.block_number, - t.event_index, - t.event_name, - t.contract_address, - t.decoded_data, - t.transformed, - t._log_id, - GREATEST( - TO_TIMESTAMP_NTZ( - t._inserted_timestamp - ), - TO_TIMESTAMP_NTZ( - l._inserted_timestamp - ) - ) AS _inserted_timestamp, - t.decoded_flat, - l.block_timestamp, - l.origin_function_signature, - l.origin_from_address, - l.origin_to_address, - l.topics, - l.data, - l.event_removed :: STRING AS event_removed, - l.tx_status, - FALSE AS is_pending - FROM - {{ this }} - t - INNER JOIN {{ ref('silver__logs') }} - l USING ( - block_number, - _log_id - ) - WHERE - t.is_pending - AND l.block_timestamp IS NOT NULL -) -{% endif %}, -complete_data AS ( - SELECT - tx_hash, - block_number, - event_index, - event_name, - contract_address, - decoded_data, - transformed, - _log_id, - _inserted_timestamp, - decoded_flat, - block_timestamp, - origin_function_signature, - origin_from_address, - origin_to_address, - topics, - DATA, - event_removed, - tx_status, - is_pending, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash', 'event_index'] - ) }} AS decoded_logs_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id - FROM - new_records - -{% if is_incremental() %} -UNION -SELECT - tx_hash, - block_number, - event_index, - event_name, - contract_address, - decoded_data, - transformed, - _log_id, - _inserted_timestamp, - decoded_flat, - block_timestamp, - origin_function_signature, - origin_from_address, - origin_to_address, - topics, - DATA, - event_removed, - tx_status, - is_pending, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash', 'event_index'] - ) }} AS decoded_logs_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - missing_data -{% endif %} -) -SELECT - * -FROM - complete_data qualify(ROW_NUMBER() over (PARTITION BY block_number, event_index -ORDER BY - _inserted_timestamp DESC, is_pending ASC)) = 1 \ No newline at end of file diff --git a/models/silver/core/silver__logs.sql b/models/silver/core/silver__logs.sql deleted file mode 100644 index 564f664..0000000 --- a/models/silver/core/silver__logs.sql +++ /dev/null @@ -1,189 +0,0 @@ -{{ 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 = ['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__native_transfers.sql b/models/silver/core/silver__native_transfers.sql deleted file mode 100644 index 08a6258..0000000 --- a/models/silver/core/silver__native_transfers.sql +++ /dev/null @@ -1,92 +0,0 @@ -{{ config( - materialized = 'incremental', - incremental_strategy = 'delete+insert', - unique_key = 'block_number', - cluster_by = ['block_timestamp::DATE'], - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION", - tags = ['core','non_realtime','reorg'] -) }} - -WITH xdai_base AS ( - - SELECT - tx_hash, - block_number, - block_timestamp, - identifier, - from_address, - to_address, - concat_ws( - '-', - block_number, - tx_position, - CONCAT( - TYPE, - '_', - trace_address - ) - ) AS _call_id, - modified_timestamp AS _inserted_timestamp, - value_precise_raw AS xdai_value_precise_raw, - value_precise AS xdai_value_precise, - VALUE AS xdai_value, - tx_position, - trace_index, - origin_from_address, - origin_to_address, - origin_function_signature - FROM - {{ ref('core__fact_traces') }} - WHERE - xdai_value > 0 - AND tx_succeeded - AND trace_succeeded - AND TYPE NOT IN ( - 'DELEGATECALL', - 'STATICCALL' - ) - -{% if is_incremental() %} -AND _inserted_timestamp >= ( - SELECT - MAX(_inserted_timestamp) - INTERVAL '72 hours' - FROM - {{ this }} -) -{% endif %} -) -SELECT - tx_hash, - block_number, - block_timestamp, - identifier, - origin_from_address, - origin_to_address, - origin_function_signature, - from_address, - to_address, - xdai_value AS amount, - xdai_value_precise_raw AS amount_precise_raw, - xdai_value_precise AS amount_precise, - ROUND( - xdai_value * price, - 2 - ) AS amount_usd, - _call_id, - _inserted_timestamp, - tx_position, - trace_index, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash', 'trace_index'] - ) }} AS native_transfers_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - xdai_base A - LEFT JOIN {{ ref('price__ez_prices_hourly') }} - ON DATE_TRUNC( - 'hour', - A.block_timestamp - ) = HOUR - AND token_address = LOWER('0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d') diff --git a/models/silver/core/silver__receipts.sql b/models/silver/core/silver__receipts.sql deleted file mode 100644 index fe5f315..0000000 --- a/models/silver/core/silver__receipts.sql +++ /dev/null @@ -1,89 +0,0 @@ --- depends_on: {{ ref('bronze__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(block_hash, tx_hash, from_address, to_address)", - tags = ['non_realtime'], - full_refresh = false -) }} - -WITH base AS ( - - SELECT - block_number, - DATA, - _inserted_timestamp - FROM - -{% if is_incremental() %} -{{ ref('bronze__receipts') }} -WHERE - _inserted_timestamp >= ( - SELECT - MAX(_inserted_timestamp) _inserted_timestamp - FROM - {{ this }} - ) - AND IS_OBJECT(DATA) -{% else %} - {{ ref('bronze__receipts_fr') }} -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, - utils.udf_hex_to_int( - DATA :cumulativeGasUsed :: STRING - ) :: INT AS cumulative_gas_used, - utils.udf_hex_to_int( - DATA :effectiveGasPrice :: STRING - ) :: bigint AS effective_gas_price, - DATA :from :: STRING AS from_address, - utils.udf_hex_to_int( - DATA :gasUsed :: STRING - ) :: INT AS gas_used, - 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, - utils.udf_hex_to_int( - DATA :transactionIndex :: STRING - ) :: INT AS POSITION, - utils.udf_hex_to_int( - DATA :type :: STRING - ) :: INT AS TYPE, - _inserted_timestamp - FROM - base -) -SELECT - * -FROM - FINAL -WHERE - tx_hash 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__relevant_contracts.sql b/models/silver/core/silver__relevant_contracts.sql deleted file mode 100644 index 14ba6cf..0000000 --- a/models/silver/core/silver__relevant_contracts.sql +++ /dev/null @@ -1,134 +0,0 @@ -{{ config( - materialized = 'incremental', - unique_key = "contract_address", - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(contract_address)", - tags = ['non_realtime'] -) }} - -WITH emitted_events AS ( - - SELECT - contract_address, - COUNT(*) AS event_count, - MAX(modified_timestamp) AS max_inserted_timestamp_logs, - MAX(block_number) AS latest_event_block - FROM - {{ ref('core__fact_event_logs') }} - -{% if is_incremental() %} -WHERE - modified_timestamp > ( - SELECT - MAX(max_inserted_timestamp_logs) - FROM - {{ this }} - ) -{% endif %} -GROUP BY - contract_address -), -function_calls AS ( - SELECT - to_address AS contract_address, - COUNT(*) AS function_call_count, - MAX(modified_timestamp) AS max_inserted_timestamp_traces, - MAX(block_number) AS latest_call_block - FROM - {{ ref('core__fact_traces') }} - WHERE - tx_succeeded - AND trace_succeeded - AND to_address IS NOT NULL - AND input IS NOT NULL - AND input <> '0x' - -{% if is_incremental() %} -AND modified_timestamp > ( - SELECT - MAX(max_inserted_timestamp_traces) - FROM - {{ this }} -) -{% endif %} -GROUP BY - 1 -), -active_contracts AS ( - SELECT - contract_address - FROM - emitted_events - UNION - SELECT - contract_address - FROM - function_calls -), -previous_totals AS ( - -{% if is_incremental() %} -SELECT - contract_address, total_event_count, total_call_count, max_inserted_timestamp_logs, latest_event_block, max_inserted_timestamp_traces, latest_call_block -FROM - {{ this }} -{% else %} -SELECT - NULL AS contract_address, 0 AS total_event_count, 0 AS total_call_count, '1970-01-01 00:00:00' AS max_inserted_timestamp_logs, 0 AS latest_event_block, '1970-01-01 00:00:00' AS max_inserted_timestamp_traces, 0 AS latest_call_block -{% endif %}) -SELECT - C.contract_address, - COALESCE( - p.total_event_count, - 0 - ) + COALESCE( - e.event_count, - 0 - ) AS total_event_count, - COALESCE( - p.total_call_count, - 0 - ) + COALESCE( - f.function_call_count, - 0 - ) AS total_call_count, - COALESCE( - p.total_event_count, - 0 - ) + COALESCE( - e.event_count, - 0 - ) + COALESCE( - p.total_call_count, - 0 - ) + COALESCE( - f.function_call_count, - 0 - ) AS total_interaction_count, - COALESCE( - e.max_inserted_timestamp_logs, - p.max_inserted_timestamp_logs, - '1970-01-01 00:00:00' - ) AS max_inserted_timestamp_logs, - COALESCE( - f.max_inserted_timestamp_traces, - p.max_inserted_timestamp_traces, - '1970-01-01 00:00:00' - ) AS max_inserted_timestamp_traces, - COALESCE( - e.latest_event_block, - p.latest_event_block, - 0 - ) AS latest_event_block, - COALESCE( - f.latest_call_block, - p.latest_call_block, - 0 - ) AS latest_call_block -FROM - active_contracts C - LEFT JOIN emitted_events e - ON C.contract_address = e.contract_address - LEFT JOIN function_calls f - ON C.contract_address = f.contract_address - LEFT JOIN previous_totals p - ON C.contract_address = p.contract_address diff --git a/models/silver/core/silver__relevant_contracts.yml b/models/silver/core/silver__relevant_contracts.yml deleted file mode 100644 index 41b1888..0000000 --- a/models/silver/core/silver__relevant_contracts.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: 2 -models: - - name: silver__relevant_contracts - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - CONTRACT_ADDRESS \ No newline at end of file diff --git a/models/silver/core/silver__traces.sql b/models/silver/core/silver__traces.sql deleted file mode 100644 index b95e81b..0000000 --- a/models/silver/core/silver__traces.sql +++ /dev/null @@ -1,151 +0,0 @@ --- depends_on: {{ ref('bronze__traces') }} -{{ config ( - materialized = "incremental", - incremental_strategy = 'delete+insert', - unique_key = "block_number", - cluster_by = ['modified_timestamp::DATE','partition_key'], - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION", - tags = ['non_realtime'], - full_refresh = false -) }} - -WITH bronze_traces AS ( - - SELECT - block_number, - partition_key, - VALUE :array_index :: INT AS tx_position, - DATA :result AS full_traces, - _inserted_timestamp - FROM - -{% if is_incremental() and not full_reload_mode %} -{{ ref('bronze__traces') }} -WHERE - _inserted_timestamp >= ( - SELECT - MAX(_inserted_timestamp) _inserted_timestamp - FROM - {{ this }} - ) - AND DATA :result IS NOT NULL {% elif is_incremental() and full_reload_mode %} - {{ ref('bronze__traces_fr') }} -WHERE - partition_key BETWEEN ( - SELECT - MAX(partition_key) - 100000 - FROM - {{ this }} - ) - AND ( - SELECT - MAX(partition_key) + 1000000 - FROM - {{ this }} - ) -{% else %} - {{ ref('bronze__traces_fr') }} -WHERE - partition_key <= 5000000 -{% 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, - partition_key, - IFF( - path IN ( - 'result', - 'result.value', - 'result.type', - 'result.to', - 'result.input', - 'result.gasUsed', - 'result.gas', - 'result.from', - 'result.output', - 'result.error', - 'result.revertReason', - 'result.time', - 'gasUsed', - 'gas', - 'type', - 'to', - 'from', - 'value', - 'input', - 'error', - 'output', - 'time', - '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 trace_address_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, - partition_key, - trace_address, - _inserted_timestamp -) -SELECT - block_number, - tx_position, - trace_address, - parent_trace_address, - trace_address_array, - trace_json, - partition_key, - _inserted_timestamp, - {{ dbt_utils.generate_surrogate_key( - ['block_number', 'tx_position', 'trace_address'] - ) }} AS traces_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - flatten_traces qualify(ROW_NUMBER() over(PARTITION BY traces_id -ORDER BY - _inserted_timestamp DESC)) = 1 diff --git a/models/silver/core/silver__transactions.sql b/models/silver/core/silver__transactions.sql deleted file mode 100644 index 1acb611..0000000 --- a/models/silver/core/silver__transactions.sql +++ /dev/null @@ -1,342 +0,0 @@ --- depends_on: {{ ref('bronze__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 = ['non_realtime'] -) }} - -WITH base AS ( - - SELECT - block_number, - DATA, - _inserted_timestamp - FROM - -{% if is_incremental() %} -{{ ref('bronze__transactions') }} -WHERE - _inserted_timestamp >= ( - SELECT - MAX(_inserted_timestamp) _inserted_timestamp - FROM - {{ this }} - ) - AND IS_OBJECT(DATA) -{% else %} - {{ ref('bronze__transactions_fr') }} -WHERE - IS_OBJECT(DATA) -{% endif %} -), -base_tx AS ( - SELECT - A.block_number AS block_number, - A.data :blockHash :: STRING AS block_hash, - utils.udf_hex_to_int( - A.data :blockNumber :: STRING - ) :: INT AS blockNumber, - utils.udf_hex_to_int( - A.data :chainId :: STRING - ) :: INT AS chain_id, - A.data :from :: STRING AS from_address, - utils.udf_hex_to_int( - A.data :gas :: STRING - ) :: INT AS gas, - utils.udf_hex_to_int( - A.data :gasPrice :: STRING - ) :: INT / pow( - 10, - 9 - ) 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, - utils.udf_hex_to_int( - A.data :maxFeePerGas :: STRING - ) :: INT / pow( - 10, - 9 - ) AS max_fee_per_gas, - utils.udf_hex_to_int( - A.data :maxPriorityFeePerGas :: STRING - ) :: INT / pow( - 10, - 9 - ) AS max_priority_fee_per_gas, - utils.udf_hex_to_int( - A.data :nonce :: STRING - ) :: INT 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, - utils.udf_hex_to_int( - A.data :transactionIndex :: STRING - ) :: INT 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 - 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, - tx_success, - tx_status, - cumulative_gas_used, - utils.udf_decimal_adjust( - r.effective_gas_price, - 9 - ) AS effective_gas_price, - CASE - WHEN t.block_number >= 19040000 - AND r.type = 2 THEN utils.udf_decimal_adjust( - r.effective_gas_price * r.gas_used, - 18 - ) - ELSE utils.udf_decimal_adjust( - utils.udf_hex_to_int( - t.data :gasPrice :: STRING - ) :: bigint * r.gas_used, - 18 - ) - END AS tx_fee_precise, - COALESCE( - tx_fee_precise :: FLOAT, - 0 - ) AS tx_fee, - r.type AS tx_type, - t._inserted_timestamp, - t.data - 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, - utils.udf_decimal_adjust( - r.effective_gas_price, - 9 - ) AS effective_gas_price, - CASE - WHEN t.block_number >= 19040000 - AND r.type = 2 THEN utils.udf_decimal_adjust( - r.effective_gas_price * r.gas_used, - 18 - ) - ELSE utils.udf_decimal_adjust( - utils.udf_hex_to_int( - t.data :gasPrice :: STRING - ) :: bigint * r.gas_used, - 18 - ) - END 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 - 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_precise_raw, - value_precise, - VALUE, - block_timestamp, - is_pending, - gas_used, - tx_success, - tx_status, - cumulative_gas_used, - effective_gas_price, - tx_fee, - tx_fee_precise, - tx_type, - _inserted_timestamp, - DATA - 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_precise_raw, - value_precise, - VALUE, - block_timestamp, - is_pending, - gas_used, - tx_success, - tx_status, - cumulative_gas_used, - effective_gas_price, - tx_fee, - tx_fee_precise_heal AS tx_fee_precise, - tx_type, - _inserted_timestamp, - DATA -FROM - missing_data -{% endif %} -) -SELECT - *, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash'] - ) }} AS transactions_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -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__transfers.sql b/models/silver/core/silver__transfers.sql deleted file mode 100644 index 37b6292..0000000 --- a/models/silver/core/silver__transfers.sql +++ /dev/null @@ -1,292 +0,0 @@ --- depends_on: {{ ref('silver__complete_token_prices') }} -{{ 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 ON EQUALITY(tx_hash, origin_function_signature, origin_from_address, origin_to_address, contract_address, from_address, to_address, symbol), SUBSTRING(origin_function_signature, contract_address, from_address, to_address, symbol)", - tags = ['non_realtime','reorg','heal'] -) }} - -WITH logs AS ( - - SELECT - CONCAT( - tx_hash :: STRING, - '_', - event_index :: STRING - ) AS _log_id, - block_number, - tx_hash, - block_timestamp, - origin_function_signature, - origin_from_address, - origin_to_address, - contract_address :: STRING AS contract_address, - CONCAT('0x', SUBSTR(topics [1], 27, 40)) :: STRING AS from_address, - CONCAT('0x', SUBSTR(topics [2], 27, 40)) :: STRING AS to_address, - utils.udf_hex_to_int(SUBSTR(DATA, 3, 64)) AS raw_amount_precise, - raw_amount_precise :: FLOAT AS raw_amount, - event_index, - modified_timestamp AS _inserted_timestamp - FROM - {{ ref('core__fact_event_logs') }} - WHERE - topics [0] :: STRING = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' - AND tx_succeeded - -{% if is_incremental() %} -AND _inserted_timestamp >= ( - SELECT - MAX( - _inserted_timestamp - ) - INTERVAL '{{ var(' lookback ', ' 4 hours ') }}' - FROM - {{ this }} -) -{% endif %} -), -token_transfers AS ( - SELECT - block_number, - block_timestamp, - tx_hash, - event_index, - origin_function_signature, - origin_from_address, - origin_to_address, - t.contract_address, - from_address, - to_address, - raw_amount_precise, - raw_amount, - IFF( - C.token_decimals IS NOT NULL, - utils.udf_decimal_adjust( - raw_amount_precise, - C.token_decimals - ), - NULL - ) AS amount_precise, - amount_precise :: FLOAT AS amount, - IFF( - C.token_decimals IS NOT NULL - AND price IS NOT NULL, - amount * price, - NULL - ) AS amount_usd, - C.token_decimals AS decimals, - C.token_symbol AS symbol, - price AS token_price, - CASE - WHEN C.token_decimals IS NULL THEN 'false' - ELSE 'true' - END AS has_decimal, - CASE - WHEN price IS NULL THEN 'false' - ELSE 'true' - END AS has_price, - _log_id, - _inserted_timestamp - FROM - logs t - LEFT JOIN {{ ref('price__ez_prices_hourly') }} - p - ON t.contract_address = p.token_address - AND DATE_TRUNC( - 'hour', - t.block_timestamp - ) = HOUR - LEFT JOIN {{ ref('silver__contracts') }} C USING (contract_address) - WHERE - raw_amount IS NOT NULL - AND to_address IS NOT NULL - AND from_address IS NOT NULL -) - -{% if is_incremental() and var( - 'HEAL_MODEL' -) %}, -heal_model AS ( - SELECT - t0.block_number, - t0.block_timestamp, - t0.tx_hash, - t0.event_index, - t0.origin_function_signature, - t0.origin_from_address, - t0.origin_to_address, - t0.contract_address, - t0.from_address, - t0.to_address, - t0.raw_amount_precise, - t0.raw_amount, - IFF( - C.token_decimals IS NOT NULL, - utils.udf_decimal_adjust( - t0.raw_amount_precise, - C.token_decimals - ), - NULL - ) AS amount_precise_heal, - amount_precise_heal :: FLOAT AS amount_heal, - IFF( - C.token_decimals IS NOT NULL - AND price IS NOT NULL, - amount_heal * p.price, - NULL - ) AS amount_usd, - C.token_decimals AS decimals, - C.token_symbol AS symbol, - p.price AS token_price, - CASE - WHEN C.token_decimals IS NULL THEN 'false' - ELSE 'true' - END AS has_decimal, - CASE - WHEN p.price IS NULL THEN 'false' - ELSE 'true' - END AS has_price, - t0._log_id, - t0._inserted_timestamp - FROM - {{ this }} - t0 - LEFT JOIN {{ ref('price__ez_prices_hourly') }} - p - ON t0.contract_address = p.token_address - AND DATE_TRUNC( - 'hour', - t0.block_timestamp - ) = HOUR - LEFT JOIN {{ ref('silver__contracts') }} C - ON C.contract_address = t0.contract_address - WHERE - t0.block_number IN ( - SELECT - DISTINCT t1.block_number AS block_number - FROM - {{ this }} - t1 - WHERE - t1.decimals IS NULL - AND _inserted_timestamp < ( - SELECT - MAX( - _inserted_timestamp - ) - INTERVAL '{{ var(' lookback ', ' 4 hours ') }}' - FROM - {{ this }} - ) - AND EXISTS ( - SELECT - 1 - FROM - {{ ref('silver__contracts') }} C - WHERE - C._inserted_timestamp > DATEADD('DAY', -14, SYSDATE()) - AND C.token_decimals IS NOT NULL - AND C.contract_address = t1.contract_address) - ) - OR t0.block_number IN ( - SELECT - DISTINCT t2.block_number - FROM - {{ this }} - t2 - WHERE - t2.token_price IS NULL - AND _inserted_timestamp < ( - SELECT - MAX( - _inserted_timestamp - ) - INTERVAL '{{ var(' lookback ', ' 4 hours ') }}' - FROM - {{ this }} - ) - AND EXISTS ( - SELECT - 1 - FROM - {{ ref('silver__complete_token_prices') }} - p - WHERE - p._inserted_timestamp > DATEADD('DAY', -14, SYSDATE()) - AND p.price IS NOT NULL - AND p.token_address = t2.contract_address - AND p.hour = DATE_TRUNC( - 'hour', - t2.block_timestamp - ) - ) - ) - ) - {% endif %} - SELECT - block_number, - block_timestamp, - tx_hash, - event_index, - origin_function_signature, - origin_from_address, - origin_to_address, - contract_address, - from_address, - to_address, - raw_amount_precise, - raw_amount, - amount_precise, - amount, - amount_usd, - decimals, - symbol, - token_price, - has_decimal, - has_price, - _log_id, - _inserted_timestamp, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash', 'event_index'] - ) }} AS transfers_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id - FROM - token_transfers - -{% if is_incremental() and var( - 'HEAL_MODEL' -) %} -UNION ALL -SELECT - block_number, - block_timestamp, - tx_hash, - event_index, - origin_function_signature, - origin_from_address, - origin_to_address, - contract_address, - from_address, - to_address, - raw_amount_precise, - raw_amount, - amount_precise_heal AS amount_precise, - amount_heal AS amount, - amount_usd, - decimals, - symbol, - token_price, - has_decimal, - has_price, - _log_id, - _inserted_timestamp, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash', 'event_index'] - ) }} AS transfers_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - heal_model -{% endif %} diff --git a/models/silver/core/silver__tx_count.sql b/models/silver/core/silver__tx_count.sql deleted file mode 100644 index f48be2c..0000000 --- a/models/silver/core/silver__tx_count.sql +++ /dev/null @@ -1,30 +0,0 @@ -WITH base AS ( - SELECT - block_number, - MIN(modified_timestamp) AS _inserted_timestamp, - COUNT(*) AS tx_count - FROM - {{ ref('core__fact_transactions') }} - -{% if is_incremental() %} -WHERE - modified_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/core/tests/blocks/test_silver__blocks_full.sql b/models/silver/core/tests/blocks/test_silver__blocks_full.sql deleted file mode 100644 index 25dc03b..0000000 --- a/models/silver/core/tests/blocks/test_silver__blocks_full.sql +++ /dev/null @@ -1,9 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['full_test'] -) }} - -SELECT - * -FROM - {{ ref('silver__blocks') }} diff --git a/models/silver/core/tests/blocks/test_silver__blocks_full.yml b/models/silver/core/tests/blocks/test_silver__blocks_full.yml deleted file mode 100644 index f905d5f..0000000 --- a/models/silver/core/tests/blocks/test_silver__blocks_full.yml +++ /dev/null @@ -1,95 +0,0 @@ -version: 2 -models: - - name: test_silver__blocks_full - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - BLOCK_NUMBER - - fsc_utils.sequence_gaps: - column_name: BLOCK_NUMBER - where: BLOCK_TIMESTAMP < CURRENT_DATE - 1 - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: BLOCK_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ - - name: DIFFICULTY - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: TOTAL_DIFFICULTY - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: EXTRA_DATA - tests: - - not_null - - name: GAS_LIMIT - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: GAS_USED - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: PARENT_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: MINER - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: NONCE - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - name: RECEIPTS_ROOT - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: SHA3_UNCLES - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: SIZE - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - diff --git a/models/silver/core/tests/blocks/test_silver__blocks_recent.sql b/models/silver/core/tests/blocks/test_silver__blocks_recent.sql deleted file mode 100644 index c27a8a9..0000000 --- a/models/silver/core/tests/blocks/test_silver__blocks_recent.sql +++ /dev/null @@ -1,27 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['recent_test'] -) }} - -WITH last_3_days AS ( - - SELECT - block_number - FROM - {{ ref("_max_block_by_date") }} - qualify ROW_NUMBER() over ( - ORDER BY - block_number DESC - ) = 3 -) -SELECT - * -FROM - {{ ref('silver__blocks') }} -WHERE - block_number >= ( - SELECT - block_number - FROM - last_3_days - ) diff --git a/models/silver/core/tests/blocks/test_silver__blocks_recent.yml b/models/silver/core/tests/blocks/test_silver__blocks_recent.yml deleted file mode 100644 index 45d505c..0000000 --- a/models/silver/core/tests/blocks/test_silver__blocks_recent.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: 2 -models: - - name: test_silver__blocks_recent - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - BLOCK_NUMBER - - fsc_utils.sequence_gaps: - column_name: BLOCK_NUMBER - config: - severity: error - error_if: ">10" - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - name: BLOCK_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 3 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ - \ No newline at end of file diff --git a/models/silver/core/tests/confirmed_blocks/test_silver__confirmed_blocks_full.sql b/models/silver/core/tests/confirmed_blocks/test_silver__confirmed_blocks_full.sql deleted file mode 100644 index 6d93a21..0000000 --- a/models/silver/core/tests/confirmed_blocks/test_silver__confirmed_blocks_full.sql +++ /dev/null @@ -1,9 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['full_test'] -) }} - -SELECT - * -FROM - {{ ref('silver__confirmed_blocks') }} diff --git a/models/silver/core/tests/confirmed_blocks/test_silver__confirmed_blocks_full.yml b/models/silver/core/tests/confirmed_blocks/test_silver__confirmed_blocks_full.yml deleted file mode 100644 index 81a9db0..0000000 --- a/models/silver/core/tests/confirmed_blocks/test_silver__confirmed_blocks_full.yml +++ /dev/null @@ -1,34 +0,0 @@ -version: 2 -models: - - name: test_silver__confirmed_blocks_full - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TX_HASH - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - name: BLOCK_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ \ No newline at end of file diff --git a/models/silver/core/tests/confirmed_blocks/test_silver__confirmed_blocks_recent.sql b/models/silver/core/tests/confirmed_blocks/test_silver__confirmed_blocks_recent.sql deleted file mode 100644 index 0808f4a..0000000 --- a/models/silver/core/tests/confirmed_blocks/test_silver__confirmed_blocks_recent.sql +++ /dev/null @@ -1,27 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['recent_test'] -) }} - -WITH last_3_days AS ( - - SELECT - block_number - FROM - {{ ref("_max_block_by_date") }} - qualify ROW_NUMBER() over ( - ORDER BY - block_number DESC - ) = 3 -) -SELECT - * -FROM - {{ ref('silver__confirmed_blocks') }} -WHERE - block_number >= ( - SELECT - block_number - FROM - last_3_days - ) diff --git a/models/silver/core/tests/confirmed_blocks/test_silver__confirmed_blocks_recent.yml b/models/silver/core/tests/confirmed_blocks/test_silver__confirmed_blocks_recent.yml deleted file mode 100644 index 757e16f..0000000 --- a/models/silver/core/tests/confirmed_blocks/test_silver__confirmed_blocks_recent.yml +++ /dev/null @@ -1,34 +0,0 @@ -version: 2 -models: - - name: test_silver__confirmed_blocks_recent - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TX_HASH - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - name: BLOCK_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 5 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ \ No newline at end of file diff --git a/models/silver/core/tests/decoded_logs/test_silver__decoded_logs_full.sql b/models/silver/core/tests/decoded_logs/test_silver__decoded_logs_full.sql deleted file mode 100644 index 1dcc890..0000000 --- a/models/silver/core/tests/decoded_logs/test_silver__decoded_logs_full.sql +++ /dev/null @@ -1,9 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['full_test'] -) }} - -SELECT - * -FROM - {{ ref('silver__decoded_logs') }} diff --git a/models/silver/core/tests/decoded_logs/test_silver__decoded_logs_full.yml b/models/silver/core/tests/decoded_logs/test_silver__decoded_logs_full.yml deleted file mode 100644 index 436c8e7..0000000 --- a/models/silver/core/tests/decoded_logs/test_silver__decoded_logs_full.yml +++ /dev/null @@ -1,52 +0,0 @@ -version: 2 -models: - - name: test_silver__decoded_logs_full - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - _LOG_ID - - dbt_utils.recency: - datepart: day - field: _INSERTED_TIMESTAMP - interval: 1 - - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: EVENT_INDEX - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: CONTRACT_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - name: EVENT_NAME - tests: - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - STRING - - VARCHAR - - - - - - diff --git a/models/silver/core/tests/decoded_logs/test_silver__decoded_logs_recent.sql b/models/silver/core/tests/decoded_logs/test_silver__decoded_logs_recent.sql deleted file mode 100644 index ff24729..0000000 --- a/models/silver/core/tests/decoded_logs/test_silver__decoded_logs_recent.sql +++ /dev/null @@ -1,27 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['recent_test'] -) }} - -WITH last_3_days AS ( - - SELECT - block_number - FROM - {{ ref("_max_block_by_date") }} - qualify ROW_NUMBER() over ( - ORDER BY - block_number DESC - ) = 3 -) -SELECT - * -FROM - {{ ref('silver__decoded_logs') }} -WHERE - block_number >= ( - SELECT - block_number - FROM - last_3_days - ) diff --git a/models/silver/core/tests/decoded_logs/test_silver__decoded_logs_recent.yml b/models/silver/core/tests/decoded_logs/test_silver__decoded_logs_recent.yml deleted file mode 100644 index 0831194..0000000 --- a/models/silver/core/tests/decoded_logs/test_silver__decoded_logs_recent.yml +++ /dev/null @@ -1,57 +0,0 @@ -version: 2 -models: - - name: test_silver__decoded_logs_recent - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - _LOG_ID - - dbt_utils.recency: - datepart: day - field: _INSERTED_TIMESTAMP - interval: 1 - - fsc_utils.recent_decoded_logs_match: - config: - severity: error - error_if: ">0" - - missing_decoded_logs - - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: EVENT_INDEX - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: CONTRACT_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - name: EVENT_NAME - tests: - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - STRING - - VARCHAR - - - - - - diff --git a/models/silver/core/tests/event_logs/test_silver__logs_full.sql b/models/silver/core/tests/event_logs/test_silver__logs_full.sql deleted file mode 100644 index e117298..0000000 --- a/models/silver/core/tests/event_logs/test_silver__logs_full.sql +++ /dev/null @@ -1,9 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['full_test'] -) }} - -SELECT - * -FROM - {{ ref('silver__logs') }} diff --git a/models/silver/core/tests/event_logs/test_silver__logs_full.yml b/models/silver/core/tests/event_logs/test_silver__logs_full.yml deleted file mode 100644 index 25760b2..0000000 --- a/models/silver/core/tests/event_logs/test_silver__logs_full.yml +++ /dev/null @@ -1,77 +0,0 @@ -version: 2 -models: - - name: test_silver__logs_full - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - _LOG_ID - - fsc_utils.sequence_gaps: - partition_by: - - BLOCK_NUMBER - - TX_HASH - column_name: EVENT_INDEX - where: BLOCK_TIMESTAMP < CURRENT_DATE - 1 - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - name: BLOCK_TIMESTAMP - tests: - - not_null: - where: NOT IS_PENDING - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - fsc_utils.tx_block_count: - config: - severity: error - error_if: "!=0" - - name: EVENT_INDEX - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: CONTRACT_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TOPICS - tests: - - not_null - - name: DATA - tests: - - not_null - - name: EVENT_REMOVED - tests: - - not_null - - name: _LOG_ID - tests: - - not_null - - name: ORIGIN_FUNCTION_SIGNATURE - tests: - - not_null: - where: NOT IS_PENDING - - name: ORIGIN_FROM_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: ORIGIN_TO_ADDRESS - tests: - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ \ No newline at end of file diff --git a/models/silver/core/tests/event_logs/test_silver__logs_recent.sql b/models/silver/core/tests/event_logs/test_silver__logs_recent.sql deleted file mode 100644 index faa40cf..0000000 --- a/models/silver/core/tests/event_logs/test_silver__logs_recent.sql +++ /dev/null @@ -1,27 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['recent_test'] -) }} - -WITH last_3_days AS ( - - SELECT - block_number - FROM - {{ ref("_max_block_by_date") }} - qualify ROW_NUMBER() over ( - ORDER BY - block_number DESC - ) = 3 -) -SELECT - * -FROM - {{ ref('silver__logs') }} -WHERE - block_number >= ( - SELECT - block_number - FROM - last_3_days - ) diff --git a/models/silver/core/tests/event_logs/test_silver__logs_recent.yml b/models/silver/core/tests/event_logs/test_silver__logs_recent.yml deleted file mode 100644 index 3a92aaa..0000000 --- a/models/silver/core/tests/event_logs/test_silver__logs_recent.yml +++ /dev/null @@ -1,33 +0,0 @@ -version: 2 -models: - - name: test_silver__logs_recent - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - _LOG_ID - - fsc_utils.sequence_gaps: - partition_by: - - BLOCK_NUMBER - - TX_HASH - column_name: EVENT_INDEX - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - name: BLOCK_TIMESTAMP - tests: - - not_null: - where: NOT IS_PENDING - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 3 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ - - name: TX_HASH - tests: - - not_null diff --git a/models/silver/core/tests/receipts/test_silver__receipts_full.sql b/models/silver/core/tests/receipts/test_silver__receipts_full.sql deleted file mode 100644 index 56f39ae..0000000 --- a/models/silver/core/tests/receipts/test_silver__receipts_full.sql +++ /dev/null @@ -1,9 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['full_test'] -) }} - -SELECT - * -FROM - {{ ref('silver__receipts') }} diff --git a/models/silver/core/tests/receipts/test_silver__receipts_full.yml b/models/silver/core/tests/receipts/test_silver__receipts_full.yml deleted file mode 100644 index 9a18685..0000000 --- a/models/silver/core/tests/receipts/test_silver__receipts_full.yml +++ /dev/null @@ -1,82 +0,0 @@ -version: 2 -models: - - name: test_silver__receipts_full - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TX_HASH - - fsc_utils.sequence_gaps: - partition_by: - - BLOCK_NUMBER - column_name: POSITION - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: POSITION - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - name: FROM_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TO_ADDRESS - tests: - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - where: TO_ADDRESS IS NOT NULL - - name: BLOCK_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: CUMULATIVE_GAS_USED - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: EFFECTIVE_GAS_PRICE - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: GAS_USED - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: TX_STATUS - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_set: - value_set: ['SUCCESS', 'FAIL'] - - name: TYPE - tests: - - not_null - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - diff --git a/models/silver/core/tests/receipts/test_silver__receipts_recent.sql b/models/silver/core/tests/receipts/test_silver__receipts_recent.sql deleted file mode 100644 index 0b5a901..0000000 --- a/models/silver/core/tests/receipts/test_silver__receipts_recent.sql +++ /dev/null @@ -1,27 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['recent_test'] -) }} - -WITH last_3_days AS ( - - SELECT - block_number - FROM - {{ ref("_max_block_by_date") }} - qualify ROW_NUMBER() over ( - ORDER BY - block_number DESC - ) = 3 -) -SELECT - * -FROM - {{ ref('silver__receipts') }} -WHERE - block_number >= ( - SELECT - block_number - FROM - last_3_days - ) diff --git a/models/silver/core/tests/receipts/test_silver__receipts_recent.yml b/models/silver/core/tests/receipts/test_silver__receipts_recent.yml deleted file mode 100644 index 1e8cfa1..0000000 --- a/models/silver/core/tests/receipts/test_silver__receipts_recent.yml +++ /dev/null @@ -1,28 +0,0 @@ -version: 2 -models: - - name: test_silver__receipts_recent - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TX_HASH - - fsc_utils.sequence_gaps: - partition_by: - - BLOCK_NUMBER - column_name: POSITION - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 3 - - diff --git a/models/silver/core/tests/traces/test_silver__traces_full.sql b/models/silver/core/tests/traces/test_silver__traces_full.sql deleted file mode 100644 index be52e71..0000000 --- a/models/silver/core/tests/traces/test_silver__traces_full.sql +++ /dev/null @@ -1,9 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['full_test'] -) }} - -SELECT - * -FROM - {{ ref('silver__traces') }} diff --git a/models/silver/core/tests/traces/test_silver__traces_full.yml b/models/silver/core/tests/traces/test_silver__traces_full.yml deleted file mode 100644 index f21a7e1..0000000 --- a/models/silver/core/tests/traces/test_silver__traces_full.yml +++ /dev/null @@ -1,52 +0,0 @@ -version: 2 -models: - - name: test_silver__traces_full - description: "This is a view used to test all of the silver traces model." - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TRACES_ID - - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - name: TX_POSITION - tests: - - not_null - - name: TRACE_ADDRESS - tests: - - not_null - - name: TRACE_JSON - tests: - - not_null - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 2 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_LTZ - - TIMESTAMP_NTZ - - name: INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 2 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_LTZ - - TIMESTAMP_NTZ - - name: MODIFIED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 2 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_LTZ - - TIMESTAMP_NTZ diff --git a/models/silver/core/tests/traces/test_silver__traces_recent.sql b/models/silver/core/tests/traces/test_silver__traces_recent.sql deleted file mode 100644 index 7c3aae3..0000000 --- a/models/silver/core/tests/traces/test_silver__traces_recent.sql +++ /dev/null @@ -1,27 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['recent_test'] -) }} - -WITH last_3_days AS ( - - SELECT - block_number - FROM - {{ ref("_max_block_by_date") }} - qualify ROW_NUMBER() over ( - ORDER BY - block_number DESC - ) = 3 -) -SELECT - * -FROM - {{ ref('silver__traces') }} -WHERE - block_number >= ( - SELECT - block_number - FROM - last_3_days - ) diff --git a/models/silver/core/tests/traces/test_silver__traces_recent.yml b/models/silver/core/tests/traces/test_silver__traces_recent.yml deleted file mode 100644 index 10e6629..0000000 --- a/models/silver/core/tests/traces/test_silver__traces_recent.yml +++ /dev/null @@ -1,52 +0,0 @@ -version: 2 -models: - - name: test_silver__traces_recent - description: "This is a view used to test the last three days of traces." - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TRACES_ID - - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - name: TX_POSITION - tests: - - not_null - - name: TRACE_ADDRESS - tests: - - not_null - - name: TRACE_JSON - tests: - - not_null - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 2 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_LTZ - - TIMESTAMP_NTZ - - name: INSERTED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 2 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_LTZ - - TIMESTAMP_NTZ - - name: MODIFIED_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 2 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_LTZ - - TIMESTAMP_NTZ diff --git a/models/silver/core/tests/transactions/test_silver__transactions_full.sql b/models/silver/core/tests/transactions/test_silver__transactions_full.sql deleted file mode 100644 index df58d17..0000000 --- a/models/silver/core/tests/transactions/test_silver__transactions_full.sql +++ /dev/null @@ -1,9 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['full_test'] -) }} - -SELECT - * -FROM - {{ ref('silver__transactions') }} diff --git a/models/silver/core/tests/transactions/test_silver__transactions_full.yml b/models/silver/core/tests/transactions/test_silver__transactions_full.yml deleted file mode 100644 index c1d11d8..0000000 --- a/models/silver/core/tests/transactions/test_silver__transactions_full.yml +++ /dev/null @@ -1,119 +0,0 @@ -version: 2 -models: - - name: test_silver__transactions_full - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TX_HASH - - fsc_utils.sequence_gaps: - partition_by: - - BLOCK_NUMBER - column_name: POSITION - where: BLOCK_TIMESTAMP < CURRENT_DATE - 1 - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: BLOCK_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: NONCE - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: POSITION - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - name: FROM_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TO_ADDRESS - tests: - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - where: TO_ADDRESS IS NOT NULL - - name: VALUE - tests: - - not_null - - name: BLOCK_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: GAS_PRICE - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: GAS - tests: - - not_null - - name: INPUT_DATA - tests: - - not_null - - name: TX_STATUS - tests: - - not_null: - where: NOT IS_PENDING - - dbt_expectations.expect_column_values_to_be_in_set: - value_set: ['SUCCESS', 'FAIL'] - where: NOT IS_PENDING - - name: GAS_USED - tests: - - not_null: - where: NOT IS_PENDING - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: CUMULATIVE_GAS_USED - tests: - - not_null: - where: NOT IS_PENDING - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: TX_FEE - tests: - - not_null: - where: NOT IS_PENDING - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: EFFECTIVE_GAS_PRICE - tests: - - not_null: - where: NOT IS_PENDING - - name: ORIGIN_FUNCTION_SIGNATURE - tests: - - not_null - - diff --git a/models/silver/core/tests/transactions/test_silver__transactions_recent.sql b/models/silver/core/tests/transactions/test_silver__transactions_recent.sql deleted file mode 100644 index a7b0802..0000000 --- a/models/silver/core/tests/transactions/test_silver__transactions_recent.sql +++ /dev/null @@ -1,27 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['recent_test'] -) }} - -WITH last_3_days AS ( - - SELECT - block_number - FROM - {{ ref("_max_block_by_date") }} - qualify ROW_NUMBER() over ( - ORDER BY - block_number DESC - ) = 3 -) -SELECT - * -FROM - {{ ref('silver__transactions') }} -WHERE - block_number >= ( - SELECT - block_number - FROM - last_3_days - ) diff --git a/models/silver/core/tests/transactions/test_silver__transactions_recent.yml b/models/silver/core/tests/transactions/test_silver__transactions_recent.yml deleted file mode 100644 index 3539ac2..0000000 --- a/models/silver/core/tests/transactions/test_silver__transactions_recent.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: 2 -models: - - name: test_silver__transactions_recent - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TX_HASH - - fsc_utils.sequence_gaps: - partition_by: - - BLOCK_NUMBER - column_name: POSITION - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - name: BLOCK_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: hour - interval: 3 - \ No newline at end of file diff --git a/models/silver/core/tests/transfers/test_silver__transfers_full.sql b/models/silver/core/tests/transfers/test_silver__transfers_full.sql deleted file mode 100644 index 487722d..0000000 --- a/models/silver/core/tests/transfers/test_silver__transfers_full.sql +++ /dev/null @@ -1,9 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['full_test'] -) }} - -SELECT - * -FROM - {{ ref('silver__transfers') }} diff --git a/models/silver/core/tests/transfers/test_silver__transfers_full.yml b/models/silver/core/tests/transfers/test_silver__transfers_full.yml deleted file mode 100644 index fe05c44..0000000 --- a/models/silver/core/tests/transfers/test_silver__transfers_full.yml +++ /dev/null @@ -1,70 +0,0 @@ -version: 2 -models: - - name: test_silver__transfers_full - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - _LOG_ID - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: BLOCK_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: CONTRACT_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: FROM_ADDRESS - tests: - - not_null: - where: BLOCK_TIMESTAMP > '2021-08-01' - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TO_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: RAW_AMOUNT - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: _LOG_ID - tests: - - not_null - - name: ORIGIN_FUNCTION_SIGNATURE - tests: - - not_null - - name: ORIGIN_FROM_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: ORIGIN_TO_ADDRESS - tests: - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - diff --git a/models/silver/core/tests/transfers/test_silver__transfers_recent.sql b/models/silver/core/tests/transfers/test_silver__transfers_recent.sql deleted file mode 100644 index 32af55a..0000000 --- a/models/silver/core/tests/transfers/test_silver__transfers_recent.sql +++ /dev/null @@ -1,27 +0,0 @@ -{{ config ( - materialized = 'view', - tags = ['recent_test'] -) }} - -WITH last_3_days AS ( - - SELECT - block_number - FROM - {{ ref("_max_block_by_date") }} - qualify ROW_NUMBER() over ( - ORDER BY - block_number DESC - ) = 3 -) -SELECT - * -FROM - {{ ref('silver__transfers') }} -WHERE - block_number >= ( - SELECT - block_number - FROM - last_3_days - ) diff --git a/models/silver/core/tests/transfers/test_silver__transfers_recent.yml b/models/silver/core/tests/transfers/test_silver__transfers_recent.yml deleted file mode 100644 index 469c17f..0000000 --- a/models/silver/core/tests/transfers/test_silver__transfers_recent.yml +++ /dev/null @@ -1,68 +0,0 @@ -version: 2 -models: - - name: test_silver__transfers_recent - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - _LOG_ID - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: BLOCK_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: CONTRACT_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: FROM_ADDRESS - tests: - - not_null: - where: BLOCK_TIMESTAMP > '2021-08-01' - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TO_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: RAW_AMOUNT - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: _LOG_ID - tests: - - not_null - - name: ORIGIN_FUNCTION_SIGNATURE - tests: - - not_null - - name: ORIGIN_FROM_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: ORIGIN_TO_ADDRESS - tests: - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ \ No newline at end of file diff --git a/models/silver/defi/bridge/ccip/silver_bridge__ccip_send_requested.sql b/models/silver/defi/bridge/ccip/silver_bridge__ccip_send_requested.sql index e4a0b20..5f535eb 100644 --- a/models/silver/defi/bridge/ccip/silver_bridge__ccip_send_requested.sql +++ b/models/silver/defi/bridge/ccip/silver_bridge__ccip_send_requested.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_bridge','defi','bridge','curated'] ) }} WITH on_ramp_set AS ( diff --git a/models/silver/defi/bridge/celer/silver_bridge__celer_cbridge_send.sql b/models/silver/defi/bridge/celer/silver_bridge__celer_cbridge_send.sql index e166e46..c803104 100644 --- a/models/silver/defi/bridge/celer/silver_bridge__celer_cbridge_send.sql +++ b/models/silver/defi/bridge/celer/silver_bridge__celer_cbridge_send.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_bridge','defi','bridge','curated'] ) }} WITH base_evt AS ( diff --git a/models/silver/defi/bridge/hop/silver_bridge__hop_ammwrapper.sql b/models/silver/defi/bridge/hop/silver_bridge__hop_ammwrapper.sql index 3c4a529..7b6b74d 100644 --- a/models/silver/defi/bridge/hop/silver_bridge__hop_ammwrapper.sql +++ b/models/silver/defi/bridge/hop/silver_bridge__hop_ammwrapper.sql @@ -2,7 +2,7 @@ materialized = 'incremental', incremental_strategy = 'delete+insert', unique_key = "block_number", - tags = ['curated'] + tags = ['silver_bridge','defi','bridge','curated'] ) }} WITH base_contracts AS ( diff --git a/models/silver/defi/bridge/hop/silver_bridge__hop_l2canonicaltoken.sql b/models/silver/defi/bridge/hop/silver_bridge__hop_l2canonicaltoken.sql index e0cc25e..ce86800 100644 --- a/models/silver/defi/bridge/hop/silver_bridge__hop_l2canonicaltoken.sql +++ b/models/silver/defi/bridge/hop/silver_bridge__hop_l2canonicaltoken.sql @@ -2,7 +2,7 @@ materialized = 'incremental', incremental_strategy = 'delete+insert', unique_key = "block_number", - tags = ['curated'] + tags = ['silver_bridge','defi','bridge','curated'] ) }} WITH base_contracts AS ( diff --git a/models/silver/defi/bridge/hop/silver_bridge__hop_transfersent.sql b/models/silver/defi/bridge/hop/silver_bridge__hop_transfersent.sql index 806ba40..cf00922 100644 --- a/models/silver/defi/bridge/hop/silver_bridge__hop_transfersent.sql +++ b/models/silver/defi/bridge/hop/silver_bridge__hop_transfersent.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_bridge','defi','bridge','curated'] ) }} WITH base_evt AS ( diff --git a/models/silver/defi/bridge/meson/silver_bridge__meson_transfers.sql b/models/silver/defi/bridge/meson/silver_bridge__meson_transfers.sql index f209a29..e0426c3 100644 --- a/models/silver/defi/bridge/meson/silver_bridge__meson_transfers.sql +++ b/models/silver/defi/bridge/meson/silver_bridge__meson_transfers.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_bridge','defi','bridge','curated'] ) }} WITH token_transfers AS ( diff --git a/models/silver/defi/bridge/silver_bridge__complete_bridge_activity.sql b/models/silver/defi/bridge/silver_bridge__complete_bridge_activity.sql index 1c83c06..35d736e 100644 --- a/models/silver/defi/bridge/silver_bridge__complete_bridge_activity.sql +++ b/models/silver/defi/bridge/silver_bridge__complete_bridge_activity.sql @@ -5,7 +5,7 @@ unique_key = ['block_number','platform','version'], cluster_by = ['block_timestamp::DATE','platform'], post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, bridge_address, sender, receiver, destination_chain_receiver, destination_chain_id, destination_chain, token_address, token_symbol), SUBSTRING(origin_function_signature, bridge_address, sender, receiver, destination_chain_receiver, destination_chain, token_address, token_symbol)", - tags = ['curated','reorg','heal'] + tags = ['silver_bridge','defi','bridge','curated','heal'] ) }} WITH celer_cbridge AS ( diff --git a/models/silver/defi/dex/balancer/silver_dex__balancer_pools.sql b/models/silver/defi/dex/balancer/silver_dex__balancer_pools.sql index e8b13e2..ac179f1 100644 --- a/models/silver/defi/dex/balancer/silver_dex__balancer_pools.sql +++ b/models/silver/defi/dex/balancer/silver_dex__balancer_pools.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'pool_address', full_refresh = false, - tags = ['curated'] + tags = ['silver_dex','defi','dex','curated'] ) }} WITH pools_registered AS ( diff --git a/models/silver/defi/dex/balancer/silver_dex__balancer_swaps.sql b/models/silver/defi/dex/balancer/silver_dex__balancer_swaps.sql index 09e0c3a..df7d474 100644 --- a/models/silver/defi/dex/balancer/silver_dex__balancer_swaps.sql +++ b/models/silver/defi/dex/balancer/silver_dex__balancer_swaps.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_dex','defi','dex','curated'] ) }} WITH pools AS ( diff --git a/models/silver/defi/dex/curve/silver_dex__curve_pools.sql b/models/silver/defi/dex/curve/silver_dex__curve_pools.sql index 3fbc1a9..a4292cc 100644 --- a/models/silver/defi/dex/curve/silver_dex__curve_pools.sql +++ b/models/silver/defi/dex/curve/silver_dex__curve_pools.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'pool_address', full_refresh = false, - tags = ['curated'] + tags = ['silver_dex','defi','dex','curated'] ) }} WITH contract_deployments AS ( diff --git a/models/silver/defi/dex/curve/silver_dex__curve_swaps.sql b/models/silver/defi/dex/curve/silver_dex__curve_swaps.sql index e4fd511..076bcfc 100644 --- a/models/silver/defi/dex/curve/silver_dex__curve_swaps.sql +++ b/models/silver/defi/dex/curve/silver_dex__curve_swaps.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_dex','defi','dex','curated'] ) }} WITH pool_meta AS ( diff --git a/models/silver/defi/dex/honeyswap/silver_dex__honeyswap_pools.sql b/models/silver/defi/dex/honeyswap/silver_dex__honeyswap_pools.sql index 67f1fb4..57a3119 100644 --- a/models/silver/defi/dex/honeyswap/silver_dex__honeyswap_pools.sql +++ b/models/silver/defi/dex/honeyswap/silver_dex__honeyswap_pools.sql @@ -2,7 +2,7 @@ materialized = 'incremental', incremental_strategy = 'delete+insert', unique_key = 'pool_address', - tags = ['curated'] + tags = ['silver_dex','defi','dex','curated'] ) }} WITH pool_creation AS ( diff --git a/models/silver/defi/dex/honeyswap/silver_dex__honeyswap_swaps.sql b/models/silver/defi/dex/honeyswap/silver_dex__honeyswap_swaps.sql index 49e59aa..9d2aa5f 100644 --- a/models/silver/defi/dex/honeyswap/silver_dex__honeyswap_swaps.sql +++ b/models/silver/defi/dex/honeyswap/silver_dex__honeyswap_swaps.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_dex','defi','dex','curated'] ) }} WITH pools AS ( diff --git a/models/silver/defi/dex/silver_dex__complete_dex_liquidity_pools.sql b/models/silver/defi/dex/silver_dex__complete_dex_liquidity_pools.sql index bf4c6f2..36cc01c 100644 --- a/models/silver/defi/dex/silver_dex__complete_dex_liquidity_pools.sql +++ b/models/silver/defi/dex/silver_dex__complete_dex_liquidity_pools.sql @@ -4,7 +4,7 @@ unique_key = ['block_number','platform','version'], cluster_by = ['block_timestamp::DATE','platform'], post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, contract_address, pool_address, pool_name, tokens, symbols), SUBSTRING(pool_address, pool_name, tokens, symbols)", - tags = ['curated','reorg','heal'] + tags = ['silver_dex','defi','dex','curated','heal'] ) }} WITH contracts AS ( diff --git a/models/silver/defi/dex/silver_dex__complete_dex_swaps.sql b/models/silver/defi/dex/silver_dex__complete_dex_swaps.sql index d48683f..47a28a1 100644 --- a/models/silver/defi/dex/silver_dex__complete_dex_swaps.sql +++ b/models/silver/defi/dex/silver_dex__complete_dex_swaps.sql @@ -5,7 +5,7 @@ unique_key = ['block_number','platform','version'], cluster_by = ['block_timestamp::DATE','platform'], post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_function_signature, origin_from_address, origin_to_address, contract_address, pool_name, event_name, sender, tx_to, token_in, token_out, symbol_in, symbol_out), SUBSTRING(origin_function_signature, pool_name, event_name, sender, tx_to, token_in, token_out, symbol_in, symbol_out)", - tags = ['curated','reorg','heal'] + tags = ['silver_dex','defi','dex','curated','heal'] ) }} WITH sushi AS ( diff --git a/models/silver/defi/dex/sushi/silver_dex__sushi_pools.sql b/models/silver/defi/dex/sushi/silver_dex__sushi_pools.sql index 9ba8d9d..9b53a27 100644 --- a/models/silver/defi/dex/sushi/silver_dex__sushi_pools.sql +++ b/models/silver/defi/dex/sushi/silver_dex__sushi_pools.sql @@ -2,7 +2,7 @@ materialized = 'incremental', incremental_strategy = 'delete+insert', unique_key = 'pool_address', - tags = ['curated'] + tags = ['silver_dex','defi','dex','curated'] ) }} WITH pool_creation AS ( diff --git a/models/silver/defi/dex/sushi/silver_dex__sushi_swaps.sql b/models/silver/defi/dex/sushi/silver_dex__sushi_swaps.sql index e985fbe..e766ae8 100644 --- a/models/silver/defi/dex/sushi/silver_dex__sushi_swaps.sql +++ b/models/silver/defi/dex/sushi/silver_dex__sushi_swaps.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_dex','defi','dex','curated'] ) }} WITH pools AS ( diff --git a/models/silver/defi/dex/swapr/silver_dex__swapr_pools.sql b/models/silver/defi/dex/swapr/silver_dex__swapr_pools.sql index ea32cf1..3752f6e 100644 --- a/models/silver/defi/dex/swapr/silver_dex__swapr_pools.sql +++ b/models/silver/defi/dex/swapr/silver_dex__swapr_pools.sql @@ -2,7 +2,7 @@ materialized = 'incremental', incremental_strategy = 'delete+insert', unique_key = 'pool_address', - tags = ['curated'] + tags = ['silver_dex','defi','dex','curated'] ) }} WITH pool_creation AS ( diff --git a/models/silver/defi/dex/swapr/silver_dex__swapr_swaps.sql b/models/silver/defi/dex/swapr/silver_dex__swapr_swaps.sql index 92fa044..c18a35c 100644 --- a/models/silver/defi/dex/swapr/silver_dex__swapr_swaps.sql +++ b/models/silver/defi/dex/swapr/silver_dex__swapr_swaps.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_dex','defi','dex','curated'] ) }} WITH pools AS ( diff --git a/models/silver/defi/lending/aave/silver__aave_borrows.sql b/models/silver/defi/lending/aave/silver__aave_borrows.sql index b731094..63eb5a9 100644 --- a/models/silver/defi/lending/aave/silver__aave_borrows.sql +++ b/models/silver/defi/lending/aave/silver__aave_borrows.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH --borrows from Aave LendingPool contracts diff --git a/models/silver/defi/lending/aave/silver__aave_deposits.sql b/models/silver/defi/lending/aave/silver__aave_deposits.sql index 85833df..a51c05d 100644 --- a/models/silver/defi/lending/aave/silver__aave_deposits.sql +++ b/models/silver/defi/lending/aave/silver__aave_deposits.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/aave/silver__aave_flashloans.sql b/models/silver/defi/lending/aave/silver__aave_flashloans.sql index 87f8ab6..c12ee84 100644 --- a/models/silver/defi/lending/aave/silver__aave_flashloans.sql +++ b/models/silver/defi/lending/aave/silver__aave_flashloans.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/aave/silver__aave_liquidations.sql b/models/silver/defi/lending/aave/silver__aave_liquidations.sql index c77b327..5005b67 100644 --- a/models/silver/defi/lending/aave/silver__aave_liquidations.sql +++ b/models/silver/defi/lending/aave/silver__aave_liquidations.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/aave/silver__aave_repayments.sql b/models/silver/defi/lending/aave/silver__aave_repayments.sql index 05137fa..458e50a 100644 --- a/models/silver/defi/lending/aave/silver__aave_repayments.sql +++ b/models/silver/defi/lending/aave/silver__aave_repayments.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/aave/silver__aave_tokens.sql b/models/silver/defi/lending/aave/silver__aave_tokens.sql index 62bbcd3..3cb6b31 100644 --- a/models/silver/defi/lending/aave/silver__aave_tokens.sql +++ b/models/silver/defi/lending/aave/silver__aave_tokens.sql @@ -1,6 +1,6 @@ {{ config( materialized = 'incremental', - tags = ['curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH DECODE AS ( diff --git a/models/silver/defi/lending/aave/silver__aave_withdraws.sql b/models/silver/defi/lending/aave/silver__aave_withdraws.sql index 4f1d68e..7702cab 100644 --- a/models/silver/defi/lending/aave/silver__aave_withdraws.sql +++ b/models/silver/defi/lending/aave/silver__aave_withdraws.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/agave/silver__agave_borrows.sql b/models/silver/defi/lending/agave/silver__agave_borrows.sql index 6b29856..d694c05 100644 --- a/models/silver/defi/lending/agave/silver__agave_borrows.sql +++ b/models/silver/defi/lending/agave/silver__agave_borrows.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH --borrows from agave LendingPool contracts diff --git a/models/silver/defi/lending/agave/silver__agave_deposits.sql b/models/silver/defi/lending/agave/silver__agave_deposits.sql index 05e400b..8ec207e 100644 --- a/models/silver/defi/lending/agave/silver__agave_deposits.sql +++ b/models/silver/defi/lending/agave/silver__agave_deposits.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/agave/silver__agave_flashloans.sql b/models/silver/defi/lending/agave/silver__agave_flashloans.sql index 2fddb06..d60ce49 100644 --- a/models/silver/defi/lending/agave/silver__agave_flashloans.sql +++ b/models/silver/defi/lending/agave/silver__agave_flashloans.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/agave/silver__agave_liquidations.sql b/models/silver/defi/lending/agave/silver__agave_liquidations.sql index aa99e4b..e35ea54 100644 --- a/models/silver/defi/lending/agave/silver__agave_liquidations.sql +++ b/models/silver/defi/lending/agave/silver__agave_liquidations.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/agave/silver__agave_repayments.sql b/models/silver/defi/lending/agave/silver__agave_repayments.sql index ae39451..dbc03e0 100644 --- a/models/silver/defi/lending/agave/silver__agave_repayments.sql +++ b/models/silver/defi/lending/agave/silver__agave_repayments.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/agave/silver__agave_tokens.sql b/models/silver/defi/lending/agave/silver__agave_tokens.sql index 0ae4b99..24f8a8f 100644 --- a/models/silver/defi/lending/agave/silver__agave_tokens.sql +++ b/models/silver/defi/lending/agave/silver__agave_tokens.sql @@ -1,6 +1,6 @@ {{ config( materialized = 'incremental', - tags = ['curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH contracts AS ( diff --git a/models/silver/defi/lending/agave/silver__agave_withdraws.sql b/models/silver/defi/lending/agave/silver__agave_withdraws.sql index cd508a2..fb3c548 100644 --- a/models/silver/defi/lending/agave/silver__agave_withdraws.sql +++ b/models/silver/defi/lending/agave/silver__agave_withdraws.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/complete_lending/silver__complete_lending_borrows.sql b/models/silver/defi/lending/complete_lending/silver__complete_lending_borrows.sql index db5ee5d..d2230fc 100644 --- a/models/silver/defi/lending/complete_lending/silver__complete_lending_borrows.sql +++ b/models/silver/defi/lending/complete_lending/silver__complete_lending_borrows.sql @@ -5,7 +5,7 @@ unique_key = ['block_number','platform'], cluster_by = ['block_timestamp::DATE','platform'], post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, contract_address, event_name, token_address, token_symbol, borrower, protocol_market), SUBSTRING(origin_function_signature, event_name, token_address, token_symbol, borrower, protocol_market)", - tags = ['reorg','curated','heal'] + tags = ['silver','defi','lending','curated','heal'] ) }} WITH aave AS ( diff --git a/models/silver/defi/lending/complete_lending/silver__complete_lending_deposits.sql b/models/silver/defi/lending/complete_lending/silver__complete_lending_deposits.sql index c8057aa..a31d47c 100644 --- a/models/silver/defi/lending/complete_lending/silver__complete_lending_deposits.sql +++ b/models/silver/defi/lending/complete_lending/silver__complete_lending_deposits.sql @@ -5,7 +5,7 @@ unique_key = ['block_number','platform'], cluster_by = ['block_timestamp::DATE','platform'], post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, contract_address, event_name, token_address, token_symbol, depositor, protocol_market), SUBSTRING(origin_function_signature, event_name, token_address, token_symbol, depositor, protocol_market)", - tags = ['reorg','curated','heal'] + tags = ['silver','defi','lending','curated','heal'] ) }} WITH aave AS ( diff --git a/models/silver/defi/lending/complete_lending/silver__complete_lending_flashloans.sql b/models/silver/defi/lending/complete_lending/silver__complete_lending_flashloans.sql index de37093..c06e5c9 100644 --- a/models/silver/defi/lending/complete_lending/silver__complete_lending_flashloans.sql +++ b/models/silver/defi/lending/complete_lending/silver__complete_lending_flashloans.sql @@ -5,7 +5,7 @@ unique_key = ['block_number','platform'], cluster_by = ['block_timestamp::DATE','platform'], post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, contract_address, event_name, flashloan_token, flashloan_token_symbol, protocol_market), SUBSTRING(origin_function_signature, event_name, flashloan_token, flashloan_token_symbol, protocol_market)", - tags = ['reorg','curated','heal'] + tags = ['silver','defi','lending','curated','heal'] ) }} WITH aave AS ( diff --git a/models/silver/defi/lending/complete_lending/silver__complete_lending_liquidations.sql b/models/silver/defi/lending/complete_lending/silver__complete_lending_liquidations.sql index 0e59964..de0ce84 100644 --- a/models/silver/defi/lending/complete_lending/silver__complete_lending_liquidations.sql +++ b/models/silver/defi/lending/complete_lending/silver__complete_lending_liquidations.sql @@ -5,7 +5,7 @@ unique_key = ['block_number','platform'], cluster_by = ['block_timestamp::DATE','platform'], post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, contract_address, event_name, liquidator, borrower, collateral_token, collateral_token_symbol, debt_token, debt_token_symbol, protocol_market), SUBSTRING(origin_function_signature, event_name, liquidator, borrower, collateral_token, collateral_token_symbol, debt_token, debt_token_symbol, protocol_market)", - tags = ['reorg','curated','heal'] + tags = ['silver','defi','lending','curated','heal'] ) }} WITH aave AS ( diff --git a/models/silver/defi/lending/complete_lending/silver__complete_lending_repayments.sql b/models/silver/defi/lending/complete_lending/silver__complete_lending_repayments.sql index 38da536..2270daf 100644 --- a/models/silver/defi/lending/complete_lending/silver__complete_lending_repayments.sql +++ b/models/silver/defi/lending/complete_lending/silver__complete_lending_repayments.sql @@ -5,7 +5,7 @@ unique_key = ['block_number','platform'], cluster_by = ['block_timestamp::DATE','platform'], post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, contract_address, event_name, token_address, token_symbol, payer, borrower, protocol_market), SUBSTRING(origin_function_signature, event_name, token_address, token_symbol, payer, borrower, protocol_market)", - tags = ['reorg','curated','heal'] + tags = ['silver','defi','lending','curated','heal'] ) }} WITH aave AS ( diff --git a/models/silver/defi/lending/complete_lending/silver__complete_lending_withdraws.sql b/models/silver/defi/lending/complete_lending/silver__complete_lending_withdraws.sql index 9caabb7..e5e47a9 100644 --- a/models/silver/defi/lending/complete_lending/silver__complete_lending_withdraws.sql +++ b/models/silver/defi/lending/complete_lending/silver__complete_lending_withdraws.sql @@ -5,7 +5,7 @@ unique_key = ['block_number','platform'], cluster_by = ['block_timestamp::DATE','platform'], post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(tx_hash, origin_from_address, origin_to_address, origin_function_signature, contract_address, event_name, token_address, token_symbol, depositor, protocol_market), SUBSTRING(origin_function_signature, event_name, token_address, token_symbol, depositor, protocol_market)", - tags = ['reorg','curated','heal'] + tags = ['silver','defi','lending','curated','heal'] ) }} WITH aave AS ( diff --git a/models/silver/defi/lending/realt/silver__realt_borrows.sql b/models/silver/defi/lending/realt/silver__realt_borrows.sql index e63b924..95182ec 100644 --- a/models/silver/defi/lending/realt/silver__realt_borrows.sql +++ b/models/silver/defi/lending/realt/silver__realt_borrows.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH --borrows from realt LendingPool contracts diff --git a/models/silver/defi/lending/realt/silver__realt_deposits.sql b/models/silver/defi/lending/realt/silver__realt_deposits.sql index 6cb8259..5af9e9a 100644 --- a/models/silver/defi/lending/realt/silver__realt_deposits.sql +++ b/models/silver/defi/lending/realt/silver__realt_deposits.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/realt/silver__realt_flashloans.sql b/models/silver/defi/lending/realt/silver__realt_flashloans.sql index 012c369..03955e2 100644 --- a/models/silver/defi/lending/realt/silver__realt_flashloans.sql +++ b/models/silver/defi/lending/realt/silver__realt_flashloans.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/realt/silver__realt_liquidations.sql b/models/silver/defi/lending/realt/silver__realt_liquidations.sql index 78c355b..16c6d13 100644 --- a/models/silver/defi/lending/realt/silver__realt_liquidations.sql +++ b/models/silver/defi/lending/realt/silver__realt_liquidations.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/realt/silver__realt_repayments.sql b/models/silver/defi/lending/realt/silver__realt_repayments.sql index 3375e0c..2db3703 100644 --- a/models/silver/defi/lending/realt/silver__realt_repayments.sql +++ b/models/silver/defi/lending/realt/silver__realt_repayments.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/realt/silver__realt_tokens.sql b/models/silver/defi/lending/realt/silver__realt_tokens.sql index 8dda962..48fdf63 100644 --- a/models/silver/defi/lending/realt/silver__realt_tokens.sql +++ b/models/silver/defi/lending/realt/silver__realt_tokens.sql @@ -1,6 +1,6 @@ {{ config( materialized = 'incremental', - tags = ['curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH DECODE AS ( diff --git a/models/silver/defi/lending/realt/silver__realt_withdraws.sql b/models/silver/defi/lending/realt/silver__realt_withdraws.sql index f10b367..2ccb76c 100644 --- a/models/silver/defi/lending/realt/silver__realt_withdraws.sql +++ b/models/silver/defi/lending/realt/silver__realt_withdraws.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/spark/silver__spark_borrows.sql b/models/silver/defi/lending/spark/silver__spark_borrows.sql index 911e82e..39b1895 100644 --- a/models/silver/defi/lending/spark/silver__spark_borrows.sql +++ b/models/silver/defi/lending/spark/silver__spark_borrows.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH --borrows from Aave LendingPool contracts diff --git a/models/silver/defi/lending/spark/silver__spark_deposits.sql b/models/silver/defi/lending/spark/silver__spark_deposits.sql index 1379a69..a564eb0 100644 --- a/models/silver/defi/lending/spark/silver__spark_deposits.sql +++ b/models/silver/defi/lending/spark/silver__spark_deposits.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/spark/silver__spark_flashloans.sql b/models/silver/defi/lending/spark/silver__spark_flashloans.sql index d62923d..93d1083 100644 --- a/models/silver/defi/lending/spark/silver__spark_flashloans.sql +++ b/models/silver/defi/lending/spark/silver__spark_flashloans.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/spark/silver__spark_liquidations.sql b/models/silver/defi/lending/spark/silver__spark_liquidations.sql index ffb2893..6da1950 100644 --- a/models/silver/defi/lending/spark/silver__spark_liquidations.sql +++ b/models/silver/defi/lending/spark/silver__spark_liquidations.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/spark/silver__spark_repayments.sql b/models/silver/defi/lending/spark/silver__spark_repayments.sql index e313ca9..7b6f2fa 100644 --- a/models/silver/defi/lending/spark/silver__spark_repayments.sql +++ b/models/silver/defi/lending/spark/silver__spark_repayments.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/defi/lending/spark/silver__spark_tokens.sql b/models/silver/defi/lending/spark/silver__spark_tokens.sql index fa0cfc2..95053e2 100644 --- a/models/silver/defi/lending/spark/silver__spark_tokens.sql +++ b/models/silver/defi/lending/spark/silver__spark_tokens.sql @@ -1,6 +1,6 @@ {{ config( materialized = 'incremental', - tags = ['curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH DECODE AS ( diff --git a/models/silver/defi/lending/spark/silver__spark_withdraws.sql b/models/silver/defi/lending/spark/silver__spark_withdraws.sql index 78a2bfa..e942f3e 100644 --- a/models/silver/defi/lending/spark/silver__spark_withdraws.sql +++ b/models/silver/defi/lending/spark/silver__spark_withdraws.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = "block_number", cluster_by = ['block_timestamp::DATE'], - tags = ['reorg','curated'] + tags = ['silver','defi','lending','curated'] ) }} WITH atoken_meta AS ( diff --git a/models/silver/labels/silver__labels.sql b/models/silver/labels/silver__labels.sql deleted file mode 100644 index ed35013..0000000 --- a/models/silver/labels/silver__labels.sql +++ /dev/null @@ -1,40 +0,0 @@ -{{ 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, label_type, label_subtype, address_name, project_name), SUBSTRING(address, label_type, label_subtype, address_name, project_name); 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/nft/silver__nft_transfers.sql b/models/silver/nft/silver__nft_transfers.sql deleted file mode 100644 index 93ddac4..0000000 --- a/models/silver/nft/silver__nft_transfers.sql +++ /dev/null @@ -1,470 +0,0 @@ -{{ 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 ON EQUALITY(tx_hash, contract_address, project_name, from_address, to_address, event_type, token_transfer_type), SUBSTRING(contract_address, project_name, from_address, to_address, event_type, token_transfer_type)", - tags = ['curated','reorg'] -) }} - -WITH base AS ( - - SELECT - _log_id, - block_number, - tx_hash, - block_timestamp, - event_index, - contract_address, - topics, - DATA, - regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data, - TO_TIMESTAMP_NTZ(_inserted_timestamp) AS _inserted_timestamp - FROM - {{ ref('silver__logs') }} - WHERE - tx_status = 'SUCCESS' - AND ( - ( - topics [0] :: STRING = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' - AND DATA = '0x' - AND topics [3] IS NOT NULL - ) --erc721s - OR ( - topics [0] :: STRING = '0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62' - ) --erc1155s - OR ( - topics [0] :: STRING = '0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb' - ) --erc1155s TransferBatch event - ) - -{% if is_incremental() %} -AND TO_TIMESTAMP_NTZ(_inserted_timestamp) >= ( - SELECT - MAX( - _inserted_timestamp - ) - INTERVAL '24 hours' - FROM - {{ this }} -) -{% endif %} -), -erc721s AS ( - SELECT - _log_id, - block_number, - tx_hash, - block_timestamp, - contract_address, - CONCAT('0x', SUBSTR(topics [1] :: STRING, 27, 40)) AS from_address, - CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS to_address, - utils.udf_hex_to_int( - topics [3] :: STRING - ) :: STRING AS token_id, - NULL AS erc1155_value, - TO_TIMESTAMP_NTZ(_inserted_timestamp) AS _inserted_timestamp, - event_index - FROM - base - WHERE - topics [0] :: STRING = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' - AND DATA = '0x' - AND topics [3] IS NOT NULL -), -transfer_singles AS ( - SELECT - _log_id, - block_number, - tx_hash, - block_timestamp, - contract_address, - CONCAT('0x', SUBSTR(topics [1] :: STRING, 27, 40)) AS operator_address, - CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS from_address, - CONCAT('0x', SUBSTR(topics [3] :: STRING, 27, 40)) AS to_address, - utils.udf_hex_to_int( - segmented_data [0] :: STRING - ) :: STRING AS token_id, - utils.udf_hex_to_int( - segmented_data [1] :: STRING - ) :: STRING AS erc1155_value, - TO_TIMESTAMP_NTZ(_inserted_timestamp) AS _inserted_timestamp, - event_index - FROM - base - WHERE - topics [0] :: STRING = '0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62' - AND to_address IS NOT NULL -), -transfer_batch_raw AS ( - SELECT - block_number, - block_timestamp, - tx_hash, - event_index, - segmented_data, - CONCAT('0x', SUBSTR(topics [1] :: STRING, 27, 40)) AS operator_address, - CONCAT('0x', SUBSTR(topics [2] :: STRING, 27, 40)) AS from_address, - CONCAT('0x', SUBSTR(topics [3] :: STRING, 27, 40)) AS to_address, - contract_address, - utils.udf_hex_to_int( - segmented_data [2] :: STRING - ) AS tokenid_length, - tokenid_length AS quantity_length, - _log_id, - TO_TIMESTAMP_NTZ(_inserted_timestamp) AS _inserted_timestamp - FROM - base - WHERE - topics [0] :: STRING = '0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb' - AND to_address IS NOT NULL -), -flattened AS ( - SELECT - block_number, - block_timestamp, - _log_id, - _inserted_timestamp, - tx_hash, - event_index, - operator_address, - from_address, - to_address, - contract_address, - INDEX, - VALUE, - tokenid_length, - quantity_length, - 2 + tokenid_length AS tokenid_indextag, - 4 + tokenid_length AS quantity_indextag_start, - 4 + tokenid_length + tokenid_length AS quantity_indextag_end, - CASE - WHEN INDEX BETWEEN 3 - AND ( - tokenid_indextag - ) THEN 'tokenid' - WHEN INDEX BETWEEN ( - quantity_indextag_start - ) - AND ( - quantity_indextag_end - ) THEN 'quantity' - ELSE NULL - END AS label - FROM - transfer_batch_raw, - LATERAL FLATTEN ( - input => segmented_data - ) -), -tokenid_list AS ( - SELECT - block_number, - block_timestamp, - _log_id, - _inserted_timestamp, - tx_hash, - event_index, - operator_address, - from_address, - to_address, - contract_address, - utils.udf_hex_to_int( - VALUE :: STRING - ) :: STRING AS tokenId, - ROW_NUMBER() over ( - PARTITION BY tx_hash, - event_index - ORDER BY - INDEX ASC - ) AS tokenid_order - FROM - flattened - WHERE - label = 'tokenid' -), -quantity_list AS ( - SELECT - tx_hash, - event_index, - utils.udf_hex_to_int( - VALUE :: STRING - ) :: STRING AS quantity, - ROW_NUMBER() over ( - PARTITION BY tx_hash, - event_index - ORDER BY - INDEX ASC - ) AS quantity_order - FROM - flattened - WHERE - label = 'quantity' -), -transfer_batch_final AS ( - SELECT - block_number, - block_timestamp, - _log_id, - _inserted_timestamp, - t.tx_hash, - t.event_index, - operator_address, - from_address, - to_address, - contract_address, - t.tokenId AS token_id, - q.quantity AS erc1155_value, - tokenid_order AS intra_event_index - FROM - tokenid_list t - INNER JOIN quantity_list q - ON t.tx_hash = q.tx_hash - AND t.event_index = q.event_index - AND t.tokenid_order = q.quantity_order -), -all_transfers AS ( - SELECT - block_number, - tx_hash, - block_timestamp, - contract_address, - from_address, - to_address, - token_id, - erc1155_value, - _inserted_timestamp, - event_index, - 1 AS intra_event_index, - 'erc721_Transfer' AS token_transfer_type, - CONCAT( - _log_id, - '-', - contract_address, - '-', - token_id - ) AS _log_id - FROM - erc721s - UNION ALL - SELECT - block_number, - tx_hash, - block_timestamp, - contract_address, - from_address, - to_address, - token_id, - erc1155_value, - _inserted_timestamp, - event_index, - 1 AS intra_event_index, - 'erc1155_TransferSingle' AS token_transfer_type, - CONCAT( - _log_id, - '-', - contract_address, - '-', - token_id - ) AS _log_id - FROM - transfer_singles - WHERE - erc1155_value != '0' - UNION ALL - SELECT - block_number, - tx_hash, - block_timestamp, - contract_address, - from_address, - to_address, - token_id, - erc1155_value, - _inserted_timestamp, - event_index, - intra_event_index, - 'erc1155_TransferBatch' AS token_transfer_type, - CONCAT( - _log_id, - '-', - contract_address, - '-', - token_id, - '-', - intra_event_index - ) AS _log_id - FROM - transfer_batch_final - WHERE - erc1155_value != '0' -), -transfer_base AS ( - SELECT - block_number, - block_timestamp, - tx_hash, - event_index, - intra_event_index, - contract_address, - C.token_name AS project_name, - from_address, - to_address, - A.token_id AS tokenId, - erc1155_value, - CASE - WHEN from_address = '0x0000000000000000000000000000000000000000' THEN 'mint' - ELSE 'other' - END AS event_type, - token_transfer_type, - A._log_id, - A._inserted_timestamp - FROM - all_transfers A - LEFT JOIN {{ ref('silver__contracts') }} C USING (contract_address) - WHERE - to_address IS NOT NULL -) - -{% if is_incremental() %}, -fill_transfers AS ( - SELECT - t.block_number, - t.block_timestamp, - t.tx_hash, - t.event_index, - t.intra_event_index, - t.contract_address, - C.token_name AS project_name, - t.from_address, - t.to_address, - t.tokenId, - t.erc1155_value, - t.event_type, - t.token_transfer_type, - t._log_id, - GREATEST( - t._inserted_timestamp, - C._inserted_timestamp - ) AS _inserted_timestamp - FROM - {{ this }} - t - INNER JOIN {{ ref('silver__contracts') }} C USING (contract_address) - WHERE - t.project_name IS NULL - AND C.token_name IS NOT NULL -), -blocks_fill AS ( - SELECT - * exclude ( - nft_transfers_id, - inserted_timestamp, - modified_timestamp, - _invocation_id - ) - FROM - {{ this }} - WHERE - block_number IN ( - SELECT - block_number - FROM - fill_transfers - ) - AND _log_id NOT IN ( - SELECT - _log_id - FROM - fill_transfers - ) -) -{% endif %}, -final_base AS ( - SELECT - block_number, - block_timestamp, - tx_hash, - event_index, - intra_event_index, - contract_address, - project_name, - from_address, - to_address, - tokenId, - erc1155_value, - event_type, - token_transfer_type, - _log_id, - _inserted_timestamp - FROM - transfer_base - -{% if is_incremental() %} -UNION ALL -SELECT - block_number, - block_timestamp, - tx_hash, - event_index, - intra_event_index, - contract_address, - project_name, - from_address, - to_address, - tokenId, - erc1155_value, - event_type, - token_transfer_type, - _log_id, - _inserted_timestamp -FROM - fill_transfers -UNION ALL -SELECT - block_number, - block_timestamp, - tx_hash, - event_index, - intra_event_index, - contract_address, - project_name, - from_address, - to_address, - tokenId, - erc1155_value, - event_type, - token_transfer_type, - _log_id, - _inserted_timestamp -FROM - blocks_fill -{% endif %} -) -SELECT - block_number, - block_timestamp, - tx_hash, - event_index, - intra_event_index, - contract_address, - project_name, - from_address, - to_address, - tokenId, - erc1155_value, - event_type, - token_transfer_type, - _log_id, - _inserted_timestamp, - {{ dbt_utils.generate_surrogate_key( - ['tx_hash','event_index','intra_event_index'] - ) }} AS nft_transfers_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - final_base qualify ROW_NUMBER() over ( - PARTITION BY _log_id - ORDER BY - _inserted_timestamp DESC - ) = 1 diff --git a/models/silver/nft/silver__nft_transfers.yml b/models/silver/nft/silver__nft_transfers.yml deleted file mode 100644 index 4e8c333..0000000 --- a/models/silver/nft/silver__nft_transfers.yml +++ /dev/null @@ -1,68 +0,0 @@ - -version: 2 -models: - - name: silver__nft_transfers - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - _LOG_ID - columns: - - name: BLOCK_NUMBER - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: BLOCK_TIMESTAMP - tests: - - not_null - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ - - name: TX_HASH - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: EVENT_INDEX - tests: - - not_null - - name: INTRA_EVENT_INDEX - tests: - - not_null - - name: CONTRACT_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: FROM_ADDRESS - tests: - - not_null: - where: BLOCK_TIMESTAMP > '2021-08-01' - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TO_ADDRESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_match_regex: - regex: 0[xX][0-9a-fA-F]+ - - name: TOKENID - tests: - - not_null - - name: _LOG_ID - tests: - - not_null - - name: _INSERTED_TIMESTAMP - tests: - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_NTZ - - TIMESTAMP_LTZ \ No newline at end of file diff --git a/models/silver/prices/silver__complete_native_asset_metadata.sql b/models/silver/prices/silver__complete_native_asset_metadata.sql deleted file mode 100644 index a81b6a6..0000000 --- a/models/silver/prices/silver__complete_native_asset_metadata.sql +++ /dev/null @@ -1,38 +0,0 @@ -{{ config( - materialized = 'incremental', - incremental_strategy = 'delete+insert', - unique_key = 'complete_native_asset_metadata_id', - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(asset_id, symbol, name),SUBSTRING(asset_id, symbol, name)", - tags = ['non_realtime'] -) }} - -SELECT - asset_id, - symbol, - NAME, - decimals, - blockchain, - is_deprecated, - provider, - source, - _inserted_timestamp, - inserted_timestamp, - modified_timestamp, - complete_native_asset_metadata_id, - _invocation_id -FROM - {{ ref( - 'bronze__complete_native_asset_metadata' - ) }} - -{% if is_incremental() %} -WHERE - modified_timestamp >= ( - SELECT - MAX( - modified_timestamp - ) - FROM - {{ this }} - ) -{% endif %} diff --git a/models/silver/prices/silver__complete_native_asset_metadata.yml b/models/silver/prices/silver__complete_native_asset_metadata.yml deleted file mode 100644 index 1c1fdf1..0000000 --- a/models/silver/prices/silver__complete_native_asset_metadata.yml +++ /dev/null @@ -1,24 +0,0 @@ -version: 2 -models: - - name: silver__complete_native_asset_metadata - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - SYMBOL - - columns: - - name: PROVIDER - tests: - - not_null - - name: SYMBOL - tests: - - not_null - - name: BLOCKCHAIN - tests: - - not_null - - name: MODIFIED_TIMESTAMP - tests: - - not_null - - name: COMPLETE_NATIVE_ASSET_METADATA_ID - tests: - - unique \ No newline at end of file diff --git a/models/silver/prices/silver__complete_native_prices.sql b/models/silver/prices/silver__complete_native_prices.sql deleted file mode 100644 index ec99925..0000000 --- a/models/silver/prices/silver__complete_native_prices.sql +++ /dev/null @@ -1,42 +0,0 @@ -{{ config( - materialized = 'incremental', - incremental_strategy = 'delete+insert', - unique_key = 'complete_native_prices_id', - cluster_by = ['hour::DATE'], - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(asset_id, symbol, name),SUBSTRING(asset_id, symbol, name)", - tags = ['non_realtime'] -) }} - -SELECT - HOUR, - asset_id, - symbol, - NAME, - decimals, - price, - blockchain, - is_imputed, - is_deprecated, - provider, - source, - _inserted_timestamp, - inserted_timestamp, - modified_timestamp, - complete_native_prices_id, - _invocation_id -FROM - {{ ref( - 'bronze__complete_native_prices' - ) }} - -{% if is_incremental() %} -WHERE - modified_timestamp >= ( - SELECT - MAX( - modified_timestamp - ) - FROM - {{ this }} - ) -{% endif %} diff --git a/models/silver/prices/silver__complete_native_prices.yml b/models/silver/prices/silver__complete_native_prices.yml deleted file mode 100644 index bb72433..0000000 --- a/models/silver/prices/silver__complete_native_prices.yml +++ /dev/null @@ -1,37 +0,0 @@ -version: 2 -models: - - name: silver__complete_native_prices - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - HOUR - - SYMBOL - - columns: - - name: HOUR - tests: - - not_null - - name: SYMBOL - tests: - - not_null - - name: BLOCKCHAIN - tests: - - not_null - - name: PROVIDER - tests: - - not_null - - name: PRICE - tests: - - not_null - - name: IS_IMPUTED - tests: - - not_null - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - name: MODIFIED_TIMESTAMP - tests: - - not_null - - name: COMPLETE_NATIVE_PRICES_ID - tests: - - unique \ No newline at end of file diff --git a/models/silver/prices/silver__complete_provider_asset_metadata.sql b/models/silver/prices/silver__complete_provider_asset_metadata.sql deleted file mode 100644 index b981c9c..0000000 --- a/models/silver/prices/silver__complete_provider_asset_metadata.sql +++ /dev/null @@ -1,38 +0,0 @@ -{{ config( - materialized = 'incremental', - incremental_strategy = 'delete+insert', - unique_key = 'complete_provider_asset_metadata_id', - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(asset_id, token_address, symbol, name),SUBSTRING(asset_id, token_address, symbol, name)", - tags = ['non_realtime'] -) }} - -SELECT - asset_id, - token_address, - NAME, - symbol, - platform, - platform_id, - provider, - source, - _inserted_timestamp, - inserted_timestamp, - modified_timestamp, - complete_provider_asset_metadata_id, - _invocation_id -FROM - {{ ref( - 'bronze__complete_provider_asset_metadata' - ) }} - -{% if is_incremental() %} -WHERE - modified_timestamp >= ( - SELECT - MAX( - modified_timestamp - ) - FROM - {{ this }} - ) -{% endif %} \ No newline at end of file diff --git a/models/silver/prices/silver__complete_provider_asset_metadata.yml b/models/silver/prices/silver__complete_provider_asset_metadata.yml deleted file mode 100644 index 8fa56fd..0000000 --- a/models/silver/prices/silver__complete_provider_asset_metadata.yml +++ /dev/null @@ -1,26 +0,0 @@ -version: 2 -models: - - name: silver__complete_provider_asset_metadata - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - ASSET_ID - - TOKEN_ADDRESS - - NAME - - SYMBOL - - PLATFORM - - PLATFORM_ID - - PROVIDER - columns: - - name: PROVIDER - tests: - - not_null - - name: ASSET_ID - tests: - - not_null - - name: MODIFIED_TIMESTAMP - tests: - - not_null - - name: COMPLETE_PROVIDER_ASSET_METADATA_ID - tests: - - unique \ No newline at end of file diff --git a/models/silver/prices/silver__complete_provider_prices.sql b/models/silver/prices/silver__complete_provider_prices.sql deleted file mode 100644 index a8be434..0000000 --- a/models/silver/prices/silver__complete_provider_prices.sql +++ /dev/null @@ -1,47 +0,0 @@ -{{ config( - materialized = 'incremental', - incremental_strategy = 'delete+insert', - unique_key = 'complete_provider_prices_id', - cluster_by = ['recorded_hour::DATE','provider'], - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(asset_id),SUBSTRING(asset_id)", - tags = ['non_realtime'] -) }} - -SELECT - p.asset_id, - recorded_hour, - OPEN, - high, - low, - CLOSE, - p.provider, - p.source, - p._inserted_timestamp, - p.inserted_timestamp, - p.modified_timestamp, - p.complete_provider_prices_id, - p._invocation_id -FROM - {{ ref( - 'bronze__complete_provider_prices' - ) }} - p - INNER JOIN {{ ref('bronze__complete_provider_asset_metadata') }} - m - ON p.asset_id = m.asset_id - -{% if is_incremental() %} -WHERE - p.modified_timestamp >= ( - SELECT - MAX( - modified_timestamp - ) - FROM - {{ this }} - ) -{% endif %} - -qualify(ROW_NUMBER() over (PARTITION BY p.asset_id, recorded_hour, p.provider -ORDER BY - p.modified_timestamp DESC)) = 1 diff --git a/models/silver/prices/silver__complete_provider_prices.yml b/models/silver/prices/silver__complete_provider_prices.yml deleted file mode 100644 index 8db23c7..0000000 --- a/models/silver/prices/silver__complete_provider_prices.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: 2 -models: - - name: silver__complete_provider_prices - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - ASSET_ID - - RECORDED_HOUR - - PROVIDER - columns: - - name: PROVIDER - tests: - - not_null - - name: ASSET_ID - tests: - - not_null - - name: RECORDED_HOUR - tests: - - not_null - - name: MODIFIED_TIMESTAMP - tests: - - not_null - - name: COMPLETE_PROVIDER_PRICES_ID - tests: - - unique \ No newline at end of file diff --git a/models/silver/prices/silver__complete_token_asset_metadata.sql b/models/silver/prices/silver__complete_token_asset_metadata.sql deleted file mode 100644 index f5339b8..0000000 --- a/models/silver/prices/silver__complete_token_asset_metadata.sql +++ /dev/null @@ -1,43 +0,0 @@ -{{ config( - materialized = 'incremental', - incremental_strategy = 'delete+insert', - unique_key = 'complete_token_asset_metadata_id', - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(asset_id, token_address, symbol, name),SUBSTRING(asset_id, token_address, symbol, name)", - tags = ['non_realtime'] -) }} - -SELECT - LOWER( - A.token_address - ) AS token_address, - asset_id, - symbol, - NAME, - decimals, - blockchain, - blockchain_name, - blockchain_id, - is_deprecated, - provider, - source, - _inserted_timestamp, - inserted_timestamp, - modified_timestamp, - complete_token_asset_metadata_id, - _invocation_id -FROM - {{ ref( - 'bronze__complete_token_asset_metadata' - ) }} A - -{% if is_incremental() %} -WHERE - modified_timestamp >= ( - SELECT - MAX( - modified_timestamp - ) - FROM - {{ this }} - ) -{% endif %} diff --git a/models/silver/prices/silver__complete_token_asset_metadata.yml b/models/silver/prices/silver__complete_token_asset_metadata.yml deleted file mode 100644 index 3eea590..0000000 --- a/models/silver/prices/silver__complete_token_asset_metadata.yml +++ /dev/null @@ -1,28 +0,0 @@ -version: 2 -models: - - name: silver__complete_token_asset_metadata - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - TOKEN_ADDRESS - - BLOCKCHAIN - - columns: - - name: PROVIDER - tests: - - not_null - - name: TOKEN_ADDRESS - tests: - - not_null - - name: BLOCKCHAIN - tests: - - not_null - - name: BLOCKCHAIN_ID - tests: - - not_null - - name: MODIFIED_TIMESTAMP - tests: - - not_null - - name: COMPLETE_TOKEN_ASSET_METADATA_ID - tests: - - unique \ No newline at end of file diff --git a/models/silver/prices/silver__complete_token_prices.sql b/models/silver/prices/silver__complete_token_prices.sql deleted file mode 100644 index f8e6442..0000000 --- a/models/silver/prices/silver__complete_token_prices.sql +++ /dev/null @@ -1,48 +0,0 @@ -{{ config( - materialized = 'incremental', - incremental_strategy = 'delete+insert', - unique_key = 'complete_token_prices_id', - cluster_by = ['hour::DATE'], - post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(asset_id, token_address, symbol, name),SUBSTRING(asset_id, token_address, symbol, name)", - tags = ['non_realtime'] -) }} - -SELECT - HOUR, - LOWER( - p.token_address - ) AS token_address, - asset_id, - symbol, - NAME, - decimals, - price, - blockchain, - blockchain_name, - blockchain_id, - is_imputed, - is_deprecated, - provider, - source, - _inserted_timestamp, - inserted_timestamp, - modified_timestamp, - complete_token_prices_id, - _invocation_id -FROM - {{ ref( - 'bronze__complete_token_prices' - ) }} - p - -{% if is_incremental() %} -WHERE - modified_timestamp >= ( - SELECT - MAX( - modified_timestamp - ) - FROM - {{ this }} - ) -{% endif %} diff --git a/models/silver/prices/silver__complete_token_prices.yml b/models/silver/prices/silver__complete_token_prices.yml deleted file mode 100644 index d2ac57f..0000000 --- a/models/silver/prices/silver__complete_token_prices.yml +++ /dev/null @@ -1,41 +0,0 @@ -version: 2 -models: - - name: silver__complete_token_prices - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - HOUR - - TOKEN_ADDRESS - - BLOCKCHAIN - - columns: - - name: HOUR - tests: - - not_null - - name: TOKEN_ADDRESS - tests: - - not_null - - name: BLOCKCHAIN - tests: - - not_null - - name: BLOCKCHAIN_ID - tests: - - not_null - - name: PROVIDER - tests: - - not_null - - name: PRICE - tests: - - not_null - - name: IS_IMPUTED - tests: - - not_null - - name: _INSERTED_TIMESTAMP - tests: - - not_null - - name: MODIFIED_TIMESTAMP - tests: - - not_null - - name: COMPLETE_TOKEN_PRICES_ID - tests: - - unique \ No newline at end of file diff --git a/models/silver/protocols/olas/metadata/silver_olas__getservice_reads.sql b/models/silver/protocols/olas/metadata/silver_olas__getservice_reads.sql index ddfffc2..e559c80 100644 --- a/models/silver/protocols/olas/metadata/silver_olas__getservice_reads.sql +++ b/models/silver/protocols/olas/metadata/silver_olas__getservice_reads.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'getservice_reads_id', full_refresh = false, - tags = ['curated'] + tags = ['silver_olas','curated','olas'] ) }} WITH service_contracts AS ( diff --git a/models/silver/protocols/olas/metadata/silver_olas__registry_metadata.sql b/models/silver/protocols/olas/metadata/silver_olas__registry_metadata.sql index 843fce6..29219d3 100644 --- a/models/silver/protocols/olas/metadata/silver_olas__registry_metadata.sql +++ b/models/silver/protocols/olas/metadata/silver_olas__registry_metadata.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'registry_metadata_id', full_refresh = false, - tags = ['curated'] + tags = ['silver_olas','curated','olas'] ) }} WITH new_records AS ( diff --git a/models/silver/protocols/olas/metadata/silver_olas__registry_metadata_complete.sql b/models/silver/protocols/olas/metadata/silver_olas__registry_metadata_complete.sql index fb241ff..6db2835 100644 --- a/models/silver/protocols/olas/metadata/silver_olas__registry_metadata_complete.sql +++ b/models/silver/protocols/olas/metadata/silver_olas__registry_metadata_complete.sql @@ -1,5 +1,6 @@ {{ config( - materialized = 'view' + materialized = 'view', + tags = ['silver_olas','curated','olas'] ) }} SELECT diff --git a/models/silver/protocols/olas/metadata/silver_olas__registry_reads.sql b/models/silver/protocols/olas/metadata/silver_olas__registry_reads.sql index 3541f79..6755c9c 100644 --- a/models/silver/protocols/olas/metadata/silver_olas__registry_reads.sql +++ b/models/silver/protocols/olas/metadata/silver_olas__registry_reads.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'registry_reads_id', full_refresh = false, - tags = ['curated'] + tags = ['silver_olas','curated','olas'] ) }} WITH service_contracts AS ( diff --git a/models/silver/protocols/olas/silver_olas__create_service_multisigs.sql b/models/silver/protocols/olas/silver_olas__create_service_multisigs.sql index 4b5b7e2..cc97329 100644 --- a/models/silver/protocols/olas/silver_olas__create_service_multisigs.sql +++ b/models/silver/protocols/olas/silver_olas__create_service_multisigs.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_olas','curated','olas'] ) }} SELECT diff --git a/models/silver/protocols/olas/silver_olas__mech_delivers.sql b/models/silver/protocols/olas/silver_olas__mech_delivers.sql index c8b9578..4bcb262 100644 --- a/models/silver/protocols/olas/silver_olas__mech_delivers.sql +++ b/models/silver/protocols/olas/silver_olas__mech_delivers.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_olas','curated','olas'] ) }} SELECT diff --git a/models/silver/protocols/olas/silver_olas__mech_requests.sql b/models/silver/protocols/olas/silver_olas__mech_requests.sql index 9f3908b..2979c94 100644 --- a/models/silver/protocols/olas/silver_olas__mech_requests.sql +++ b/models/silver/protocols/olas/silver_olas__mech_requests.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_olas','curated','olas'] ) }} SELECT diff --git a/models/silver/protocols/olas/silver_olas__olas_staking.sql b/models/silver/protocols/olas/silver_olas__olas_staking.sql index f6f293b..99f554c 100644 --- a/models/silver/protocols/olas/silver_olas__olas_staking.sql +++ b/models/silver/protocols/olas/silver_olas__olas_staking.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_olas','curated','olas'] ) }} WITH deposits AS ( diff --git a/models/silver/protocols/olas/silver_olas__service_checkpoint.sql b/models/silver/protocols/olas/silver_olas__service_checkpoint.sql index 19ebadd..7257e2e 100644 --- a/models/silver/protocols/olas/silver_olas__service_checkpoint.sql +++ b/models/silver/protocols/olas/silver_olas__service_checkpoint.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_olas','curated','olas'] ) }} WITH decoded_evt AS ( diff --git a/models/silver/protocols/olas/silver_olas__service_event_logs.sql b/models/silver/protocols/olas/silver_olas__service_event_logs.sql index af0df8d..b0975c1 100644 --- a/models/silver/protocols/olas/silver_olas__service_event_logs.sql +++ b/models/silver/protocols/olas/silver_olas__service_event_logs.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_olas','curated','olas'] ) }} WITH service_multisigs AS ( diff --git a/models/silver/protocols/olas/silver_olas__service_registrations.sql b/models/silver/protocols/olas/silver_olas__service_registrations.sql index c51d58b..6876258 100644 --- a/models/silver/protocols/olas/silver_olas__service_registrations.sql +++ b/models/silver/protocols/olas/silver_olas__service_registrations.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg','heal'] + tags = ['silver_olas','curated','olas','heal'] ) }} WITH registry_evt AS ( diff --git a/models/silver/protocols/olas/silver_olas__service_staking.sql b/models/silver/protocols/olas/silver_olas__service_staking.sql index 9d0554f..92c8dbb 100644 --- a/models/silver/protocols/olas/silver_olas__service_staking.sql +++ b/models/silver/protocols/olas/silver_olas__service_staking.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_olas','curated','olas'] ) }} WITH all_evt AS ( diff --git a/models/silver/protocols/olas/silver_olas__services_evicted.sql b/models/silver/protocols/olas/silver_olas__services_evicted.sql index ee7592c..c7b65bf 100644 --- a/models/silver/protocols/olas/silver_olas__services_evicted.sql +++ b/models/silver/protocols/olas/silver_olas__services_evicted.sql @@ -3,7 +3,7 @@ incremental_strategy = 'delete+insert', unique_key = 'block_number', cluster_by = ['block_timestamp::DATE'], - tags = ['curated','reorg'] + tags = ['silver_olas','curated','olas'] ) }} WITH decoded_evt AS ( diff --git a/models/silver/stats/silver_stats__core_metrics_hourly.sql b/models/silver/stats/silver_stats__core_metrics_hourly.sql deleted file mode 100644 index b08810d..0000000 --- a/models/silver/stats/silver_stats__core_metrics_hourly.sql +++ /dev/null @@ -1,80 +0,0 @@ -{{ config( - materialized = 'incremental', - incremental_strategy = 'delete+insert', - unique_key = "block_timestamp_hour", - cluster_by = ['block_timestamp_hour::DATE'], - tags = ['curated'] -) }} -/* run incremental timestamp value first then use it as a static value */ -{% if execute %} - -{% if is_incremental() %} -{% set query %} - -SELECT - MIN(DATE_TRUNC('hour', block_timestamp)) block_timestamp_hour -FROM - {{ ref('core__fact_transactions') }} -WHERE - modified_timestamp >= ( - SELECT - MAX(_inserted_timestamp) - FROM - {{ this }} - ) {% endset %} - {% set min_block_timestamp_hour = run_query(query).columns [0].values() [0] %} -{% endif %} -{% endif %} -SELECT - DATE_TRUNC( - 'hour', - block_timestamp - ) AS block_timestamp_hour, - MIN(block_number) AS block_number_min, - MAX(block_number) AS block_number_max, - COUNT( - DISTINCT block_number - ) AS block_count, - COUNT( - DISTINCT tx_hash - ) AS transaction_count, - COUNT( - DISTINCT CASE - WHEN tx_succeeded THEN tx_hash - END - ) AS transaction_count_success, - COUNT( - DISTINCT CASE - WHEN NOT tx_succeeded THEN tx_hash - END - ) AS transaction_count_failed, - COUNT( - DISTINCT from_address - ) AS unique_from_count, - COUNT( - DISTINCT to_address - ) AS unique_to_count, - SUM(tx_fee_precise) AS total_fees, - MAX(modified_timestamp) AS _inserted_timestamp, - {{ dbt_utils.generate_surrogate_key( - ['block_timestamp_hour'] - ) }} AS core_metrics_hourly_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - {{ ref('core__fact_transactions') }} -WHERE - block_timestamp_hour < DATE_TRUNC( - 'hour', - CURRENT_TIMESTAMP - ) - -{% if is_incremental() %} -AND DATE_TRUNC( - 'hour', - block_timestamp -) >= '{{ min_block_timestamp_hour }}' -{% endif %} -GROUP BY - 1 diff --git a/models/silver/stats/silver_stats__core_metrics_hourly.yml b/models/silver/stats/silver_stats__core_metrics_hourly.yml deleted file mode 100644 index df231f3..0000000 --- a/models/silver/stats/silver_stats__core_metrics_hourly.yml +++ /dev/null @@ -1,84 +0,0 @@ -version: 2 -models: - - name: silver_stats__core_metrics_hourly - tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - BLOCK_TIMESTAMP_HOUR - columns: - - name: BLOCK_TIMESTAMP_HOUR - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - TIMESTAMP_LTZ - - TIMESTAMP_NTZ - - name: BLOCK_NUMBER_MIN - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: BLOCK_NUMBER_MAX - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: BLOCK_COUNT - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: TRANSACTION_COUNT - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: TRANSACTION_COUNT_SUCCESS - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: TRANSACTION_COUNT_FAILED - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: UNIQUE_FROM_COUNT - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: UNIQUE_TO_COUNT - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - NUMBER - - FLOAT - - name: TOTAL_FEES - tests: - - not_null - - dbt_expectations.expect_column_values_to_be_in_type_list: - column_type_list: - - DECIMAL - - FLOAT - - NUMBER - - name: _INSERTED_TIMESTAMP - tests: - - dbt_expectations.expect_row_values_to_have_recent_data: - datepart: day - interval: 1 diff --git a/models/silver/utilities/silver__number_sequence.sql b/models/silver/utilities/silver__number_sequence.sql deleted file mode 100644 index 6d79dd5..0000000 --- a/models/silver/utilities/silver__number_sequence.sql +++ /dev/null @@ -1,13 +0,0 @@ -{{ 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 index 32e74be..9db61ef 100644 --- a/models/sources.yml +++ b/models/sources.yml @@ -1,39 +1,10 @@ version: 2 + sources: - - name: prod - database: chainwalkers - schema: prod - tables: - - name: gnosis_blocks - - name: gnosis_txs - - name: crosschain - database: "{{ 'crosschain' if target.database == 'GNOSIS' else 'crosschain_dev' }}" - schema: core - tables: - - name: address_labels - - name: ez_hourly_prices - - name: dim_labels - - name: crosschain_silver - database: "{{ 'crosschain' if target.database == 'GNOSIS' else 'crosschain_dev' }}" - schema: silver - tables: - - name: near_address_encoded - - name: labels_combined - - name: complete_token_asset_metadata - - name: complete_token_prices - - name: complete_provider_asset_metadata - - name: complete_provider_prices - - name: complete_native_asset_metadata - - name: complete_native_prices - - name: crosschain_public - database: crosschain - schema: bronze_public - tables: - - name: user_abis - name: bronze_streamline database: streamline schema: | - {{ var('GLOBAL_PROD_DB_NAME') ~ ('_dev' if var("STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES", False) else '') }} + {{ target.database.upper() | replace('_DEV', '') ~ '_DEV' if var("STREAMLINE_USE_DEV_FOR_EXTERNAL_TABLES", False) else target.database.upper() | replace('_DEV', '') }} tables: - name: receipts - name: blocks @@ -47,18 +18,32 @@ sources: - name: traces_v2 - name: confirm_blocks_v2 - name: decoded_logs_v2 - - name: gnosis_silver - database: gnosis + - name: contract_abis + - name: crosschain_silver + database: >- + {{ 'CROSSCHAIN_DEV' if '_DEV' in target.database.upper() else 'CROSSCHAIN' }} schema: silver tables: - - name: verified_abis - - name: gnosis_bronze_api - database: gnosis - schema: bronze_api + - name: near_address_encoded + - name: labels_combined + - name: complete_provider_asset_metadata + - name: complete_native_asset_metadata + - name: complete_native_prices + - name: complete_provider_prices + - name: complete_token_asset_metadata + - name: complete_token_prices + - name: crosschain_public + database: crosschain + schema: bronze_public tables: - - name: contract_abis + - name: user_abis + - name: complete_streamline + database: "{{ target.database }}" + schema: streamline + tables: + - name: complete_contract_abis - name: github_actions - database: gnosis + database: "{{ target.database }}" schema: github_actions tables: - name: workflows @@ -66,4 +51,23 @@ sources: database: external schema: defillama tables: - - name: dim_chains \ No newline at end of file + - name: dim_chains + - name: abis_silver + database: "{{ target.database }}" + schema: silver + tables: + - name: verified_abis + - name: complete_event_abis + - name: fsc_evm_admin + database: >- + {{ 'FSC_EVM_DEV' if '_DEV' in target.database.upper() else 'FSC_EVM' }} + schema: admin + tables: + - name: _master_keys + - name: rpc_node_logs + - name: logs_temp + database: "{{ target.database }}" + schema: silver + tables: + - name: logs + - name: decoded_logs \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__blocks.sql b/models/streamline/bronze/core/bronze__blocks.sql index aa987cf..b5611e0 100644 --- a/models/streamline/bronze/core/bronze__blocks.sql +++ b/models/streamline/bronze/core/bronze__blocks.sql @@ -1,39 +1,14 @@ -{# Set variables #} -{% set source_name = 'BLOCKS' %} -{% set source_version = 'V2' if var('GLOBAL_USES_STREAMLINE_V1', false) or var('GLOBAL_USES_BLOCKS_TRANSACTIONS_PATH', false) else '' %} -{% set model_type = '' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = default_vars['partition_function'] %} -{% set partition_join_key = default_vars['partition_join_key'] %} -{% set balances = default_vars['balances'] %} -{% set block_number = default_vars['block_number'] %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_core'] + tags = ['bronze','core','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query( + source_name = 'blocks', + source_version = 'v2' ) }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__blocks_fr.sql b/models/streamline/bronze/core/bronze__blocks_fr.sql index 33ad98f..470f3e9 100644 --- a/models/streamline/bronze/core/bronze__blocks_fr.sql +++ b/models/streamline/bronze/core/bronze__blocks_fr.sql @@ -1,6 +1,9 @@ +{# Log configuration details #} +{{ fsc_evm.log_model_details() }} + {{ config ( materialized = 'view', - tags = ['bronze_core'] + tags = ['bronze','core','phase_1'] ) }} SELECT @@ -13,7 +16,6 @@ SELECT _inserted_timestamp FROM {{ ref('bronze__blocks_fr_v2') }} -{% if var('GLOBAL_USES_STREAMLINE_V1', false) %} UNION ALL SELECT _partition_by_block_id AS partition_key, @@ -24,18 +26,4 @@ SELECT file_name, _inserted_timestamp FROM - {{ ref('bronze__blocks_fr_v1') }} -{% endif %} -{% if var('GLOBAL_USES_BLOCKS_TRANSACTIONS_PATH', false) %} -UNION ALL -SELECT - partition_key, - block_number, - VALUE, - DATA, - metadata, - file_name, - _inserted_timestamp -FROM - {{ ref('bronze__blocks_fr_v2_1') }} -{% endif %} \ No newline at end of file + {{ ref('bronze__blocks_fr_v1') }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__blocks_fr_v1.sql b/models/streamline/bronze/core/bronze__blocks_fr_v1.sql index b45639a..6b0b0bc 100644 --- a/models/streamline/bronze/core/bronze__blocks_fr_v1.sql +++ b/models/streamline/bronze/core/bronze__blocks_fr_v1.sql @@ -1,40 +1,16 @@ -{# Set variables #} -{% set source_name = 'BLOCKS' %} -{% set source_version = '' %} -{% set model_type = 'FR' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = "CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 3), '_', 1) AS INTEGER)" %} -{% set partition_join_key = '_partition_by_block_id' %} -{% set balances = default_vars['balances'] %} -{% set block_number = false %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_core_streamline_v1'] + tags = ['bronze','core','streamline_v1','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query_fr( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - partition_join_key = partition_join_key, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query_fr( + source_name = 'blocks', + partition_function = "CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 3), '_', 1) AS INTEGER)", + partition_join_key = "_partition_by_block_id", + block_number = false ) }} diff --git a/models/streamline/bronze/core/bronze__blocks_fr_v2.sql b/models/streamline/bronze/core/bronze__blocks_fr_v2.sql index 91576bd..32dcd1d 100644 --- a/models/streamline/bronze/core/bronze__blocks_fr_v2.sql +++ b/models/streamline/bronze/core/bronze__blocks_fr_v2.sql @@ -1,40 +1,14 @@ -{# Set variables #} -{% set source_name = 'BLOCKS' %} -{% set source_version = 'V2' if var('GLOBAL_USES_STREAMLINE_V1', false) else '' %} -{% set model_type = 'FR' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = default_vars['partition_function'] %} -{% set partition_join_key = default_vars['partition_join_key'] %} -{% set balances = default_vars['balances'] %} -{% set block_number = default_vars['block_number'] %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_core'] + tags = ['bronze','core','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query_fr( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - partition_join_key = partition_join_key, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query_fr( + source_name = 'blocks', + source_version = 'v2' ) }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__confirm_blocks.sql b/models/streamline/bronze/core/bronze__confirm_blocks.sql index 031fdb2..2927de0 100644 --- a/models/streamline/bronze/core/bronze__confirm_blocks.sql +++ b/models/streamline/bronze/core/bronze__confirm_blocks.sql @@ -1,39 +1,14 @@ -{# Set variables #} -{% set source_name = 'CONFIRM_BLOCKS' %} -{% set source_version = 'V2' if var('GLOBAL_USES_STREAMLINE_V1', false) else '' %} -{% set model_type = '' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = default_vars['partition_function'] %} -{% set partition_join_key = default_vars['partition_join_key'] %} -{% set balances = default_vars['balances'] %} -{% set block_number = default_vars['block_number'] %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_core'] + tags = ['bronze','core','confirm_blocks','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query( + source_name = 'confirm_blocks', + source_version = 'v2' ) }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__confirm_blocks_fr.sql b/models/streamline/bronze/core/bronze__confirm_blocks_fr.sql index ebf8ac6..5b4a5e8 100644 --- a/models/streamline/bronze/core/bronze__confirm_blocks_fr.sql +++ b/models/streamline/bronze/core/bronze__confirm_blocks_fr.sql @@ -1,6 +1,9 @@ +{# Log configuration details #} +{{ fsc_evm.log_model_details() }} + {{ config ( materialized = 'view', - tags = ['bronze_core'] + tags = ['bronze','core','confirm_blocks','phase_1'] ) }} SELECT @@ -13,7 +16,6 @@ SELECT _inserted_timestamp FROM {{ ref('bronze__confirm_blocks_fr_v2') }} -{% if var('GLOBAL_USES_STREAMLINE_V1', false) %} UNION ALL SELECT _partition_by_block_id AS partition_key, @@ -24,5 +26,4 @@ SELECT file_name, _inserted_timestamp FROM - {{ ref('bronze__confirm_blocks_fr_v1') }} -{% endif %} \ No newline at end of file + {{ ref('bronze__confirm_blocks_fr_v1') }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__confirm_blocks_fr_v1.sql b/models/streamline/bronze/core/bronze__confirm_blocks_fr_v1.sql index a4402e5..b65db0d 100644 --- a/models/streamline/bronze/core/bronze__confirm_blocks_fr_v1.sql +++ b/models/streamline/bronze/core/bronze__confirm_blocks_fr_v1.sql @@ -1,40 +1,17 @@ -{# Set variables #} -{% set source_name = 'CONFIRM_BLOCKS' %} -{% set source_version = '' %} -{% set model_type = 'FR' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = "CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 3), '_', 1) AS INTEGER)" %} -{% set partition_join_key = '_partition_by_block_id' %} -{% set balances = default_vars['balances'] %} -{% set block_number = false %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_core_streamline_v1'] + tags = ['bronze','core','streamline_v1','confirm_blocks','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query_fr( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - partition_join_key = partition_join_key, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query_fr( + source_name = 'confirm_blocks', + source_version = '', + partition_function = "CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 3), '_', 1) AS INTEGER)", + partition_join_key = "_partition_by_block_id", + block_number = false ) }} diff --git a/models/streamline/bronze/core/bronze__confirm_blocks_fr_v2.sql b/models/streamline/bronze/core/bronze__confirm_blocks_fr_v2.sql index d03c45b..f14b458 100644 --- a/models/streamline/bronze/core/bronze__confirm_blocks_fr_v2.sql +++ b/models/streamline/bronze/core/bronze__confirm_blocks_fr_v2.sql @@ -1,40 +1,14 @@ -{# Set variables #} -{% set source_name = 'CONFIRM_BLOCKS' %} -{% set source_version = 'V2' if var('GLOBAL_USES_STREAMLINE_V1', false) else '' %} -{% set model_type = 'FR' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = default_vars['partition_function'] %} -{% set partition_join_key = default_vars['partition_join_key'] %} -{% set balances = default_vars['balances'] %} -{% set block_number = default_vars['block_number'] %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_core'] + tags = ['bronze','core','confirm_blocks','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query_fr( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - partition_join_key = partition_join_key, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query_fr( + source_name = 'confirm_blocks', + source_version = 'v2' ) }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__receipts.sql b/models/streamline/bronze/core/bronze__receipts.sql index 21d84b9..4e167d2 100644 --- a/models/streamline/bronze/core/bronze__receipts.sql +++ b/models/streamline/bronze/core/bronze__receipts.sql @@ -1,39 +1,14 @@ -{# Set variables #} -{% set source_name = 'RECEIPTS' %} -{% set source_version = 'V2' if var('GLOBAL_USES_STREAMLINE_V1', false) else '' %} -{% set model_type = '' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = default_vars['partition_function'] %} -{% set partition_join_key = default_vars['partition_join_key'] %} -{% set balances = default_vars['balances'] %} -{% set block_number = default_vars['block_number'] %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_receipts'] + tags = ['bronze','core','receipts','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query( + source_name = 'receipts', + source_version = 'v2' ) }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__receipts_by_hash.sql b/models/streamline/bronze/core/bronze__receipts_by_hash.sql new file mode 100644 index 0000000..e69de29 diff --git a/models/streamline/bronze/core/bronze__receipts_by_hash_fr.sql b/models/streamline/bronze/core/bronze__receipts_by_hash_fr.sql new file mode 100644 index 0000000..e69de29 diff --git a/models/streamline/bronze/core/bronze__receipts_fr.sql b/models/streamline/bronze/core/bronze__receipts_fr.sql index 3b861c0..9b46789 100644 --- a/models/streamline/bronze/core/bronze__receipts_fr.sql +++ b/models/streamline/bronze/core/bronze__receipts_fr.sql @@ -1,6 +1,9 @@ +{# Log configuration details #} +{{ fsc_evm.log_model_details() }} + {{ config ( materialized = 'view', - tags = ['bronze_receipts'] + tags = ['bronze','core','receipts','phase_1'] ) }} SELECT @@ -14,25 +17,18 @@ SELECT _inserted_timestamp FROM {{ ref('bronze__receipts_fr_v2') }} - - {% if var('GLOBAL_USES_STREAMLINE_V1',false) %} - UNION ALL - SELECT - _partition_by_block_id AS partition_key, - block_number, - COALESCE( - VALUE :"array_index" :: INT, - TRY_TO_NUMBER( - utils.udf_hex_to_int( - VALUE :"data" :"transactionIndex" :: STRING - ) - ) - ) AS array_index, - VALUE, - DATA, - metadata, - file_name, - _inserted_timestamp - FROM - {{ ref('bronze__receipts_fr_v1') }} - {% endif %} +UNION ALL +SELECT + _partition_by_block_id AS partition_key, + block_number, + COALESCE( + VALUE :array_index :: INT, + TRY_TO_NUMBER(utils.udf_hex_to_int(VALUE :data :"transactionIndex" :: STRING)) + ) AS array_index, + VALUE, + DATA, + metadata, + file_name, + _inserted_timestamp +FROM + {{ ref('bronze__receipts_fr_v1') }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__receipts_fr_v1.sql b/models/streamline/bronze/core/bronze__receipts_fr_v1.sql index 6c4956e..edba56d 100644 --- a/models/streamline/bronze/core/bronze__receipts_fr_v1.sql +++ b/models/streamline/bronze/core/bronze__receipts_fr_v1.sql @@ -1,40 +1,17 @@ -{# Set variables #} -{% set source_name = 'RECEIPTS' %} -{% set source_version = '' %} -{% set model_type = 'FR' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = "CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 3), '_', 1) AS INTEGER)" %} -{% set partition_join_key = '_partition_by_block_id' %} -{% set balances = default_vars['balances'] %} -{% set block_number = false %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_core_streamline_v1','bronze_receipts'] -) }} + tags = ['bronze','core','streamline_v1','receipts','phase_1'] +) }} {# Main query starts here #} -{{ streamline_external_table_query_fr( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - partition_join_key = partition_join_key, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} \ No newline at end of file +{{ fsc_evm.streamline_external_table_query_fr( + source_name = 'receipts', + source_version = '', + partition_function = "CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 3), '_', 1) AS INTEGER)", + partition_join_key = "_partition_by_block_id", + block_number = false +) }} diff --git a/models/streamline/bronze/core/bronze__receipts_fr_v2.sql b/models/streamline/bronze/core/bronze__receipts_fr_v2.sql index 90e0a07..cf74f3c 100644 --- a/models/streamline/bronze/core/bronze__receipts_fr_v2.sql +++ b/models/streamline/bronze/core/bronze__receipts_fr_v2.sql @@ -1,40 +1,14 @@ -{# Set variables #} -{% set source_name = 'RECEIPTS' %} -{% set source_version = 'V2' if var('GLOBAL_USES_STREAMLINE_V1', false) else '' %} -{% set model_type = 'FR' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = default_vars['partition_function'] %} -{% set partition_join_key = default_vars['partition_join_key'] %} -{% set balances = default_vars['balances'] %} -{% set block_number = default_vars['block_number'] %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_receipts'] + tags = ['bronze','core','receipts','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query_fr( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - partition_join_key = partition_join_key, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query_fr( + source_name = 'receipts', + source_version = 'v2' ) }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__traces.sql b/models/streamline/bronze/core/bronze__traces.sql index f866176..9803133 100644 --- a/models/streamline/bronze/core/bronze__traces.sql +++ b/models/streamline/bronze/core/bronze__traces.sql @@ -1,39 +1,14 @@ -{# Set variables #} -{% set source_name = 'TRACES' %} -{% set source_version = 'V2' if var('GLOBAL_USES_STREAMLINE_V1', false) else '' %} -{% set model_type = '' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = default_vars['partition_function'] %} -{% set partition_join_key = default_vars['partition_join_key'] %} -{% set balances = default_vars['balances'] %} -{% set block_number = default_vars['block_number'] %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_core'] + tags = ['bronze','core','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query( + source_name = 'traces', + source_version = 'v2' ) }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__traces_fr.sql b/models/streamline/bronze/core/bronze__traces_fr.sql index b150c36..74b915f 100644 --- a/models/streamline/bronze/core/bronze__traces_fr.sql +++ b/models/streamline/bronze/core/bronze__traces_fr.sql @@ -1,6 +1,9 @@ +{# Log configuration details #} +{{ fsc_evm.log_model_details() }} + {{ config ( materialized = 'view', - tags = ['bronze_core'] + tags = ['bronze','core','phase_1'] ) }} SELECT @@ -14,7 +17,6 @@ SELECT _inserted_timestamp FROM {{ ref('bronze__traces_fr_v2') }} -{% if var('GLOBAL_USES_STREAMLINE_V1', false) %} UNION ALL SELECT _partition_by_block_id AS partition_key, @@ -26,5 +28,4 @@ SELECT file_name, _inserted_timestamp FROM - {{ ref('bronze__traces_fr_v1') }} -{% endif %} \ No newline at end of file + {{ ref('bronze__traces_fr_v1') }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__traces_fr_v1.sql b/models/streamline/bronze/core/bronze__traces_fr_v1.sql index 3905c1b..6456d29 100644 --- a/models/streamline/bronze/core/bronze__traces_fr_v1.sql +++ b/models/streamline/bronze/core/bronze__traces_fr_v1.sql @@ -1,40 +1,16 @@ -{# Set variables #} -{% set source_name = 'DEBUG_TRACEBLOCKBYNUMBER' if var('GLOBAL_USES_SINGLE_FLIGHT_METHOD',false) else 'TRACES' %} -{% set source_version = '' %} -{% set model_type = 'FR' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = "CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 3), '_', 1) AS INTEGER)" %} -{% set partition_join_key = '_partition_by_block_id' %} -{% set balances = default_vars['balances'] %} -{% set block_number = false %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_core_streamline_v1'] + tags = ['bronze','core','streamline_v1','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query_fr( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - partition_join_key = partition_join_key, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query_fr( + source_name = 'debug_traceblockbynumber', + partition_function = "CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 3), '_', 1) AS INTEGER)", + partition_join_key = "_partition_by_block_id", + block_number = false ) }} diff --git a/models/streamline/bronze/core/bronze__traces_fr_v2.sql b/models/streamline/bronze/core/bronze__traces_fr_v2.sql index 0415825..facbd5d 100644 --- a/models/streamline/bronze/core/bronze__traces_fr_v2.sql +++ b/models/streamline/bronze/core/bronze__traces_fr_v2.sql @@ -1,40 +1,14 @@ -{# Set variables #} -{% set source_name = 'TRACES' %} -{% set source_version = 'V2' if var('GLOBAL_USES_STREAMLINE_V1', false) else '' %} -{% set model_type = 'FR' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = default_vars['partition_function'] %} -{% set partition_join_key = default_vars['partition_join_key'] %} -{% set balances = default_vars['balances'] %} -{% set block_number = default_vars['block_number'] %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_core'] + tags = ['bronze','core','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query_fr( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - partition_join_key = partition_join_key, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query_fr( + source_name = 'traces', + source_version = 'v2' ) }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__transactions.sql b/models/streamline/bronze/core/bronze__transactions.sql index 8b6ba90..df93172 100644 --- a/models/streamline/bronze/core/bronze__transactions.sql +++ b/models/streamline/bronze/core/bronze__transactions.sql @@ -1,39 +1,14 @@ -{# Set variables #} -{% set source_name = 'TRANSACTIONS' %} -{% set source_version = 'V2' if var('GLOBAL_USES_STREAMLINE_V1', false) or var('GLOBAL_USES_BLOCKS_TRANSACTIONS_PATH', false) else '' %} -{% set model_type = '' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = default_vars['partition_function'] %} -{% set partition_join_key = default_vars['partition_join_key'] %} -{% set balances = default_vars['balances'] %} -{% set block_number = default_vars['block_number'] %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_core'] + tags = ['bronze','core','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query( + source_name = 'transactions', + source_version = 'v2' ) }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__transactions_fr.sql b/models/streamline/bronze/core/bronze__transactions_fr.sql index 2721f1d..ccb3e1b 100644 --- a/models/streamline/bronze/core/bronze__transactions_fr.sql +++ b/models/streamline/bronze/core/bronze__transactions_fr.sql @@ -1,6 +1,9 @@ +{# Log configuration details #} +{{ fsc_evm.log_model_details() }} + {{ config ( materialized = 'view', - tags = ['bronze_core'] + tags = ['bronze','core','phase_1'] ) }} SELECT @@ -13,7 +16,6 @@ SELECT _inserted_timestamp FROM {{ ref('bronze__transactions_fr_v2') }} -{% if var('GLOBAL_USES_STREAMLINE_V1', false) %} UNION ALL SELECT _partition_by_block_id AS partition_key, @@ -24,18 +26,4 @@ SELECT file_name, _inserted_timestamp FROM - {{ ref('bronze__transactions_fr_v1') }} -{% endif %} -{% if var('GLOBAL_USES_BLOCKS_TRANSACTIONS_PATH', false) %} -UNION ALL -SELECT - partition_key, - block_number, - VALUE, - DATA, - metadata, - file_name, - _inserted_timestamp -FROM - {{ ref('bronze__transactions_fr_v2_1') }} -{% endif %} \ No newline at end of file + {{ ref('bronze__transactions_fr_v1') }} \ No newline at end of file diff --git a/models/streamline/bronze/core/bronze__transactions_fr_v1.sql b/models/streamline/bronze/core/bronze__transactions_fr_v1.sql index 41179ac..54e50ad 100644 --- a/models/streamline/bronze/core/bronze__transactions_fr_v1.sql +++ b/models/streamline/bronze/core/bronze__transactions_fr_v1.sql @@ -1,40 +1,16 @@ -{# Set variables #} -{% set source_name = 'TRANSACTIONS' %} -{% set source_version = '' %} -{% set model_type = 'FR' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = "CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 3), '_', 1) AS INTEGER)" %} -{% set partition_join_key = '_partition_by_block_id' %} -{% set balances = default_vars['balances'] %} -{% set block_number = false %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_core_streamline_v1'] + tags = ['bronze','core','streamline_v1','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query_fr( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - partition_join_key = partition_join_key, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query_fr( + source_name = 'transactions', + partition_function = "CAST(SPLIT_PART(SPLIT_PART(file_name, '/', 3), '_', 1) AS INTEGER)", + partition_join_key = "_partition_by_block_id", + block_number = false ) }} diff --git a/models/streamline/bronze/core/bronze__transactions_fr_v2.sql b/models/streamline/bronze/core/bronze__transactions_fr_v2.sql index 7907074..25da349 100644 --- a/models/streamline/bronze/core/bronze__transactions_fr_v2.sql +++ b/models/streamline/bronze/core/bronze__transactions_fr_v2.sql @@ -1,40 +1,14 @@ -{# Set variables #} -{% set source_name = 'TRANSACTIONS' %} -{% set source_version = 'V2' if var('GLOBAL_USES_STREAMLINE_V1', false) else '' %} -{% set model_type = 'FR' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - -{% set partition_function = default_vars['partition_function'] %} -{% set partition_join_key = default_vars['partition_join_key'] %} -{% set balances = default_vars['balances'] %} -{% set block_number = default_vars['block_number'] %} -{% set uses_receipts_by_hash = default_vars['uses_receipts_by_hash'] %} - {# Log configuration details #} -{{ log_bronze_details( - source_name = source_name, - source_version = source_version, - model_type = model_type, - partition_function = partition_function, - partition_join_key = partition_join_key, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_core'] + tags = ['bronze','core','phase_1'] ) }} {# Main query starts here #} -{{ streamline_external_table_query_fr( - source_name = source_name.lower(), - source_version = source_version.lower(), - partition_function = partition_function, - partition_join_key = partition_join_key, - balances = balances, - block_number = block_number, - uses_receipts_by_hash = uses_receipts_by_hash +{{ fsc_evm.streamline_external_table_query_fr( + source_name = 'transactions', + source_version = 'v2' ) }} \ No newline at end of file diff --git a/models/streamline/bronze/decoder/bronze__decoded_logs.sql b/models/streamline/bronze/decoder/bronze__decoded_logs.sql index 8a339c6..1d5264a 100644 --- a/models/streamline/bronze/decoder/bronze__decoded_logs.sql +++ b/models/streamline/bronze/decoder/bronze__decoded_logs.sql @@ -1,23 +1,14 @@ -{# Set variables #} -{% set source_name = 'DECODED_LOGS' %} -{% set source_version = 'V2' if var('GLOBAL_USES_STREAMLINE_V1', false) else '' %} -{% set model_type = '' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - {# Log configuration details #} -{{ log_model_details( - vars = default_vars -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_decoded_logs'] + tags = ['bronze','decoded_logs','phase_2'] ) }} {# Main query starts here #} -{{ streamline_external_table_query_decoder( - source_name = source_name.lower(), - source_version = source_version.lower() +{{ fsc_evm.streamline_external_table_query_decoder( + source_name = 'decoded_logs', + source_version = 'v2' ) }} \ No newline at end of file diff --git a/models/streamline/bronze/decoder/bronze__decoded_logs_fr.sql b/models/streamline/bronze/decoder/bronze__decoded_logs_fr.sql index bbe5955..03e1cfb 100644 --- a/models/streamline/bronze/decoder/bronze__decoded_logs_fr.sql +++ b/models/streamline/bronze/decoder/bronze__decoded_logs_fr.sql @@ -1,20 +1,18 @@ {# Log configuration details #} -{{ log_model_details() }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_decoded_logs'] + tags = ['bronze','decoded_logs','phase_2'] ) }} SELECT * FROM {{ ref('bronze__decoded_logs_fr_v2') }} -{% if var('GLOBAL_USES_STREAMLINE_V1', false) %} UNION ALL SELECT * FROM - {{ ref('bronze__decoded_logs_fr_v1') }} -{% endif %} + {{ ref('bronze__decoded_logs_fr_v1') }} \ No newline at end of file diff --git a/models/streamline/bronze/decoder/bronze__decoded_logs_fr_v1.sql b/models/streamline/bronze/decoder/bronze__decoded_logs_fr_v1.sql index 8c122fa..20e47dd 100644 --- a/models/streamline/bronze/decoder/bronze__decoded_logs_fr_v1.sql +++ b/models/streamline/bronze/decoder/bronze__decoded_logs_fr_v1.sql @@ -1,23 +1,13 @@ -{# Set variables #} -{% set source_name = 'DECODED_LOGS' %} -{% set source_version = '' %} -{% set model_type = 'FR' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - {# Log configuration details #} -{{ log_model_details( - vars = default_vars -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_decoded_logs_streamline_v1'] + tags = ['bronze','decoded_logs','streamline_v1','phase_2'] ) }} {# Main query starts here #} -{{ streamline_external_table_query_decoder_fr( - source_name = source_name.lower(), - source_version = source_version.lower() +{{ fsc_evm.streamline_external_table_query_decoder_fr( + source_name = 'decoded_logs' ) }} \ No newline at end of file diff --git a/models/streamline/bronze/decoder/bronze__decoded_logs_fr_v2.sql b/models/streamline/bronze/decoder/bronze__decoded_logs_fr_v2.sql index 2bd430a..c849a83 100644 --- a/models/streamline/bronze/decoder/bronze__decoded_logs_fr_v2.sql +++ b/models/streamline/bronze/decoder/bronze__decoded_logs_fr_v2.sql @@ -1,23 +1,14 @@ -{# Set variables #} -{% set source_name = 'DECODED_LOGS' %} -{% set source_version = 'V2' if var('GLOBAL_USES_STREAMLINE_V1', false) else '' %} -{% set model_type = 'FR' %} - -{%- set default_vars = set_default_variables_bronze(source_name, model_type) -%} - {# Log configuration details #} -{{ log_model_details( - vars = default_vars -) }} +{{ fsc_evm.log_model_details() }} {# Set up dbt configuration #} {{ config ( materialized = 'view', - tags = ['bronze_decoded_logs'] + tags = ['bronze','decoded_logs','phase_2'] ) }} {# Main query starts here #} -{{ streamline_external_table_query_decoder_fr( - source_name = source_name.lower(), - source_version = source_version.lower() +{{ fsc_evm.streamline_external_table_query_decoder_fr( + source_name = 'decoded_logs', + source_version = 'v2' ) }} \ No newline at end of file diff --git a/models/streamline/silver/_24_hour_lookback.sql b/models/streamline/silver/_24_hour_lookback.sql deleted file mode 100644 index e9d060f..0000000 --- a/models/streamline/silver/_24_hour_lookback.sql +++ /dev/null @@ -1,26 +0,0 @@ -{{ config ( - materialized = "ephemeral" -) }} - -WITH max_time AS ( - - SELECT - MAX(block_timestamp) AS max_timestamp - FROM - {{ ref("silver__blocks") }} -) -SELECT - MIN(block_number) AS block_number -FROM - {{ ref("silver__blocks") }} - JOIN max_time - ON block_timestamp BETWEEN DATEADD( - 'hour', - -25, - max_timestamp - ) - AND DATEADD( - 'hour', - -24, - max_timestamp - ) diff --git a/models/streamline/silver/_block_lookback.sql b/models/streamline/silver/_block_lookback.sql deleted file mode 100644 index f37bcf6..0000000 --- a/models/streamline/silver/_block_lookback.sql +++ /dev/null @@ -1,11 +0,0 @@ -{{ config ( - materialized = "ephemeral" -) }} - -SELECT - MIN(block_number) AS block_number -FROM - {{ ref("silver__blocks") }} -WHERE - block_timestamp >= DATEADD('hour', -72, TRUNCATE(SYSDATE(), 'HOUR')) - AND block_timestamp < DATEADD('hour', -71, TRUNCATE(SYSDATE(), 'HOUR')) diff --git a/models/streamline/silver/_max_block_by_date.sql b/models/streamline/silver/_max_block_by_date.sql deleted file mode 100644 index a56cf82..0000000 --- a/models/streamline/silver/_max_block_by_date.sql +++ /dev/null @@ -1,27 +0,0 @@ -{{ config ( - materialized = "ephemeral", - unique_key = "block_number", -) }} - -WITH base AS ( - - SELECT - block_timestamp :: DATE AS block_date, - MAX(block_number) block_number - FROM - {{ ref("silver__blocks") }} - GROUP BY - block_timestamp :: DATE -) -SELECT - block_date, - block_number -FROM - base -WHERE - block_date <> ( - SELECT - MAX(block_date) - FROM - base - ) \ No newline at end of file diff --git a/models/streamline/silver/_max_block_by_hour.sql b/models/streamline/silver/_max_block_by_hour.sql deleted file mode 100644 index 80e3d97..0000000 --- a/models/streamline/silver/_max_block_by_hour.sql +++ /dev/null @@ -1,37 +0,0 @@ -{{ config ( - materialized = "ephemeral" -) }} - -WITH base AS ( - - SELECT - DATE_TRUNC( - 'hour', - block_timestamp - ) AS block_hour, - MAX(block_number) block_number - FROM - {{ ref("silver__blocks") }} - WHERE - block_timestamp > DATEADD( - 'day', - -5, - CURRENT_DATE - ) - GROUP BY - 1 -) -SELECT - block_hour, - block_number -FROM - base -WHERE - block_hour <> ( - SELECT - MAX( - block_hour - ) - FROM - base - ) diff --git a/models/streamline/silver/core/complete/streamline__blocks_complete.sql b/models/streamline/silver/core/complete/streamline__blocks_complete.sql deleted file mode 100644 index 4c8977d..0000000 --- a/models/streamline/silver/core/complete/streamline__blocks_complete.sql +++ /dev/null @@ -1,50 +0,0 @@ -{# Set variables #} -{%- set source_name = 'BLOCKS' -%} -{%- set model_type = 'COMPLETE' -%} - -{%- set full_refresh_type = var((source_name ~ '_complete_full_refresh').upper(), false) -%} - -{% set post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(block_number)" %} - -{# Log configuration details #} -{{ log_complete_details( - post_hook = post_hook, - full_refresh_type = full_refresh_type -) }} - -{# Set up dbt configuration #} --- depends_on: {{ ref('bronze__' ~ source_name.lower()) }} - -{{ config ( - materialized = "incremental", - unique_key = "block_number", - cluster_by = "ROUND(block_number, -3)", - post_hook = post_hook, - full_refresh = full_refresh_type, - tags = ['streamline_core_complete'] -) }} - -{# Main query starts here #} -SELECT - block_number, - file_name, - {{ dbt_utils.generate_surrogate_key(['block_number']) }} AS complete_{{ source_name.lower() }}_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - _inserted_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - {% if is_incremental() %} - {{ ref('bronze__' ~ source_name.lower()) }} - WHERE - _inserted_timestamp >= ( - SELECT - COALESCE(MAX(_inserted_timestamp), '1970-01-01'::TIMESTAMP) AS _inserted_timestamp - FROM - {{ this }} - ) - {% else %} - {{ ref('bronze__' ~ source_name.lower() ~ '_fr') }} - {% endif %} - -QUALIFY (ROW_NUMBER() OVER (PARTITION BY block_number ORDER BY _inserted_timestamp DESC)) = 1 diff --git a/models/streamline/silver/core/complete/streamline__confirm_blocks_complete.sql b/models/streamline/silver/core/complete/streamline__confirm_blocks_complete.sql deleted file mode 100644 index fe73ef2..0000000 --- a/models/streamline/silver/core/complete/streamline__confirm_blocks_complete.sql +++ /dev/null @@ -1,50 +0,0 @@ -{# Set variables #} -{%- set source_name = 'CONFIRM_BLOCKS' -%} -{%- set model_type = 'COMPLETE' -%} - -{%- set full_refresh_type = var((source_name ~ '_complete_full_refresh').upper(), false) -%} - -{% set post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(block_number)" %} - -{# Log configuration details #} -{{ log_complete_details( - post_hook = post_hook, - full_refresh_type = full_refresh_type -) }} - -{# Set up dbt configuration #} --- depends_on: {{ ref('bronze__' ~ source_name.lower()) }} - -{{ config ( - materialized = "incremental", - unique_key = "block_number", - cluster_by = "ROUND(block_number, -3)", - post_hook = post_hook, - full_refresh = full_refresh_type, - tags = ['streamline_core_complete_confirm_blocks'] -) }} - -{# Main query starts here #} -SELECT - block_number, - file_name, - {{ dbt_utils.generate_surrogate_key(['block_number']) }} AS complete_{{ source_name.lower() }}_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - _inserted_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - {% if is_incremental() %} - {{ ref('bronze__' ~ source_name.lower()) }} - WHERE - _inserted_timestamp >= ( - SELECT - COALESCE(MAX(_inserted_timestamp), '1970-01-01'::TIMESTAMP) AS _inserted_timestamp - FROM - {{ this }} - ) - {% else %} - {{ ref('bronze__' ~ source_name.lower() ~ '_fr') }} - {% endif %} - -QUALIFY (ROW_NUMBER() OVER (PARTITION BY block_number ORDER BY _inserted_timestamp DESC)) = 1 diff --git a/models/streamline/silver/core/complete/streamline__receipts_complete.sql b/models/streamline/silver/core/complete/streamline__receipts_complete.sql deleted file mode 100644 index b77138d..0000000 --- a/models/streamline/silver/core/complete/streamline__receipts_complete.sql +++ /dev/null @@ -1,50 +0,0 @@ -{# Set variables #} -{%- set source_name = 'RECEIPTS' -%} -{%- set model_type = 'COMPLETE' -%} - -{%- set full_refresh_type = var((source_name ~ '_complete_full_refresh').upper(), false) -%} - -{% set post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(block_number)" %} - -{# Log configuration details #} -{{ log_complete_details( - post_hook = post_hook, - full_refresh_type = full_refresh_type -) }} - -{# Set up dbt configuration #} --- depends_on: {{ ref('bronze__' ~ source_name.lower()) }} - -{{ config ( - materialized = "incremental", - unique_key = "block_number", - cluster_by = "ROUND(block_number, -3)", - post_hook = post_hook, - full_refresh = full_refresh_type, - tags = ['streamline_core_complete_receipts'] -) }} - -{# Main query starts here #} -SELECT - block_number, - file_name, - {{ dbt_utils.generate_surrogate_key(['block_number']) }} AS complete_{{ source_name.lower() }}_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - _inserted_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - {% if is_incremental() %} - {{ ref('bronze__' ~ source_name.lower()) }} - WHERE - _inserted_timestamp >= ( - SELECT - COALESCE(MAX(_inserted_timestamp), '1970-01-01'::TIMESTAMP) AS _inserted_timestamp - FROM - {{ this }} - ) - {% else %} - {{ ref('bronze__' ~ source_name.lower() ~ '_fr') }} - {% endif %} - -QUALIFY (ROW_NUMBER() OVER (PARTITION BY block_number ORDER BY _inserted_timestamp DESC)) = 1 diff --git a/models/streamline/silver/core/complete/streamline__traces_complete.sql b/models/streamline/silver/core/complete/streamline__traces_complete.sql deleted file mode 100644 index e715876..0000000 --- a/models/streamline/silver/core/complete/streamline__traces_complete.sql +++ /dev/null @@ -1,50 +0,0 @@ -{# Set variables #} -{%- set source_name = 'TRACES' -%} -{%- set model_type = 'COMPLETE' -%} - -{%- set full_refresh_type = var((source_name ~ '_complete_full_refresh').upper(), false) -%} - -{% set post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(block_number)" %} - -{# Log configuration details #} -{{ log_complete_details( - post_hook = post_hook, - full_refresh_type = full_refresh_type -) }} - -{# Set up dbt configuration #} --- depends_on: {{ ref('bronze__' ~ source_name.lower()) }} - -{{ config ( - materialized = "incremental", - unique_key = "block_number", - cluster_by = "ROUND(block_number, -3)", - post_hook = post_hook, - full_refresh = full_refresh_type, - tags = ['streamline_core_complete'] -) }} - -{# Main query starts here #} -SELECT - block_number, - file_name, - {{ dbt_utils.generate_surrogate_key(['block_number']) }} AS complete_{{ source_name.lower() }}_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - _inserted_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - {% if is_incremental() %} - {{ ref('bronze__' ~ source_name.lower()) }} - WHERE - _inserted_timestamp >= ( - SELECT - COALESCE(MAX(_inserted_timestamp), '1970-01-01'::TIMESTAMP) AS _inserted_timestamp - FROM - {{ this }} - ) - {% else %} - {{ ref('bronze__' ~ source_name.lower() ~ '_fr') }} - {% endif %} - -QUALIFY (ROW_NUMBER() OVER (PARTITION BY block_number ORDER BY _inserted_timestamp DESC)) = 1 \ No newline at end of file diff --git a/models/streamline/silver/core/complete/streamline__transactions_complete.sql b/models/streamline/silver/core/complete/streamline__transactions_complete.sql deleted file mode 100644 index 06ec7f7..0000000 --- a/models/streamline/silver/core/complete/streamline__transactions_complete.sql +++ /dev/null @@ -1,50 +0,0 @@ -{# Set variables #} -{%- set source_name = 'TRANSACTIONS' -%} -{%- set model_type = 'COMPLETE' -%} - -{%- set full_refresh_type = var((source_name ~ '_complete_full_refresh').upper(), false) -%} - -{% set post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(block_number)"%} - -{# Log configuration details #} -{{ log_complete_details( - post_hook = post_hook, - full_refresh_type = full_refresh_type -) }} - -{# Set up dbt configuration #} --- depends_on: {{ ref('bronze__' ~ source_name.lower()) }} - -{{ config ( - materialized = "incremental", - unique_key = "block_number", - cluster_by = "ROUND(block_number, -3)", - post_hook = post_hook, - full_refresh = full_refresh_type, - tags = ['streamline_core_complete'] -) }} - -{# Main query starts here #} -SELECT - block_number, - file_name, - {{ dbt_utils.generate_surrogate_key(['block_number']) }} AS complete_{{ source_name.lower() }}_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - _inserted_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - {% if is_incremental() %} - {{ ref('bronze__' ~ source_name.lower()) }} - WHERE - _inserted_timestamp >= ( - SELECT - COALESCE(MAX(_inserted_timestamp), '1970-01-01'::TIMESTAMP) AS _inserted_timestamp - FROM - {{ this }} - ) - {% else %} - {{ ref('bronze__' ~ source_name.lower() ~ '_fr') }} - {% endif %} - -QUALIFY (ROW_NUMBER() OVER (PARTITION BY block_number ORDER BY _inserted_timestamp DESC)) = 1 \ No newline at end of file diff --git a/models/streamline/silver/core/history/streamline__blocks_transactions_history.sql b/models/streamline/silver/core/history/streamline__blocks_transactions_history.sql deleted file mode 100644 index baed1d7..0000000 --- a/models/streamline/silver/core/history/streamline__blocks_transactions_history.sql +++ /dev/null @@ -1,112 +0,0 @@ -{# Set variables #} -{%- set model_name = 'BLOCKS_TRANSACTIONS' -%} -{%- set model_type = 'HISTORY' -%} - -{%- set default_vars = set_default_variables_streamline(model_name, model_type) -%} - -{# Set up parameters for the streamline process. These will come from the vars set in dbt_project.yml #} - -{%- set streamline_params = set_streamline_parameters( - model_name=model_name, - model_type=model_type -) -%} - -{%- set node_url = default_vars['node_url'] -%} -{%- set node_secret_path = default_vars['node_secret_path'] -%} -{%- set model_quantum_state = default_vars['model_quantum_state'] -%} -{%- set sql_limit = streamline_params['sql_limit'] -%} -{%- set testing_limit = default_vars['testing_limit'] -%} -{%- set order_by_clause = default_vars['order_by_clause'] -%} -{%- set new_build = default_vars['new_build'] -%} -{%- set method_params = streamline_params['method_params'] -%} -{%- set method = streamline_params['method'] -%} - -{# Log configuration details #} -{{ log_streamline_details( - model_name=model_name, - model_type=model_type, - node_url=node_url, - model_quantum_state=model_quantum_state, - sql_limit=sql_limit, - testing_limit=testing_limit, - order_by_clause=order_by_clause, - new_build=new_build, - streamline_params=streamline_params, - method_params=method_params, - method=method -) }} - -{# Set up dbt configuration #} -{{ config ( - materialized = "view", - post_hook = fsc_utils.if_data_call_function_v2( - func = 'streamline.udf_bulk_rest_api_v2', - target = "{{this.schema}}.{{this.identifier}}", - params = streamline_params - ), - tags = ['streamline_core_history'] -) }} - -{# Main query starts here #} -WITH -{% if not new_build %} - last_3_days AS ( - SELECT block_number - FROM {{ ref("_block_lookback") }} - ), -{% endif %} - -{# Identify blocks that need processing #} -to_do AS ( - SELECT block_number - FROM {{ ref("streamline__blocks") }} - WHERE - block_number IS NOT NULL - {% if not new_build %} - AND block_number <= (SELECT block_number FROM last_3_days) - {% endif %} - - EXCEPT - - SELECT block_number - FROM {{ ref("streamline__blocks_complete") }} b - INNER JOIN {{ ref("streamline__transactions_complete") }} t USING(block_number) - WHERE 1=1 - {% if not new_build %} - AND block_number <= (SELECT block_number FROM last_3_days) - {% endif %} -), -ready_blocks AS ( - SELECT block_number - FROM to_do - - {% if testing_limit is not none %} - LIMIT {{ testing_limit }} - {% endif %} -) - -{# Generate API requests for each block #} -SELECT - block_number, - ROUND(block_number, -3) AS partition_key, - live.udf_api( - 'POST', - '{{ node_url }}', - OBJECT_CONSTRUCT( - 'Content-Type', 'application/json', - 'fsc-quantum-state', '{{ model_quantum_state }}' - ), - OBJECT_CONSTRUCT( - 'id', block_number, - 'jsonrpc', '2.0', - 'method', '{{ method }}', - 'params', {{ method_params }} - ), - '{{ node_secret_path }}' - ) AS request -FROM - ready_blocks - -{{ order_by_clause }} - -LIMIT {{ sql_limit }} \ No newline at end of file diff --git a/models/streamline/silver/core/history/streamline__confirm_blocks_history.sql b/models/streamline/silver/core/history/streamline__confirm_blocks_history.sql deleted file mode 100644 index d715b31..0000000 --- a/models/streamline/silver/core/history/streamline__confirm_blocks_history.sql +++ /dev/null @@ -1,133 +0,0 @@ -{# Set variables #} -{%- set model_name = 'CONFIRM_BLOCKS' -%} -{%- set model_type = 'HISTORY' -%} - -{%- set default_vars = set_default_variables_streamline(model_name, model_type) -%} - -{# Set up parameters for the streamline process. These will come from the vars set in dbt_project.yml #} -{%- set streamline_params = set_streamline_parameters( - model_name=model_name, - model_type=model_type -) -%} - -{%- set node_url = default_vars['node_url'] -%} -{%- set node_secret_path = default_vars['node_secret_path'] -%} -{%- set model_quantum_state = default_vars['model_quantum_state'] -%} -{%- set sql_limit = streamline_params['sql_limit'] -%} -{%- set testing_limit = default_vars['testing_limit'] -%} -{%- set order_by_clause = default_vars['order_by_clause'] -%} -{%- set new_build = default_vars['new_build'] -%} -{%- set method_params = streamline_params['method_params'] -%} -{%- set method = streamline_params['method'] -%} - -{# Log configuration details #} -{{ log_streamline_details( - model_name=model_name, - model_type=model_type, - node_url=node_url, - model_quantum_state=model_quantum_state, - sql_limit=sql_limit, - testing_limit=testing_limit, - order_by_clause=order_by_clause, - new_build=new_build, - streamline_params=streamline_params, - method_params=method_params, - method=method -) }} - -{# Set up dbt configuration #} -{{ config ( - materialized = "view", - post_hook = fsc_utils.if_data_call_function_v2( - func = 'streamline.udf_bulk_rest_api_v2', - target = "{{this.schema}}.{{this.identifier}}", - params = streamline_params - ), - tags = ['streamline_core_history_confirm_blocks'] -) }} - -{# Main query starts here #} -WITH -{% if not new_build %} - last_3_days AS ( - SELECT block_number - FROM {{ ref("_block_lookback") }} - ), -{% endif %} - -{# Delay blocks #} -look_back AS ( - SELECT - block_number - FROM - {{ ref("_max_block_by_hour") }} - qualify ROW_NUMBER() over ( - ORDER BY - block_number DESC - ) = 6 - ), - -{# Identify blocks that need processing #} -to_do AS ( - SELECT block_number - FROM {{ ref("streamline__blocks") }} - WHERE - block_number IS NOT NULL - AND block_number <= (SELECT block_number FROM look_back) - {% if not new_build %} - AND block_number <= (SELECT block_number FROM last_3_days) - {% endif %} - - EXCEPT - - {# Exclude blocks that have already been processed #} - SELECT block_number - FROM {{ ref('streamline__' ~ model_name.lower() ~ '_complete') }} - WHERE 1=1 - AND block_number IS NOT NULL - AND block_number <= (SELECT block_number FROM look_back) - AND _inserted_timestamp >= DATEADD( - 'day', - -4, - SYSDATE() - ) - {% if not new_build %} - AND block_number <= (SELECT block_number FROM last_3_days) - {% endif %} -) - -{# Prepare the final list of blocks to process #} -,ready_blocks AS ( - SELECT block_number - FROM to_do - - {% if testing_limit is not none %} - LIMIT {{ testing_limit }} - {% endif %} -) - -{# Generate API requests for each block #} -SELECT - block_number, - ROUND(block_number, -3) AS partition_key, - live.udf_api( - 'POST', - '{{ node_url }}', - OBJECT_CONSTRUCT( - 'Content-Type', 'application/json', - 'fsc-quantum-state', '{{ model_quantum_state }}' - ), - OBJECT_CONSTRUCT( - 'id', block_number, - 'jsonrpc', '2.0', - 'method', '{{ method }}', - 'params', {{ method_params }} - ), - '{{ node_secret_path }}' - ) AS request -FROM - ready_blocks - -{{ order_by_clause }} - -LIMIT {{ sql_limit }} \ No newline at end of file diff --git a/models/streamline/silver/core/history/streamline__receipts_history.sql b/models/streamline/silver/core/history/streamline__receipts_history.sql deleted file mode 100644 index 4cd5823..0000000 --- a/models/streamline/silver/core/history/streamline__receipts_history.sql +++ /dev/null @@ -1,113 +0,0 @@ -{# Set variables #} -{%- set model_name = 'RECEIPTS' -%} -{%- set model_type = 'HISTORY' -%} - -{%- set default_vars = set_default_variables_streamline(model_name, model_type) -%} - -{# Set up parameters for the streamline process. These will come from the vars set in dbt_project.yml #} -{%- set streamline_params = set_streamline_parameters( - model_name=model_name, - model_type=model_type -) -%} - -{%- set node_url = default_vars['node_url'] -%} -{%- set node_secret_path = default_vars['node_secret_path'] -%} -{%- set model_quantum_state = default_vars['model_quantum_state'] -%} -{%- set sql_limit = streamline_params['sql_limit'] -%} -{%- set testing_limit = default_vars['testing_limit'] -%} -{%- set order_by_clause = default_vars['order_by_clause'] -%} -{%- set new_build = default_vars['new_build'] -%} -{%- set method_params = streamline_params['method_params'] -%} -{%- set method = streamline_params['method'] -%} - -{# Log configuration details #} -{{ log_streamline_details( - model_name=model_name, - model_type=model_type, - node_url=node_url, - model_quantum_state=model_quantum_state, - sql_limit=sql_limit, - testing_limit=testing_limit, - order_by_clause=order_by_clause, - new_build=new_build, - streamline_params=streamline_params, - method_params=method_params, - method=method -) }} - -{# Set up dbt configuration #} -{{ config ( - materialized = "view", - post_hook = fsc_utils.if_data_call_function_v2( - func = 'streamline.udf_bulk_rest_api_v2', - target = "{{this.schema}}.{{this.identifier}}", - params = streamline_params - ), - tags = ['streamline_core_history_receipts'] -) }} - -{# Main query starts here #} -WITH -{% if not new_build %} - last_3_days AS ( - SELECT block_number - FROM {{ ref("_block_lookback") }} - ), -{% endif %} - -{# Identify blocks that need processing #} -to_do AS ( - SELECT block_number - FROM {{ ref("streamline__blocks") }} - WHERE - block_number IS NOT NULL - {% if not new_build %} - AND block_number <= (SELECT block_number FROM last_3_days) - {% endif %} - - EXCEPT - - {# Exclude blocks that have already been processed #} - SELECT block_number - FROM {{ ref('streamline__' ~ model_name.lower() ~ '_complete') }} - WHERE 1=1 - {% if not new_build %} - AND block_number <= (SELECT block_number FROM last_3_days) - {% endif %} -) - -{# Prepare the final list of blocks to process #} -,ready_blocks AS ( - SELECT block_number - FROM to_do - - {% if testing_limit is not none %} - LIMIT {{ testing_limit }} - {% endif %} -) - -{# Generate API requests for each block #} -SELECT - block_number, - ROUND(block_number, -3) AS partition_key, - live.udf_api( - 'POST', - '{{ node_url }}', - OBJECT_CONSTRUCT( - 'Content-Type', 'application/json', - 'fsc-quantum-state', '{{ model_quantum_state }}' - ), - OBJECT_CONSTRUCT( - 'id', block_number, - 'jsonrpc', '2.0', - 'method', '{{ method }}', - 'params', {{ method_params }} - ), - '{{ node_secret_path }}' - ) AS request -FROM - ready_blocks - -{{ order_by_clause }} - -LIMIT {{ sql_limit }} \ No newline at end of file diff --git a/models/streamline/silver/core/history/streamline__traces_history.sql b/models/streamline/silver/core/history/streamline__traces_history.sql deleted file mode 100644 index 0cf5cc2..0000000 --- a/models/streamline/silver/core/history/streamline__traces_history.sql +++ /dev/null @@ -1,113 +0,0 @@ -{# Set variables #} -{%- set model_name = 'TRACES' -%} -{%- set model_type = 'HISTORY' -%} - -{%- set default_vars = set_default_variables_streamline(model_name, model_type) -%} - -{# Set up parameters for the streamline process. These will come from the vars set in dbt_project.yml #} -{%- set streamline_params = set_streamline_parameters( - model_name=model_name, - model_type=model_type -) -%} - -{%- set node_url = default_vars['node_url'] -%} -{%- set node_secret_path = default_vars['node_secret_path'] -%} -{%- set model_quantum_state = default_vars['model_quantum_state'] -%} -{%- set sql_limit = streamline_params['sql_limit'] -%} -{%- set testing_limit = default_vars['testing_limit'] -%} -{%- set order_by_clause = default_vars['order_by_clause'] -%} -{%- set new_build = default_vars['new_build'] -%} -{%- set method_params = streamline_params['method_params'] -%} -{%- set method = streamline_params['method'] -%} - -{# Log configuration details #} -{{ log_streamline_details( - model_name=model_name, - model_type=model_type, - node_url=node_url, - model_quantum_state=model_quantum_state, - sql_limit=sql_limit, - testing_limit=testing_limit, - order_by_clause=order_by_clause, - new_build=new_build, - streamline_params=streamline_params, - method_params=method_params, - method=method -) }} - -{# Set up dbt configuration #} -{{ config ( - materialized = "view", - post_hook = fsc_utils.if_data_call_function_v2( - func = 'streamline.udf_bulk_rest_api_v2', - target = "{{this.schema}}.{{this.identifier}}", - params = streamline_params - ), - tags = ['streamline_core_history'] -) }} - -{# Main query starts here #} -WITH -{% if not new_build %} - last_3_days AS ( - SELECT block_number - FROM {{ ref("_block_lookback") }} - ), -{% endif %} - -{# Identify blocks that need processing #} -to_do AS ( - SELECT block_number - FROM {{ ref("streamline__blocks") }} - WHERE - block_number IS NOT NULL - {% if not new_build %} - AND block_number <= (SELECT block_number FROM last_3_days) - {% endif %} - - EXCEPT - - {# Exclude blocks that have already been processed #} - SELECT block_number - FROM {{ ref('streamline__' ~ model_name.lower() ~ '_complete') }} - WHERE 1=1 - {% if not new_build %} - AND block_number <= (SELECT block_number FROM last_3_days) - {% endif %} -) - -{# Prepare the final list of blocks to process #} -,ready_blocks AS ( - SELECT block_number - FROM to_do - - {% if testing_limit is not none %} - LIMIT {{ testing_limit }} - {% endif %} -) - -{# Generate API requests for each block #} -SELECT - block_number, - ROUND(block_number, -3) AS partition_key, - live.udf_api( - 'POST', - '{{ node_url }}', - OBJECT_CONSTRUCT( - 'Content-Type', 'application/json', - 'fsc-quantum-state', '{{ model_quantum_state }}' - ), - OBJECT_CONSTRUCT( - 'id', block_number, - 'jsonrpc', '2.0', - 'method', '{{ method }}', - 'params', {{ method_params }} - ), - '{{ node_secret_path }}' - ) AS request -FROM - ready_blocks - -{{ order_by_clause }} - -LIMIT {{ sql_limit }} \ No newline at end of file diff --git a/models/streamline/silver/core/realtime/streamline__blocks_transactions_realtime.sql b/models/streamline/silver/core/realtime/streamline__blocks_transactions_realtime.sql deleted file mode 100644 index 0bd0a93..0000000 --- a/models/streamline/silver/core/realtime/streamline__blocks_transactions_realtime.sql +++ /dev/null @@ -1,126 +0,0 @@ -{# Set variables #} -{%- set model_name = 'BLOCKS_TRANSACTIONS' -%} -{%- set model_type = 'REALTIME' -%} -{%- set min_block = var('GLOBAL_START_UP_BLOCK', none) -%} - -{%- set default_vars = set_default_variables_streamline(model_name, model_type) -%} - -{# Set up parameters for the streamline process. These will come from the vars set in dbt_project.yml #} -{%- set streamline_params = set_streamline_parameters( - model_name=model_name, - model_type=model_type -) -%} - -{%- set node_url = default_vars['node_url'] -%} -{%- set node_secret_path = default_vars['node_secret_path'] -%} -{%- set model_quantum_state = default_vars['model_quantum_state'] -%} -{%- set sql_limit = streamline_params['sql_limit'] -%} -{%- set testing_limit = default_vars['testing_limit'] -%} -{%- set order_by_clause = default_vars['order_by_clause'] -%} -{%- set new_build = default_vars['new_build'] -%} -{%- set method_params = streamline_params['method_params'] -%} -{%- set method = streamline_params['method'] -%} - -{# Log configuration details #} -{{ log_streamline_details( - model_name=model_name, - model_type=model_type, - node_url=node_url, - model_quantum_state=model_quantum_state, - sql_limit=sql_limit, - testing_limit=testing_limit, - order_by_clause=order_by_clause, - new_build=new_build, - streamline_params=streamline_params, - method_params=method_params, - method=method, - min_block=min_block -) }} - -{# Set up dbt configuration #} -{{ config ( - materialized = "view", - post_hook = fsc_utils.if_data_call_function_v2( - func = 'streamline.udf_bulk_rest_api_v2', - target = "{{this.schema}}.{{this.identifier}}", - params = streamline_params - ), - tags = ['streamline_core_realtime'] -) }} - -{# Main query starts here #} -WITH -{% if not new_build %} - last_3_days AS ( - SELECT block_number - FROM {{ ref("_block_lookback") }} - ), -{% endif %} - -{# Identify blocks that need processing #} -to_do AS ( - SELECT block_number - FROM {{ ref("streamline__blocks") }} - WHERE - block_number IS NOT NULL - {% if not new_build %} - AND block_number >= (SELECT block_number FROM last_3_days) - {% endif %} - - {% if min_block is not none %} - AND block_number >= {{ min_block }} - {% endif %} - - EXCEPT - - SELECT block_number - FROM {{ ref("streamline__blocks_complete") }} b - INNER JOIN {{ ref("streamline__transactions_complete") }} t USING(block_number) - WHERE 1=1 - {% if not new_build %} - AND block_number >= (SELECT block_number FROM last_3_days) - {% endif %} -), -ready_blocks AS ( - SELECT block_number - FROM to_do - - {% if not new_build %} - UNION - SELECT block_number - FROM {{ ref("_unconfirmed_blocks") }} - UNION - SELECT block_number - FROM {{ ref("_missing_txs") }} - {% endif %} - - {% if testing_limit is not none %} - LIMIT {{ testing_limit }} - {% endif %} -) - -{# Generate API requests for each block #} -SELECT - block_number, - ROUND(block_number, -3) AS partition_key, - live.udf_api( - 'POST', - '{{ node_url }}', - OBJECT_CONSTRUCT( - 'Content-Type', 'application/json', - 'fsc-quantum-state', '{{ model_quantum_state }}' - ), - OBJECT_CONSTRUCT( - 'id', block_number, - 'jsonrpc', '2.0', - 'method', '{{ method }}', - 'params', {{ method_params }} - ), - '{{ node_secret_path }}' - ) AS request -FROM - ready_blocks - -{{ order_by_clause }} - -LIMIT {{ sql_limit }} \ No newline at end of file diff --git a/models/streamline/silver/core/realtime/streamline__confirm_blocks_realtime.sql b/models/streamline/silver/core/realtime/streamline__confirm_blocks_realtime.sql deleted file mode 100644 index 6135a3f..0000000 --- a/models/streamline/silver/core/realtime/streamline__confirm_blocks_realtime.sql +++ /dev/null @@ -1,138 +0,0 @@ -{# Set variables #} -{%- set model_name = 'CONFIRM_BLOCKS' -%} -{%- set model_type = 'REALTIME' -%} -{%- set min_block = var('GLOBAL_START_UP_BLOCK', none) -%} - -{%- set default_vars = set_default_variables_streamline(model_name, model_type) -%} - -{# Set up parameters for the streamline process. These will come from the vars set in dbt_project.yml #} -{%- set streamline_params = set_streamline_parameters( - model_name=model_name, - model_type=model_type -) -%} - -{%- set node_url = default_vars['node_url'] -%} -{%- set node_secret_path = default_vars['node_secret_path'] -%} -{%- set model_quantum_state = default_vars['model_quantum_state'] -%} -{%- set sql_limit = streamline_params['sql_limit'] -%} -{%- set testing_limit = default_vars['testing_limit'] -%} -{%- set order_by_clause = default_vars['order_by_clause'] -%} -{%- set new_build = default_vars['new_build'] -%} -{%- set method_params = streamline_params['method_params'] -%} -{%- set method = streamline_params['method'] -%} - -{# Log configuration details #} -{{ log_streamline_details( - model_name=model_name, - model_type=model_type, - node_url=node_url, - model_quantum_state=model_quantum_state, - sql_limit=sql_limit, - testing_limit=testing_limit, - order_by_clause=order_by_clause, - new_build=new_build, - streamline_params=streamline_params, - method_params=method_params, - method=method, - min_block=min_block -) }} - -{# Set up dbt configuration #} -{{ config ( - materialized = "view", - post_hook = fsc_utils.if_data_call_function_v2( - func = 'streamline.udf_bulk_rest_api_v2', - target = "{{this.schema}}.{{this.identifier}}", - params = streamline_params - ), - tags = ['streamline_core_realtime_confirm_blocks'] -) }} - -{# Main query starts here #} -WITH -{% if not new_build %} - last_3_days AS ( - SELECT block_number - FROM {{ ref("_block_lookback") }} - ), -{% endif %} - -{# Delay blocks #} -look_back AS ( - SELECT - block_number - FROM - {{ ref("_max_block_by_hour") }} - qualify ROW_NUMBER() over ( - ORDER BY - block_number DESC - ) = 6 - ), - -{# Identify blocks that need processing #} -to_do AS ( - SELECT block_number - FROM {{ ref("streamline__blocks") }} - WHERE - block_number IS NOT NULL - AND block_number <= (SELECT block_number FROM look_back) - {% if not new_build %} - AND block_number >= (SELECT block_number FROM last_3_days) - {% endif %} - {% if min_block is not none %} - AND block_number >= {{ min_block }} - {% endif %} - - EXCEPT - - {# Exclude blocks that have already been processed #} - SELECT block_number - FROM {{ ref('streamline__' ~ model_name.lower() ~ '_complete') }} - WHERE 1=1 - AND block_number IS NOT NULL - AND block_number <= (SELECT block_number FROM look_back) - AND _inserted_timestamp >= DATEADD( - 'day', - -4, - SYSDATE() - ) - {% if not new_build %} - AND block_number >= (SELECT block_number FROM last_3_days) - {% endif %} -) - -{# Prepare the final list of blocks to process #} -,ready_blocks AS ( - SELECT block_number - FROM to_do - - {% if testing_limit is not none %} - LIMIT {{ testing_limit }} - {% endif %} -) - -{# Generate API requests for each block #} -SELECT - block_number, - ROUND(block_number, -3) AS partition_key, - live.udf_api( - 'POST', - '{{ node_url }}', - OBJECT_CONSTRUCT( - 'Content-Type', 'application/json', - 'fsc-quantum-state', '{{ model_quantum_state }}' - ), - OBJECT_CONSTRUCT( - 'id', block_number, - 'jsonrpc', '2.0', - 'method', '{{ method }}', - 'params', {{ method_params }} - ), - '{{ node_secret_path }}' - ) AS request -FROM - ready_blocks - -{{ order_by_clause }} - -LIMIT {{ sql_limit }} \ No newline at end of file diff --git a/models/streamline/silver/core/realtime/streamline__receipts_realtime.sql b/models/streamline/silver/core/realtime/streamline__receipts_realtime.sql deleted file mode 100644 index 6ec5c85..0000000 --- a/models/streamline/silver/core/realtime/streamline__receipts_realtime.sql +++ /dev/null @@ -1,130 +0,0 @@ -{# Set variables #} -{%- set model_name = 'RECEIPTS' -%} -{%- set model_type = 'REALTIME' -%} -{%- set min_block = var('GLOBAL_START_UP_BLOCK', none) -%} - -{%- set default_vars = set_default_variables_streamline(model_name, model_type) -%} - -{# Set up parameters for the streamline process. These will come from the vars set in dbt_project.yml #} -{%- set streamline_params = set_streamline_parameters( - model_name=model_name, - model_type=model_type -) -%} - -{%- set node_url = default_vars['node_url'] -%} -{%- set node_secret_path = default_vars['node_secret_path'] -%} -{%- set model_quantum_state = default_vars['model_quantum_state'] -%} -{%- set sql_limit = streamline_params['sql_limit'] -%} -{%- set testing_limit = default_vars['testing_limit'] -%} -{%- set order_by_clause = default_vars['order_by_clause'] -%} -{%- set new_build = default_vars['new_build'] -%} -{%- set method_params = streamline_params['method_params'] -%} -{%- set method = streamline_params['method'] -%} - -{# Log configuration details #} -{{ log_streamline_details( - model_name=model_name, - model_type=model_type, - node_url=node_url, - model_quantum_state=model_quantum_state, - sql_limit=sql_limit, - testing_limit=testing_limit, - order_by_clause=order_by_clause, - new_build=new_build, - streamline_params=streamline_params, - method_params=method_params, - method=method, - min_block=min_block -) }} - -{# Set up dbt configuration #} -{{ config ( - materialized = "view", - post_hook = fsc_utils.if_data_call_function_v2( - func = 'streamline.udf_bulk_rest_api_v2', - target = "{{this.schema}}.{{this.identifier}}", - params = streamline_params - ), - tags = ['streamline_core_realtime_receipts'] -) }} - -{# Main query starts here #} -WITH -{% if not new_build %} - last_3_days AS ( - SELECT block_number - FROM {{ ref("_block_lookback") }} - ), -{% endif %} - -{# Identify blocks that need processing #} -to_do AS ( - SELECT block_number - FROM {{ ref("streamline__blocks") }} - WHERE - block_number IS NOT NULL - {% if not new_build %} - AND block_number >= (SELECT block_number FROM last_3_days) - {% endif %} - {% if min_block is not none %} - AND block_number >= {{ min_block }} - {% endif %} - - EXCEPT - - {# Exclude blocks that have already been processed #} - SELECT block_number - FROM {{ ref('streamline__' ~ model_name.lower() ~ '_complete') }} - WHERE 1=1 - {% if not new_build %} - AND block_number >= (SELECT block_number FROM last_3_days) - {% endif %} -) - -{# Prepare the final list of blocks to process #} -,ready_blocks AS ( - SELECT block_number - FROM to_do - - {% if not new_build %} - UNION - SELECT block_number - FROM {{ ref("_unconfirmed_blocks") }} - UNION - SELECT block_number - FROM {{ ref("_missing_txs") }} - UNION - SELECT block_number - FROM {{ ref("_missing_receipts") }} - {% endif %} - - {% if testing_limit is not none %} - LIMIT {{ testing_limit }} - {% endif %} -) - -{# Generate API requests for each block #} -SELECT - block_number, - ROUND(block_number, -3) AS partition_key, - live.udf_api( - 'POST', - '{{ node_url }}', - OBJECT_CONSTRUCT( - 'Content-Type', 'application/json', - 'fsc-quantum-state', '{{ model_quantum_state }}' - ), - OBJECT_CONSTRUCT( - 'id', block_number, - 'jsonrpc', '2.0', - 'method', '{{ method }}', - 'params', {{ method_params }} - ), - '{{ node_secret_path }}' - ) AS request -FROM - ready_blocks - -{{ order_by_clause }} - -LIMIT {{ sql_limit }} \ No newline at end of file diff --git a/models/streamline/silver/core/realtime/streamline__traces_realtime.sql b/models/streamline/silver/core/realtime/streamline__traces_realtime.sql deleted file mode 100644 index 34f7f98..0000000 --- a/models/streamline/silver/core/realtime/streamline__traces_realtime.sql +++ /dev/null @@ -1,127 +0,0 @@ -{# Set variables #} -{%- set model_name = 'TRACES' -%} -{%- set model_type = 'REALTIME' -%} -{%- set min_block = var('GLOBAL_START_UP_BLOCK', none) -%} - -{%- set default_vars = set_default_variables_streamline(model_name, model_type) -%} - -{# Set up parameters for the streamline process. These will come from the vars set in dbt_project.yml #} -{%- set streamline_params = set_streamline_parameters( - model_name=model_name, - model_type=model_type -) -%} - -{%- set node_url = default_vars['node_url'] -%} -{%- set node_secret_path = default_vars['node_secret_path'] -%} -{%- set model_quantum_state = default_vars['model_quantum_state'] -%} -{%- set sql_limit = streamline_params['sql_limit'] -%} -{%- set testing_limit = default_vars['testing_limit'] -%} -{%- set order_by_clause = default_vars['order_by_clause'] -%} -{%- set new_build = default_vars['new_build'] -%} -{%- set method_params = streamline_params['method_params'] -%} -{%- set method = streamline_params['method'] -%} - -{# Log configuration details #} -{{ log_streamline_details( - model_name=model_name, - model_type=model_type, - node_url=node_url, - model_quantum_state=model_quantum_state, - sql_limit=sql_limit, - testing_limit=testing_limit, - order_by_clause=order_by_clause, - new_build=new_build, - streamline_params=streamline_params, - method_params=method_params, - method=method, - min_block=min_block -) }} - -{# Set up dbt configuration #} -{{ config ( - materialized = "view", - post_hook = fsc_utils.if_data_call_function_v2( - func = 'streamline.udf_bulk_rest_api_v2', - target = "{{this.schema}}.{{this.identifier}}", - params = streamline_params - ), - tags = ['streamline_core_realtime'] -) }} - -{# Main query starts here #} -WITH -{% if not new_build %} - last_3_days AS ( - SELECT block_number - FROM {{ ref("_block_lookback") }} - ), -{% endif %} - -{# Identify blocks that need processing #} -to_do AS ( - SELECT block_number - FROM {{ ref("streamline__blocks") }} - WHERE - block_number IS NOT NULL - {% if not new_build %} - AND block_number >= (SELECT block_number FROM last_3_days) - {% endif %} - {% if min_block is not none %} - AND block_number >= {{ min_block }} - {% endif %} - - EXCEPT - - {# Exclude blocks that have already been processed #} - SELECT block_number - FROM {{ ref('streamline__' ~ model_name.lower() ~ '_complete') }} - WHERE 1=1 - {% if not new_build %} - AND block_number >= (SELECT block_number FROM last_3_days) - {% endif %} -) - -{# Prepare the final list of blocks to process #} -,ready_blocks AS ( - SELECT block_number - FROM to_do - - {% if not new_build %} - UNION - SELECT block_number - FROM {{ ref("_unconfirmed_blocks") }} - UNION - SELECT block_number - FROM {{ ref("_missing_traces") }} - {% endif %} - - {% if testing_limit is not none %} - LIMIT {{ testing_limit }} - {% endif %} -) - -{# Generate API requests for each block #} -SELECT - block_number, - ROUND(block_number, -3) AS partition_key, - live.udf_api( - 'POST', - '{{ node_url }}', - OBJECT_CONSTRUCT( - 'Content-Type', 'application/json', - 'fsc-quantum-state', '{{ model_quantum_state }}' - ), - OBJECT_CONSTRUCT( - 'id', block_number, - 'jsonrpc', '2.0', - 'method', '{{ method }}', - 'params', {{ method_params }} - ), - '{{ node_secret_path }}' - ) AS request -FROM - ready_blocks - -{{ order_by_clause }} - -LIMIT {{ sql_limit }} \ No newline at end of file diff --git a/models/streamline/silver/core/retry/_missing_receipts.sql b/models/streamline/silver/core/retry/_missing_receipts.sql deleted file mode 100644 index fb055b6..0000000 --- a/models/streamline/silver/core/retry/_missing_receipts.sql +++ /dev/null @@ -1,34 +0,0 @@ -{{ config ( - materialized = "ephemeral" -) }} - -WITH lookback AS ( - - SELECT - block_number - FROM - {{ ref("_block_lookback") }} -) -SELECT - DISTINCT t.block_number AS block_number -FROM - {{ ref("silver__transactions") }} - t - LEFT JOIN {{ ref("silver__receipts") }} - r USING ( - block_number, - block_hash, - tx_hash - ) -WHERE - r.tx_hash IS NULL - AND t.block_number >= ( - SELECT - block_number - FROM - lookback - ) - AND t.block_timestamp >= DATEADD('hour', -84, SYSDATE()) - AND ( - r._inserted_timestamp >= DATEADD('hour', -84, SYSDATE()) - OR r._inserted_timestamp IS NULL) diff --git a/models/streamline/silver/core/retry/_missing_traces.sql b/models/streamline/silver/core/retry/_missing_traces.sql deleted file mode 100644 index 346f556..0000000 --- a/models/streamline/silver/core/retry/_missing_traces.sql +++ /dev/null @@ -1,17 +0,0 @@ -{{ config ( - materialized = "ephemeral" -) }} - -SELECT - DISTINCT tx.block_number -FROM - {{ ref("test_silver__transactions_recent") }} - tx - LEFT JOIN {{ ref("test_gold__fact_traces_recent") }} - tr USING ( - block_number, - tx_hash - ) -WHERE - tr.tx_hash IS NULL - AND tx.block_timestamp > DATEADD('day', -5, SYSDATE()) diff --git a/models/streamline/silver/core/retry/_missing_txs.sql b/models/streamline/silver/core/retry/_missing_txs.sql deleted file mode 100644 index 7718e97..0000000 --- a/models/streamline/silver/core/retry/_missing_txs.sql +++ /dev/null @@ -1,40 +0,0 @@ -{{ config ( - materialized = "ephemeral" -) }} - -WITH lookback AS ( - - SELECT - block_number - FROM - {{ ref("_block_lookback") }} -), -transactions AS ( - SELECT - block_number, - POSITION, - LAG( - POSITION, - 1 - ) over ( - PARTITION BY block_number - ORDER BY - POSITION ASC - ) AS prev_POSITION - FROM - {{ ref("silver__transactions") }} - WHERE - block_timestamp >= DATEADD('hour', -84, SYSDATE()) - AND block_number >= ( - SELECT - block_number - FROM - lookback - ) -) -SELECT - DISTINCT block_number AS block_number -FROM - transactions -WHERE - POSITION - prev_POSITION <> 1 diff --git a/models/streamline/silver/core/retry/_unconfirmed_blocks.sql b/models/streamline/silver/core/retry/_unconfirmed_blocks.sql deleted file mode 100644 index 8e2507c..0000000 --- a/models/streamline/silver/core/retry/_unconfirmed_blocks.sql +++ /dev/null @@ -1,34 +0,0 @@ -{{ config ( - materialized = "ephemeral" -) }} - -WITH lookback AS ( - - SELECT - block_number - FROM - {{ ref("_block_lookback") }} -) -SELECT - DISTINCT cb.block_number AS block_number -FROM - {{ ref("silver__confirmed_blocks") }} - cb - LEFT JOIN {{ ref("silver__transactions") }} - txs USING ( - block_number, - block_hash, - tx_hash - ) -WHERE - txs.tx_hash IS NULL - AND cb.block_number >= ( - SELECT - block_number - FROM - lookback - ) - AND cb._inserted_timestamp >= DATEADD('hour', -84, SYSDATE()) - AND ( - txs._inserted_timestamp >= DATEADD('hour', -84, SYSDATE()) - OR txs._inserted_timestamp IS NULL) diff --git a/models/streamline/silver/core/streamline__blocks.sql b/models/streamline/silver/core/streamline__blocks.sql deleted file mode 100644 index 9e56c76..0000000 --- a/models/streamline/silver/core/streamline__blocks.sql +++ /dev/null @@ -1,36 +0,0 @@ -{%- if flags.WHICH == 'compile' and execute -%} - - {% set config_log = '\n' %} - {% set config_log = config_log ~ '\n=== DBT Model Config ===\n'%} - {% set config_log = config_log ~ '\n{{ config (\n' %} - {% set config_log = config_log ~ ' materialized = "' ~ config.get('materialized') ~ '",\n' %} - {% set config_log = config_log ~ ' tags = ' ~ config.get('tags') | tojson ~ '\n' %} - {% set config_log = config_log ~ ') }}\n' %} - {{ log(config_log, info=True) }} - {{ log("", info=True) }} -{%- endif -%} - -{{ config ( - materialized = "view", - tags = ['streamline_core_complete'] -) }} - -SELECT - _id, - ( - ({{ var('GLOBAL_BLOCKS_PER_HOUR',0) }} / 60) * {{ var('GLOBAL_CHAINHEAD_DELAY',3) }} - ) :: INT AS block_number_delay, --minute-based block delay - (_id - block_number_delay) :: INT AS block_number, - utils.udf_int_to_hex(block_number) AS block_number_hex -FROM - {{ ref('silver__number_sequence') }} -WHERE - _id <= ( - SELECT - COALESCE( - block_number, - 0 - ) - FROM - {{ ref("streamline__get_chainhead") }} - ) \ No newline at end of file diff --git a/models/streamline/silver/core/streamline__get_chainhead.sql b/models/streamline/silver/core/streamline__get_chainhead.sql deleted file mode 100644 index 9e98ae7..0000000 --- a/models/streamline/silver/core/streamline__get_chainhead.sql +++ /dev/null @@ -1,54 +0,0 @@ -{%- set model_quantum_state = var('CHAINHEAD_QUANTUM_STATE', 'livequery') -%} - -{%- set node_url = var('GLOBAL_NODE_URL', '{Service}/{Authentication}') -%} - -{%- if flags.WHICH == 'compile' and execute -%} - - {{ log("=== Current Variable Settings ===", info=True) }} - {{ log("CHAINHEAD_QUANTUM_STATE: " ~ model_quantum_state, info=True) }} - {{ log("", info=True) }} - - {{ log("=== API Details ===", info=True) }} - {{ log("NODE_URL: " ~ node_url, info=True) }} - {{ log("NODE_SECRET_PATH: " ~ var('GLOBAL_NODE_SECRET_PATH'), info=True) }} - {{ log("", info=True) }} - - {% set config_log = '\n' %} - {% set config_log = config_log ~ '\n=== DBT Model Config ===\n'%} - {% set config_log = config_log ~ '\n{{ config (\n' %} - {% set config_log = config_log ~ ' materialized = "' ~ config.get('materialized') ~ '",\n' %} - {% set config_log = config_log ~ ' tags = ' ~ config.get('tags') | tojson ~ '\n' %} - {% set config_log = config_log ~ ') }}\n' %} - {{ log(config_log, info=True) }} - {{ log("", info=True) }} - -{%- endif -%} - -{{ config ( - materialized = 'table', - tags = ['streamline_core_complete','chainhead'] -) }} - -SELECT - live.udf_api( - 'POST', - '{{ node_url }}', - OBJECT_CONSTRUCT( - 'Content-Type', 'application/json', - 'fsc-quantum-state', '{{ model_quantum_state }}' - ), - OBJECT_CONSTRUCT( - 'id', - 0, - 'jsonrpc', - '2.0', - 'method', - 'eth_blockNumber', - 'params', - [] - ), - '{{ var('GLOBAL_NODE_SECRET_PATH') }}' - ) AS resp, - utils.udf_hex_to_int( - resp :data :result :: STRING - ) AS block_number \ No newline at end of file diff --git a/models/streamline/silver/core/streamline__get_chainhead.yml b/models/streamline/silver/core/streamline__get_chainhead.yml deleted file mode 100644 index e318e4d..0000000 --- a/models/streamline/silver/core/streamline__get_chainhead.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: 2 -models: - - name: streamline__get_chainhead - description: "This model is used to get the chainhead from the blockchain." - - columns: - - name: BLOCK_NUMBER - tests: - - not_null \ No newline at end of file diff --git a/models/streamline/silver/decoded_logs/complete/streamline__decoded_logs_complete.sql b/models/streamline/silver/decoded_logs/complete/streamline__decoded_logs_complete.sql deleted file mode 100644 index 3e80589..0000000 --- a/models/streamline/silver/decoded_logs/complete/streamline__decoded_logs_complete.sql +++ /dev/null @@ -1,50 +0,0 @@ -{# Set variables #} -{%- set source_name = 'DECODED_LOGS' -%} -{%- set model_type = 'COMPLETE' -%} - -{%- set full_refresh_type = var((source_name ~ '_complete_full_refresh').upper(), false) -%} - -{% set post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION on equality(_log_id)" %} - -{# Log configuration details #} -{{ log_model_details() }} - -{# Set up dbt configuration #} --- depends_on: {{ ref('bronze__' ~ source_name.lower()) }} - -{{ config ( - materialized = "incremental", - unique_key = "_log_id", - cluster_by = "ROUND(block_number, -3)", - incremental_predicates = ["dynamic_range", "block_number"], - merge_update_columns = ["_log_id"], - post_hook = post_hook, - full_refresh = full_refresh_type, - tags = ['streamline_decoded_logs_complete'] -) }} - -{# Main query starts here #} -SELECT - block_number, - file_name, - id AS _log_id, - {{ dbt_utils.generate_surrogate_key(['id']) }} AS complete_{{ source_name.lower() }}_id, - SYSDATE() AS inserted_timestamp, - SYSDATE() AS modified_timestamp, - _inserted_timestamp, - '{{ invocation_id }}' AS _invocation_id -FROM - {% if is_incremental() %} - {{ ref('bronze__' ~ source_name.lower()) }} - WHERE - _inserted_timestamp >= ( - SELECT - COALESCE(MAX(_inserted_timestamp), '1970-01-01'::TIMESTAMP) AS _inserted_timestamp - FROM - {{ this }} - ) - {% else %} - {{ ref('bronze__' ~ source_name.lower() ~ '_fr') }} - {% endif %} - -QUALIFY (ROW_NUMBER() OVER (PARTITION BY id ORDER BY _inserted_timestamp DESC)) = 1 diff --git a/models/streamline/silver/decoded_logs/realtime/streamline__decoded_logs_realtime.sql b/models/streamline/silver/decoded_logs/realtime/streamline__decoded_logs_realtime.sql deleted file mode 100644 index a0ff21b..0000000 --- a/models/streamline/silver/decoded_logs/realtime/streamline__decoded_logs_realtime.sql +++ /dev/null @@ -1,110 +0,0 @@ -{%- set testing_limit = var('DECODED_LOGS_REALTIME_TESTING_LIMIT', none) -%} - -{%- set streamline_params = { - "external_table": var("DECODED_LOGS_REALTIME_EXTERNAL_TABLE", "decoded_logs"), - "sql_limit": var("DECODED_LOGS_REALTIME_SQL_LIMIT", 10000000), - "producer_batch_size": var("DECODED_LOGS_REALTIME_PRODUCER_BATCH_SIZE", 400000), - "worker_batch_size": var("DECODED_LOGS_REALTIME_WORKER_BATCH_SIZE", 200000), - "sql_source": "decoded_logs_realtime" -} -%} - -{# Log configuration details #} -{{ log_model_details( - params = streamline_params -) }} - -{# Set up dbt configuration #} -{{ config ( - materialized = "view", - post_hook = [fsc_utils.if_data_call_function_v2( - func = 'streamline.udf_bulk_decode_logs_v2', - target = "{{this.schema}}.{{this.identifier}}", - params = { - "external_table": streamline_params['external_table'], - "sql_limit": streamline_params['sql_limit'], - "producer_batch_size": streamline_params['producer_batch_size'], - "worker_batch_size": streamline_params['worker_batch_size'], - "sql_source": streamline_params['sql_source'] - } - ), - fsc_utils.if_data_call_wait()], - tags = ['streamline_decoded_logs_realtime'] -) }} - -WITH target_blocks AS ( - SELECT - block_number - FROM - {{ ref('core__fact_blocks') }} - WHERE - block_number >= ( - SELECT - block_number - FROM - {{ ref('_24_hour_lookback') }} - ) -), -existing_logs_to_exclude AS ( - SELECT - _log_id - FROM - {{ ref('streamline__decoded_logs_complete') }} - l - INNER JOIN target_blocks b USING (block_number) - WHERE - l.inserted_timestamp :: DATE >= DATEADD('day', -2, SYSDATE()) -), -candidate_logs AS ( - SELECT - l.block_number, - l.tx_hash, - l.event_index, - l.contract_address, - l.topics, - l.data, - CONCAT( - l.tx_hash :: STRING, - '-', - l.event_index :: STRING - ) AS _log_id - FROM - target_blocks b - INNER JOIN {{ ref('core__fact_event_logs') }} - l USING (block_number) - WHERE - l.tx_succeeded - AND l.inserted_timestamp :: DATE >= DATEADD('day', -2, SYSDATE()) -) -SELECT - l.block_number, - l._log_id, - A.abi, - OBJECT_CONSTRUCT( - 'topics', - l.topics, - 'data', - l.data, - 'address', - l.contract_address - ) AS DATA -FROM - candidate_logs l - INNER JOIN {{ ref('silver__complete_event_abis') }} A - ON A.parent_contract_address = l.contract_address - AND A.event_signature = l.topics [0] :: STRING - AND l.block_number BETWEEN A.start_block - AND A.end_block -WHERE - NOT EXISTS ( - SELECT - 1 - FROM - existing_logs_to_exclude e - WHERE - e._log_id = l._log_id - ) - -{% if testing_limit is not none %} - LIMIT - {{ testing_limit }} -{% endif %} \ No newline at end of file diff --git a/package-lock.yml b/package-lock.yml deleted file mode 100644 index 54b0cb5..0000000 --- a/package-lock.yml +++ /dev/null @@ -1,18 +0,0 @@ -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: c3ab97e8e06d31e8c6f63819714e0a2d45c45e82 -- package: get-select/dbt_snowflake_query_tags - version: 2.5.0 -- git: https://github.com/FlipsideCrypto/fsc-evm.git - revision: ec6adae14ab4060ad4a553fb7f32d7e57693996d -- package: calogica/dbt_date - version: 0.7.2 -- git: https://github.com/FlipsideCrypto/livequery-models.git - revision: b024188be4e9c6bc00ed77797ebdc92d351d620e -sha1_hash: b53a8dd1a1f99a375e8f024920d5eb7630a0765f diff --git a/packages.yml b/packages.yml index e90ff6f..65f7fcb 100644 --- a/packages.yml +++ b/packages.yml @@ -1,13 +1,3 @@ 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.31.0 - - package: get-select/dbt_snowflake_query_tags - version: [">=2.0.0", "<3.0.0"] - git: https://github.com/FlipsideCrypto/fsc-evm.git - revision: v1.5.0 \ No newline at end of file + revision: v4.0.0-beta.59 diff --git a/python/slack_alert.py b/python/slack_alert.py deleted file mode 100644 index 11ad94a..0000000 --- a/python/slack_alert.py +++ /dev/null @@ -1,74 +0,0 @@ -import requests -import os -import sys - -def create_message(): - """Creates a simple failure notification message with repo, workflow name, and URL""" - - # Get GitHub environment variables - repository = os.environ.get('GITHUB_REPOSITORY', 'Unknown repository') - repo_name = repository.split('/')[-1] if '/' in repository else repository - workflow_name = os.environ.get('GITHUB_WORKFLOW', 'Unknown workflow') - run_id = os.environ.get('GITHUB_RUN_ID', '') - server_url = os.environ.get('GITHUB_SERVER_URL', 'https://github.com') - - # Build the workflow URL - workflow_url = f"{server_url}/{repository}/actions/runs/{run_id}" - - message_body = { - "text": f"Failure in {repo_name}", - "attachments": [ - { - "color": "#f44336", # Red color for failures - "fields": [ - { - "title": "Repository", - "value": repository, - "short": True - }, - { - "title": "Workflow", - "value": workflow_name, - "short": True - } - ], - "actions": [ - { - "type": "button", - "text": "View Workflow Run", - "style": "primary", - "url": workflow_url - } - ], - "footer": "GitHub Actions" - } - ] - } - - return message_body - -def send_alert(webhook_url): - """Sends a failure notification to Slack""" - - message = create_message() - - try: - response = requests.post(webhook_url, json=message) - - if response.status_code == 200: - print("Successfully sent Slack notification") - else: - print(f"Failed to send Slack notification: {response.status_code} {response.text}") - sys.exit(1) - except Exception as e: - print(f"Error sending Slack notification: {str(e)}") - sys.exit(1) - -if __name__ == '__main__': - webhook_url = os.environ.get("SLACK_WEBHOOK_URL") - - if not webhook_url: - print("ERROR: SLACK_WEBHOOK_URL environment variable is required") - sys.exit(1) - - send_alert(webhook_url) \ No newline at end of file diff --git a/tests/gnosis/test_gold__missing_traces.sql b/tests/gnosis/test_gold__missing_traces.sql deleted file mode 100644 index 514d31c..0000000 --- a/tests/gnosis/test_gold__missing_traces.sql +++ /dev/null @@ -1,2 +0,0 @@ --- depends_on: {{ ref('test_silver__transactions_full') }} -{{ missing_txs(ref("test_gold__fact_traces_full")) }} diff --git a/tests/gnosis/test_gold__recent_missing_traces.sql b/tests/gnosis/test_gold__recent_missing_traces.sql deleted file mode 100644 index f82e42d..0000000 --- a/tests/gnosis/test_gold__recent_missing_traces.sql +++ /dev/null @@ -1,2 +0,0 @@ --- depends_on: {{ ref('test_silver__transactions_recent') }} -{{ recent_missing_txs(ref("test_gold__fact_traces_recent"), 1000) }} diff --git a/tests/gnosis/test_silver__confirmed_blocks.sql b/tests/gnosis/test_silver__confirmed_blocks.sql deleted file mode 100644 index 8cbac8b..0000000 --- a/tests/gnosis/test_silver__confirmed_blocks.sql +++ /dev/null @@ -1 +0,0 @@ -{{ missing_confirmed_txs(ref("test_silver__confirmed_blocks_full"), ref("test_silver__transactions_full")) }} diff --git a/tests/gnosis/test_silver__missing_receipts.sql b/tests/gnosis/test_silver__missing_receipts.sql deleted file mode 100644 index 8481599..0000000 --- a/tests/gnosis/test_silver__missing_receipts.sql +++ /dev/null @@ -1,2 +0,0 @@ --- depends_on: {{ ref('test_silver__transactions_full') }} -{{ missing_txs(ref("test_silver__receipts_full")) }} diff --git a/tests/gnosis/test_silver__recent_confirmed_blocks.sql b/tests/gnosis/test_silver__recent_confirmed_blocks.sql deleted file mode 100644 index 79cdd66..0000000 --- a/tests/gnosis/test_silver__recent_confirmed_blocks.sql +++ /dev/null @@ -1 +0,0 @@ -{{ missing_confirmed_txs(ref("test_silver__confirmed_blocks_recent"), ref("test_silver__transactions_recent")) }} diff --git a/tests/gnosis/test_silver__recent_missing_receipts.sql b/tests/gnosis/test_silver__recent_missing_receipts.sql deleted file mode 100644 index e173fee..0000000 --- a/tests/gnosis/test_silver__recent_missing_receipts.sql +++ /dev/null @@ -1,2 +0,0 @@ --- depends_on: {{ ref('test_silver__transactions_recent') }} -{{ recent_missing_txs(ref("test_silver__receipts_recent"), 1000) }}