solana-models/models/silver/nfts/silver__nft_sales_tensorswap_buysellevent.yml
desmond-hui 780e4a5ef1
Tensorswap models using logs (#600)
* udf to grab program data logs from log messages

* output table with encoded program data in tx logs

* add comments

* setup views and source

* update tag

* wip realtime view

* wip

* fix bad join

* wip

* decoded logs

* wip

* add event_type, index, inner_index and refactor existing

* handle additional nested calls

* add columns, add to SO

* use backfill macro

* wip

* handle non-contiguous program log messaging

* tmp upperbound

* minor changes

* reset child index when a new top level program is invoked

* rebuild transaction logs program data

* remove backfill

* still need to use min price as backup

* add post PR TODO

* revert tmp full-refresh changes

* add comment

* add tests

* update columns

* add docs and tests, fix col name

* update col description
2024-07-09 09:27:57 -07:00

83 lines
2.5 KiB
YAML

version: 2
models:
- name: silver__nft_sales_tensorswap_buysellevent
columns:
- name: BLOCK_TIMESTAMP
description: "{{ doc('block_timestamp') }}"
tests:
- not_null
- dbt_expectations.expect_row_values_to_have_recent_data:
datepart: day
interval: 2
- name: BLOCK_ID
description: "{{ doc('block_id') }}"
tests:
- not_null
- name: TX_ID
description: "{{ doc('tx_id') }}"
tests:
- not_null
- name: SUCCEEDED
description: "{{ doc('tx_succeeded') }}"
tests:
- not_null
- name: INDEX
description: "{{ doc('event_index') }}"
tests:
- not_null
- name: INNER_INDEX
description: "{{ doc('inner_index') }}"
- name: LOG_INDEX
description: "{{ doc('log_index') }}"
tests:
- not_null
- name: PROGRAM_ID
description: "{{ doc('program_id') }}"
tests:
- not_null
- name: EVENT_TYPE
description: "{{ doc('event_type') }}"
tests:
- not_null
- accepted_values:
values: ["BuySellEvent"]
- name: CREATOR_FEE
description: "Part of `sales_amount` in SOL that goes to the creator"
tests:
- not_null
- name: MM_FEE
description: "Part of `sales_amount` in SOL that goes to the market maker"
tests:
- not_null
- name: TSWAP_FEE
description: "Part of `sales_amount` in SOL that goes to Tensor"
tests:
- not_null
- name: SALES_AMOUNT
description: "{{ doc('sales_amount') }}"
tests:
- not_null
- dbt_utils.expression_is_true:
expression: ">= 0"
- name: _INSERTED_TIMESTAMP
description: "{{ doc('_inserted_timestamp') }}"
tests:
- not_null
- name: NFT_SALES_TENSORSWAP_BUYSELLEVENT_ID
description: '{{ doc("pk") }}'
tests:
- unique
- name: INSERTED_TIMESTAMP
description: '{{ doc("inserted_timestamp") }}'
tests:
- not_null
- name: MODIFIED_TIMESTAMP
description: '{{ doc("modified_timestamp") }}'
tests:
- not_null
- name: _INVOCATION_ID
description: '{{ doc("_invocation_id") }}'
tests:
- not_null:
name: test_silver__not_null_nft_sales_tensorswap_buysellevent__invocation_id